enter and notify events (gtkmain.c)
- From: pks spiffykitty com
- To: gtk-devel-list gnome org
- Subject: enter and notify events (gtkmain.c)
- Date: Wed, 26 Mar 2003 22:17:30 -0700
I have written gtk 1.2.10 code that disables
a button when it is clicked because the code
executed in response to the button click runs
for a long time in separate threads (this is
to allow the other threads to update a list
in the button's parent window).
when the mouse pointer is removed from the button
while it is insensitive, a leave notify event
is sent and GtkButton.in_button is set to FALSE
by gtk_button_leave_notify().
so far so good.
if the mouse pointer is returned to the button
before it is made sensitive again, gtkmain.c
fails to send the enter notify event, leaving
GtkButton.in_button as FALSE and making all
clicks futile until the mouse pointer leaves
and enters the gtk button again.
here is the gtk_main_do_event() code from gtkmain.c
which causes this behavior:
case GDK_ENTER_NOTIFY:
if (GTK_WIDGET_IS_SENSITIVE (grab_widget))
{
gtk_widget_event (grab_widget, event);
if (event_widget == grab_widget)
GTK_PRIVATE_SET_FLAG (event_widget, GTK_LEAVE_PENDING);
}
break;
case GDK_LEAVE_NOTIFY:
if (GTK_WIDGET_LEAVE_PENDING (event_widget))
{
GTK_PRIVATE_UNSET_FLAG (event_widget, GTK_LEAVE_PENDING);
gtk_widget_event (event_widget, event);
}
else if (GTK_WIDGET_IS_SENSITIVE (grab_widget))
gtk_widget_event (grab_widget, event);
break;
I assume the check for sensitivity before forwarding
GDK_[ENTER,LEAVE]_NOTIFY events and tracking the
GTK_LEAVE_PENDING flag is to avoid rendering an insensitive
widget's prelight state.
Are there other motivations?
Am I doomed patching gtk to blindly call gtk_widget_event()
for both enter and leave events? (doing so has corrected
my GtkButton.in_button problem ... but for all I know may
have broken tons of other widgets)
And now I've typed all this, a rather simple question comes
to mind ...
Is it best just to patch gtk_real_button_pressed() to
correct the GtkButton.in_button field?
Thanks for any and all input.
Patrick Schweiger
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]