forked from AuroraMiddleware/gtk
Pop up context menus at the right device
When multiple pointers are in play, we need to be careful not to loose track of the device between receiving a button press and popping up a menu. https://bugzilla.gnome.org/show_bug.cgi?id=663396
This commit is contained in:
parent
7644ef1e3a
commit
41d4229155
@ -8882,6 +8882,7 @@ typedef struct
|
||||
GtkEntry *entry;
|
||||
gint button;
|
||||
guint time;
|
||||
GdkDevice *device;
|
||||
} PopupInfo;
|
||||
|
||||
static void
|
||||
@ -8989,15 +8990,15 @@ popup_targets_received (GtkClipboard *clipboard,
|
||||
info_entry_priv->popup_menu);
|
||||
|
||||
|
||||
if (info->button)
|
||||
gtk_menu_popup (GTK_MENU (info_entry_priv->popup_menu), NULL, NULL,
|
||||
NULL, NULL,
|
||||
if (info->device)
|
||||
gtk_menu_popup_for_device (GTK_MENU (info_entry_priv->popup_menu),
|
||||
info->device, NULL, NULL, NULL, NULL, NULL,
|
||||
info->button, info->time);
|
||||
else
|
||||
{
|
||||
gtk_menu_popup (GTK_MENU (info_entry_priv->popup_menu), NULL, NULL,
|
||||
popup_position_func, entry,
|
||||
info->button, info->time);
|
||||
0, gtk_get_current_event_time ());
|
||||
gtk_menu_shell_select_first (GTK_MENU_SHELL (info_entry_priv->popup_menu), FALSE);
|
||||
}
|
||||
}
|
||||
@ -9022,11 +9023,13 @@ gtk_entry_do_popup (GtkEntry *entry,
|
||||
{
|
||||
info->button = event->button;
|
||||
info->time = event->time;
|
||||
info->device = event->device;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->button = 0;
|
||||
info->time = gtk_get_current_event_time ();
|
||||
info->device = NULL;
|
||||
}
|
||||
|
||||
gtk_clipboard_request_contents (gtk_widget_get_clipboard (GTK_WIDGET (entry), GDK_SELECTION_CLIPBOARD),
|
||||
|
@ -8157,6 +8157,7 @@ typedef struct
|
||||
GtkTextView *text_view;
|
||||
gint button;
|
||||
guint time;
|
||||
GdkDevice *device;
|
||||
} PopupInfo;
|
||||
|
||||
static gboolean
|
||||
@ -8310,9 +8311,9 @@ popup_targets_received (GtkClipboard *clipboard,
|
||||
0,
|
||||
priv->popup_menu);
|
||||
|
||||
if (info->button)
|
||||
gtk_menu_popup (GTK_MENU (priv->popup_menu), NULL, NULL,
|
||||
NULL, NULL,
|
||||
if (info->device)
|
||||
gtk_menu_popup_for_device (GTK_MENU (priv->popup_menu),
|
||||
info->device, NULL, NULL, NULL, NULL, NULL,
|
||||
info->button, info->time);
|
||||
else
|
||||
{
|
||||
@ -8343,11 +8344,13 @@ gtk_text_view_do_popup (GtkTextView *text_view,
|
||||
{
|
||||
info->button = event->button;
|
||||
info->time = event->time;
|
||||
info->device = event->device;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->button = 0;
|
||||
info->time = gtk_get_current_event_time ();
|
||||
info->device = NULL;
|
||||
}
|
||||
|
||||
gtk_clipboard_request_contents (gtk_widget_get_clipboard (GTK_WIDGET (text_view),
|
||||
|
Loading…
Reference in New Issue
Block a user