diff options
author | Olivier Duchateau <duchateau.olivier@gmail.com> | 2018-01-03 00:21:06 +0100 |
---|---|---|
committer | Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at> | 2018-01-03 00:21:38 +0100 |
commit | 96b8a42da2134089b616569d6878735fe81d9cca (patch) | |
tree | 59bf39c90d21ef7957939775c94bc4ab6d449aa0 /plugins | |
parent | 5c007a74b773057bf26b16a58973fca4406b2295 (diff) | |
download | xfce4-panel-96b8a42da2134089b616569d6878735fe81d9cca.tar.gz |
Use 'gdk_screen_is_composited' with Gtk3 (Bug #14128)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/systray/systray-manager.c | 5 | ||||
-rw-r--r-- | plugins/systray/systray.c | 28 |
2 files changed, 32 insertions, 1 deletions
diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c index e24b1924..46827d04 100644 --- a/plugins/systray/systray-manager.c +++ b/plugins/systray/systray-manager.c @@ -766,9 +766,14 @@ systray_manager_set_visual (SystrayManager *manager) visual_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_SYSTEM_TRAY_VISUAL"); +#if GTK_CHECK_VERSION (3, 22, 0) + if (gdk_screen_is_composited (gtk_widget_get_screen (manager->invisible)) + && (gdk_screen_get_rgba_visual (screen) != NULL)) +#else if (gtk_widget_is_composited (manager->invisible) && gdk_screen_get_rgba_visual (screen) != NULL && gdk_display_supports_composite (display)) +#endif { /* get the rgba visual */ xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_rgba_visual (screen)); diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c index 1264e5a7..9e34c739 100644 --- a/plugins/systray/systray.c +++ b/plugins/systray/systray.c @@ -249,7 +249,7 @@ systray_plugin_init (SystrayPlugin *plugin) plugin->box = systray_box_new (); gtk_box_pack_start (GTK_BOX (plugin->hvbox), plugin->box, TRUE, TRUE, 0); g_signal_connect (G_OBJECT (plugin->box), "draw", - G_CALLBACK (systray_plugin_box_draw), NULL); + G_CALLBACK (systray_plugin_box_draw), plugin); gtk_container_set_border_width (GTK_CONTAINER (plugin->box), FRAME_SPACING); gtk_widget_show (plugin->box); @@ -721,7 +721,32 @@ systray_plugin_box_draw_icon (GtkWidget *child, } +#if GTK_CHECK_VERSION (3, 22, 0) +static void +systray_plugin_box_draw (GtkWidget *box, + cairo_t *cr, + gpointer user_data) +{ + SystrayPlugin *plugin = XFCE_SYSTRAY_PLUGIN (user_data); + GdkScreen *screen; + + panel_return_if_fail (XFCE_IS_SYSTRAY_PLUGIN (plugin)); + panel_return_if_fail (cr != NULL); + + screen = gtk_widget_get_screen (GTK_WIDGET (plugin)); + if (G_LIKELY (screen != NULL)) + { + if (!gdk_screen_is_composited (screen)) + return; + } + + /* separately draw all the composed tray icons after gtk + * handled the draw event */ + gtk_container_foreach (GTK_CONTAINER (box), + (GtkCallback) systray_plugin_box_draw_icon, cr); +} +#else static void systray_plugin_box_draw (GtkWidget *box, cairo_t *cr, @@ -737,6 +762,7 @@ systray_plugin_box_draw (GtkWidget *box, gtk_container_foreach (GTK_CONTAINER (box), (GtkCallback) systray_plugin_box_draw_icon, cr); } +#endif |