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.
This commit is contained in:
parent
f4ff83ff20
commit
d5addcc1f4
3
NEWS
3
NEWS
|
@ -3,6 +3,9 @@ version 0.4.5:
|
||||||
Rocha.
|
Rocha.
|
||||||
* Added support for sending the closed reason in the "closed" signal
|
* Added support for sending the closed reason in the "closed" signal
|
||||||
handler. (Ticket #139)
|
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.
|
* Fixed a breakage where we were including gtkversion.h directly.
|
||||||
|
|
||||||
version 0.4.4 (27-February-2007):
|
version 0.4.4 (27-February-2007):
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
# define HAVE_STATUS_ICON
|
# define HAVE_STATUS_ICON
|
||||||
# include <gtk/gtkstatusicon.h>
|
# include <gtk/gtkstatusicon.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
#define CHECK_DBUS_VERSION(major, minor) \
|
#define CHECK_DBUS_VERSION(major, minor) \
|
||||||
(DBUS_MAJOR_VER > (major) || \
|
(DBUS_MAJOR_VER > (major) || \
|
||||||
|
@ -396,6 +397,13 @@ notify_notification_finalize(GObject *object)
|
||||||
G_OBJECT_CLASS(parent_class)->finalize(object);
|
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
|
static void
|
||||||
_notify_notification_update_applet_hints(NotifyNotification *n)
|
_notify_notification_update_applet_hints(NotifyNotification *n)
|
||||||
{
|
{
|
||||||
|
@ -407,6 +415,18 @@ _notify_notification_update_applet_hints(NotifyNotification *n)
|
||||||
if (priv->status_icon != NULL)
|
if (priv->status_icon != NULL)
|
||||||
{
|
{
|
||||||
GdkRectangle rect;
|
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,
|
if (!gtk_status_icon_get_geometry(priv->status_icon, &screen,
|
||||||
&rect, NULL))
|
&rect, NULL))
|
||||||
|
@ -1003,6 +1023,32 @@ notify_notification_set_hint_int32(NotifyNotification *notification,
|
||||||
g_strdup(key), hint_value);
|
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:
|
* notify_notification_set_hint_double:
|
||||||
* @notification: The notification.
|
* @notification: The notification.
|
||||||
|
|
|
@ -127,6 +127,8 @@ void notify_notification_set_icon_from_pixbuf(NotifyNotification *notification,
|
||||||
|
|
||||||
void notify_notification_set_hint_int32(NotifyNotification *notification,
|
void notify_notification_set_hint_int32(NotifyNotification *notification,
|
||||||
const gchar *key, gint value);
|
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,
|
void notify_notification_set_hint_double(NotifyNotification *notification,
|
||||||
const gchar *key, gdouble value);
|
const gchar *key, gdouble value);
|
||||||
|
|
Loading…
Reference in New Issue