diff --git a/ChangeLog b/ChangeLog index 214f092..48afdcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Tue Jun 06 00:27:50 PDT 2006 Christian Hammond + + * docs/reference/tmpl/notification.sgml: + * libnotify/notification.c: + * libnotify/notification.h: + - Update notify_notification_set_geometry_hints() to take a x, y + instead of a GdkRectangle. We don't need the width and height + information. + Tue Jun 06 00:14:00 PDT 2006 Christian Hammond A docs/reference/libnotify-docs.sgml: diff --git a/docs/reference/tmpl/notification.sgml b/docs/reference/tmpl/notification.sgml index e91daaa..b988743 100644 --- a/docs/reference/tmpl/notification.sgml +++ b/docs/reference/tmpl/notification.sgml @@ -133,7 +133,8 @@ NotifyNotification @notification: @screen: -@rect: +@x: +@y: diff --git a/libnotify/notification.c b/libnotify/notification.c index f869f1c..f2726f4 100644 --- a/libnotify/notification.c +++ b/libnotify/notification.c @@ -387,44 +387,45 @@ _notify_notification_update_applet_hints(NotifyNotification *n) { NotifyNotificationPrivate *priv = n->priv; GdkScreen *screen = NULL; - GdkRectangle rect; + gint x, y; #ifdef HAVE_STATUS_ICON if (priv->status_icon != NULL) { + GdkRectangle rect; + if (!gtk_status_icon_get_geometry(priv->status_icon, &screen, &rect, NULL)) { return; } + + x = rect.x + rect.width / 2; + y = rect.y + rect.height / 2; } else #endif /* HAVE_STATUS_ICON */ if (priv->attached_widget != NULL) { GtkWidget *widget = priv->attached_widget; - GtkRequisition requisition; screen = gtk_widget_get_screen(widget); - gtk_widget_size_request(widget, &requisition); - rect.width = requisition.width; - rect.height = requisition.height; - gdk_window_get_origin(widget->window, &rect.x, &rect.y); + gdk_window_get_origin(widget->window, &x, &y); if (GTK_WIDGET_NO_WINDOW(widget)) { - rect.x += widget->allocation.x; - rect.y += widget->allocation.y; + x += widget->allocation.x; + y += widget->allocation.y; } - rect.x += widget->allocation.width / 2; - rect.y += widget->allocation.height / 2; + x += widget->allocation.width / 2; + y += widget->allocation.height / 2; } else return; - notify_notification_set_geometry_hints(n, screen, &rect); + notify_notification_set_geometry_hints(n, screen, x, y); } #if 0 @@ -640,7 +641,8 @@ notify_notification_attach_to_status_icon(NotifyNotification *notification, void notify_notification_set_geometry_hints(NotifyNotification *notification, GdkScreen *screen, - GdkRectangle *rect) + gint x, + gint y) { char *display_name; @@ -648,10 +650,9 @@ notify_notification_set_geometry_hints(NotifyNotification *notification, g_return_if_fail(NOTIFY_IS_NOTIFICATION(notification)); g_return_if_fail(screen != NULL); g_return_if_fail(GDK_IS_SCREEN(screen)); - g_return_if_fail(rect != NULL); - notify_notification_set_hint_int32(notification, "x", rect->x); - notify_notification_set_hint_int32(notification, "y", rect->y); + notify_notification_set_hint_int32(notification, "x", x); + notify_notification_set_hint_int32(notification, "y", y); display_name = gdk_screen_make_display_name(screen); notify_notification_set_hint_string(notification, "xdisplay", display_name); diff --git a/libnotify/notification.h b/libnotify/notification.h index 7aa5e7a..7fbe28c 100644 --- a/libnotify/notification.h +++ b/libnotify/notification.h @@ -108,7 +108,8 @@ void notify_notification_attach_to_status_icon(NotifyNotification *notification, void notify_notification_set_geometry_hints(NotifyNotification *notification, GdkScreen *screen, - GdkRectangle *rect); + gint x, + gint y); gboolean notify_notification_show(NotifyNotification *notification, GError **error);