forked from AuroraMiddleware/gtk
Merge branch 'inspector-menu-fix' into 'master'
Inspector menu fix See merge request GNOME/gtk!804
This commit is contained in:
commit
78d254370c
@ -146,15 +146,48 @@ gdk_event_class_init (GdkEventClass *klass)
|
|||||||
g_object_class_install_properties (object_class, N_PROPS, event_props);
|
g_object_class_install_properties (object_class, N_PROPS, event_props);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
_gdk_event_emit (GdkEvent *event)
|
check_event_sanity (GdkEvent *event)
|
||||||
{
|
{
|
||||||
|
GdkDisplay *display;
|
||||||
|
GdkSurface *surface;
|
||||||
|
GdkDevice *device;
|
||||||
|
|
||||||
|
display = gdk_event_get_display (event);
|
||||||
|
surface = gdk_event_get_surface (event);
|
||||||
|
device = gdk_event_get_device (event);
|
||||||
|
|
||||||
if (gdk_event_get_event_type (event) == GDK_NOTHING)
|
if (gdk_event_get_event_type (event) == GDK_NOTHING)
|
||||||
{
|
{
|
||||||
g_warning ("Ignoring GDK_NOTHING events; they're good for nothing");
|
g_warning ("Ignoring GDK_NOTHING events; they're good for nothing");
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (surface && display != gdk_surface_get_display (surface))
|
||||||
|
{
|
||||||
|
char *type = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event->any.type);
|
||||||
|
g_warning ("Event of type %s with mismatched surface display", type);
|
||||||
|
g_free (type);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device && display != gdk_device_get_display (device))
|
||||||
|
{
|
||||||
|
char *type = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event->any.type);
|
||||||
|
g_warning ("Event of type %s with mismatched device display", type);
|
||||||
|
g_free (type);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_gdk_event_emit (GdkEvent *event)
|
||||||
|
{
|
||||||
|
if (!check_event_sanity (event))
|
||||||
|
return;
|
||||||
|
|
||||||
if (gdk_drag_handle_source_event (event))
|
if (gdk_drag_handle_source_event (event))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -645,5 +645,7 @@ void gdk_event_set_related_target (GdkEvent *event,
|
|||||||
GObject *user_data);
|
GObject *user_data);
|
||||||
GObject * gdk_event_get_related_target (const GdkEvent *event);
|
GObject * gdk_event_get_related_target (const GdkEvent *event);
|
||||||
|
|
||||||
|
gboolean check_event_sanity (GdkEvent *event);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GDK_EVENTS_PRIVATE_H__ */
|
#endif /* __GDK_EVENTS_PRIVATE_H__ */
|
||||||
|
@ -293,6 +293,7 @@ gdk_seat_grab (GdkSeat *seat,
|
|||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_SEAT (seat), GDK_GRAB_FAILED);
|
g_return_val_if_fail (GDK_IS_SEAT (seat), GDK_GRAB_FAILED);
|
||||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_GRAB_FAILED);
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_GRAB_FAILED);
|
||||||
|
g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_seat_get_display (seat), GDK_GRAB_FAILED);
|
||||||
|
|
||||||
capabilities &= GDK_SEAT_CAPABILITY_ALL;
|
capabilities &= GDK_SEAT_CAPABILITY_ALL;
|
||||||
g_return_val_if_fail (capabilities != GDK_SEAT_CAPABILITY_NONE, GDK_GRAB_FAILED);
|
g_return_val_if_fail (capabilities != GDK_SEAT_CAPABILITY_NONE, GDK_GRAB_FAILED);
|
||||||
|
@ -151,6 +151,9 @@ _gdk_wayland_display_deliver_event (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
GList *node;
|
GList *node;
|
||||||
|
|
||||||
|
if (!check_event_sanity (event))
|
||||||
|
g_warning ("Snap! delivering insane events\n");
|
||||||
|
|
||||||
node = _gdk_event_queue_append (display, event);
|
node = _gdk_event_queue_append (display, event);
|
||||||
_gdk_windowing_got_event (display, node, event,
|
_gdk_windowing_got_event (display, node, event,
|
||||||
_gdk_display_get_next_serial (display));
|
_gdk_display_get_next_serial (display));
|
||||||
|
@ -1053,6 +1053,15 @@ attach_widget_display_changed (GtkWidget *attach_widget,
|
|||||||
menu_change_display (menu, gtk_widget_get_display (attach_widget));
|
menu_change_display (menu, gtk_widget_get_display (attach_widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
attach_widget_root_changed (GObject *attach_widget,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
gpointer menu)
|
||||||
|
{
|
||||||
|
if (!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-display"))
|
||||||
|
menu_change_display (menu, gtk_widget_get_display (GTK_WIDGET (attach_widget)));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_toplevel_attached_to (GtkWindow *toplevel, GParamSpec *pspec, GtkMenu *menu)
|
menu_toplevel_attached_to (GtkWindow *toplevel, GParamSpec *pspec, GtkMenu *menu)
|
||||||
{
|
{
|
||||||
@ -1108,6 +1117,8 @@ gtk_menu_attach_to_widget (GtkMenu *menu,
|
|||||||
|
|
||||||
g_signal_connect (attach_widget, "display-changed",
|
g_signal_connect (attach_widget, "display-changed",
|
||||||
G_CALLBACK (attach_widget_display_changed), menu);
|
G_CALLBACK (attach_widget_display_changed), menu);
|
||||||
|
g_signal_connect (attach_widget, "notify::root",
|
||||||
|
G_CALLBACK (attach_widget_root_changed), menu);
|
||||||
attach_widget_display_changed (attach_widget, NULL, menu);
|
attach_widget_display_changed (attach_widget, NULL, menu);
|
||||||
|
|
||||||
data->detacher = detacher;
|
data->detacher = detacher;
|
||||||
@ -1190,6 +1201,9 @@ gtk_menu_detach (GtkMenu *menu)
|
|||||||
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
||||||
(gpointer) attach_widget_display_changed,
|
(gpointer) attach_widget_display_changed,
|
||||||
menu);
|
menu);
|
||||||
|
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
||||||
|
(gpointer) attach_widget_root_changed,
|
||||||
|
menu);
|
||||||
|
|
||||||
if (data->detacher)
|
if (data->detacher)
|
||||||
data->detacher (data->attach_widget, menu);
|
data->detacher (data->attach_widget, menu);
|
||||||
@ -1265,6 +1279,8 @@ popup_grab_on_surface (GdkSurface *surface,
|
|||||||
GdkGrabStatus status;
|
GdkGrabStatus status;
|
||||||
GdkSeat *seat;
|
GdkSeat *seat;
|
||||||
|
|
||||||
|
g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_device_get_display (pointer), FALSE);
|
||||||
|
|
||||||
seat = gdk_device_get_seat (pointer);
|
seat = gdk_device_get_seat (pointer);
|
||||||
status = gdk_seat_grab (seat, surface,
|
status = gdk_seat_grab (seat, surface,
|
||||||
GDK_SEAT_CAPABILITY_ALL, TRUE,
|
GDK_SEAT_CAPABILITY_ALL, TRUE,
|
||||||
@ -1320,7 +1336,11 @@ gtk_menu_popup_internal (GtkMenu *menu,
|
|||||||
device = NULL;
|
device = NULL;
|
||||||
|
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
{
|
||||||
|
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
||||||
|
g_return_if_fail (gdk_device_get_display (device) == display);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
widget = GTK_WIDGET (menu);
|
widget = GTK_WIDGET (menu);
|
||||||
menu_shell = GTK_MENU_SHELL (menu);
|
menu_shell = GTK_MENU_SHELL (menu);
|
||||||
@ -1330,6 +1350,8 @@ gtk_menu_popup_internal (GtkMenu *menu,
|
|||||||
else
|
else
|
||||||
pointer = device;
|
pointer = device;
|
||||||
|
|
||||||
|
g_return_if_fail (gdk_device_get_display (pointer) == display);
|
||||||
|
|
||||||
menu_shell->priv->parent_menu_shell = parent_menu_shell;
|
menu_shell->priv->parent_menu_shell = parent_menu_shell;
|
||||||
|
|
||||||
/* Find the last viewable ancestor, and make an X grab on it
|
/* Find the last viewable ancestor, and make an X grab on it
|
||||||
|
Loading…
Reference in New Issue
Block a user