Re: Patch to permit always transparent

Ale <[email protected]> Wed, 10 Nov 2004 10:43:15 +0100
Newsgroups gmane.comp.xfce.devel
Message-ID <[email protected]>
------=_Part_400_5748075.1100079795761
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Wed, 10 Nov 2004 08:16:05 +0100, Jasper Huijsmans <[email protected]> wrote:
> Jasper Huijsmans wrote:
> > Seems you forgot the patch ;-)

Doh! :P

> Also, if the patch is against one of the beta releases, it is probably
> outdated for CVS. 

Patch isn't against beta but from cvs checkout 09/11

> You could argue that the hidden panel should be transparent. I have no
> strong opinion about that, actually.

It's only a small patch over  a personal preference... I like
transparency but when panel is set as autohidden it takes too much
space over my screen, so i prefer that it could be transparent even if
authohide is set.

I've added a checkbox on panel settings dialog "Always transparent",
that if enabled:
1) when autohide is disabled it remains transp even on mouse over...
2) if autohide is enabled it remains always transp..

> 
>         Jasper

Thx Ale

------=_Part_400_5748075.1100079795761
Content-Type: text/x-patch; name="settings_always_transp.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="settings_always_transp.patch"

Index: xfce4/xfce4-panel/panel/global.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/xfce/xfce4/xfce4-panel/panel/global.h,v
retrieving revision 1.44
diff -u -r1.44 global.h
--- xfce4/xfce4-panel/panel/global.h=0913 Sep 2004 20:31:39 -0000=091.44
+++ xfce4/xfce4-panel/panel/global.h=099 Nov 2004 21:57:45 -0000
@@ -100,6 +100,7 @@
     int popup_position;
=20
     int autohide;
+    int always_transp;
=20
     char *theme;
=20
Index: xfce4/xfce4-panel/panel/mcs_client.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/xfce/xfce4/xfce4-panel/panel/mcs_client.c,v
retrieving revision 1.22
diff -u -r1.22 mcs_client.c
--- xfce4/xfce4-panel/panel/mcs_client.c=0913 Sep 2004 20:31:39 -0000=091.2=
2
+++ xfce4/xfce4-panel/panel/mcs_client.c=099 Nov 2004 21:57:46 -0000
@@ -58,6 +58,7 @@
     panel_set_popup_position,
     panel_set_theme,
     panel_set_autohide,
+    panel_set_always_transp,
 };
=20
 static void
Index: xfce4/xfce4-panel/panel/panel.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/xfce/xfce4/xfce4-panel/panel/panel.c,v
retrieving revision 1.128
diff -u -r1.128 panel.c
--- xfce4/xfce4-panel/panel/panel.c=098 Nov 2004 21:53:08 -0000=091.128
+++ xfce4/xfce4-panel/panel/panel.c=099 Nov 2004 21:57:47 -0000
@@ -910,7 +910,7 @@
 {
     if (!(settings.autohide))
     {
-        if (event->detail !=3D GDK_NOTIFY_INFERIOR)
+        if (!(settings.always_transp) && event->detail !=3D GDK_NOTIFY_INF=
ERIOR)
             set_opacity (p, FALSE);
        =20
 =09return FALSE;
@@ -1198,10 +1198,12 @@
     restrict_position (p, &(p->position.x), &(p->position.y));
     gtk_window_move (GTK_WINDOW (p->toplevel), p->position.x, p->position.=
y);
=20
-    if (p->priv->settings.autohide)
+    if (p->priv->settings.autohide){
 =09panel_set_autohide (TRUE);
-    else
-        set_opacity (p, TRUE);
+=09if ( p->priv->settings.always_transp)=20
+=09  set_opacity (p, TRUE);
+    }else
+      set_opacity (p, TRUE);
=20
     update_partial_struts (p);
=20
@@ -1299,9 +1301,11 @@
=20
     panel_set_layer (panel.priv->settings.layer);
=20
-    if (hidden)
+    if (hidden) {
 =09panel_set_autohide (TRUE);
-    else
+=09if (settings.always_transp)=20
+          set_opacity (&panel, TRUE);
+    }else
         set_opacity (&panel, TRUE);
=20
     update_partial_struts (&panel);
@@ -1464,7 +1468,8 @@
                 g_timeout_add (1000, (GSourceFunc) panel_hide_timeout, &pa=
nel);
         }
=20
-        set_opacity (&panel, FALSE);
+=09if ( !(settings.always_transp) )
+=09  set_opacity (&panel, FALSE);
     }
     else
     {
@@ -1475,6 +1480,21 @@
     update_partial_struts (&panel);
 }
=20
+G_MODULE_EXPORT /* EXPORT:panel_set_always_transp */
+void
+panel_set_always_transp (gboolean transparent)
+{
+  panel.priv->settings.always_transp =3D transparent;
+ =20
+  /* backwards compat */
+  settings =3D panel.priv->settings;
+  if (transparent || !(panel.priv->settings.autohide))
+    set_opacity (&panel, TRUE);
+  else
+    set_opacity (&panel, FALSE);
+}
+
+
 /*  Global preferences
  *  ------------------
 */
@@ -1488,6 +1508,7 @@
     p->priv->settings.popup_position =3D RIGHT;
=20
     p->priv->settings.autohide =3D FALSE;
+    p->priv->settings.always_transp =3D FALSE;
=20
     p->priv->settings.theme =3D NULL;
=20
Index: xfce4/xfce4-panel/panel/panel.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/xfce/xfce4/xfce4-panel/panel/panel.h,v
retrieving revision 1.16
diff -u -r1.16 panel.h
--- xfce4/xfce4-panel/panel/panel.h=0913 Sep 2004 20:31:39 -0000=091.16
+++ xfce4/xfce4-panel/panel/panel.h=099 Nov 2004 21:57:47 -0000
@@ -75,6 +75,7 @@
 G_MODULE_IMPORT void panel_set_theme (const char *theme);
=20
 G_MODULE_IMPORT void panel_set_autohide (gboolean hide);
+G_MODULE_IMPORT void panel_set_always_transp (gboolean transparent);
=20
 /* panel data */
 G_MODULE_IMPORT void panel_parse_xml (xmlNodePtr node);
Index: xfce4/xfce4-panel/settings/xfce_settings.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/xfce/xfce4/xfce4-panel/settings/xfce_settings.h,v
retrieving revision 1.8
diff -u -r1.8 xfce_settings.h
--- xfce4/xfce4-panel/settings/xfce_settings.h=0930 Aug 2004 12:55:43 -0000=
=091.8
+++ xfce4/xfce4-panel/settings/xfce_settings.h=099 Nov 2004 21:57:47 -0000
@@ -31,6 +31,7 @@
     XFCE_POPUPPOSITION,
     XFCE_THEME,
     XFCE_AUTOHIDE,
+    XFCE_ALWAYS_TRANSP,
     XFCE_OPTIONS
 };
=20
@@ -41,6 +42,7 @@
     "popupposition",
     "theme",
     "autohide",
+    "always_transp",
 };
=20
 #endif /* __XFCE_SETTINGS_H */
Index: xfce4/xfce4-panel/settings/xfce_settings_dialog.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/xfce/xfce4/xfce4-panel/settings/xfce_settings_dialog.c,v
retrieving revision 1.45
diff -u -r1.45 xfce_settings_dialog.c
--- xfce4/xfce4-panel/settings/xfce_settings_dialog.c=0931 Oct 2004 13:58:3=
2 -0000=091.45
+++ xfce4/xfce4-panel/settings/xfce_settings_dialog.c=099 Nov 2004 21:57:48=
 -0000
@@ -418,6 +418,55 @@
     g_signal_connect (check, "toggled", G_CALLBACK (autohide_changed), NUL=
L);
 }
=20
+/* always transparent */
+
+static void
+always_transp_changed (GtkToggleButton * tb)
+{
+  int always_transp;
+ =20
+  always_transp =3D gtk_toggle_button_get_active (tb) ? 1 : 0;
+
+  mcs_manager_set_int (mcs_manager, xfce_settings_names[XFCE_ALWAYS_TRANSP=
],
+=09=09       CHANNEL, always_transp);
+  mcs_manager_notify (mcs_manager, CHANNEL);
+}
+
+static void
+add_always_transp_box (GtkBox * box, GtkSizeGroup * sg)
+{
+  GtkWidget *hbox, *label, *check;
+  McsSetting *setting;
+ =20
+  hbox =3D gtk_hbox_new (FALSE, BORDER);
+  gtk_widget_show (hbox);
+  gtk_box_pack_start (box, hbox, FALSE, TRUE, 0);
+ =20
+  label =3D gtk_label_new (_("Always transparent:"));
+  gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+  gtk_widget_show (label);
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+  gtk_size_group_add_widget (sg, label);
+
+  check =3D gtk_check_button_new ();
+  gtk_widget_show (check);
+  gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
+ =20
+  setting =3D mcs_manager_setting_lookup (mcs_manager,
+=09=09=09=09=09xfce_settings_names[XFCE_ALWAYS_TRANSP],
+=09=09=09=09=09CHANNEL);
+
+  if (setting)
+  {
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
+=09=09=09=09    setting->data.v_int =3D=3D 1);
+  }
+ =20
+  g_signal_connect (check, "toggled", G_CALLBACK (always_transp_changed), =
NULL);
+}
+
+
+
 /* the dialog */
=20
 static void
@@ -503,6 +552,7 @@
 #endif
=20
     add_autohide_box (GTK_BOX (vbox), sg);
+    add_always_transp_box (GTK_BOX (vbox), sg);
=20
     g_object_unref (sg);
=20

------=_Part_400_5748075.1100079795761
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Xfce-dev mailing list
[email protected]
http://lunar-linux.org/mailman/listinfo/xfce-dev
------=_Part_400_5748075.1100079795761--