[gnome-panel] na: Add support for _NET_SYSTEM_TRAY_PADDING in backend
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] na: Add support for _NET_SYSTEM_TRAY_PADDING in backend
- Date: Tue, 22 Feb 2011 23:50:30 +0000 (UTC)
commit 3b31fc3e17af7996071bbcc48c27f7012bb2c689
Author: Vincent Untz <vuntz gnome org>
Date: Wed Feb 23 00:38:28 2011 +0100
na: Add support for _NET_SYSTEM_TRAY_PADDING in backend
We still need to get a padding value from somewhere.
Based on patch from Matthias Clasen <mclasen redhat com>
https://bugzilla.gnome.org/show_bug.cgi?id=583273
applets/notification_area/na-tray-manager.c | 45 +++++++++++++++++++++++++++
applets/notification_area/na-tray-manager.h | 3 ++
applets/notification_area/na-tray.c | 10 ++++++
applets/notification_area/na-tray.h | 2 +
4 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/applets/notification_area/na-tray-manager.c b/applets/notification_area/na-tray-manager.c
index 5354619..3c25db5 100644
--- a/applets/notification_area/na-tray-manager.c
+++ b/applets/notification_area/na-tray-manager.c
@@ -97,6 +97,8 @@ na_tray_manager_init (NaTrayManager *manager)
manager->invisible = NULL;
manager->socket_table = g_hash_table_new (NULL, NULL);
+ manager->padding = 0;
+
manager->fg.red = 0;
manager->fg.green = 0;
manager->fg.blue = 0;
@@ -651,6 +653,34 @@ na_tray_manager_set_visual_property (NaTrayManager *manager)
}
static void
+na_tray_manager_set_padding_property (NaTrayManager *manager)
+{
+#ifdef GDK_WINDOWING_X11
+ GdkWindow *window;
+ GdkDisplay *display;
+ Atom atom;
+ gulong data[1];
+
+ g_return_if_fail (manager->invisible != NULL);
+ window = gtk_widget_get_window (manager->invisible);
+ g_return_if_fail (window != NULL);
+
+ display = gtk_widget_get_display (manager->invisible);
+ atom = gdk_x11_get_xatom_by_name_for_display (display,
+ "_NET_SYSTEM_TRAY_PADDING");
+
+ data[0] = manager->padding;
+
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ atom,
+ XA_CARDINAL, 32,
+ PropModeReplace,
+ (guchar *) &data, 1);
+#endif
+}
+
+static void
na_tray_manager_set_colors_property (NaTrayManager *manager)
{
#ifdef GDK_WINDOWING_X11
@@ -734,6 +764,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager,
na_tray_manager_set_orientation_property (manager);
na_tray_manager_set_visual_property (manager);
+ na_tray_manager_set_padding_property (manager);
na_tray_manager_set_colors_property (manager);
window = gtk_widget_get_window (invisible);
@@ -870,6 +901,20 @@ na_tray_manager_set_orientation (NaTrayManager *manager,
}
void
+na_tray_manager_set_padding (NaTrayManager *manager,
+ gint padding)
+{
+ g_return_if_fail (NA_IS_TRAY_MANAGER (manager));
+
+ if (manager->padding != padding)
+ {
+ manager->padding = padding;
+
+ na_tray_manager_set_padding_property (manager);
+ }
+}
+
+void
na_tray_manager_set_colors (NaTrayManager *manager,
GdkColor *fg,
GdkColor *error,
diff --git a/applets/notification_area/na-tray-manager.h b/applets/notification_area/na-tray-manager.h
index 1350bdf..6273f38 100644
--- a/applets/notification_area/na-tray-manager.h
+++ b/applets/notification_area/na-tray-manager.h
@@ -56,6 +56,7 @@ struct _NaTrayManager
GtkWidget *invisible;
GdkScreen *screen;
GtkOrientation orientation;
+ gint padding;
GdkColor fg;
GdkColor error;
GdkColor warning;
@@ -96,6 +97,8 @@ gboolean na_tray_manager_manage_screen (NaTrayManager *manager,
void na_tray_manager_set_orientation (NaTrayManager *manager,
GtkOrientation orientation);
GtkOrientation na_tray_manager_get_orientation (NaTrayManager *manager);
+void na_tray_manager_set_padding (NaTrayManager *manager,
+ gint padding);
void na_tray_manager_set_colors (NaTrayManager *manager,
GdkColor *fg,
GdkColor *error,
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c
index a32a4ff..08f6b50 100644
--- a/applets/notification_area/na-tray.c
+++ b/applets/notification_area/na-tray.c
@@ -817,6 +817,16 @@ idle_redraw_cb (NaTray *tray)
}
void
+na_tray_set_padding (NaTray *tray,
+ gint padding)
+{
+ NaTrayPrivate *priv = tray->priv;
+
+ if (get_tray (priv->trays_screen) == tray)
+ na_tray_manager_set_padding (priv->trays_screen->tray_manager, padding);
+}
+
+void
na_tray_set_colors (NaTray *tray,
GdkColor *fg,
GdkColor *error,
diff --git a/applets/notification_area/na-tray.h b/applets/notification_area/na-tray.h
index 1a48eb0..77d3ea3 100644
--- a/applets/notification_area/na-tray.h
+++ b/applets/notification_area/na-tray.h
@@ -60,6 +60,8 @@ NaTray *na_tray_new_for_screen (GdkScreen *screen,
void na_tray_set_orientation (NaTray *tray,
GtkOrientation orientation);
GtkOrientation na_tray_get_orientation (NaTray *tray);
+void na_tray_set_padding (NaTray *tray,
+ gint padding);
void na_tray_set_colors (NaTray *tray,
GdkColor *fg,
GdkColor *error,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]