diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-11 10:54:30 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-11 10:54:30 +0100 |
commit | 6ec698059acd9d5e791f39bc50fb8b98cb024146 (patch) | |
tree | 9c364c056bf49466cb23e4593f57d4cdcc519efb /platform/linuxbsd | |
parent | bbe8ff24f4f873806701ef8d924bac2b7097203b (diff) | |
parent | 52d75c9b35a8a25fb439dad335716a1a3f6d5007 (diff) |
Merge pull request #68482 from Sauermann/fix-mouse-enter-event
Fix unsent WINDOW_EVENT_MOUSE_ENTER event on mouse_mode-change
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/x11/display_server_x11.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index c3a86c69e1..2e60ad8f45 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -376,10 +376,18 @@ void DisplayServerX11::mouse_set_mode(MouseMode p_mode) { } // The only modes that show a cursor are VISIBLE and CONFINED - bool showCursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED); + bool show_cursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED); + bool previously_shown = (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED); + + if (show_cursor && !previously_shown) { + WindowID window_id = get_window_at_screen_position(mouse_get_position()); + if (window_id != INVALID_WINDOW_ID) { + _send_window_event(windows[window_id], WINDOW_EVENT_MOUSE_ENTER); + } + } for (const KeyValue<WindowID, WindowData> &E : windows) { - if (showCursor) { + if (show_cursor) { XDefineCursor(x11_display, E.value.x11_window, cursors[current_cursor]); // show cursor } else { XDefineCursor(x11_display, E.value.x11_window, null_cursor); // hide cursor |