mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Move management of shared state to shared code
Platform code may not modify shared state. Related to #1568.
This commit is contained in:
parent
7da3e52c86
commit
6d2003d07a
@ -1373,7 +1373,6 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
|
|
||||||
void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enabled)
|
||||||
{
|
{
|
||||||
window->mousePassthrough = enabled;
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
[window->ns.object setIgnoresMouseEvents:enabled];
|
[window->ns.object setIgnoresMouseEvents:enabled];
|
||||||
}
|
}
|
||||||
|
@ -1887,8 +1887,6 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enable
|
|||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
SetLayeredWindowAttributes(window->win32.handle, key, alpha, flags);
|
SetLayeredWindowAttributes(window->win32.handle, key, alpha, flags);
|
||||||
|
|
||||||
window->mousePassthrough = enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
|
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
|
||||||
|
21
src/window.c
21
src/window.c
@ -197,13 +197,14 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
|||||||
window->videoMode.blueBits = fbconfig.blueBits;
|
window->videoMode.blueBits = fbconfig.blueBits;
|
||||||
window->videoMode.refreshRate = _glfw.hints.refreshRate;
|
window->videoMode.refreshRate = _glfw.hints.refreshRate;
|
||||||
|
|
||||||
window->monitor = (_GLFWmonitor*) monitor;
|
window->monitor = (_GLFWmonitor*) monitor;
|
||||||
window->resizable = wndconfig.resizable;
|
window->resizable = wndconfig.resizable;
|
||||||
window->decorated = wndconfig.decorated;
|
window->decorated = wndconfig.decorated;
|
||||||
window->autoIconify = wndconfig.autoIconify;
|
window->autoIconify = wndconfig.autoIconify;
|
||||||
window->floating = wndconfig.floating;
|
window->floating = wndconfig.floating;
|
||||||
window->focusOnShow = wndconfig.focusOnShow;
|
window->focusOnShow = wndconfig.focusOnShow;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->mousePassthrough = wndconfig.mousePassthrough;
|
||||||
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
|
|
||||||
window->minwidth = GLFW_DONT_CARE;
|
window->minwidth = GLFW_DONT_CARE;
|
||||||
window->minheight = GLFW_DONT_CARE;
|
window->minheight = GLFW_DONT_CARE;
|
||||||
@ -908,7 +909,13 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
|
|||||||
else if (attrib == GLFW_FOCUS_ON_SHOW)
|
else if (attrib == GLFW_FOCUS_ON_SHOW)
|
||||||
window->focusOnShow = value;
|
window->focusOnShow = value;
|
||||||
else if (attrib == GLFW_MOUSE_PASSTHROUGH)
|
else if (attrib == GLFW_MOUSE_PASSTHROUGH)
|
||||||
|
{
|
||||||
|
if (window->mousePassthrough == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
window->mousePassthrough = value;
|
||||||
_glfwPlatformSetWindowMousePassthrough(window, value);
|
_glfwPlatformSetWindowMousePassthrough(window, value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
|
||||||
}
|
}
|
||||||
|
@ -1129,9 +1129,6 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|||||||
|
|
||||||
void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enabled)
|
void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enabled)
|
||||||
{
|
{
|
||||||
if (enabled == window->mousePassthrough)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
|
struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
|
||||||
@ -1141,7 +1138,6 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enable
|
|||||||
else
|
else
|
||||||
wl_surface_set_input_region(window->wl.surface, 0);
|
wl_surface_set_input_region(window->wl.surface, 0);
|
||||||
wl_surface_commit(window->wl.surface);
|
wl_surface_commit(window->wl.surface);
|
||||||
window->mousePassthrough = enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
|
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
|
||||||
|
@ -2707,9 +2707,6 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enable
|
|||||||
if (!_glfw.x11.xshape.available)
|
if (!_glfw.x11.xshape.available)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (enabled == window->mousePassthrough)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
Region region = XCreateRegion();
|
Region region = XCreateRegion();
|
||||||
@ -2722,8 +2719,6 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enable
|
|||||||
XShapeCombineMask(_glfw.x11.display, window->x11.handle,
|
XShapeCombineMask(_glfw.x11.display, window->x11.handle,
|
||||||
ShapeInput, 0, 0, None, ShapeSet);
|
ShapeInput, 0, 0, None, ShapeSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->mousePassthrough = enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
|
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
|
||||||
|
Loading…
Reference in New Issue
Block a user