forked from AuroraMiddleware/gtk
ue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c: Fix up grabs to be robust; grab the keyboard as well as the pointer so we won't leave the window behind if the user switches desktops with a keyboard combination. (Based on a patch from Matthias Clasen, #82525)
This commit is contained in:
parent
6bd08ac815
commit
e76d752e9a
@ -1,3 +1,11 @@
|
||||
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombo.c: Fix up grabs to be robust; grab
|
||||
the keyboard as well as the pointer so we won't
|
||||
leave the window behind if the user switches desktops
|
||||
with a keyboard combination. (Based on a patch
|
||||
from Matthias Clasen, #82525)
|
||||
|
||||
Wed Nov 13 14:01:44 2002 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c:
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombo.c: Fix up grabs to be robust; grab
|
||||
the keyboard as well as the pointer so we won't
|
||||
leave the window behind if the user switches desktops
|
||||
with a keyboard combination. (Based on a patch
|
||||
from Matthias Clasen, #82525)
|
||||
|
||||
Wed Nov 13 14:01:44 2002 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c:
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombo.c: Fix up grabs to be robust; grab
|
||||
the keyboard as well as the pointer so we won't
|
||||
leave the window behind if the user switches desktops
|
||||
with a keyboard combination. (Based on a patch
|
||||
from Matthias Clasen, #82525)
|
||||
|
||||
Wed Nov 13 14:01:44 2002 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c:
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombo.c: Fix up grabs to be robust; grab
|
||||
the keyboard as well as the pointer so we won't
|
||||
leave the window behind if the user switches desktops
|
||||
with a keyboard combination. (Based on a patch
|
||||
from Matthias Clasen, #82525)
|
||||
|
||||
Wed Nov 13 14:01:44 2002 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c:
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombo.c: Fix up grabs to be robust; grab
|
||||
the keyboard as well as the pointer so we won't
|
||||
leave the window behind if the user switches desktops
|
||||
with a keyboard combination. (Based on a patch
|
||||
from Matthias Clasen, #82525)
|
||||
|
||||
Wed Nov 13 14:01:44 2002 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c:
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Nov 12 17:10:10 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcombo.c: Fix up grabs to be robust; grab
|
||||
the keyboard as well as the pointer so we won't
|
||||
leave the window behind if the user switches desktops
|
||||
with a keyboard combination. (Based on a patch
|
||||
from Matthias Clasen, #82525)
|
||||
|
||||
Wed Nov 13 14:01:44 2002 Soeren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* gtk/gtkstyle.c:
|
||||
|
@ -297,6 +297,8 @@ gtk_combo_window_key_press (GtkWidget *window,
|
||||
gtk_grab_remove (combo->popwin);
|
||||
gdk_display_pointer_ungrab (gtk_widget_get_display (window),
|
||||
event->time);
|
||||
gdk_display_keyboard_ungrab (gtk_widget_get_display (window),
|
||||
event->time);
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,27 +563,56 @@ gtk_combo_popdown_list (GtkCombo *combo)
|
||||
{
|
||||
gtk_grab_remove (combo->popwin);
|
||||
gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (combo)),
|
||||
GDK_CURRENT_TIME);
|
||||
gtk_get_current_event_time ());
|
||||
gdk_display_keyboard_ungrab (gtk_widget_get_display (GTK_WIDGET (combo)),
|
||||
gtk_get_current_event_time ());
|
||||
}
|
||||
|
||||
gtk_widget_hide (combo->popwin);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
popup_grab_on_window (GdkWindow *window,
|
||||
guint32 activate_time)
|
||||
{
|
||||
if ((gdk_pointer_grab (window, TRUE,
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK,
|
||||
NULL, NULL, activate_time) == 0))
|
||||
{
|
||||
if (gdk_keyboard_grab (window, TRUE,
|
||||
activate_time) == 0)
|
||||
return TRUE;
|
||||
else
|
||||
{
|
||||
gdk_display_pointer_ungrab (gdk_drawable_get_display (window),
|
||||
activate_time);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_activate (GtkWidget *widget,
|
||||
GtkCombo *combo)
|
||||
{
|
||||
if (!combo->button->window ||
|
||||
!popup_grab_on_window (combo->button->window,
|
||||
gtk_get_current_event_time ()))
|
||||
return FALSE;
|
||||
|
||||
gtk_combo_popup_list (combo);
|
||||
|
||||
/* This must succeed since we already have the grab */
|
||||
popup_grab_on_window (combo->popwin->window,
|
||||
gtk_get_current_event_time ());
|
||||
|
||||
if (!GTK_WIDGET_HAS_FOCUS (combo->entry))
|
||||
gtk_widget_grab_focus (combo->entry);
|
||||
|
||||
gtk_grab_add (combo->popwin);
|
||||
gdk_pointer_grab (combo->popwin->window, TRUE,
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK,
|
||||
NULL, NULL, GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -595,18 +626,21 @@ gtk_combo_popup_button_press (GtkWidget *button,
|
||||
if (event->button != 1)
|
||||
return FALSE;
|
||||
|
||||
if (!popup_grab_on_window (combo->button->window,
|
||||
gtk_get_current_event_time ()))
|
||||
return FALSE;
|
||||
|
||||
combo->current_button = event->button;
|
||||
|
||||
gtk_combo_popup_list (combo);
|
||||
|
||||
/* This must succeed since we already have the grab */
|
||||
popup_grab_on_window (combo->popwin->window,
|
||||
gtk_get_current_event_time ());
|
||||
|
||||
gtk_button_pressed (GTK_BUTTON (button));
|
||||
|
||||
gtk_grab_add (combo->popwin);
|
||||
gdk_pointer_grab (combo->popwin->window, TRUE,
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK,
|
||||
NULL, NULL, GDK_CURRENT_TIME);
|
||||
|
||||
GTK_LIST (combo->list)->drag_selection = TRUE;
|
||||
gtk_grab_add (combo->list);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user