[metacity/gnome-3-24] keybindings: fix window menu position
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity/gnome-3-24] keybindings: fix window menu position
- Date: Thu, 20 Apr 2017 13:28:13 +0000 (UTC)
commit b42ff5f79cf1e16d4b7b84e341fdf5da6403f625
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Apr 20 16:21:43 2017 +0300
keybindings: fix window menu position
src/core/keybindings.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 49f934c..a82a39f 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2785,12 +2785,12 @@ key_press_event_new (XEvent *xevent)
display = gdk_display_get_default ();
seat = gdk_display_get_default_seat (display);
- window = gdk_x11_window_lookup_for_display (display, xevent->xkey.window);
+ window = gdk_x11_window_foreign_new_for_display (display, xevent->xkey.window);
device = gdk_seat_get_keyboard (seat);
event = gdk_event_new (GDK_KEY_PRESS);
- event->key.window = window ? g_object_ref (window) : NULL;
+ event->key.window = window;
event->key.send_event = xevent->xkey.send_event ? TRUE : FALSE;
event->key.time = xevent->xkey.time;
event->key.state = (GdkModifierType) xevent->xkey.state;
@@ -2814,8 +2814,17 @@ handle_activate_window_menu (MetaDisplay *display,
GdkEvent *gdk_event;
#if GTK_CHECK_VERSION (3, 22, 0)
- rect.x = display->focus_window->rect.x;
- rect.y = display->focus_window->rect.y;
+ if (display->focus_window->frame)
+ {
+ rect.x = display->focus_window->rect.x;
+ rect.y = display->focus_window->rect.y;
+ }
+ else
+ {
+ rect.x = 0;
+ rect.y = 0;
+ }
+
rect.width = display->focus_window->rect.width;
rect.height = 0;
#else
@@ -2828,6 +2837,15 @@ handle_activate_window_menu (MetaDisplay *display,
rect.height = 0;
#endif
+ if (meta_window_is_client_decorated (display->focus_window))
+ {
+ rect.x += display->focus_window->custom_frame_extents.left;
+ rect.y += display->focus_window->custom_frame_extents.top;
+
+ rect.width -= display->focus_window->custom_frame_extents.left +
+ display->focus_window->custom_frame_extents.right;
+ }
+
gdk_event = key_press_event_new (event);
meta_window_show_menu (display->focus_window, &rect, gdk_event);
gdk_event_free (gdk_event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]