mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
expose gtk_bindings_activate_event(), changed callers.
Mon Mar 1 23:52:15 2004 Tim Janik <timj@gtk.org> * gtk/gtkbindings.[hc]: expose gtk_bindings_activate_event(), changed callers. * gtk/gtkwindow.[hc]: added gtk_window_propagate_key_event() to expose the key event propagation mechanism used for focus widgets. (gtk_window_key_release_event): use the same key event propagation logic as gtk_window_key_press_event().
This commit is contained in:
parent
c04ecdaa1a
commit
c454880a0c
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Mon Mar 1 23:52:15 2004 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkbindings.[hc]: expose gtk_bindings_activate_event(), changed
|
||||
callers.
|
||||
|
||||
* gtk/gtkwindow.[hc]: added gtk_window_propagate_key_event() to expose
|
||||
the key event propagation mechanism used for focus widgets.
|
||||
(gtk_window_key_release_event): use the same key event propagation logic
|
||||
as gtk_window_key_press_event().
|
||||
|
||||
2004-03-01 Simon Budig <simon@gimp.org>
|
||||
|
||||
* gdk/x11/gdkinput-x11.c: X11 R6.4 specifies 15 events
|
||||
|
@ -1,3 +1,13 @@
|
||||
Mon Mar 1 23:52:15 2004 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkbindings.[hc]: expose gtk_bindings_activate_event(), changed
|
||||
callers.
|
||||
|
||||
* gtk/gtkwindow.[hc]: added gtk_window_propagate_key_event() to expose
|
||||
the key event propagation mechanism used for focus widgets.
|
||||
(gtk_window_key_release_event): use the same key event propagation logic
|
||||
as gtk_window_key_press_event().
|
||||
|
||||
2004-03-01 Simon Budig <simon@gimp.org>
|
||||
|
||||
* gdk/x11/gdkinput-x11.c: X11 R6.4 specifies 15 events
|
||||
|
@ -1,3 +1,13 @@
|
||||
Mon Mar 1 23:52:15 2004 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkbindings.[hc]: expose gtk_bindings_activate_event(), changed
|
||||
callers.
|
||||
|
||||
* gtk/gtkwindow.[hc]: added gtk_window_propagate_key_event() to expose
|
||||
the key event propagation mechanism used for focus widgets.
|
||||
(gtk_window_key_release_event): use the same key event propagation logic
|
||||
as gtk_window_key_press_event().
|
||||
|
||||
2004-03-01 Simon Budig <simon@gimp.org>
|
||||
|
||||
* gdk/x11/gdkinput-x11.c: X11 R6.4 specifies 15 events
|
||||
|
@ -1,3 +1,13 @@
|
||||
Mon Mar 1 23:52:15 2004 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkbindings.[hc]: expose gtk_bindings_activate_event(), changed
|
||||
callers.
|
||||
|
||||
* gtk/gtkwindow.[hc]: added gtk_window_propagate_key_event() to expose
|
||||
the key event propagation mechanism used for focus widgets.
|
||||
(gtk_window_key_release_event): use the same key event propagation logic
|
||||
as gtk_window_key_press_event().
|
||||
|
||||
2004-03-01 Simon Budig <simon@gimp.org>
|
||||
|
||||
* gdk/x11/gdkinput-x11.c: X11 R6.4 specifies 15 events
|
||||
|
@ -1,3 +1,13 @@
|
||||
Mon Mar 1 23:52:15 2004 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkbindings.[hc]: expose gtk_bindings_activate_event(), changed
|
||||
callers.
|
||||
|
||||
* gtk/gtkwindow.[hc]: added gtk_window_propagate_key_event() to expose
|
||||
the key event propagation mechanism used for focus widgets.
|
||||
(gtk_window_key_release_event): use the same key event propagation logic
|
||||
as gtk_window_key_press_event().
|
||||
|
||||
2004-03-01 Simon Budig <simon@gimp.org>
|
||||
|
||||
* gdk/x11/gdkinput-x11.c: X11 R6.4 specifies 15 events
|
||||
|
@ -1102,7 +1102,7 @@ gtk_bindings_activate (GtkObject *object,
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_bindings_activate_event:
|
||||
* gtk_bindings_activate_event:
|
||||
* @object: a #GtkObject (generally must be a widget)
|
||||
* @event: a #GdkEventKey
|
||||
*
|
||||
@ -1112,8 +1112,8 @@ gtk_bindings_activate (GtkObject *object,
|
||||
* Return value: %TRUE if a matching key binding was found
|
||||
**/
|
||||
gboolean
|
||||
_gtk_bindings_activate_event (GtkObject *object,
|
||||
GdkEventKey *event)
|
||||
gtk_bindings_activate_event (GtkObject *object,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GSList *entries = NULL;
|
||||
GdkDisplay *display;
|
||||
|
@ -136,7 +136,7 @@ void gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
|
||||
guint gtk_binding_parse_binding (GScanner *scanner);
|
||||
|
||||
|
||||
gboolean _gtk_bindings_activate_event (GtkObject *object,
|
||||
gboolean gtk_bindings_activate_event (GtkObject *object,
|
||||
GdkEventKey *event);
|
||||
void _gtk_binding_reset_parsed (void);
|
||||
|
||||
|
@ -580,7 +580,7 @@ gtk_menu_shell_key_press (GtkWidget *widget,
|
||||
if (!menu_shell->active_menu_item && menu_shell->parent_menu_shell)
|
||||
return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent *)event);
|
||||
|
||||
if (_gtk_bindings_activate_event (GTK_OBJECT (widget), event))
|
||||
if (gtk_bindings_activate_event (GTK_OBJECT (widget), event))
|
||||
return TRUE;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
@ -3303,14 +3303,14 @@ static gboolean
|
||||
gtk_widget_real_key_press_event (GtkWidget *widget,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
return _gtk_bindings_activate_event (GTK_OBJECT (widget), event);
|
||||
return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_widget_real_key_release_event (GtkWidget *widget,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
return _gtk_bindings_activate_event (GTK_OBJECT (widget), event);
|
||||
return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
122
gtk/gtkwindow.c
122
gtk/gtkwindow.c
@ -4183,53 +4183,75 @@ _gtk_window_query_nonaccels (GtkWindow *window,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_propagate_key_event:
|
||||
* @window: a #GtkWindow
|
||||
* @event: a #GdkEventKey
|
||||
*
|
||||
* Propagate a key press or release event to the focus widget and
|
||||
* up the focus container chain until a widget handles @event.
|
||||
* This is normally called by the default ::key_press_event and
|
||||
* ::key_release_event handlers for toplevel windows,
|
||||
* however in some cases it may be useful to call this directly when
|
||||
* overriding the standard key handling for a toplevel window.
|
||||
*
|
||||
* Return value: %TRUE if a widget in the focus chain handled the event.
|
||||
**/
|
||||
gboolean
|
||||
gtk_window_propagate_key_event (GtkWindow *window,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
gboolean handled = FALSE;
|
||||
GtkWidget *widget, *focus;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
|
||||
|
||||
widget = GTK_WIDGET (window);
|
||||
focus = window->focus_widget;
|
||||
if (focus)
|
||||
g_object_ref (focus);
|
||||
|
||||
while (!handled &&
|
||||
focus && focus != widget &&
|
||||
gtk_widget_get_toplevel (focus) == widget)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (focus))
|
||||
handled = gtk_widget_event (focus, (GdkEvent*) event);
|
||||
|
||||
parent = focus->parent;
|
||||
if (parent)
|
||||
g_object_ref (parent);
|
||||
|
||||
g_object_unref (focus);
|
||||
|
||||
focus = parent;
|
||||
}
|
||||
|
||||
if (focus)
|
||||
g_object_unref (focus);
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_window_key_press_event (GtkWidget *widget,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GtkWindow *window;
|
||||
GtkWidget *focus;
|
||||
gboolean handled;
|
||||
GtkWindow *window = GTK_WINDOW (widget);
|
||||
gboolean handled = FALSE;
|
||||
|
||||
window = GTK_WINDOW (widget);
|
||||
|
||||
handled = FALSE;
|
||||
|
||||
/* Check for mnemonics and accelerators
|
||||
*/
|
||||
/* handle mnemonics and accelerators */
|
||||
if (!handled)
|
||||
handled = gtk_window_activate_key (window, event);
|
||||
|
||||
/* handle focus widget key events */
|
||||
if (!handled)
|
||||
{
|
||||
focus = window->focus_widget;
|
||||
if (focus)
|
||||
g_object_ref (focus);
|
||||
|
||||
while (!handled &&
|
||||
focus && focus != widget &&
|
||||
gtk_widget_get_toplevel (focus) == widget)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (focus))
|
||||
handled = gtk_widget_event (focus, (GdkEvent*) event);
|
||||
|
||||
parent = focus->parent;
|
||||
if (parent)
|
||||
g_object_ref (parent);
|
||||
|
||||
g_object_unref (focus);
|
||||
|
||||
focus = parent;
|
||||
}
|
||||
|
||||
if (focus)
|
||||
g_object_unref (focus);
|
||||
}
|
||||
handled = gtk_window_propagate_key_event (window, event);
|
||||
|
||||
/* Chain up, invokes binding set */
|
||||
if (!handled && GTK_WIDGET_CLASS (parent_class)->key_press_event)
|
||||
if (!handled)
|
||||
handled = GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
|
||||
|
||||
return handled;
|
||||
@ -4239,20 +4261,16 @@ static gint
|
||||
gtk_window_key_release_event (GtkWidget *widget,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GtkWindow *window;
|
||||
gint handled;
|
||||
|
||||
window = GTK_WINDOW (widget);
|
||||
handled = FALSE;
|
||||
if (window->focus_widget &&
|
||||
window->focus_widget != widget &&
|
||||
GTK_WIDGET_SENSITIVE (window->focus_widget))
|
||||
{
|
||||
handled = gtk_widget_event (window->focus_widget, (GdkEvent*) event);
|
||||
}
|
||||
GtkWindow *window = GTK_WINDOW (widget);
|
||||
gboolean handled = FALSE;
|
||||
|
||||
if (!handled && GTK_WIDGET_CLASS (parent_class)->key_release_event)
|
||||
handled = GTK_WIDGET_CLASS (parent_class)->key_release_event (widget, event);
|
||||
/* handle focus widget key events */
|
||||
if (!handled)
|
||||
handled = gtk_window_propagate_key_event (window, event);
|
||||
|
||||
/* Chain up, invokes binding set */
|
||||
if (!handled)
|
||||
handled = GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
|
||||
|
||||
return handled;
|
||||
}
|
||||
@ -7068,9 +7086,9 @@ gtk_window_free_key_hash (GtkWindow *window)
|
||||
|
||||
/**
|
||||
* gtk_window_activate_key:
|
||||
* @window: a #GtkWindow
|
||||
* @event: a #GdkEventKey
|
||||
*
|
||||
* @window: a #GtkWindow
|
||||
* @event: a #GdkEventKey
|
||||
*
|
||||
* Activates mnemonics and accelerators for this #GtkWindow. This is normally
|
||||
* called by the default ::key_press_event handler for toplevel windows,
|
||||
* however in some cases it may be useful to call this directly when
|
||||
|
@ -287,6 +287,8 @@ GdkModifierType gtk_window_get_mnemonic_modifier (GtkWindow *window);
|
||||
|
||||
gboolean gtk_window_activate_key (GtkWindow *window,
|
||||
GdkEventKey *event);
|
||||
gboolean gtk_window_propagate_key_event (GtkWindow *window,
|
||||
GdkEventKey *event);
|
||||
|
||||
void gtk_window_present (GtkWindow *window);
|
||||
void gtk_window_iconify (GtkWindow *window);
|
||||
|
Loading…
Reference in New Issue
Block a user