mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 11:20:12 +00:00
make a clear distinction between key press/release events, which will be
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org> * gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between key press/release events, which will be sent to a widgets toplevel ancestor and be forwarded from there, and all other events that need to get propagated up the widget tree (pointed out by Owen Taylor).
This commit is contained in:
parent
c2906f2bea
commit
11f79ebe18
@ -1,3 +1,10 @@
|
||||
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between
|
||||
key press/release events, which will be sent to a widgets toplevel
|
||||
ancestor and be forwarded from there, and all other events that need to
|
||||
get propagated up the widget tree (pointed out by Owen Taylor).
|
||||
|
||||
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between
|
||||
key press/release events, which will be sent to a widgets toplevel
|
||||
ancestor and be forwarded from there, and all other events that need to
|
||||
get propagated up the widget tree (pointed out by Owen Taylor).
|
||||
|
||||
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between
|
||||
key press/release events, which will be sent to a widgets toplevel
|
||||
ancestor and be forwarded from there, and all other events that need to
|
||||
get propagated up the widget tree (pointed out by Owen Taylor).
|
||||
|
||||
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between
|
||||
key press/release events, which will be sent to a widgets toplevel
|
||||
ancestor and be forwarded from there, and all other events that need to
|
||||
get propagated up the widget tree (pointed out by Owen Taylor).
|
||||
|
||||
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between
|
||||
key press/release events, which will be sent to a widgets toplevel
|
||||
ancestor and be forwarded from there, and all other events that need to
|
||||
get propagated up the widget tree (pointed out by Owen Taylor).
|
||||
|
||||
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between
|
||||
key press/release events, which will be sent to a widgets toplevel
|
||||
ancestor and be forwarded from there, and all other events that need to
|
||||
get propagated up the widget tree (pointed out by Owen Taylor).
|
||||
|
||||
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu Mar 26 23:12:54 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkmain.c (gtk_propagate_event): make a clear distinction between
|
||||
key press/release events, which will be sent to a widgets toplevel
|
||||
ancestor and be forwarded from there, and all other events that need to
|
||||
get propagated up the widget tree (pointed out by Owen Taylor).
|
||||
|
||||
Thu Mar 26 21:37:57 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkradiobutton.c (gtk_radio_button_draw_indicator): always
|
||||
|
@ -1516,49 +1516,44 @@ static void
|
||||
gtk_propagate_event (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
GtkWidget *tmp;
|
||||
gint handled_event;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
handled_event = FALSE;
|
||||
gtk_widget_ref (widget);
|
||||
|
||||
if ((event->type == GDK_KEY_PRESS) ||
|
||||
(event->type == GDK_KEY_RELEASE))
|
||||
{
|
||||
|
||||
/* Only send key events to window widgets.
|
||||
* The window widget will in turn pass the
|
||||
* key event on to the currently focused widget
|
||||
* for that window.
|
||||
*/
|
||||
parent = gtk_widget_get_ancestor (widget, gtk_window_get_type ());
|
||||
handled_event = (parent &&
|
||||
GTK_WIDGET_IS_SENSITIVE (parent) &&
|
||||
gtk_widget_event (parent, event));
|
||||
handled_event |= parent == widget;
|
||||
|
||||
widget = gtk_widget_get_ancestor (widget, gtk_window_get_type ());
|
||||
if (widget && GTK_WIDGET_IS_SENSITIVE (widget))
|
||||
gtk_widget_event (widget, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
gint handled_event;
|
||||
|
||||
/* Other events get propagated up the widget tree
|
||||
* so that parents can see the button and motion
|
||||
* events of the children.
|
||||
*/
|
||||
tmp = widget;
|
||||
while (!handled_event && tmp)
|
||||
|
||||
handled_event = FALSE;
|
||||
while (!handled_event && widget)
|
||||
{
|
||||
gtk_widget_ref (tmp);
|
||||
handled_event = !GTK_WIDGET_IS_SENSITIVE (tmp) || gtk_widget_event (tmp, event);
|
||||
parent = tmp->parent;
|
||||
gtk_widget_unref (tmp);
|
||||
tmp = parent;
|
||||
}
|
||||
GtkWidget *tmp;
|
||||
|
||||
gtk_widget_ref (widget);
|
||||
handled_event = !GTK_WIDGET_IS_SENSITIVE (widget) || gtk_widget_event (widget, event);
|
||||
tmp = widget->parent;
|
||||
gtk_widget_unref (widget);
|
||||
widget = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_error (gchar *str)
|
||||
|
Loading…
Reference in New Issue
Block a user