+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkmenushell.c (gtk_menu_shell_grab_broken): Ignore
+ GrabBroken events which are caused by overgrabbing inside
+ the application; menus rely on these for their operation.
+
+ * gdk/gdkevents.h (struct _GdkEventGrabBroken): Add a
+ grab_window field.
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Set
+ grab_window to NULL when generating GrabBroken events for
+ WM_KILLFOCUS messages.
+
+ * gdk/x11/gdkmain-x11.c (_gdk_xgrab_check_unmap)
+ (_gdk_xgrab_check_destroy): Set grab_window to NULL when
+ generating GrabBroken events when the grab window becomes
+ unviewable or is destroyed.
+
+ * gdk/x11/gdkmain-x11.c (gdk_pointer_grab, gdk_keyboard_grab):
+ Generate GrabBroken events when overriding a grab inside
+ the application. In this case, set grab_window to the new
+ grab_window.
+
2005-06-27 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkbutton.c (gtk_real_button_activate): Continue
(gtk_button_finish_activate): Only ungrab when we have
a keyboard grab. (#172998, William Jon McCann)
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_finalize):
Avoid a segfault. (#309054)
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add
fields for grab timestamps.
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkmenushell.c (gtk_menu_shell_grab_broken): Ignore
+ GrabBroken events which are caused by overgrabbing inside
+ the application; menus rely on these for their operation.
+
+ * gdk/gdkevents.h (struct _GdkEventGrabBroken): Add a
+ grab_window field.
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Set
+ grab_window to NULL when generating GrabBroken events for
+ WM_KILLFOCUS messages.
+
+ * gdk/x11/gdkmain-x11.c (_gdk_xgrab_check_unmap)
+ (_gdk_xgrab_check_destroy): Set grab_window to NULL when
+ generating GrabBroken events when the grab window becomes
+ unviewable or is destroyed.
+
+ * gdk/x11/gdkmain-x11.c (gdk_pointer_grab, gdk_keyboard_grab):
+ Generate GrabBroken events when overriding a grab inside
+ the application. In this case, set grab_window to the new
+ grab_window.
+
2005-06-27 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkbutton.c (gtk_real_button_activate): Continue
(gtk_button_finish_activate): Only ungrab when we have
a keyboard grab. (#172998, William Jon McCann)
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_finalize):
Avoid a segfault. (#309054)
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add
fields for grab timestamps.
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkmenushell.c (gtk_menu_shell_grab_broken): Ignore
+ GrabBroken events which are caused by overgrabbing inside
+ the application; menus rely on these for their operation.
+
+ * gdk/gdkevents.h (struct _GdkEventGrabBroken): Add a
+ grab_window field.
+
+ * gdk/win32/gdkevents-win32.c (gdk_event_translate): Set
+ grab_window to NULL when generating GrabBroken events for
+ WM_KILLFOCUS messages.
+
+ * gdk/x11/gdkmain-x11.c (_gdk_xgrab_check_unmap)
+ (_gdk_xgrab_check_destroy): Set grab_window to NULL when
+ generating GrabBroken events when the grab window becomes
+ unviewable or is destroyed.
+
+ * gdk/x11/gdkmain-x11.c (gdk_pointer_grab, gdk_keyboard_grab):
+ Generate GrabBroken events when overriding a grab inside
+ the application. In this case, set grab_window to the new
+ grab_window.
+
2005-06-27 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkbutton.c (gtk_real_button_activate): Continue
(gtk_button_finish_activate): Only ungrab when we have
a keyboard grab. (#172998, William Jon McCann)
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
* modules/input/gtkimcontextxim.c (gtk_im_context_xim_finalize):
Avoid a segfault. (#309054)
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
* gdk/x11/gdkdisplay-x11.h (struct _GdkDisplayX11): Add
fields for grab timestamps.
+2005-06-27 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/tmpl/event_structs.sgml: Update docs.
+
2005-06-25 Matthias Clasen <mclasen@redhat.com>
* gdk/gdk-sections.txt: Add GdkEventGrabBroken.
@send_event: %TRUE if the event was sent explicitly (e.g. using <function>XSendEvent</function>).
@keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
grab was broken
+@grab_window: If this event is caused by another grab in the same
+ application, @grab_window contains the new grab window. Otherwise
+ @grab_window id %NULL.
@Since: 2.8
<!-- ##### ENUM GdkScrollDirection ##### -->
GdkWindow *window;
gint8 send_event;
gboolean keyboard;
+ GdkWindow *grab_window;
};
/* Event types for DND */
event->grab_broken.window = p_grab_window;
event->grab_broken.send_event = 0;
event->grab_broken.keyboard = FALSE;
+ event->grab_broken.grab_window = NULL;
append_event (display, event);
}
event->grab_broken.window = k_grab_window;
event->grab_broken.send_event = 0;
event->grab_broken.keyboard = TRUE;
+ event->grab_broken.grab_window = NULL;
append_event (display, event);
}
static void
generate_grab_broken_event (GdkWindow *window,
+ GdkWindow *grab_window,
gboolean keyboard)
{
GdkEvent event;
event.grab_broken.window = window;
event.grab_broken.send_event = 0;
event.grab_broken.keyboard = keyboard;
-
+ event.grab_broken.grab_window = grab_window;
+
gdk_event_put (&event);
}
if (return_val == GrabSuccess)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
- if (display_x11->pointer_xgrab_window != NULL)
- {
- g_print ("overgrab pointer\n");
-#if 0
- generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_xgrab_window),
- FALSE);
-#endif
- }
+ if (display_x11->pointer_xgrab_window != NULL &&
+ display_x11->pointer_xgrab_window != window)
+ generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_xgrab_window),
+ window, FALSE);
display_x11->pointer_xgrab_window = (GdkWindowObject *)window;
display_x11->pointer_xgrab_serial = serial;
if (return_val == GrabSuccess)
{
GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (gdk_drawable_get_display (window));
- if (display_x11->keyboard_xgrab_window != NULL)
- {
- g_print ("overgrab keyboard\n");
-#if 0
- generate_grab_broken_event (GDK_WINDOW (display_x11->keyboard_xgrab_window),
- TRUE);
-#endif
- }
+ if (display_x11->keyboard_xgrab_window != NULL &&
+ display_x11->keyboard_xgrab_window != window)
+ generate_grab_broken_event (GDK_WINDOW (display_x11->keyboard_xgrab_window),
+ window, TRUE);
+
display_x11->keyboard_xgrab_window = (GdkWindowObject *)window;
display_x11->keyboard_xgrab_serial = serial;
display_x11->keyboard_xgrab_owner_events = owner_events;
if (tmp)
{
- g_print ("pointer grab broken from check unmap\n");
generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_xgrab_window),
- FALSE);
+ NULL, FALSE);
display_x11->pointer_xgrab_window = NULL;
}
}
if (tmp)
{
- g_print ("keyboard grab broken from check unmap\n");
generate_grab_broken_event (GDK_WINDOW (display_x11->keyboard_xgrab_window),
- TRUE);
+ NULL, TRUE);
display_x11->keyboard_xgrab_window = NULL;
}
}
if ((GdkWindowObject *)window == display_x11->pointer_xgrab_window)
{
- g_print ("pointer grab broken from check destroy\n");
generate_grab_broken_event (GDK_WINDOW (display_x11->pointer_xgrab_window),
- FALSE);
+ NULL, FALSE);
display_x11->pointer_xgrab_window = NULL;
}
if ((GdkWindowObject *)window == display_x11->keyboard_xgrab_window)
{
- g_print ("keyboard grab broken from check destroy\n");
generate_grab_broken_event (GDK_WINDOW (display_x11->keyboard_xgrab_window),
- TRUE);
+ NULL, TRUE);
display_x11->keyboard_xgrab_window = NULL;
}
}
gtk_menu_shell_grab_broken (GtkWidget *widget,
GdkEventGrabBroken *event)
{
- GtkMenuShell *menu_shell;
+ GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
- g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- menu_shell = GTK_MENU_SHELL (widget);
- if (menu_shell->active)
+ if (menu_shell->have_xgrab && event->grab_window == NULL)
{
+ /* Unset the active menu item so gtk_menu_popdown() doesn't see it.
+ */
+
+ gtk_menu_shell_deselect (menu_shell);
+
gtk_menu_shell_deactivate (menu_shell);
g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
}