mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
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.
This commit is contained in:
parent
f84637d31e
commit
b93c72315d
@ -512,12 +512,14 @@ meta_core_get_active_workspace (Screen *xscreen)
|
|||||||
void
|
void
|
||||||
meta_core_show_window_menu (Display *xdisplay,
|
meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
|
int device_id,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
guint32 timestamp)
|
guint32 timestamp)
|
||||||
{
|
{
|
||||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||||
|
MetaDevice *device;
|
||||||
|
|
||||||
/* There is already a menu popped up,
|
/* There is already a menu popped up,
|
||||||
* most likely from another device
|
* most likely from another device
|
||||||
@ -529,7 +531,8 @@ meta_core_show_window_menu (Display *xdisplay,
|
|||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_focus (window, timestamp);
|
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
|
void
|
||||||
|
@ -165,6 +165,7 @@ const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
|
|||||||
|
|
||||||
void meta_core_show_window_menu (Display *xdisplay,
|
void meta_core_show_window_menu (Display *xdisplay,
|
||||||
Window frame_xwindow,
|
Window frame_xwindow,
|
||||||
|
int device_id,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
|
@ -1962,6 +1962,7 @@ event_callback (XEvent *event,
|
|||||||
if (meta_prefs_get_raise_on_click ())
|
if (meta_prefs_get_raise_on_click ())
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_show_menu (window,
|
meta_window_show_menu (window,
|
||||||
|
device,
|
||||||
ev_root_x,
|
ev_root_x,
|
||||||
ev_root_y,
|
ev_root_y,
|
||||||
n_button,
|
n_button,
|
||||||
|
@ -3135,6 +3135,7 @@ handle_activate_window_menu (MetaDisplay *display,
|
|||||||
evtime = meta_input_event_get_time (display, event);
|
evtime = meta_input_event_get_time (display, event);
|
||||||
|
|
||||||
meta_window_show_menu (focus_info->focus_window,
|
meta_window_show_menu (focus_info->focus_window,
|
||||||
|
meta_device_get_paired_device (device),
|
||||||
x, y,
|
x, y,
|
||||||
0,
|
0,
|
||||||
evtime);
|
evtime);
|
||||||
|
@ -580,6 +580,7 @@ void meta_window_set_current_workspace_hint (MetaWindow *window);
|
|||||||
unsigned long meta_window_get_net_wm_desktop (MetaWindow *window);
|
unsigned long meta_window_get_net_wm_desktop (MetaWindow *window);
|
||||||
|
|
||||||
void meta_window_show_menu (MetaWindow *window,
|
void meta_window_show_menu (MetaWindow *window,
|
||||||
|
MetaDevice *device,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
|
@ -8043,6 +8043,7 @@ menu_callback (MetaWindowMenu *menu,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_window_show_menu (MetaWindow *window,
|
meta_window_show_menu (MetaWindow *window,
|
||||||
|
MetaDevice *device,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
@ -8173,7 +8174,7 @@ meta_window_show_menu (MetaWindow *window,
|
|||||||
|
|
||||||
meta_verbose ("Popping up window menu for %s\n", window->desc);
|
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
|
void
|
||||||
|
@ -1519,6 +1519,7 @@ meta_frame_titlebar_event (MetaUIFrame *frame,
|
|||||||
case META_ACTION_TITLEBAR_MENU:
|
case META_ACTION_TITLEBAR_MENU:
|
||||||
meta_core_show_window_menu (display,
|
meta_core_show_window_menu (display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
|
gdk_x11_device_get_id (pointer),
|
||||||
event->x_root,
|
event->x_root,
|
||||||
event->y_root,
|
event->y_root,
|
||||||
event->button,
|
event->button,
|
||||||
@ -1711,6 +1712,7 @@ meta_frames_button_press_event (GtkWidget *widget,
|
|||||||
|
|
||||||
meta_core_show_window_menu (display,
|
meta_core_show_window_menu (display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
|
device_id,
|
||||||
rect->x + dx,
|
rect->x + dx,
|
||||||
rect->y + rect->height + dy,
|
rect->y + rect->height + dy,
|
||||||
event->button,
|
event->button,
|
||||||
|
@ -498,13 +498,17 @@ meta_window_menu_new (MetaFrames *frames,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_window_menu_popup (MetaWindowMenu *menu,
|
meta_window_menu_popup (MetaWindowMenu *menu,
|
||||||
|
MetaDevice *device,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
guint32 timestamp)
|
guint32 timestamp)
|
||||||
{
|
{
|
||||||
|
GdkDeviceManager *device_manager;
|
||||||
|
GdkDevice *gdkdevice;
|
||||||
|
GdkDisplay *display;
|
||||||
GdkPoint *pt;
|
GdkPoint *pt;
|
||||||
|
|
||||||
pt = g_new (GdkPoint, 1);
|
pt = g_new (GdkPoint, 1);
|
||||||
|
|
||||||
g_object_set_data_full (G_OBJECT (menu->menu),
|
g_object_set_data_full (G_OBJECT (menu->menu),
|
||||||
@ -514,12 +518,18 @@ meta_window_menu_popup (MetaWindowMenu *menu,
|
|||||||
|
|
||||||
pt->x = root_x;
|
pt->x = root_x;
|
||||||
pt->y = root_y;
|
pt->y = root_y;
|
||||||
|
|
||||||
gtk_menu_popup (GTK_MENU (menu->menu),
|
display = gtk_widget_get_display (menu->menu);
|
||||||
NULL, NULL,
|
device_manager = gdk_display_get_device_manager (display);
|
||||||
popup_position_func, pt,
|
gdkdevice = gdk_x11_device_manager_lookup (device_manager,
|
||||||
button,
|
meta_device_get_id (device));
|
||||||
timestamp);
|
|
||||||
|
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))
|
if (!gtk_widget_get_visible (menu->menu))
|
||||||
meta_warning ("GtkMenu failed to grab the pointer\n");
|
meta_warning ("GtkMenu failed to grab the pointer\n");
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#define META_MENU_H
|
#define META_MENU_H
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include <meta/device.h>
|
||||||
#include "frames.h"
|
#include "frames.h"
|
||||||
|
|
||||||
/* Stock icons */
|
/* Stock icons */
|
||||||
@ -52,6 +53,7 @@ MetaWindowMenu* meta_window_menu_new (MetaFrames *frames,
|
|||||||
MetaWindowMenuFunc func,
|
MetaWindowMenuFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void meta_window_menu_popup (MetaWindowMenu *menu,
|
void meta_window_menu_popup (MetaWindowMenu *menu,
|
||||||
|
MetaDevice *device,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
|
@ -538,12 +538,13 @@ meta_ui_window_menu_new (MetaUI *ui,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_ui_window_menu_popup (MetaWindowMenu *menu,
|
meta_ui_window_menu_popup (MetaWindowMenu *menu,
|
||||||
|
MetaDevice *device,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
guint32 timestamp)
|
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
|
void
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
/* Don't include gtk.h or gdk.h here */
|
/* Don't include gtk.h or gdk.h here */
|
||||||
#include <meta/common.h>
|
#include <meta/common.h>
|
||||||
|
#include <meta/device.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
@ -132,6 +133,7 @@ MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui,
|
|||||||
MetaWindowMenuFunc func,
|
MetaWindowMenuFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void meta_ui_window_menu_popup (MetaWindowMenu *menu,
|
void meta_ui_window_menu_popup (MetaWindowMenu *menu,
|
||||||
|
MetaDevice *device,
|
||||||
int root_x,
|
int root_x,
|
||||||
int root_y,
|
int root_y,
|
||||||
int button,
|
int button,
|
||||||
|
Loading…
Reference in New Issue
Block a user