diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2011-08-02 01:12:04 +0200 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2012-11-03 19:47:37 -0400 |
commit | 827999aa8281558e9b44077baff39822167e2378 (patch) | |
tree | 1d6a872312f822428256d69f3b8c95b93a0a64c8 | |
parent | 54a58bd9b869f291446078e8baa5e00ffa6e917e (diff) | |
download | mutter-827999aa8281558e9b44077baff39822167e2378.tar.gz |
ui: Add a MetaDevice arg to meta_window_menu_popup()
This will be the device popping up the menu, gtk_menu_popup()
uses the current GTK+ event device, and that might not even be
filled up with mutter event bypassing.
-rw-r--r-- | src/core/core.c | 5 | ||||
-rw-r--r-- | src/core/core.h | 1 | ||||
-rw-r--r-- | src/core/display.c | 1 | ||||
-rw-r--r-- | src/core/keybindings.c | 1 | ||||
-rw-r--r-- | src/core/window-private.h | 1 | ||||
-rw-r--r-- | src/core/window.c | 3 | ||||
-rw-r--r-- | src/ui/frames.c | 2 | ||||
-rw-r--r-- | src/ui/menu.c | 24 | ||||
-rw-r--r-- | src/ui/menu.h | 2 | ||||
-rw-r--r-- | src/ui/ui.c | 3 | ||||
-rw-r--r-- | src/ui/ui.h | 2 |
11 files changed, 35 insertions, 10 deletions
diff --git a/src/core/core.c b/src/core/core.c index 2bb91e098..a64d2517a 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -512,12 +512,14 @@ meta_core_get_active_workspace (Screen *xscreen) void meta_core_show_window_menu (Display *xdisplay, Window frame_xwindow, + int device_id, int root_x, int root_y, int button, guint32 timestamp) { MetaWindow *window = get_window (xdisplay, frame_xwindow); + MetaDevice *device; /* There is already a menu popped up, * most likely from another device @@ -529,7 +531,8 @@ meta_core_show_window_menu (Display *xdisplay, meta_window_raise (window); meta_window_focus (window, timestamp); - meta_window_show_menu (window, root_x, root_y, button, timestamp); + device = meta_device_map_lookup (window->display->device_map, device_id); + meta_window_show_menu (window, device, root_x, root_y, button, timestamp); } void diff --git a/src/core/core.h b/src/core/core.h index 28e753cd7..dd50170ec 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -165,6 +165,7 @@ const char* meta_core_get_workspace_name_with_index (Display *xdisplay, void meta_core_show_window_menu (Display *xdisplay, Window frame_xwindow, + int device_id, int root_x, int root_y, int button, diff --git a/src/core/display.c b/src/core/display.c index bd859d0b9..4d10bebaf 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2198,6 +2198,7 @@ event_callback (XEvent *event, if (meta_prefs_get_raise_on_click ()) meta_window_raise (window); meta_window_show_menu (window, + device, ev_root_x, ev_root_y, n_button, diff --git a/src/core/keybindings.c b/src/core/keybindings.c index b39f1d87a..2d599f912 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -3138,6 +3138,7 @@ handle_activate_window_menu (MetaDisplay *display, evtime = meta_input_event_get_time (display, event); meta_window_show_menu (focus_info->focus_window, + meta_device_get_paired_device (device), x, y, 0, evtime); diff --git a/src/core/window-private.h b/src/core/window-private.h index 5809ff890..6b530d3fe 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -585,6 +585,7 @@ void meta_window_set_current_workspace_hint (MetaWindow *window); unsigned long meta_window_get_net_wm_desktop (MetaWindow *window); void meta_window_show_menu (MetaWindow *window, + MetaDevice *device, int root_x, int root_y, int button, diff --git a/src/core/window.c b/src/core/window.c index ab4aa6949..faaf8e080 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -8394,6 +8394,7 @@ menu_callback (MetaWindowMenu *menu, void meta_window_show_menu (MetaWindow *window, + MetaDevice *device, int root_x, int root_y, int button, @@ -8518,7 +8519,7 @@ meta_window_show_menu (MetaWindow *window, meta_verbose ("Popping up window menu for %s\n", window->desc); - meta_ui_window_menu_popup (menu, root_x, root_y, button, timestamp); + meta_ui_window_menu_popup (menu, device, root_x, root_y, button, timestamp); } void diff --git a/src/ui/frames.c b/src/ui/frames.c index 7fc85ffa3..7162555ad 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -1143,6 +1143,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame, case G_DESKTOP_TITLEBAR_ACTION_MENU: meta_core_show_window_menu (display, frame->xwindow, + gdk_x11_device_get_id (pointer), event->x_root, event->y_root, event->button, @@ -1330,6 +1331,7 @@ meta_frames_button_press_event (GtkWidget *widget, meta_core_show_window_menu (display, frame->xwindow, + device_id, rect->x + dx, rect->y + rect->height + dy, event->button, diff --git a/src/ui/menu.c b/src/ui/menu.c index 5c0dd16c2..5509e26b7 100644 --- a/src/ui/menu.c +++ b/src/ui/menu.c @@ -498,13 +498,17 @@ meta_window_menu_new (MetaFrames *frames, void meta_window_menu_popup (MetaWindowMenu *menu, + MetaDevice *device, int root_x, int root_y, int button, guint32 timestamp) { + GdkDeviceManager *device_manager; + GdkDevice *gdkdevice; + GdkDisplay *display; GdkPoint *pt; - + pt = g_new (GdkPoint, 1); g_object_set_data_full (G_OBJECT (menu->menu), @@ -514,12 +518,18 @@ meta_window_menu_popup (MetaWindowMenu *menu, pt->x = root_x; pt->y = root_y; - - gtk_menu_popup (GTK_MENU (menu->menu), - NULL, NULL, - popup_position_func, pt, - button, - timestamp); + + display = gtk_widget_get_display (menu->menu); + device_manager = gdk_display_get_device_manager (display); + gdkdevice = gdk_x11_device_manager_lookup (device_manager, + meta_device_get_id (device)); + + gtk_menu_popup_for_device (GTK_MENU (menu->menu), + gdkdevice, + NULL, NULL, + popup_position_func, pt, NULL, + button, + timestamp); if (!gtk_widget_get_visible (menu->menu)) meta_warning ("GtkMenu failed to grab the pointer\n"); diff --git a/src/ui/menu.h b/src/ui/menu.h index c6e8dde4d..6ac096d07 100644 --- a/src/ui/menu.h +++ b/src/ui/menu.h @@ -25,6 +25,7 @@ #define META_MENU_H #include <gtk/gtk.h> +#include <meta/device.h> #include "frames.h" /* Stock icons */ @@ -52,6 +53,7 @@ MetaWindowMenu* meta_window_menu_new (MetaFrames *frames, MetaWindowMenuFunc func, gpointer data); void meta_window_menu_popup (MetaWindowMenu *menu, + MetaDevice *device, int root_x, int root_y, int button, diff --git a/src/ui/ui.c b/src/ui/ui.c index b74a8f8a2..4646404d6 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -542,12 +542,13 @@ meta_ui_window_menu_new (MetaUI *ui, void meta_ui_window_menu_popup (MetaWindowMenu *menu, + MetaDevice *device, int root_x, int root_y, int button, guint32 timestamp) { - meta_window_menu_popup (menu, root_x, root_y, button, timestamp); + meta_window_menu_popup (menu, device, root_x, root_y, button, timestamp); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index 4a510b5c7..246c09509 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -26,6 +26,7 @@ /* Don't include gtk.h or gdk.h here */ #include <meta/common.h> +#include <meta/device.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <cairo.h> @@ -131,6 +132,7 @@ MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui, MetaWindowMenuFunc func, gpointer data); void meta_ui_window_menu_popup (MetaWindowMenu *menu, + MetaDevice *device, int root_x, int root_y, int button, |