Re: gtk_grab_add() and key press events
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor redhat com>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: gtk_grab_add() and key press events
- Date: Sat, 3 Feb 2001 09:50:38 +0100 (CET)
On 2 Feb 2001, Owen Taylor wrote:
> While working on one of the older GTK+ bugs:
> /* Other events get propagated up the widget tree
> * so that parents can see the button and motion
> * events of the children.
> */
> - while (!handled_event && widget)
> + if (!handled_event)
> {
> - GtkWidget *tmp;
> + while (TRUE)
> + {
> + GtkWidget *tmp;
> +
> + handled_event = !GTK_WIDGET_IS_SENSITIVE (widget) || gtk_widget_event (widget, event);
> + tmp = widget->parent;
> + gtk_widget_unref (widget);
when an event destroyed a widget and its parent and erroneously returns
FALSE, the below gtk_widget_ref (widget); might go to hell. granted,
the old code had the same problem, it just occoured to me.
>
> - 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;
> + widget = tmp;
> +
> + if (!handled_event && widget)
> + gtk_widget_ref (widget);
> + else
> + break;
> + }
> }
> + else
> + gtk_widget_unref (widget);
> }
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]