[Xfce4-commits] [xfce/xfce4-panel] 01/01: Use 'gdk_screen_is_composited' with Gtk3 (Bug #14128)
noreply at xfce.org
noreply at xfce.org
Wed Jan 3 00:21:59 CET 2018
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-panel.
commit 96b8a42da2134089b616569d6878735fe81d9cca
Author: Olivier Duchateau <duchateau.olivier at gmail.com>
Date: Wed Jan 3 00:21:06 2018 +0100
Use 'gdk_screen_is_composited' with Gtk3 (Bug #14128)
---
panel/panel-base-window.c | 11 +++++++++++
plugins/systray/systray-manager.c | 5 +++++
plugins/systray/systray.c | 28 +++++++++++++++++++++++++++-
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index 79e159f..c62cbf7 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -448,7 +448,11 @@ panel_base_window_screen_changed (GtkWidget *widget, GdkScreen *previous_screen)
if (visual != NULL)
{
gtk_widget_set_visual (widget, visual);
+#if GTK_CHECK_VERSION (3, 22, 0)
+ window->is_composited = gdk_screen_is_composited (screen);
+#else
window->is_composited = gtk_widget_is_composited (widget);
+#endif
}
panel_debug (PANEL_DEBUG_BASE_WINDOW,
@@ -511,7 +515,14 @@ panel_base_window_composited_changed (GtkWidget *widget)
GtkAllocation allocation;
/* set new compositing state */
+#if GTK_CHECK_VERSION (3, 22, 0)
+ GdkScreen *screen;
+
+ screen = gtk_window_get_screen (GTK_WINDOW (window));
+ window->is_composited = gdk_screen_is_composited (screen);
+#else
window->is_composited = gtk_widget_is_composited (widget);
+#endif
if (window->is_composited == was_composited)
return;
diff --git a/plugins/systray/systray-manager.c b/plugins/systray/systray-manager.c
index e24b192..46827d0 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 1264e5a..9e34c73 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
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list