shell/tray-manager: Delay managing screen if necessary
Now that Xwayland startup is asynchronous, the function may be called before X11 is available, resulting in a crash. Fix this by only managing the tray immediately if we already have an X11 display, and wait for it to be set up otherwise. Likewise, unmanage the screen when X11 becomes unavailable. https://gitlab.gnome.org/GNOME/gnome-shell/issues/2308
This commit is contained in:
parent
e6d4581959
commit
4ff94f80a0
@ -218,6 +218,9 @@ shell_tray_manager_style_changed (StWidget *theme_widget,
|
|||||||
StThemeNode *theme_node;
|
StThemeNode *theme_node;
|
||||||
StIconColors *icon_colors;
|
StIconColors *icon_colors;
|
||||||
|
|
||||||
|
if (manager->priv->na_manager == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
theme_node = st_widget_get_theme_node (theme_widget);
|
theme_node = st_widget_get_theme_node (theme_widget);
|
||||||
icon_colors = st_theme_node_get_icon_colors (theme_node);
|
icon_colors = st_theme_node_get_icon_colors (theme_node);
|
||||||
na_tray_manager_set_colors (manager->priv->na_manager,
|
na_tray_manager_set_colors (manager->priv->na_manager,
|
||||||
@ -225,15 +228,30 @@ shell_tray_manager_style_changed (StWidget *theme_widget,
|
|||||||
&icon_colors->error, &icon_colors->success);
|
&icon_colors->error, &icon_colors->success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
shell_tray_manager_manage_screen_internal (ShellTrayManager *manager)
|
||||||
|
{
|
||||||
|
shell_tray_manager_ensure_resources (manager);
|
||||||
|
na_tray_manager_manage_screen (manager->priv->na_manager);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
||||||
StWidget *theme_widget)
|
StWidget *theme_widget)
|
||||||
{
|
{
|
||||||
|
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||||
|
|
||||||
g_set_weak_pointer (&manager->priv->theme_widget, theme_widget);
|
g_set_weak_pointer (&manager->priv->theme_widget, theme_widget);
|
||||||
|
|
||||||
shell_tray_manager_ensure_resources (manager);
|
if (meta_display_get_x11_display (display) != NULL)
|
||||||
|
shell_tray_manager_manage_screen_internal (manager);
|
||||||
|
|
||||||
na_tray_manager_manage_screen (manager->priv->na_manager);
|
g_signal_connect_object (display, "x11-display-setup",
|
||||||
|
G_CALLBACK (shell_tray_manager_manage_screen_internal),
|
||||||
|
manager, G_CONNECT_SWAPPED);
|
||||||
|
g_signal_connect_object (display, "x11-display-closing",
|
||||||
|
G_CALLBACK (shell_tray_manager_release_resources),
|
||||||
|
manager, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
g_signal_connect_object (theme_widget, "style-changed",
|
g_signal_connect_object (theme_widget, "style-changed",
|
||||||
G_CALLBACK (shell_tray_manager_style_changed),
|
G_CALLBACK (shell_tray_manager_style_changed),
|
||||||
@ -244,6 +262,10 @@ shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
|||||||
void
|
void
|
||||||
shell_tray_manager_unmanage_screen (ShellTrayManager *manager)
|
shell_tray_manager_unmanage_screen (ShellTrayManager *manager)
|
||||||
{
|
{
|
||||||
|
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_by_data (display, manager);
|
||||||
|
|
||||||
if (manager->priv->theme_widget != NULL)
|
if (manager->priv->theme_widget != NULL)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (manager->priv->theme_widget,
|
g_signal_handlers_disconnect_by_func (manager->priv->theme_widget,
|
||||||
|
Loading…
Reference in New Issue
Block a user