After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 379550 - gtk_widget_set_extension_events has no effect on realized widgets
gtk_widget_set_extension_events has no effect on realized widgets
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-26 19:09 UTC by Tommi Komulainen
Modified: 2007-03-14 15:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.91 KB, patch)
2006-11-27 15:37 UTC, Tommi Komulainen
none Details | Review
Update the extension events on realized widgets (2.28 KB, patch)
2006-11-28 20:45 UTC, Tommi Komulainen
none Details | Review
Update for the gdkinput.c patch (1.79 KB, patch)
2007-01-24 09:19 UTC, Michael Natterer
committed Details | Review
Update for the gtkwidget.c patch (2.78 KB, patch)
2007-01-24 11:26 UTC, Michael Natterer
none Details | Review
Fix the gtkwidget.c patch (3.05 KB, patch)
2007-03-14 13:36 UTC, Michael Natterer
committed Details | Review

Description Tommi Komulainen 2006-11-26 19:09:18 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.
Comment 1 Tommi Komulainen 2006-11-27 15:37:48 UTC
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
Comment 2 Tommi Komulainen 2006-11-28 20:45:55 UTC
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.
Comment 3 Matthias Clasen 2007-01-24 05:00:37 UTC
I'm by no means an expert in extended input devices, but the patches look ok to me. I assume you have tested them...
Comment 4 Michael Natterer 2007-01-24 09:19:22 UTC
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.
Comment 5 Tommi Komulainen 2007-01-24 09:28:50 UTC
(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.
Comment 6 Michael Natterer 2007-01-24 11:26:55 UTC
Created attachment 81056 [details] [review]
Update for the gtkwidget.c patch

Patch cleaned up a bit. Applies cleanly against trunk again.
Comment 7 Tim Janik 2007-02-16 12:06:15 UTC
(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.
Comment 8 Tim Janik 2007-02-16 12:07:39 UTC
also see https://maemo.org/bugzilla/show_bug.cgi?id=1060 on the !NO_WINDOW condition.
Comment 9 Michael Natterer 2007-03-14 13:36:10 UTC
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().
Comment 10 Michael Natterer 2007-03-14 13:58:48 UTC
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.
Comment 11 Tor Lillqvist 2007-03-14 15:17:03 UTC
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?
Comment 12 Michael Natterer 2007-03-14 15:18:20 UTC
As you like, I won't be able to process the bug further anyway...
Comment 13 Michael Natterer 2007-03-14 15:41:24 UTC
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 :-)