GNOME Bugzilla – Bug 379550
gtk_widget_set_extension_events has no effect on realized widgets
Last modified: 2007-03-14 15:41:24 UTC
If one calls gtk_widget_set_extension_events on a widget that is already realized it has no effect as the extension events are passed to gdk only in gtk_widget_realize I would imagine refactoring code so that for realized widgets the flags are updated immediately, but the FIXME above gdk_input_set_extension_events suggests there are other issues involved.
Created attachment 77217 [details] [review] proposed patch This should take of the FIXME. Basically it makes gdk_input_set_extension_events ready to be called multiple times without leaking and resolves the root_relative_geometry in case it is called after ConfigureNotify
Created attachment 77310 [details] [review] Update the extension events on realized widgets The patch includes the fix for the issue I raised on the mailing list http://mail.gnome.org/archives/gtk-devel-list/2006-September/msg00055.html If necessary I can remove that part of the patch.
I'm by no means an expert in extended input devices, but the patches look ok to me. I assume you have tested them...
Created attachment 81050 [details] [review] Update for the gdkinput.c patch Pulls the iw = _gdk_input_window_find (window); out of the if/else and uses #ifndef XINPUT_NONE as said in the comment.
(In reply to comment #3) > I'm by no means an expert in extended input devices, but the patches look ok to > me. I assume you have tested them... Yes, to detect finger presses on n800 we're enabling extension events from GtkIMContext somewhere after widgets are realized and things are working as expected.
Created attachment 81056 [details] [review] Update for the gtkwidget.c patch Patch cleaned up a bit. Applies cleanly against trunk again.
(In reply to comment #6) > Created an attachment (id=81056) [edit] > Update for the gtkwidget.c patch > > Patch cleaned up a bit. Applies cleanly against trunk again. your cleanup broke the patch, gtk_widget_set_extension_events_internal() needs to be called in gtk_widget_realize, regardles of (!GTK_WIDGET_NO_WINDOW (widget)). _set_extension_events_internal already does the checks to ensure it only alters windows belonging to the realized widget.
also see https://maemo.org/bugzilla/show_bug.cgi?id=1060 on the !NO_WINDOW condition.
Created attachment 84570 [details] [review] Fix the gtkwidget.c patch Fixes the GTK_WIDGET_NO_WINDOW case by always setting the extension events on the widget in realize().
Fixed in trunk: 2007-03-14 Michael Natterer <mitch@imendio.com> Make gtk_widget_set_extension_events() work on already realized widgets (bug #379550, Tommi Komulainen) * gdk/x11/gdkinput.c (gdk_input_set_extension_events): allow to be called multiple times without leaking and work correctly when already realized (don't rely on a configure event following). * gtk/gtkwidget.c (gtk_widget_set_extension_events_internal): new internal function which walks the GdkWindow tree and sets the extension events on all windows that belong to the widget. (gtk_widget_realize) (gtk_widget_set_extension_events): use the new function.
Still need to apply a similar fix to gdk/win32/gdkinput.c, too, I guess. Unfortunately the is much code duplication between gdk/x11/gdkinput.c and gdk/win32/gdkinput.c. The common code should be refactored out. Reopen bug?
As you like, I won't be able to process the bug further anyway...
I meant I won't be able to contribute any win32 code, so it's up to you to reopen it for that specific reason :-)