diff --git a/browser.patch b/browser.patch new file mode 100644 index 0000000..0a88b76 --- /dev/null +++ b/browser.patch @@ -0,0 +1,35 @@ +diff -up notification-daemon-0.4.1/src/daemon/daemon.c.browser notification-daemon-0.4.1/src/daemon/daemon.c +--- notification-daemon-0.4.1/src/daemon/daemon.c.browser 2009-10-15 17:25:08.816399825 -0400 ++++ notification-daemon-0.4.1/src/daemon/daemon.c 2009-10-15 17:30:10.680399278 -0400 +@@ -845,27 +845,18 @@ url_clicked_cb(GtkWindow *nw, const char + + escaped_url = g_shell_quote(url); + +- /* +- * We can't actually check for GNOME_DESKTOP_SESSION_ID, because it's +- * not in the environment for this program :( +- */ +- if (/*g_getenv("GNOME_DESKTOP_SESSION_ID") != NULL &&*/ +- g_find_program_in_path("gnome-open") != NULL) ++ if (g_find_program_in_path("gvfs-open") != NULL) + { +- cmd = g_strdup_printf("gnome-open %s", escaped_url); ++ cmd = g_strdup_printf("gvfs-open %s", escaped_url); + } +- else if (g_find_program_in_path("mozilla-firefox") != NULL) ++ else if (g_find_program_in_path("xdg-open") != NULL) + { +- cmd = g_strdup_printf("mozilla-firefox %s", escaped_url); ++ cmd = g_strdup_printf("xdg-open %s", escaped_url); + } + else if (g_find_program_in_path("firefox") != NULL) + { + cmd = g_strdup_printf("firefox %s", escaped_url); + } +- else if (g_find_program_in_path("mozilla") != NULL) +- { +- cmd = g_strdup_printf("mozilla %s", escaped_url); +- } + else + { + g_warning("Unable to find a browser."); diff --git a/monitor-stacks.patch b/monitor-stacks.patch new file mode 100644 index 0000000..d6e75e4 --- /dev/null +++ b/monitor-stacks.patch @@ -0,0 +1,25 @@ +--- notification-daemon-0.4.1/src/daemon/stack.c 2009-09-23 01:47:50.000000000 -0400 ++++ hacked-foo/src/daemon/stack.c 2009-10-15 21:26:03.269041656 -0400 +@@ -199,17 +199,21 @@ + static void + notify_stack_shift_notifications(NotifyStack *stack, + GtkWindow *nw, +- GSList **nw_l, ++ GSList **nw_l, + gint init_width, + gint init_height, + gint *nw_x, + gint *nw_y) + { + GdkRectangle workarea; ++ GdkRectangle monitor; + GSList *l; + gint x, y, shiftx = 0, shifty = 0, index = 1; + + get_work_area(GTK_WIDGET(nw), &workarea); ++ gdk_screen_get_monitor_geometry (stack->screen, stack->monitor, &monitor); ++ gdk_rectangle_intersect (&monitor, &workarea, &workarea); ++ + get_origin_coordinates(stack->location, &workarea, &x, &y, + &shiftx, &shifty, init_width, init_height); + diff --git a/notification-daemon.spec b/notification-daemon.spec index 21fdefc..da1d3b9 100644 --- a/notification-daemon.spec +++ b/notification-daemon.spec @@ -7,7 +7,7 @@ Summary: Desktop Notification Daemon Name: notification-daemon Version: 0.4.1 -Release: 0.20090923.2%{?dist} +Release: 0.20090923.3%{?dist} URL: http://www.galago-project.org/specs/notification/ License: GPLv2+ Group: System Environment/Libraries @@ -41,6 +41,15 @@ Patch1: default-theme.patch Patch2: location.patch Patch10: notification-daemon-always-stack.patch +# Cut down on crazy browser choices +Patch11: browser.patch +# A working screensaver check +Patch12: screensaver-check.patch +# Make per-monitor stacks work as intended +Patch13: monitor-stacks.patch +# Don't crash if new monitors appear +Patch14: variable-monitors.patch + %description notification-daemon is the server implementation of the freedesktop.org desktop notification specification. Notifications can be used to inform the user @@ -53,6 +62,10 @@ user's way. %patch1 -p1 -b .default-theme %patch2 -p1 -b .location %patch10 -p1 -b .always-stack +%patch11 -p1 -b .browser +%patch12 -p1 -b .screensaver-check +%patch13 -p1 -b .monitor-stacks +%patch14 -p1 -b .variable-monitors autoreconf -i -f @@ -113,6 +126,11 @@ gconftool-2 --makefile-install-rule \ %changelog +* Thu Oct 15 2009 Matthias Clasen - 0.4.1-1.20090923.3 +- Fix issues with the multi-monitor support +- Make screensaver check work +- Use gvfs-open instead of gnome-open + * Thu Sep 24 2009 Matthias Clasen - 0.4.1-1.20090923.2 - Change default theme to 'slider' diff --git a/screensaver-check.patch b/screensaver-check.patch new file mode 100644 index 0000000..1f8660f --- /dev/null +++ b/screensaver-check.patch @@ -0,0 +1,66 @@ +--- notification-daemon-0.4.1/src/daemon/daemon.c 2009-10-15 17:21:49.127672315 -0400 ++++ hacked/src/daemon/daemon.c 2009-10-15 17:21:34.683409674 -0400 +@@ -883,33 +883,38 @@ + static gboolean + screensaver_active(GtkWidget *nw) + { +- GdkDisplay *display = gdk_drawable_get_display(GDK_DRAWABLE(nw->window)); +- Atom type; +- int format; +- unsigned long nitems, bytes_after; +- unsigned char *temp_data; +- gboolean active = FALSE; +- Atom XA_BLANK = gdk_x11_get_xatom_by_name_for_display(display, "BLANK"); +- Atom XA_LOCK = gdk_x11_get_xatom_by_name_for_display(display, "LOCK"); +- +- /* Check for a screensaver first. */ +- if (XGetWindowProperty( +- GDK_DISPLAY_XDISPLAY(display), +- GDK_ROOT_WINDOW(), +- gdk_x11_get_xatom_by_name_for_display(display, "_SCREENSAVER_STATUS"), +- 0, G_MAXLONG, False, XA_INTEGER, &type, &format, &nitems, +- &bytes_after, &temp_data) == Success && +- type && temp_data != NULL) +- { +- CARD32 *data = (CARD32 *)temp_data; +- +- active = (type == XA_INTEGER && nitems >= 3 && +- (time_t)data[1] > (time_t)666000000L && +- (data[0] == XA_BLANK || data[0] == XA_LOCK)); ++ DBusGConnection *connection; ++ DBusGProxy *gs_proxy; ++ GError *error; ++ gboolean active; ++ ++ active = FALSE; ++ ++ error = NULL; ++ connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); ++ if (connection == NULL) ++ { ++ g_error("Failed to get dbus connection: %s", error->message); ++ g_error_free(error); ++ goto out; ++ + } ++ gs_proxy = dbus_g_proxy_new_for_name(connection, ++ "org.gnome.ScreenSaver", ++ "/", ++ "org.gnome.ScreenSaver"); ++ ++ if (!dbus_g_proxy_call(gs_proxy, "GetActive", &error, ++ G_TYPE_INVALID, ++ G_TYPE_BOOLEAN, &active, ++ G_TYPE_INVALID)) ++ { ++ g_error("Failed to call gnome-screensaver: %s", error->message); ++ g_error_free(error); ++ } ++ ++out: + +- if (temp_data != NULL) +- XFree(temp_data); + return active; + } + diff --git a/variable-monitors.patch b/variable-monitors.patch new file mode 100644 index 0000000..24e6d3d --- /dev/null +++ b/variable-monitors.patch @@ -0,0 +1,93 @@ +--- notification-daemon-0.4.1/src/daemon/daemon.c 2009-10-15 21:22:24.598052888 -0400 ++++ hacked-foo/src/daemon/daemon.c 2009-10-15 21:26:56.380290516 -0400 +@@ -162,44 +162,59 @@ + } + + static void +-notify_daemon_init(NotifyDaemon *daemon) ++reallocate_stacks (NotifyDaemon *daemon) + { +- NotifyStackLocation location; +- GConfClient *client = get_gconf_client(); + GdkDisplay *display; + GdkScreen *screen; ++ gint old_stacks_size; ++ GConfClient *client = get_gconf_client(); ++ NotifyStackLocation location; + gchar *slocation; + gint i; + ++ display = gdk_display_get_default(); ++ screen = gdk_display_get_default_screen(display); ++ ++ if (daemon->priv->stacks_size < gdk_screen_get_n_monitors (screen)) { ++ slocation = gconf_client_get_string(client, GCONF_KEY_POPUP_LOCATION, ++ NULL); ++ location = get_stack_location_from_string(slocation); ++ g_free(slocation); ++ ++ old_stacks_size = daemon->priv->stacks_size; ++ daemon->priv->stacks_size = gdk_screen_get_n_monitors(screen); ++ daemon->priv->stacks = g_renew(NotifyStack *, daemon->priv->stacks, daemon->priv->stacks_size); ++ for (i = old_stacks_size; i < daemon->priv->stacks_size; i++) { ++ daemon->priv->stacks[i] = notify_stack_new(daemon, ++ screen, ++ i, ++ location); ++ } ++ } ++ ++ ++} ++ ++static void ++notify_daemon_init(NotifyDaemon *daemon) ++{ + daemon->priv = G_TYPE_INSTANCE_GET_PRIVATE(daemon, NOTIFY_TYPE_DAEMON, +- NotifyDaemonPrivate); ++ NotifyDaemonPrivate); + + daemon->priv->next_id = 1; + daemon->priv->timeout_source = 0; + +- slocation = gconf_client_get_string(client, GCONF_KEY_POPUP_LOCATION, +- NULL); +- location = get_stack_location_from_string(slocation); +- g_free(slocation); ++ daemon->priv->stacks_size = 0; ++ daemon->priv->stacks = NULL; + +- display = gdk_display_get_default(); +- screen = gdk_display_get_default_screen(display); +- daemon->priv->stacks_size = gdk_screen_get_n_monitors(screen); +- daemon->priv->stacks = g_new0(NotifyStack *, daemon->priv->stacks_size); ++ reallocate_stacks (daemon); + + daemon->priv->idle_reposition_notify_ids = g_hash_table_new(NULL, NULL); + daemon->priv->monitored_window_hash = g_hash_table_new(NULL, NULL); + gdk_window_add_filter(NULL, _notify_x11_filter, daemon); +- +- for (i = 0; i < daemon->priv->stacks_size; i++) +- { +- daemon->priv->stacks[i] = notify_stack_new(daemon, screen, +- i, location); +- } +- + daemon->priv->notification_hash = + g_hash_table_new_full(g_int_hash, g_int_equal, g_free, +- (GDestroyNotify)_notify_timeout_destroy); ++ (GDestroyNotify)_notify_timeout_destroy); + } + + static void +@@ -1308,7 +1323,9 @@ + gdk_display_get_pointer(gdk_display_get_default(), + &screen, &x, &y, NULL); + monitor = gdk_screen_get_monitor_at_point(screen, x, y); +- g_assert(monitor >= 0 && monitor < priv->stacks_size); ++ if (monitor >= priv->stacks_size) { ++ reallocate_stacks (daemon); ++ } + + notify_stack_add_window(priv->stacks[monitor], nw, new_notification); + }