[Xfce4-commits] <xfce4-panel:master> Properly update the plugin background when moving to other panel.

Nick Schermer noreply at xfce.org
Sat Jan 29 20:56:01 CET 2011


Updating branch refs/heads/master
         to 32bc2ef58f0f78d6da4fc498825008f4eba6d9f2 (commit)
       from 16ca0888abb9e92ed8a38d1e53128da01c712c4f (commit)

commit 32bc2ef58f0f78d6da4fc498825008f4eba6d9f2
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Jan 29 20:40:43 2011 +0100

    Properly update the plugin background when moving to other panel.
    
    The background alpha was not send when the other panel was opaque,
    leaving a transparent item in opaque panel.
    The background was also not unset, so for example the image or
    color was not unset.

 panel/panel-application.c     |    4 ++--
 panel/panel-plugin-external.c |    2 +-
 panel/panel-window.c          |   40 +++++++++++++++++++++++-----------------
 panel/panel-window.h          |    3 ++-
 4 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/panel/panel-application.c b/panel/panel-application.c
index 092417b..a107f5a 100644
--- a/panel/panel-application.c
+++ b/panel/panel-application.c
@@ -669,7 +669,7 @@ panel_application_plugin_insert (PanelApplication  *application,
                         GTK_WIDGET (provider), position);
 
   /* send all the needed info about the panel to the plugin */
-  panel_window_set_povider_info (window, provider);
+  panel_window_set_povider_info (window, provider, FALSE);
 
   /* show the plugin */
   gtk_widget_show (provider);
@@ -907,7 +907,7 @@ panel_application_drag_data_received (PanelWindow      *window,
               panel_itembar_reorder_child (PANEL_ITEMBAR (itembar), provider, application->drop_index);
 
               /* send all the needed panel information to the plugin */
-              panel_window_set_povider_info (window, provider);
+              panel_window_set_povider_info (window, provider, TRUE);
             }
 
           /* everything went fine */
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index f4d434a..484b531 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -632,7 +632,7 @@ panel_plugin_external_child_respawn (gpointer user_data)
 
   window = gtk_widget_get_toplevel (GTK_WIDGET (external));
   panel_return_val_if_fail (PANEL_IS_WINDOW (window), FALSE);
-  panel_window_set_povider_info (PANEL_WINDOW (window), GTK_WIDGET (external));
+  panel_window_set_povider_info (PANEL_WINDOW (window), GTK_WIDGET (external), FALSE);
 
   panel_plugin_external_child_spawn (external);
 
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 1d5424d..dbdef1e 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -2475,7 +2475,8 @@ panel_window_new (GdkScreen *screen)
 
 void
 panel_window_set_povider_info (PanelWindow *window,
-                               GtkWidget   *provider)
+                               GtkWidget   *provider,
+                               gboolean     moving_to_other_panel)
 {
   PanelBaseWindow *base_window = PANEL_BASE_WINDOW (window);
 
@@ -2485,24 +2486,29 @@ panel_window_set_povider_info (PanelWindow *window,
   xfce_panel_plugin_provider_set_locked (XFCE_PANEL_PLUGIN_PROVIDER (provider),
                                          panel_window_get_locked (window));
 
-  if (base_window->background_alpha < 1.0)
+  if (PANEL_IS_PLUGIN_EXTERNAL (provider))
     {
-      if (PANEL_IS_PLUGIN_EXTERNAL (provider))
-        panel_plugin_external_set_background_alpha (PANEL_PLUGIN_EXTERNAL (provider),
-            base_window->background_alpha);
-    }
+      if (moving_to_other_panel || base_window->background_alpha < 1.0)
+        {
+          panel_plugin_external_set_background_alpha (PANEL_PLUGIN_EXTERNAL (provider),
+              base_window->background_alpha);
+        }
 
-  if (base_window->background_style == PANEL_BG_STYLE_COLOR)
-    {
-      if (PANEL_IS_PLUGIN_EXTERNAL (provider))
-        panel_plugin_external_set_background_color (PANEL_PLUGIN_EXTERNAL (provider),
-            base_window->background_color);
-    }
-  else if (base_window->background_style == PANEL_BG_STYLE_IMAGE)
-    {
-      if (PANEL_IS_PLUGIN_EXTERNAL (provider))
-        panel_plugin_external_set_background_image (PANEL_PLUGIN_EXTERNAL (provider),
-            base_window->background_image);
+      if (base_window->background_style == PANEL_BG_STYLE_COLOR)
+        {
+          panel_plugin_external_set_background_color (PANEL_PLUGIN_EXTERNAL (provider),
+              base_window->background_color);
+        }
+      else if (base_window->background_style == PANEL_BG_STYLE_IMAGE)
+        {
+          panel_plugin_external_set_background_image (PANEL_PLUGIN_EXTERNAL (provider),
+              base_window->background_image);
+        }
+      else if (moving_to_other_panel)
+        {
+          /* unset the background (PROVIDER_PROP_TYPE_ACTION_BACKGROUND_UNSET) */
+          panel_plugin_external_set_background_color (PANEL_PLUGIN_EXTERNAL (provider), NULL);
+        }
     }
 
   panel_window_set_plugin_orientation (provider, window);
diff --git a/panel/panel-window.h b/panel/panel-window.h
index 103ad7d..99bc252 100644
--- a/panel/panel-window.h
+++ b/panel/panel-window.h
@@ -38,7 +38,8 @@ GType      panel_window_get_type         (void) G_GNUC_CONST;
 GtkWidget *panel_window_new              (GdkScreen   *screen) G_GNUC_MALLOC;
 
 void       panel_window_set_povider_info (PanelWindow *window,
-                                          GtkWidget   *provider);
+                                          GtkWidget   *provider,
+                                          gboolean     moving_to_other_panel);
 
 void       panel_window_freeze_autohide  (PanelWindow *window);
 



More information about the Xfce4-commits mailing list