Allow notification icons which use a hacked eggtrayicon.c to have a

transparent background.

Obtained from:	Debian package via Bernat Tallaferro
This commit is contained in:
Jean-Yves Lefort 2006-05-15 00:00:07 +00:00
parent 5e65f138bf
commit a138bb232d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=162383
6 changed files with 244 additions and 2 deletions

View File

@ -22,7 +22,7 @@ PREFIX?= ${X11BASE}
.if !defined(REFERENCE_PORT)
PORTREVISION= 1
PORTREVISION= 2
RUN_DEPENDS= gnome-menu-editor:${PORTSDIR}/deskutils/gnome-menu-editor

View File

@ -0,0 +1,48 @@
--- applets/notification_area/eggtraymanager.c.orig Sat Dec 31 14:39:09 2005
+++ applets/notification_area/eggtraymanager.c Mon May 15 01:36:18 2006
@@ -291,6 +291,36 @@
return FALSE;
}
+static gboolean
+transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
+{
+ gdk_window_clear_area (widget->window, event->area.x, event->area.y,
+ event->area.width, event->area.height);
+ return FALSE;
+}
+
+static void
+make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
+ gpointer user_data)
+{
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+}
+
+static void
+make_transparent (GtkWidget *widget, gpointer user_data)
+{
+ if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
+ return;
+
+ gtk_widget_set_app_paintable (widget, TRUE);
+ gtk_widget_set_double_buffered (widget, FALSE);
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+ g_signal_connect (widget, "expose_event",
+ G_CALLBACK (transparent_expose_event), NULL);
+ g_signal_connect_after (widget, "style_set",
+ G_CALLBACK (make_transparent_again), NULL);
+}
+
static void
egg_tray_manager_handle_dock_request (EggTrayManager *manager,
XClientMessageEvent *xevent)
@@ -306,6 +336,8 @@
}
socket = gtk_socket_new ();
+ g_signal_connect (socket, "realize",
+ G_CALLBACK (make_transparent), NULL);
/* We need to set the child window here
* so that the client can call _get functions

View File

@ -0,0 +1,73 @@
--- applets/notification_area/main.c.orig Wed Dec 28 22:15:27 2005
+++ applets/notification_area/main.c Mon May 15 01:36:01 2006
@@ -159,14 +159,24 @@
tray = all_trays->data;
gtk_box_pack_end (GTK_BOX (tray->box), icon, FALSE, FALSE, 0);
-
+
+ gtk_widget_hide (tray->box);
gtk_widget_show (icon);
+ gtk_widget_show (tray->box);
}
static void
tray_removed (EggTrayManager *manager, GtkWidget *icon, void *data)
{
+ SystemTray *tray;
+
+ if (all_trays == NULL)
+ return;
+
+ tray = all_trays->data;
+ gtk_widget_hide (tray->box);
+ gtk_widget_show (tray->box);
}
static void
@@ -207,9 +217,32 @@
gtk_widget_set_size_request (tray->box, -1, MIN_BOX_SIZE);
break;
}
+
+ /* Force the icons to redraw their backgrounds.
+ * gtk_widget_queue_draw() doesn't work across process boundaries,
+ * so we do this instead.
+ */
+ gtk_widget_hide (tray->box);
+ gtk_widget_show (tray->box);
}
static void
+applet_change_background (PanelApplet *applet,
+ PanelAppletBackgroundType type,
+ GdkColor *color,
+ GdkPixmap *pixmap,
+ SystemTray *tray)
+{
+ /* Force the icons to redraw their backgrounds.
+ * gtk_widget_queue_draw() doesn't work across process boundaries,
+ * so we do this instead.
+ */
+ gtk_widget_hide (tray->box);
+ gtk_widget_show (tray->box);
+}
+
+
+static void
applet_change_orientation (PanelApplet *applet,
PanelAppletOrient orient,
SystemTray *tray)
@@ -332,6 +365,11 @@
g_signal_connect (G_OBJECT (tray->applet),
"change_orient",
G_CALLBACK (applet_change_orientation),
+ tray);
+
+ g_signal_connect (G_OBJECT (tray->applet),
+ "change_background",
+ G_CALLBACK (applet_change_background),
tray);
g_signal_connect (tray->applet,

View File

@ -22,7 +22,7 @@ PREFIX?= ${X11BASE}
.if !defined(REFERENCE_PORT)
PORTREVISION= 1
PORTREVISION= 2
RUN_DEPENDS= gnome-menu-editor:${PORTSDIR}/deskutils/gnome-menu-editor

View File

@ -0,0 +1,48 @@
--- applets/notification_area/eggtraymanager.c.orig Sat Dec 31 14:39:09 2005
+++ applets/notification_area/eggtraymanager.c Mon May 15 01:36:18 2006
@@ -291,6 +291,36 @@
return FALSE;
}
+static gboolean
+transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
+{
+ gdk_window_clear_area (widget->window, event->area.x, event->area.y,
+ event->area.width, event->area.height);
+ return FALSE;
+}
+
+static void
+make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
+ gpointer user_data)
+{
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+}
+
+static void
+make_transparent (GtkWidget *widget, gpointer user_data)
+{
+ if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
+ return;
+
+ gtk_widget_set_app_paintable (widget, TRUE);
+ gtk_widget_set_double_buffered (widget, FALSE);
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+ g_signal_connect (widget, "expose_event",
+ G_CALLBACK (transparent_expose_event), NULL);
+ g_signal_connect_after (widget, "style_set",
+ G_CALLBACK (make_transparent_again), NULL);
+}
+
static void
egg_tray_manager_handle_dock_request (EggTrayManager *manager,
XClientMessageEvent *xevent)
@@ -306,6 +336,8 @@
}
socket = gtk_socket_new ();
+ g_signal_connect (socket, "realize",
+ G_CALLBACK (make_transparent), NULL);
/* We need to set the child window here
* so that the client can call _get functions

View File

@ -0,0 +1,73 @@
--- applets/notification_area/main.c.orig Wed Dec 28 22:15:27 2005
+++ applets/notification_area/main.c Mon May 15 01:36:01 2006
@@ -159,14 +159,24 @@
tray = all_trays->data;
gtk_box_pack_end (GTK_BOX (tray->box), icon, FALSE, FALSE, 0);
-
+
+ gtk_widget_hide (tray->box);
gtk_widget_show (icon);
+ gtk_widget_show (tray->box);
}
static void
tray_removed (EggTrayManager *manager, GtkWidget *icon, void *data)
{
+ SystemTray *tray;
+
+ if (all_trays == NULL)
+ return;
+
+ tray = all_trays->data;
+ gtk_widget_hide (tray->box);
+ gtk_widget_show (tray->box);
}
static void
@@ -207,9 +217,32 @@
gtk_widget_set_size_request (tray->box, -1, MIN_BOX_SIZE);
break;
}
+
+ /* Force the icons to redraw their backgrounds.
+ * gtk_widget_queue_draw() doesn't work across process boundaries,
+ * so we do this instead.
+ */
+ gtk_widget_hide (tray->box);
+ gtk_widget_show (tray->box);
}
static void
+applet_change_background (PanelApplet *applet,
+ PanelAppletBackgroundType type,
+ GdkColor *color,
+ GdkPixmap *pixmap,
+ SystemTray *tray)
+{
+ /* Force the icons to redraw their backgrounds.
+ * gtk_widget_queue_draw() doesn't work across process boundaries,
+ * so we do this instead.
+ */
+ gtk_widget_hide (tray->box);
+ gtk_widget_show (tray->box);
+}
+
+
+static void
applet_change_orientation (PanelApplet *applet,
PanelAppletOrient orient,
SystemTray *tray)
@@ -332,6 +365,11 @@
g_signal_connect (G_OBJECT (tray->applet),
"change_orient",
G_CALLBACK (applet_change_orientation),
+ tray);
+
+ g_signal_connect (G_OBJECT (tray->applet),
+ "change_background",
+ G_CALLBACK (applet_change_background),
tray);
g_signal_connect (tray->applet,