diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-03-12 10:39:04 +0000 |
---|---|---|
committer | Chun-wei Fan <fanc999@yahoo.com.tw> | 2021-03-12 17:10:06 +0000 |
commit | 9545ee34a7e20e285d34888c06bbc75673552e3e (patch) | |
tree | eb2b396772ff7b66ab15063d735f2e579e662367 | |
parent | e9ee144b7cd9a723ba3b65735247df9614b86b2f (diff) | |
download | gtk+-cherry-pick-e941e2be.tar.gz |
gdksurface-win32.c: Fix window menu positioningcherry-pick-e941e2be
We ought to get the coordinates of where the window menu should be
displayed using gdk_win32_surface_get_root_coords(), instead of rounding
the position that we obtained with gdk_event_get_position().
Also rename items a bit in the same function, and call
gdk_event_get_event_type() for consistency with the other backends.
Fixes issue #3704.
(cherry picked from commit e941e2be7ded88728f41cdd03acd3381e45562b0)
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index c690fed206..7223c82bc7 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -4261,14 +4261,15 @@ gdk_win32_surface_is_win32 (GdkSurface *window) } static gboolean -gdk_win32_surface_show_window_menu (GdkSurface *window, - GdkEvent *event) +gdk_win32_surface_show_window_menu (GdkSurface *surface, + GdkEvent *event) { double event_x, event_y; int x, y; - GdkWin32Surface *impl = GDK_WIN32_SURFACE (window); + GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface); + GdkEventType event_type = gdk_event_get_event_type (event); - switch ((int) event->event_type) + switch ((int) event_type) { case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: @@ -4280,10 +4281,9 @@ gdk_win32_surface_show_window_menu (GdkSurface *window, } gdk_event_get_position (event, &event_x, &event_y); - x = round (event_x); - y = round (event_y); + gdk_win32_surface_get_root_coords (surface, event_x, event_y, &x, &y); - SendMessage (GDK_SURFACE_HWND (window), + SendMessage (GDK_SURFACE_HWND (surface), WM_SYSMENU, 0, MAKELPARAM (x * impl->surface_scale, y * impl->surface_scale)); |