mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
fix race between fetching owner of composit selection, and
registering as a listener for changes; bug#594913
This commit is contained in:
parent
7ab7ffa542
commit
db88f084bc
@ -402,8 +402,7 @@ gdk_display_open (const gchar *display_name)
|
||||
_gdk_dnd_init (display);
|
||||
|
||||
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
|
||||
gdk_display_request_selection_notification (display,
|
||||
GDK_SCREEN_X11 (display_x11->screens[i])->cm_selection_atom);
|
||||
_gdk_x11_screen_setup (display_x11->screens[i]);
|
||||
|
||||
g_signal_emit_by_name (gdk_display_manager_get(),
|
||||
"display_opened", display);
|
||||
|
@ -989,8 +989,6 @@ _gdk_x11_screen_new (GdkDisplay *display,
|
||||
screen_x11->wmspec_check_window = None;
|
||||
/* we want this to be always non-null */
|
||||
screen_x11->window_manager_name = g_strdup ("unknown");
|
||||
screen_x11->cm_selection_atom = make_cm_atom (screen_number);
|
||||
screen_x11->is_composited = check_is_composited (display, screen_x11);
|
||||
|
||||
init_multihead (screen);
|
||||
init_randr_support (screen);
|
||||
@ -1001,6 +999,22 @@ _gdk_x11_screen_new (GdkDisplay *display,
|
||||
return screen;
|
||||
}
|
||||
|
||||
/*
|
||||
* It is important that we first request the selection
|
||||
* notification, and then setup the initial state of
|
||||
* is_composited to avoid a race condition here.
|
||||
*/
|
||||
void
|
||||
_gdk_x11_screen_setup (GdkScreen *screen)
|
||||
{
|
||||
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
|
||||
|
||||
screen_x11->cm_selection_atom = make_cm_atom (screen_x11->screen_num);
|
||||
gdk_display_request_selection_notification (screen_x11->display,
|
||||
screen_x11->cm_selection_atom);
|
||||
screen_x11->is_composited = check_is_composited (screen_x11->display, screen_x11);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_is_composited:
|
||||
* @screen: a #GdkScreen
|
||||
|
@ -122,6 +122,7 @@ GType _gdk_screen_x11_get_type (void);
|
||||
GdkScreen * _gdk_x11_screen_new (GdkDisplay *display,
|
||||
gint screen_number);
|
||||
|
||||
void _gdk_x11_screen_setup (GdkScreen *screen);
|
||||
void _gdk_x11_screen_window_manager_changed (GdkScreen *screen);
|
||||
void _gdk_x11_screen_size_changed (GdkScreen *screen,
|
||||
XEvent *event);
|
||||
|
Loading…
Reference in New Issue
Block a user