diff -Nur notification-daemon-0.3.4/src/daemon.c notification-daemon-0.3.4.new/src/daemon.c --- notification-daemon-0.3.4/src/daemon.c 2006-02-05 02:34:46.000000000 +0200 +++ notification-daemon-0.3.4.new/src/daemon.c 2006-05-12 20:34:51.000000000 +0300 @@ -560,50 +560,16 @@ static gboolean get_work_area(GtkWidget *nw, GdkRectangle *rect) { - Atom workarea = XInternAtom(GDK_DISPLAY(), "_NET_WORKAREA", True); - Atom type; - Window win; - int format; - gulong num, leftovers; - gulong max_len = 4 * 32; - guchar *ret_workarea; - long *workareas; - int result; GdkScreen *screen; - int disp_screen; + + /* It would be best to allow the user to configure this, but the first + * monitor is a good default for now (the first monitor is likely the + * primary monitor). */ + guint monitor = 0; gtk_widget_realize(nw); screen = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window)); - disp_screen = GDK_SCREEN_XNUMBER(screen); - - /* Defaults in case of error */ - rect->x = 0; - rect->y = 0; - rect->width = gdk_screen_get_width(screen); - rect->height = gdk_screen_get_height(screen); - - if (workarea == None) - return FALSE; - - win = XRootWindow(GDK_DISPLAY(), disp_screen); - result = XGetWindowProperty(GDK_DISPLAY(), win, workarea, 0, - max_len, False, AnyPropertyType, - &type, &format, &num, &leftovers, - &ret_workarea); - - if (result != Success || type == None || format == 0 || leftovers || - num % 4) - { - return FALSE; - } - - workareas = (long *)ret_workarea; - rect->x = workareas[disp_screen * 4]; - rect->y = workareas[disp_screen * 4 + 1]; - rect->width = workareas[disp_screen * 4 + 2]; - rect->height = workareas[disp_screen * 4 + 3]; - - XFree(ret_workarea); + gdk_screen_get_monitor_geometry(screen, monitor, rect); return TRUE; } diff -Nur notification-daemon-0.3.4/themes/standard/theme.c notification-daemon-0.3.4.new/themes/standard/theme.c --- notification-daemon-0.3.4/themes/standard/theme.c 2006-02-05 05:48:09.000000000 +0200 +++ notification-daemon-0.3.4.new/themes/standard/theme.c 2006-05-12 20:35:18.000000000 +0300 @@ -525,8 +525,9 @@ GtkRequisition req; GtkArrowType arrow_type; GdkScreen *screen; - int screen_width; - int screen_height; + int monitor_num; + GdkRectangle monitor_geom; + int monitor_left, monitor_right, monitor_top, monitor_bottom; int arrow_side1_width = DEFAULT_ARROW_WIDTH / 2; int arrow_side2_width = DEFAULT_ARROW_WIDTH / 2; int arrow_offset = DEFAULT_ARROW_OFFSET; @@ -536,16 +537,22 @@ gtk_widget_realize(nw); gtk_widget_size_request(nw, &req); - screen = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window)); - screen_width = gdk_screen_get_width(screen); - screen_height = gdk_screen_get_height(screen); + screen = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window)); + monitor_num = gdk_screen_get_monitor_at_point(screen, + windata->point_x, windata->point_y); + gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor_geom); + + monitor_left = monitor_geom.x; + monitor_right = monitor_left + monitor_geom.width; + monitor_top = monitor_geom.y; + monitor_bottom = monitor_top + monitor_geom.height; if (windata->border_points != NULL) g_free(windata->border_points); windata->num_border_points = 5; - if (windata->point_y + req.height + DEFAULT_ARROW_HEIGHT > screen_height) + if (windata->point_y + req.height + DEFAULT_ARROW_HEIGHT >= monitor_bottom) arrow_type = GTK_ARROW_DOWN; else arrow_type = GTK_ARROW_UP; @@ -555,12 +562,12 @@ { case GTK_ARROW_UP: case GTK_ARROW_DOWN: - if (windata->point_x < arrow_side1_width) + if (windata->point_x < monitor_left + arrow_side1_width) { arrow_side1_width = 0; arrow_offset = 0; } - else if (windata->point_x > screen_width - arrow_side2_width) + else if (windata->point_x >= monitor_right - arrow_side2_width) { arrow_side2_width = 0; arrow_offset = req.width - arrow_side1_width; @@ -568,18 +575,18 @@ else { if (windata->point_x - arrow_side2_width + req.width >= - screen_width) + monitor_right) { arrow_offset = req.width - arrow_side1_width - arrow_side2_width - - (screen_width - MAX(windata->point_x + + (monitor_right - MAX(windata->point_x + arrow_side1_width, - screen_width - + monitor_right - DEFAULT_ARROW_OFFSET)); } else { - arrow_offset = MIN(windata->point_x - arrow_side1_width, + arrow_offset = MIN(windata->point_x - arrow_side1_width - monitor_left, DEFAULT_ARROW_OFFSET); } @@ -702,12 +709,12 @@ case GTK_ARROW_LEFT: case GTK_ARROW_RIGHT: - if (windata->point_y < arrow_side1_width) + if (windata->point_y < monitor_top + arrow_side1_width) { arrow_side1_width = 0; arrow_offset = windata->point_y; } - else if (windata->point_y > screen_height - arrow_side2_width) + else if (windata->point_y >= monitor_bottom - arrow_side2_width) { arrow_side2_width = 0; arrow_offset = windata->point_y - arrow_side1_width;