From d0c6ce9fd794dbd788b90f61bba344ee88c0ca67 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jul 2020 21:15:00 +0200 Subject: [PATCH 1/7] GLFW: Add support for mouse input transparency From upstream: https://github.com/glfw/glfw/commit/d285a9fdeb5e7f4688ebbd8f8fa8f101b01b5bea. --- glfw/cocoa_window.m | 6 ++++++ glfw/glfw3.h | 11 ++++++++++- glfw/internal.h | 3 +++ glfw/null_window.c | 4 ++++ glfw/window.c | 9 +++++++++ glfw/wl_window.c | 17 +++++++++++++++++ glfw/x11_init.c | 24 ++++++++++++++++++++++++ glfw/x11_platform.h | 19 +++++++++++++++++++ glfw/x11_window.c | 26 ++++++++++++++++++++++++++ kitty/glfw-wrapper.h | 10 +++++++++- 10 files changed, 127 insertions(+), 2 deletions(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 3a905be5c..60e427ebe 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1854,6 +1854,12 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) [window->ns.object setLevel:NSNormalWindowLevel]; } +void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled) +{ + window->mousePassthrough = enabled; + [window->ns.object setIgnoresMouseEvents:enabled]; +} + float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { return (float) [window->ns.object alphaValue]; diff --git a/glfw/glfw3.h b/glfw/glfw3.h index c537b9356..a146d9eeb 100644 --- a/glfw/glfw3.h +++ b/glfw/glfw3.h @@ -932,11 +932,19 @@ extern "C" { * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). */ #define GLFW_FOCUS_ON_SHOW 0x0002000C + +/*! @brief Forward mouse input to window behind. + * + * Mouse input forwarding[window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or + * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). + */ +#define GLFW_MOUSE_PASSTHROUGH 0x0002000D + /*! @brief Occlusion window attribute * * Occlusion [window attribute](@ref GLFW_OCCLUDED_attrib). */ -#define GLFW_OCCLUDED 0x0002000D +#define GLFW_OCCLUDED 0x0002000E /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). @@ -3741,6 +3749,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib), * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib). + * [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_attrib) * * Some of these attributes are ignored for full screen windows. The new * value will take effect if the window is later made windowed. diff --git a/glfw/internal.h b/glfw/internal.h index 227458151..f6f849d16 100644 --- a/glfw/internal.h +++ b/glfw/internal.h @@ -303,6 +303,7 @@ struct _GLFWwndconfig bool maximized; bool centerCursor; bool focusOnShow; + bool mousePassthrough; bool scaleToMonitor; struct { bool retina; @@ -413,6 +414,7 @@ struct _GLFWwindow bool autoIconify; bool floating; bool focusOnShow; + bool mousePassthrough; bool shouldClose; void* userPointer; GLFWid id; @@ -717,6 +719,7 @@ float _glfwPlatformGetWindowOpacity(_GLFWwindow* window); void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled); void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled); void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled); +void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled); void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity); void _glfwPlatformUpdateIMEState(_GLFWwindow *w, int which, int a, int b, int c, int d); diff --git a/glfw/null_window.c b/glfw/null_window.c index 7fdd2ef9a..564b19a43 100644 --- a/glfw/null_window.c +++ b/glfw/null_window.c @@ -372,6 +372,10 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) window->null.floating = enabled; } +void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window UNUSED, bool enabled UNUSED) +{ +} + float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { return window->null.opacity; diff --git a/glfw/window.c b/glfw/window.c index cb2f254c8..b7453f09a 100644 --- a/glfw/window.c +++ b/glfw/window.c @@ -290,6 +290,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, } } + _glfwPlatformSetWindowMousePassthrough(window, wndconfig.mousePassthrough); + return (GLFWwindow*) window; } @@ -422,6 +424,9 @@ GLFWAPI void glfwWindowHint(int hint, int value) case GLFW_FOCUS_ON_SHOW: _glfw.hints.window.focusOnShow = value ? true : false; return; + case GLFW_MOUSE_PASSTHROUGH: + _glfw.hints.window.mousePassthrough = value ? true : false; + return; case GLFW_CLIENT_API: _glfw.hints.context.client = value; return; @@ -905,6 +910,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_OCCLUDED: @@ -985,6 +992,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); } diff --git a/glfw/wl_window.c b/glfw/wl_window.c index ef9f87cb9..6d35f5de9 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -1269,6 +1269,23 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window UNUSED, bool enabled UNU "Wayland: Window attribute setting not implemented yet"); } +void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool 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 UNUSED) { return 1.f; diff --git a/glfw/x11_init.c b/glfw/x11_init.c index b0bc43129..4252f4490 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -327,6 +327,30 @@ static bool initExtensions(void) } } +#if defined(__CYGWIN__) + _glfw.x11.xshape.handle = _glfw_dlopen("libXext-6.so"); +#else + _glfw.x11.xshape.handle = _glfw_dlopen("libXext.so.6"); +#endif + if (_glfw.x11.xshape.handle) + { + glfw_dlsym(_glfw.x11.xshape.QueryExtension, _glfw.x11.xshape.handle, "XShapeQueryExtension"); + glfw_dlsym(_glfw.x11.xshape.ShapeCombineRegion, _glfw.x11.xshape.handle, "XShapeCombineRegion"); + glfw_dlsym(_glfw.x11.xshape.QueryVersion, _glfw.x11.xshape.handle, "XShapeQueryVersion"); + + if (XShapeQueryExtension(_glfw.x11.display, + &_glfw.x11.xshape.errorBase, + &_glfw.x11.xshape.eventBase)) + { + if (XShapeQueryVersion(_glfw.x11.display, + &_glfw.x11.xshape.major, + &_glfw.x11.xshape.minor)) + { + _glfw.x11.xshape.available = true; + } + } + } + _glfw.x11.xkb.major = 1; _glfw.x11.xkb.minor = 0; _glfw.x11.xkb.available = XkbQueryExtension(_glfw.x11.display, diff --git a/glfw/x11_platform.h b/glfw/x11_platform.h index eeb647552..94ab2a835 100644 --- a/glfw/x11_platform.h +++ b/glfw/x11_platform.h @@ -125,6 +125,13 @@ typedef XRenderPictFormat* (* PFN_XRenderFindVisualFormat)(Display*,Visual const #define XRenderQueryVersion _glfw.x11.xrender.QueryVersion #define XRenderFindVisualFormat _glfw.x11.xrender.FindVisualFormat +typedef Bool (* PFN_XShapeQueryExtension)(Display*,int*,int*); +typedef Status (* PFN_XShapeQueryVersion)(Display*dpy,int*,int*); +typedef void (* PFN_XShapeCombineRegion)(Display*,Window,int,int,int,Region,int); +#define XShapeQueryExtension _glfw.x11.xshape.QueryExtension +#define XShapeQueryVersion _glfw.x11.xshape.QueryVersion +#define XShapeCombineRegion _glfw.x11.xshape.ShapeCombineRegion + typedef VkFlags VkXlibSurfaceCreateFlagsKHR; typedef VkFlags VkXcbSurfaceCreateFlagsKHR; @@ -377,6 +384,18 @@ typedef struct _GLFWlibraryX11 PFN_XRenderFindVisualFormat FindVisualFormat; } xrender; + struct { + bool available; + void* handle; + int major; + int minor; + int eventBase; + int errorBase; + PFN_XShapeQueryExtension QueryExtension; + PFN_XShapeCombineRegion ShapeCombineRegion; + PFN_XShapeQueryVersion QueryVersion; + } xshape; + EventLoopData eventLoopData; } _GLFWlibraryX11; diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 273749180..44626f306 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -2586,6 +2586,32 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) XFlush(_glfw.x11.display); } +void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled) +{ + if (!_glfw.x11.xshape.available) + return; + + if (enabled == window->mousePassthrough) + return; + + int width = 0; + int height = 0; + if (!enabled) + _glfwPlatformGetWindowSize(window, &width, &height); + + XRectangle rect; + rect.x = 0; + rect.y = 0; + rect.width = (unsigned short)width; + rect.height = (unsigned short)height; + + Region region = XCreateRegion(); + XUnionRectWithRegion(&rect, region, region); + XShapeCombineRegion(_glfw.x11.display, window->x11.handle, 2/*ShapeInput*/, 0, 0, region, 0/*ShapeSet*/); + XDestroyRegion(region); + window->mousePassthrough = enabled; +} + float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { float opacity = 1.f; diff --git a/kitty/glfw-wrapper.h b/kitty/glfw-wrapper.h index a32a727a7..b2c2e85c7 100644 --- a/kitty/glfw-wrapper.h +++ b/kitty/glfw-wrapper.h @@ -670,11 +670,19 @@ * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib). */ #define GLFW_FOCUS_ON_SHOW 0x0002000C + +/*! @brief Forward mouse input to window behind. + * + * Mouse input forwarding[window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or + * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). + */ +#define GLFW_MOUSE_PASSTHROUGH 0x0002000D + /*! @brief Occlusion window attribute * * Occlusion [window attribute](@ref GLFW_OCCLUDED_attrib). */ -#define GLFW_OCCLUDED 0x0002000D +#define GLFW_OCCLUDED 0x0002000E /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). From 6a472bd6dafc85e2ae5e841c94fd78066023c2d6 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jul 2020 23:24:48 +0200 Subject: [PATCH 2/7] GLFW: X11: Fix disabling of GLFW_MOUSE_PASSTHROUGH From upstream: https://github.com/glfw/glfw/commit/e81d38125660b94bb48a362a58f162c38a230d37. --- glfw/x11_platform.h | 4 ++++ glfw/x11_window.c | 26 ++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/glfw/x11_platform.h b/glfw/x11_platform.h index 94ab2a835..ac24a624b 100644 --- a/glfw/x11_platform.h +++ b/glfw/x11_platform.h @@ -128,9 +128,12 @@ typedef XRenderPictFormat* (* PFN_XRenderFindVisualFormat)(Display*,Visual const typedef Bool (* PFN_XShapeQueryExtension)(Display*,int*,int*); typedef Status (* PFN_XShapeQueryVersion)(Display*dpy,int*,int*); typedef void (* PFN_XShapeCombineRegion)(Display*,Window,int,int,int,Region,int); +typedef void (* PFN_XShapeCombineMask)(Display*,Window,int,int,int,Pixmap,int); + #define XShapeQueryExtension _glfw.x11.xshape.QueryExtension #define XShapeQueryVersion _glfw.x11.xshape.QueryVersion #define XShapeCombineRegion _glfw.x11.xshape.ShapeCombineRegion +#define XShapeCombineMask _glfw.x11.xshape.ShapeCombineMask typedef VkFlags VkXlibSurfaceCreateFlagsKHR; typedef VkFlags VkXcbSurfaceCreateFlagsKHR; @@ -394,6 +397,7 @@ typedef struct _GLFWlibraryX11 PFN_XShapeQueryExtension QueryExtension; PFN_XShapeCombineRegion ShapeCombineRegion; PFN_XShapeQueryVersion QueryVersion; + PFN_XShapeCombineMask ShapeCombineMask; } xshape; EventLoopData eventLoopData; diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 44626f306..3413ca151 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -2594,21 +2594,19 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled) if (enabled == window->mousePassthrough) return; - int width = 0; - int height = 0; - if (!enabled) - _glfwPlatformGetWindowSize(window, &width, &height); + if (enabled) + { + Region region = XCreateRegion(); + XShapeCombineRegion(_glfw.x11.display, window->x11.handle, + 2/*ShapeInput*/, 0, 0, region, 0/*ShapeSet*/); + XDestroyRegion(region); + } + else + { + XShapeCombineMask(_glfw.x11.display, window->x11.handle, + 2/*ShapeInput*/, 0, 0, None, 0/*ShapeSet*/); + } - XRectangle rect; - rect.x = 0; - rect.y = 0; - rect.width = (unsigned short)width; - rect.height = (unsigned short)height; - - Region region = XCreateRegion(); - XUnionRectWithRegion(&rect, region, region); - XShapeCombineRegion(_glfw.x11.display, window->x11.handle, 2/*ShapeInput*/, 0, 0, region, 0/*ShapeSet*/); - XDestroyRegion(region); window->mousePassthrough = enabled; } From d7cd6edaa5a8097725c37327ab3a87cc73ba095d Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jul 2020 23:50:26 +0200 Subject: [PATCH 3/7] GLFW: X11: Include X Shape extension headers From upstream: https://github.com/glfw/glfw/commit/68e4261d73295cc280ee3d060d421e0ace5d8d11. --- glfw/x11_platform.h | 3 +++ glfw/x11_window.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/glfw/x11_platform.h b/glfw/x11_platform.h index ac24a624b..5f3f540f3 100644 --- a/glfw/x11_platform.h +++ b/glfw/x11_platform.h @@ -51,6 +51,9 @@ // The XInput extension provides raw mouse motion input #include +// The Shape extension provides custom window shapes +#include + // The libxkb library is used for improved keyboard support #include "xkb_glfw.h" #include "backend_utils.h" diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 3413ca151..c51163184 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -2598,13 +2598,13 @@ void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled) { Region region = XCreateRegion(); XShapeCombineRegion(_glfw.x11.display, window->x11.handle, - 2/*ShapeInput*/, 0, 0, region, 0/*ShapeSet*/); + ShapeInput, 0, 0, region, ShapeSet); XDestroyRegion(region); } else { XShapeCombineMask(_glfw.x11.display, window->x11.handle, - 2/*ShapeInput*/, 0, 0, None, 0/*ShapeSet*/); + ShapeInput, 0, 0, None, ShapeSet); } window->mousePassthrough = enabled; From 805921d6a3c9dddd4c0d9cd972903447a1118998 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jul 2020 23:54:16 +0200 Subject: [PATCH 4/7] GLFW: Move management of shared state to shared code From upstream: https://github.com/glfw/glfw/commit/6d2003d07a3e502050d51b04c8b9aeb37840f4e3. --- glfw/cocoa_window.m | 1 - glfw/window.c | 21 ++++++++++++++------- glfw/wl_window.c | 4 ---- glfw/x11_window.c | 5 ----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index 60e427ebe..9fe453da6 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1856,7 +1856,6 @@ void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) void _glfwPlatformSetWindowMousePassthrough(_GLFWwindow* window, bool enabled) { - window->mousePassthrough = enabled; [window->ns.object setIgnoresMouseEvents:enabled]; } diff --git a/glfw/window.c b/glfw/window.c index b7453f09a..712d65844 100644 --- a/glfw/window.c +++ b/glfw/window.c @@ -240,13 +240,14 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, window->videoMode.blueBits = fbconfig.blueBits; window->videoMode.refreshRate = _glfw.hints.refreshRate; - window->monitor = (_GLFWmonitor*) monitor; - window->resizable = wndconfig.resizable; - window->decorated = wndconfig.decorated; - window->autoIconify = wndconfig.autoIconify; - window->floating = wndconfig.floating; - window->focusOnShow = wndconfig.focusOnShow; - window->cursorMode = GLFW_CURSOR_NORMAL; + window->monitor = (_GLFWmonitor*) monitor; + window->resizable = wndconfig.resizable; + window->decorated = wndconfig.decorated; + 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; window->minheight = 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); } diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 6d35f5de9..da3717820 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -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) diff --git a/glfw/x11_window.c b/glfw/x11_window.c index c51163184..15d2f1c6f 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -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) From 44775e46440983f8a8ecaa3ea91606b98144dddd Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jul 2020 23:55:24 +0200 Subject: [PATCH 5/7] GLFW: Remove no-op call at window creation From upstream: https://github.com/glfw/glfw/commit/1095a43708d98190afdc5dfbfc40086c333f7f72. --- glfw/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glfw/window.c b/glfw/window.c index 712d65844..78378d914 100644 --- a/glfw/window.c +++ b/glfw/window.c @@ -291,7 +291,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, } } - _glfwPlatformSetWindowMousePassthrough(window, wndconfig.mousePassthrough); + if (wndconfig.mousePassthrough) + _glfwPlatformSetWindowMousePassthrough(window, true); return (GLFWwindow*) window; } From dd54db47a945260587d8be3be2099d527eb9f441 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jul 2020 23:58:24 +0200 Subject: [PATCH 6/7] GLFW: Move mouse passthrough before window showing From upstream: https://github.com/glfw/glfw/commit/dfeacee00010fef20f8b15853302d352c1bfe0fc. --- glfw/window.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glfw/window.c b/glfw/window.c index 78378d914..7e8f74468 100644 --- a/glfw/window.c +++ b/glfw/window.c @@ -274,6 +274,9 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, } } + if (wndconfig.mousePassthrough) + _glfwPlatformSetWindowMousePassthrough(window, true); + if (window->monitor) { if (wndconfig.centerCursor) @@ -291,9 +294,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, } } - if (wndconfig.mousePassthrough) - _glfwPlatformSetWindowMousePassthrough(window, true); - return (GLFWwindow*) window; } From 4d1b537f78b3066eefb00ad2c4cb02c4f256f49b Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 16 Jul 2020 23:59:37 +0200 Subject: [PATCH 7/7] GLFW: Documentation work for GLFW_MOUSE_PASSTHROUGH From upstream: https://github.com/glfw/glfw/commit/a122d913039c2ff4bd668ad4f5cd051a1aa2f230. --- glfw/glfw3.h | 4 ++-- kitty/glfw-wrapper.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glfw/glfw3.h b/glfw/glfw3.h index a146d9eeb..4215dcf32 100644 --- a/glfw/glfw3.h +++ b/glfw/glfw3.h @@ -933,9 +933,9 @@ extern "C" { */ #define GLFW_FOCUS_ON_SHOW 0x0002000C -/*! @brief Forward mouse input to window behind. +/*! @brief Mouse input transparency window hint and attribute * - * Mouse input forwarding[window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or + * Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). */ #define GLFW_MOUSE_PASSTHROUGH 0x0002000D diff --git a/kitty/glfw-wrapper.h b/kitty/glfw-wrapper.h index b2c2e85c7..61762bf13 100644 --- a/kitty/glfw-wrapper.h +++ b/kitty/glfw-wrapper.h @@ -671,9 +671,9 @@ */ #define GLFW_FOCUS_ON_SHOW 0x0002000C -/*! @brief Forward mouse input to window behind. +/*! @brief Mouse input transparency window hint and attribute * - * Mouse input forwarding[window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or + * Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). */ #define GLFW_MOUSE_PASSTHROUGH 0x0002000D