diff --git a/README.md b/README.md index cebdf089..6efa1ae7 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,7 @@ information on what to include when reporting a bug. fallback decorations - [Wayland] Bugfix: Fallback decorations would report scroll events - [Wayland] Bugfix: Keyboard repeat events halted when any key is released (#2568) + - [Wayland] Bugfix: Fallback decorations would show menu at wrong position - [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631) - [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface` - [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless` diff --git a/src/wl_window.c b/src/wl_window.c index 2b172c9c..b9aa405d 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -405,13 +405,19 @@ static void handleFallbackDecorationButton(_GLFWwindow* window, } else if (button == BTN_RIGHT) { - if (window->wl.xdg.toplevel) - { - xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, - _glfw.wl.seat, serial, - window->wl.cursorPosX, - window->wl.cursorPosY); - } + if (!window->wl.xdg.toplevel) + return; + + if (window->wl.fallback.focus != window->wl.fallback.top.surface) + return; + + if (ypos < GLFW_BORDER_SIZE) + return; + + xdg_toplevel_show_window_menu(window->wl.xdg.toplevel, + _glfw.wl.seat, serial, + xpos, + ypos - GLFW_CAPTION_HEIGHT - GLFW_BORDER_SIZE); } }