mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 23:35:24 +00:00
Add support for mouse input transparency
This adds the GLFW_MOUSE_PASSTHROUGH window hint and attribute for controlling whether mouse input passes through the window to whatever window is behind it. Fixes #1236. Closes #1568.
This commit is contained in:
committed by
Camilla Löwy
parent
6c031af245
commit
d285a9fdeb
@@ -243,6 +243,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
}
|
||||
}
|
||||
|
||||
_glfwPlatformSetWindowMousePassthrough(window, wndconfig.mousePassthrough);
|
||||
|
||||
return (GLFWwindow*) window;
|
||||
}
|
||||
|
||||
@@ -378,6 +380,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
case GLFW_FOCUS_ON_SHOW:
|
||||
_glfw.hints.window.focusOnShow = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_MOUSE_PASSTHROUGH:
|
||||
_glfw.hints.window.mousePassthrough = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_CLIENT_API:
|
||||
_glfw.hints.context.client = value;
|
||||
return;
|
||||
@@ -822,6 +827,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
|
||||
return _glfwPlatformWindowHovered(window);
|
||||
case GLFW_FOCUS_ON_SHOW:
|
||||
return window->focusOnShow;
|
||||
case GLFW_MOUSE_PASSTHROUGH:
|
||||
return window->mousePassthrough;
|
||||
case GLFW_TRANSPARENT_FRAMEBUFFER:
|
||||
return _glfwPlatformFramebufferTransparent(window);
|
||||
case GLFW_RESIZABLE:
|
||||
@@ -900,6 +907,8 @@ 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)
|
||||
_glfwPlatformSetWindowMousePassthrough(window, value);
|
||||
else
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user