gtk/gdk/x11
Uli Schlachter 9ca38c4647 Fix race in GtkPlug window creation
According to the XEmbed specification, a window should be created
"elsewhere" and then reparented into the target parent window. Instead,
GTK+ creates the window directly in desired target parent window. This
allows some races to occur.

Another program that does not follow XEmbed is tabbed. XEmbed requires
an _XEMBED_INFO property on the to-be-embedded window, but tabbed does
not check for this property. Thus, as soon as GTK+ creates its window,
tabbed starts managing this window and now GTK+ setting up the window
races with tabbed starting to manage the window.

If tabbed is fast enough to map the window, GTK+ never sees a MapNotify
event, because it did not yet select StructureNotifyMask on its window.
This results in a black window inside of tabbed.

Note that this cannot really be fixed in tabbed, since XEmbed says that
the _XEMBED_INFO property must be already present when the window
appears. Thus, patching tabbed to wait for _XEMBED_INFO to appear is not
something that the spec requires/allows.

Instead, this commit changes GTK+ so that it directly sets the right
event mask when the window is created. This means that there is no more
race between tabbed mapping the window and GTK+ selecting
StructureNotifyMask.

Note that the proper fix would be to do as XEmbed requires: Create the
window elsewhere and then reparent it into the target window. However,
that would require a more invasive patch, so this commit only takes the
"easy approach" of fixing this one race. Hopefully, all the other races
that can occur during window setup are harmless, because the
embedder/socket will hopefully watch for PropertyNotify events as
needed.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/757
See-also: https://github.com/awesomeWM/awesome/issues/2385
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-14 14:01:25 +02:00
..
gdkapplaunchcontext-x11.c Deprecate more to-be-removed screen apis 2016-10-20 13:44:23 -04:00
gdkasync.c x11: Fix compiler warnings 2015-06-02 09:08:14 -04:00
gdkasync.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkcursor-x11.c Deprecate to-be-removed screen API 2016-10-20 12:06:42 -04:00
gdkdevice-core-x11.c Add and use GDK_CHECK_DEBUG macro 2016-02-28 21:40:30 -05:00
gdkdevice-xi2.c Add and use GDK_CHECK_DEBUG macro 2016-02-28 21:40:30 -05:00
gdkdevicemanager-core-x11.c gdk: activate surface on keyboard grabs 2018-06-18 10:32:02 +02:00
gdkdevicemanager-x11.c x11: Don't use g_print for debug output 2016-02-28 21:40:24 -05:00
gdkdevicemanager-xi2.c x11: Add necessary NULL check 2018-06-20 20:02:01 +02:00
gdkdevicemanagerprivate-core.h x11: Avoid spurious focus events on grabs 2012-03-07 15:35:21 +01:00
gdkdisplay-x11.c x11: Don't set NET_WM_PID when sandboxed 2018-05-29 20:31:32 -04:00
gdkdisplay-x11.h x11: Port to new monitor api 2016-04-27 23:18:16 -04:00
gdkdisplaymanager-x11.c displaymanager: Remove GInitable implementation 2013-05-02 16:17:30 +02:00
gdkdnd-x11.c x11: Balance an error trap 2018-02-11 23:28:50 +00:00
gdkeventsource.c gdk: activate surface on keyboard grabs 2018-06-18 10:32:02 +02:00
gdkeventsource.h Fix some oversights with header guards 2014-12-08 19:31:56 -05:00
gdkeventtranslator.c Change FSF Address 2012-02-27 17:06:11 +00:00
gdkeventtranslator.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkgeometry-x11.c x11: Fix compiler warnings 2015-06-02 09:08:14 -04:00
gdkglcontext-x11.c x11: Query whether we have GLX support 2018-04-23 09:13:41 +01:00
gdkglcontext-x11.h Remove GdkGLProfile 2015-02-12 17:51:31 +00:00
gdkkeys-x11.c x11: Fix compiler warnings 2015-06-02 09:08:14 -04:00
gdkmain-x11.c x11: Don't warn if the display is closed 2016-11-30 13:46:29 -05:00
gdkmonitor-x11.c x11: Port to new monitor api 2016-04-27 23:18:16 -04:00
gdkmonitor-x11.h x11: Port to new monitor api 2016-04-27 23:18:16 -04:00
gdkprivate-x11.h Remove a dead macro 2018-01-07 16:38:42 +00:00
gdkproperty-x11.c Remove unused variables 2015-06-13 21:10:26 -04:00
gdkscreen-x11.c x11: Avoid a division by zero 2018-03-08 16:00:40 +01:00
gdkscreen-x11.h Deprecate more to-be-removed screen apis 2016-10-20 13:44:23 -04:00
gdkselection-x11.c x11: Use g_error_matches() 2016-03-20 05:43:02 +01:00
gdksettings.c gdk: Add an X setting for gtk-keynav-use-caret 2016-03-04 22:44:29 -05:00
gdktestutils-x11.c Change FSF Address 2012-02-27 17:06:11 +00:00
gdkvisual-x11.c Add and use GDK_CHECK_DEBUG macro 2016-02-28 21:40:30 -05:00
gdkwindow-x11.c Fix race in GtkPlug window creation 2018-10-14 14:01:25 +02:00
gdkwindow-x11.h x11: Add support for _GTK_EDGE_CONSTRAINTS atom 2017-10-03 20:06:46 -03:00
gdkx11applaunchcontext.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11cursor.h docs: don't use <type> tags 2014-01-28 00:21:26 -05:00
gdkx11device-core.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11device-xi2.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11device.h Move single-include guards inside include guards 2012-12-28 09:57:56 -05:00
gdkx11devicemanager-core.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11devicemanager-xi2.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11devicemanager-xi.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11devicemanager.h Move single-include guards inside include guards 2012-12-28 09:57:56 -05:00
gdkx11display.h x11: Add gdk_x11_display_set_window_scale 2013-08-20 11:15:08 +02:00
gdkx11displaymanager.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11dnd.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11glcontext.h GL: Follow naming conventions 2014-10-21 23:48:12 -04:00
gdkx11keys.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11monitor.h x11: Port to new monitor api 2016-04-27 23:18:16 -04:00
gdkx11property.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkx11screen.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkx11selection.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11utils.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkx11visual.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkx11window.h docs: don't use <type> tags 2014-01-28 00:21:26 -05:00
gdkx-autocleanups.h gdk: Add support for g_autoptr() 2015-02-02 09:28:22 +01:00
gdkx.h x11: Port to new monitor api 2016-04-27 23:18:16 -04:00
gdkxftdefaults.c Simplify Xft setting fallback 2015-07-07 20:54:16 -04:00
gdkxid.c docs: use Returns: consistently 2014-02-19 18:56:05 -05:00
Makefile.am Opt in to structured logging 2016-07-22 23:13:20 -04:00
MwmUtil.h Change FSF Address 2012-02-27 17:06:11 +00:00
xsettings-client.c x11: Don't use g_print for debug output 2016-02-28 21:40:24 -05:00
xsettings-client.h Fix font size when gdk_x11_display_set_window_scale() is used 2014-03-06 23:20:00 -05:00