[Galago-commits] r3011 - in trunk/libnotify: . libnotify
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Thu Sep 25 18:12:48 PDT 2008
Author: chipx86
Date: 2008-09-25 18:12:47 -0700 (Thu, 25 Sep 2008)
New Revision: 3011
Modified:
trunk/libnotify/NEWS
trunk/libnotify/libnotify/notification.c
trunk/libnotify/libnotify/notification.h
Log:
Added support for sending the status icon XID to the notification daemon. This will allow better position tracking for context notifications. Patch by Colin Walters.
Modified: trunk/libnotify/NEWS
===================================================================
--- trunk/libnotify/NEWS 2008-09-26 01:07:01 UTC (rev 3010)
+++ trunk/libnotify/NEWS 2008-09-26 01:12:47 UTC (rev 3011)
@@ -3,6 +3,9 @@
Rocha.
* Added support for sending the closed reason in the "closed" signal
handler. (Ticket #139)
+ * Added support for sending the status icon XID to the notification
+ daemon. This will allow better position tracking for context
+ notifications. Patch by Colin Walters.
* Fixed a breakage where we were including gtkversion.h directly.
version 0.4.4 (27-February-2007):
Modified: trunk/libnotify/libnotify/notification.c
===================================================================
--- trunk/libnotify/libnotify/notification.c 2008-09-26 01:07:01 UTC (rev 3010)
+++ trunk/libnotify/libnotify/notification.c 2008-09-26 01:12:47 UTC (rev 3011)
@@ -31,6 +31,7 @@
# define HAVE_STATUS_ICON
# include <gtk/gtkstatusicon.h>
#endif
+#include <gdk/gdkx.h>
#define CHECK_DBUS_VERSION(major, minor) \
(DBUS_MAJOR_VER > (major) || \
@@ -396,6 +397,13 @@
G_OBJECT_CLASS(parent_class)->finalize(object);
}
+static GtkWidget *
+get_internal_tray_icon (GtkStatusIcon *status)
+{
+ /* This function is a temporary hack */
+ return GTK_WIDGET (*((GtkWidget**)(status->priv)));
+}
+
static void
_notify_notification_update_applet_hints(NotifyNotification *n)
{
@@ -407,7 +415,19 @@
if (priv->status_icon != NULL)
{
GdkRectangle rect;
+ GtkWidget *internal_tray = get_internal_tray_icon (priv->status_icon);
+ GdkWindow *window;
+ // TODO: this is sort of a hack, but we need a window ID to send along
+ gtk_widget_realize (internal_tray);
+ window = internal_tray->window;
+
+ if (window != NULL)
+ {
+ guint32 xid = GDK_WINDOW_XID (window);
+ notify_notification_set_hint_uint32(n, "window-xid", xid);
+ }
+
if (!gtk_status_icon_get_geometry(priv->status_icon, &screen,
&rect, NULL))
{
@@ -1003,7 +1023,33 @@
g_strdup(key), hint_value);
}
+
/**
+ * notify_notification_set_hint_uint32:
+ * @notification: The notification.
+ * @key: The hint.
+ * @value: The hint's value.
+ *
+ * Sets a hint with an unsigned 32-bit integer value.
+ */
+void
+notify_notification_set_hint_uint32(NotifyNotification *notification,
+ const gchar *key, guint value)
+{
+ GValue *hint_value;
+
+ g_return_if_fail(notification != NULL);
+ g_return_if_fail(NOTIFY_IS_NOTIFICATION(notification));
+ g_return_if_fail(key != NULL && *key != '\0');
+
+ hint_value = g_new0(GValue, 1);
+ g_value_init(hint_value, G_TYPE_UINT);
+ g_value_set_uint(hint_value, value);
+ g_hash_table_insert(notification->priv->hints,
+ g_strdup(key), hint_value);
+}
+
+/**
* notify_notification_set_hint_double:
* @notification: The notification.
* @key: The hint.
Modified: trunk/libnotify/libnotify/notification.h
===================================================================
--- trunk/libnotify/libnotify/notification.h 2008-09-26 01:07:01 UTC (rev 3010)
+++ trunk/libnotify/libnotify/notification.h 2008-09-26 01:12:47 UTC (rev 3011)
@@ -127,6 +127,8 @@
void notify_notification_set_hint_int32(NotifyNotification *notification,
const gchar *key, gint value);
+void notify_notification_set_hint_uint32(NotifyNotification *notification,
+ const gchar *key, guint value);
void notify_notification_set_hint_double(NotifyNotification *notification,
const gchar *key, gdouble value);
More information about the galago-commits
mailing list