GLFW: Move management of shared state to shared code

From upstream: 6d2003d07a.
This commit is contained in:
Luflosi 2020-07-16 23:54:16 +02:00
parent d7cd6edaa5
commit 805921d6a3
No known key found for this signature in database
GPG Key ID: 4E41E29EDCC345D0
4 changed files with 14 additions and 17 deletions

View File

@ -1856,7 +1856,6 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled)
void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled)
{
window->mousePassthrough = enabled;
[window->ns.object setIgnoresMouseEvents:enabled];
}

7
glfw/window.c vendored
View File

@ -246,6 +246,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
window->autoIconify = wndconfig.autoIconify;
window->floating = wndconfig.floating;
window->focusOnShow = wndconfig.focusOnShow;
window->mousePassthrough = wndconfig.mousePassthrough;
window->cursorMode = GLFW_CURSOR_NORMAL;
window->minwidth = GLFW_DONT_CARE;
@ -993,7 +994,13 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
else if (attrib == GLFW_FOCUS_ON_SHOW)
window->focusOnShow = value;
else if (attrib == GLFW_MOUSE_PASSTHROUGH)
{
if (window->mousePassthrough == value)
return;
window->mousePassthrough = value;
_glfwPlatformSetWindowMousePassthrough(window, value);
}
else
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
}

4
glfw/wl_window.c vendored
View File

@ -1271,9 +1271,6 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window UNUSED, bool enabled UNU
void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled)
{
if (enabled == window->mousePassthrough)
return;
if (enabled)
{
struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
@ -1283,7 +1280,6 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled)
else
wl_surface_set_input_region(window->wl.surface, 0);
wl_surface_commit(window->wl.surface);
window->mousePassthrough = enabled;
}
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window UNUSED)

5
glfw/x11_window.c vendored
View File

@ -2591,9 +2591,6 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled)
if (!_glfw.x11.xshape.available)
return;
if (enabled == window->mousePassthrough)
return;
if (enabled)
{
Region region = XCreateRegion();
@ -2606,8 +2603,6 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled)
XShapeCombineMask(_glfw.x11.display, window->x11.handle,
ShapeInput, 0, 0, None, ShapeSet);
}
window->mousePassthrough = enabled;
}
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)