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:
Rokas Kupstys
2019-09-30 15:44:43 +03:00
committed by Camilla Löwy
parent 6c031af245
commit d285a9fdeb
10 changed files with 148 additions and 0 deletions
+17
View File
@@ -1127,6 +1127,23 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
"Wayland: Window attribute setting not implemented yet");
}
void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, GLFWbool enabled)
{
if (enabled == window->mousePassthrough)
return;
if (enabled)
{
struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
wl_surface_set_input_region(window->wl.surface, region);
wl_region_destroy(region);
}
else
wl_surface_set_input_region(window->wl.surface, 0);
wl_surface_commit(window->wl.surface);
window->mousePassthrough = enabled;
}
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
{
return 1.f;