Bug 526149 - GtkCellRendererAccel editing conflicts with mnemonics

GtkCellRendererAccel also needs to acquire the GTK+ grab in addition to
a GDK keyboard grab.  With the GDK keyboard grab, KeyPress and
KeyRelease events are delivered as usual, although we only want to
receive them for our grab widget.
This commit is contained in:
Kristian Rietveld 2009-08-23 08:59:34 +02:00
parent f84df976a7
commit 6320b12e8c

View File

@ -470,6 +470,7 @@ grab_key_callback (GtkWidget *widget,
edited = TRUE; edited = TRUE;
out: out:
gtk_grab_remove (accel->grab_widget);
gdk_display_keyboard_ungrab (display, event->time); gdk_display_keyboard_ungrab (display, event->time);
gdk_display_pointer_ungrab (display, event->time); gdk_display_pointer_ungrab (display, event->time);
@ -497,6 +498,7 @@ ungrab_stuff (GtkWidget *widget,
{ {
GdkDisplay *display = gtk_widget_get_display (widget); GdkDisplay *display = gtk_widget_get_display (widget);
gtk_grab_remove (accel->grab_widget);
gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME); gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME); gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
@ -606,6 +608,8 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
gtk_widget_show_all (accel->edit_widget); gtk_widget_show_all (accel->edit_widget);
gtk_grab_add (accel->grab_widget);
g_signal_connect (G_OBJECT (accel->edit_widget), "unrealize", g_signal_connect (G_OBJECT (accel->edit_widget), "unrealize",
G_CALLBACK (ungrab_stuff), accel); G_CALLBACK (ungrab_stuff), accel);