[Goodies-commits] r2167 - in notification-daemon-xfce/trunk/src: daemon themes/standard
Nick Schermer
nick at xfce.org
Mon Nov 13 20:37:30 CET 2006
Author: nick
Date: 2006-11-13 19:37:29 +0000 (Mon, 13 Nov 2006)
New Revision: 2167
Modified:
notification-daemon-xfce/trunk/src/daemon/Makefile.am
notification-daemon-xfce/trunk/src/daemon/daemon.c
notification-daemon-xfce/trunk/src/themes/standard/theme.c
Log:
Merge fixes from the origional daemon. This will (probably) also fix the compilation in the new dbus api.
Modified: notification-daemon-xfce/trunk/src/daemon/Makefile.am
===================================================================
--- notification-daemon-xfce/trunk/src/daemon/Makefile.am 2006-11-11 17:36:28 UTC (rev 2166)
+++ notification-daemon-xfce/trunk/src/daemon/Makefile.am 2006-11-13 19:37:29 UTC (rev 2167)
@@ -22,7 +22,9 @@
notificationdaemon-dbus-glue.h
notificationdaemon-dbus-glue.h: notificationdaemon.xml
- dbus-binding-tool --mode=glib-server \
+ dbus-binding-tool \
+ --mode=glib-server \
+ --prefix=notification_daemon_xfce \
$(srcdir)/notificationdaemon.xml > notificationdaemon-dbus-glue.h
INCLUDES = \
Modified: notification-daemon-xfce/trunk/src/daemon/daemon.c
===================================================================
--- notification-daemon-xfce/trunk/src/daemon/daemon.c 2006-11-11 17:36:28 UTC (rev 2166)
+++ notification-daemon-xfce/trunk/src/daemon/daemon.c 2006-11-13 19:37:29 UTC (rev 2167)
@@ -1108,7 +1108,7 @@
dbus_conn = dbus_g_connection_get_connection(connection);
dbus_g_object_type_install_info(NOTIFY_TYPE_DAEMON,
- &dbus_glib__object_info);
+ &dbus_glib_notification_daemon_xfce_object_info);
bus_proxy = dbus_g_proxy_new_for_name(connection,
"org.freedesktop.DBus",
Modified: notification-daemon-xfce/trunk/src/themes/standard/theme.c
===================================================================
--- notification-daemon-xfce/trunk/src/themes/standard/theme.c 2006-11-11 17:36:28 UTC (rev 2166)
+++ notification-daemon-xfce/trunk/src/themes/standard/theme.c 2006-11-13 19:37:29 UTC (rev 2167)
@@ -1,23 +1,3 @@
-/* $Id$
- *
- * Copyright (C) 2006 Christian Hammond <chipx86 at chipx86.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
#include "config.h"
#include <gtk/gtk.h>
@@ -54,6 +34,9 @@
int drawn_arrow_end_x;
int drawn_arrow_end_y;
+ int width;
+ int height;
+
GdkGC *gc;
GdkPoint *border_points;
size_t num_border_points;
@@ -87,14 +70,15 @@
#define DEFAULT_ARROW_WIDTH 28
static void
-fill_background(GtkWidget *win, WindowData *windata)
+fill_background(GtkWidget *widget, WindowData *windata)
{
- GtkStyle *style = gtk_widget_get_style(win);
- GdkGC *gc = style->base_gc[GTK_STATE_NORMAL];
+ GtkStyle *style = gtk_widget_get_style(windata->win);
- gdk_draw_rectangle(GDK_DRAWABLE(win->window), gc, TRUE,
- win->allocation.x, win->allocation.y,
- win->allocation.width, win->allocation.height);
+ gdk_draw_rectangle(GDK_DRAWABLE(widget->window),
+ style->base_gc[GTK_STATE_NORMAL], TRUE,
+ 0, 0,
+ widget->allocation.width,
+ widget->allocation.height);
}
static void
@@ -135,13 +119,235 @@
g_object_unref(G_OBJECT(gc));
}
-static gboolean
-draw_border(GtkWidget *win, GdkEventExpose *event, WindowData *windata)
+static GtkArrowType
+get_notification_arrow_type(GtkWidget *nw)
{
- int w, h;
+ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
+ int screen_height;
- fill_background(win, windata);
+ screen_height = gdk_screen_get_height(
+ gdk_drawable_get_screen(GDK_DRAWABLE(nw->window)));
+ if (windata->point_y + windata->height + DEFAULT_ARROW_HEIGHT >
+ screen_height)
+ {
+ return GTK_ARROW_DOWN;
+ }
+ else
+ {
+ return GTK_ARROW_UP;
+ }
+}
+
+#define ADD_POINT(_x, _y, shapeoffset_x, shapeoffset_y) \
+ G_STMT_START { \
+ windata->border_points[i].x = (_x); \
+ windata->border_points[i].y = (_y); \
+ shape_points[i].x = (_x) + (shapeoffset_x); \
+ shape_points[i].y = (_y) + (shapeoffset_y); \
+ i++;\
+ } G_STMT_END
+
+static void
+create_border_with_arrow(GtkWidget *nw, WindowData *windata)
+{
+ int width;
+ int height;
+ int y;
+ GtkArrowType arrow_type;
+ GdkScreen *screen;
+ int screen_width;
+ int screen_height;
+ int arrow_side1_width = DEFAULT_ARROW_WIDTH / 2;
+ int arrow_side2_width = DEFAULT_ARROW_WIDTH / 2;
+ int arrow_offset = DEFAULT_ARROW_OFFSET;
+ GdkPoint *shape_points = NULL;
+ int i = 0;
+
+ width = windata->width;
+ height = windata->height;
+
+ screen = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window));
+ screen_width = gdk_screen_get_width(screen);
+ screen_height = gdk_screen_get_height(screen);
+
+ windata->num_border_points = 5;
+
+ arrow_type = get_notification_arrow_type(nw);
+
+ /* Handle the offset and such */
+ switch (arrow_type)
+ {
+ case GTK_ARROW_UP:
+ case GTK_ARROW_DOWN:
+ if (windata->point_x < arrow_side1_width)
+ {
+ arrow_side1_width = 0;
+ arrow_offset = 0;
+ }
+ else if (windata->point_x > screen_width - arrow_side2_width)
+ {
+ arrow_side2_width = 0;
+ arrow_offset = width - arrow_side1_width;
+ }
+ else
+ {
+ if (windata->point_x - arrow_side2_width + width >=
+ screen_width)
+ {
+ arrow_offset =
+ width - arrow_side1_width - arrow_side2_width -
+ (screen_width - MAX(windata->point_x +
+ arrow_side1_width,
+ screen_width -
+ DEFAULT_ARROW_OFFSET));
+ }
+ else
+ {
+ arrow_offset = MIN(windata->point_x - arrow_side1_width,
+ DEFAULT_ARROW_OFFSET);
+ }
+
+ if (arrow_offset == 0 ||
+ arrow_offset == width - arrow_side1_width)
+ windata->num_border_points++;
+ else
+ windata->num_border_points += 2;
+ }
+
+ /*
+ * Why risk this for official builds? If it's somehow off the
+ * screen, it won't horribly impact the user. Definitely less
+ * than an assertion would...
+ */
+#if 0
+ g_assert(arrow_offset + arrow_side1_width >= 0);
+ g_assert(arrow_offset + arrow_side1_width + arrow_side2_width <=
+ width);
+#endif
+
+ windata->border_points = g_new0(GdkPoint,
+ windata->num_border_points);
+ shape_points = g_new0(GdkPoint, windata->num_border_points);
+
+ windata->drawn_arrow_begin_x = arrow_offset;
+ windata->drawn_arrow_middle_x = arrow_offset + arrow_side1_width;
+ windata->drawn_arrow_end_x = arrow_offset + arrow_side1_width +
+ arrow_side2_width;
+
+ if (arrow_type == GTK_ARROW_UP)
+ {
+ windata->drawn_arrow_begin_y = DEFAULT_ARROW_HEIGHT;
+ windata->drawn_arrow_middle_y = 0;
+ windata->drawn_arrow_end_y = DEFAULT_ARROW_HEIGHT;
+
+ if (arrow_side1_width == 0)
+ {
+ ADD_POINT(0, 0, 0, 0);
+ }
+ else
+ {
+ ADD_POINT(0, DEFAULT_ARROW_HEIGHT, 0, 0);
+
+ if (arrow_offset > 0)
+ ADD_POINT(arrow_offset -
+ (arrow_side2_width > 0 ? 0 : 1),
+ DEFAULT_ARROW_HEIGHT, 0, 0);
+
+ ADD_POINT(arrow_offset + arrow_side1_width -
+ (arrow_side2_width > 0 ? 0 : 1),
+ 0, 0, 0);
+ }
+
+ if (arrow_side2_width > 0)
+ {
+ ADD_POINT(windata->drawn_arrow_end_x,
+ windata->drawn_arrow_end_y, 1, 0);
+ ADD_POINT(width - 1, DEFAULT_ARROW_HEIGHT, 1, 0);
+ }
+
+ ADD_POINT(width - 1, height - 1, 1, 1);
+ ADD_POINT(0, height - 1, 0, 1);
+
+ y = windata->point_y;
+ }
+ else
+ {
+ windata->drawn_arrow_begin_y = height - DEFAULT_ARROW_HEIGHT;
+ windata->drawn_arrow_middle_y = height;
+ windata->drawn_arrow_end_y = height - DEFAULT_ARROW_HEIGHT;
+
+ ADD_POINT(0, 0, 0, 0);
+ ADD_POINT(width - 1, 0, 1, 0);
+
+ if (arrow_side2_width == 0)
+ {
+ ADD_POINT(width - 1, height,
+ (arrow_side1_width > 0 ? 0 : 1), 0);
+ }
+ else
+ {
+ ADD_POINT(width - 1, height - DEFAULT_ARROW_HEIGHT, 1, 1);
+
+ if (arrow_offset < width - arrow_side1_width)
+ {
+ ADD_POINT(arrow_offset + arrow_side1_width +
+ arrow_side2_width,
+ height - DEFAULT_ARROW_HEIGHT, 0, 1);
+ }
+
+ ADD_POINT(arrow_offset + arrow_side1_width, height, 0, 1);
+ }
+
+ if (arrow_side1_width > 0)
+ {
+ ADD_POINT(windata->drawn_arrow_begin_x -
+ (arrow_side2_width > 0 ? 0 : 1),
+ windata->drawn_arrow_begin_y, 0, 0);
+ ADD_POINT(0, height - DEFAULT_ARROW_HEIGHT, 0, 1);
+ }
+
+ y = windata->point_y - height;
+ }
+
+#if 0
+ g_assert(i == windata->num_border_points);
+ g_assert(windata->point_x - arrow_offset - arrow_side1_width >= 0);
+#endif
+ gtk_window_move(GTK_WINDOW(nw),
+ windata->point_x - arrow_offset -
+ arrow_side1_width,
+ y);
+
+ break;
+
+ case GTK_ARROW_LEFT:
+ case GTK_ARROW_RIGHT:
+ if (windata->point_y < arrow_side1_width)
+ {
+ arrow_side1_width = 0;
+ arrow_offset = windata->point_y;
+ }
+ else if (windata->point_y > screen_height - arrow_side2_width)
+ {
+ arrow_side2_width = 0;
+ arrow_offset = windata->point_y - arrow_side1_width;
+ }
+ break;
+ }
+
+ g_assert(shape_points != NULL);
+
+ windata->window_region =
+ gdk_region_polygon(shape_points, windata->num_border_points,
+ GDK_EVEN_ODD_RULE);
+ g_free(shape_points);
+}
+
+static void
+draw_border(GtkWidget *win,
+ WindowData *windata)
+{
if (windata->gc == NULL)
{
GdkColor color;
@@ -151,21 +357,32 @@
gdk_gc_set_rgb_fg_color(windata->gc, &color);
}
- gdk_drawable_get_size(win->window, &w, &h);
-
if (windata->has_arrow)
{
+ create_border_with_arrow(win, windata);
+
gdk_draw_polygon(win->window, windata->gc, FALSE,
windata->border_points, windata->num_border_points);
gdk_window_shape_combine_region(win->window, windata->window_region,
0, 0);
+ g_free(windata->border_points);
+ windata->border_points = NULL;
}
else
{
gdk_draw_rectangle(win->window, windata->gc, FALSE,
- 0, 0, w - 1, h - 1);
+ 0, 0, windata->width - 1, windata->height - 1);
}
+}
+
+static gboolean
+paint_window(GtkWidget *win,
+ GdkEventExpose *event,
+ WindowData *windata)
+{
+ fill_background(win, windata);
+ draw_border(win, windata);
draw_stripe(win, windata);
return FALSE;
@@ -177,16 +394,43 @@
if (windata->gc != NULL)
g_object_unref(G_OBJECT(windata->gc));
- if (windata->border_points != NULL)
- g_free(windata->border_points);
-
if (windata->window_region != NULL)
gdk_region_destroy(windata->window_region);
- g_free (windata);
+ g_free(windata);
}
static void
+update_spacers(GtkWidget *nw)
+{
+ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
+
+ if (windata->has_arrow)
+ {
+ switch (get_notification_arrow_type(GTK_WIDGET(nw)))
+ {
+ case GTK_ARROW_UP:
+ gtk_widget_show(windata->top_spacer);
+ gtk_widget_hide(windata->bottom_spacer);
+ break;
+
+ case GTK_ARROW_DOWN:
+ gtk_widget_hide(windata->top_spacer);
+ gtk_widget_show(windata->bottom_spacer);
+ break;
+
+ default:
+ g_assert_not_reached();
+ }
+ }
+ else
+ {
+ gtk_widget_hide(windata->top_spacer);
+ gtk_widget_hide(windata->bottom_spacer);
+ }
+}
+
+static void
update_content_hbox_visibility(WindowData *windata)
{
/*
@@ -205,6 +449,19 @@
}
}
+static gboolean
+configure_event_cb(GtkWidget *nw,
+ GdkEventConfigure *event,
+ WindowData *windata)
+{
+ windata->width = event->width;
+ windata->height = event->height;
+
+ update_spacers(nw);
+
+ return FALSE;
+}
+
GtkWindow *
create_notification(UrlClickedCb url_clicked)
{
@@ -213,9 +470,12 @@
GtkWidget *main_vbox;
GtkWidget *hbox;
GtkWidget *vbox;
+#ifdef ENABLE_CLOSE_BUTTON
GtkWidget *close_button;
GtkWidget *image;
+#endif
GtkWidget *alignment;
+ AtkObject *atkobj;
WindowData *windata;
windata = g_new0(WindowData, 1);
@@ -224,14 +484,19 @@
win = gtk_window_new(GTK_WINDOW_POPUP);
windata->win = win;
- gtk_widget_add_events(win, GDK_BUTTON_RELEASE_MASK);
+ gtk_window_set_title(GTK_WINDOW(win), "Notification");
+ gtk_widget_add_events(win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_widget_realize(win);
+
g_object_set_data_full(G_OBJECT(win), "windata", windata,
(GDestroyNotify)destroy_windata);
gtk_widget_set_app_paintable(win, TRUE);
+ atk_object_set_role(gtk_widget_get_accessible(win), ATK_ROLE_ALERT);
- g_signal_connect(G_OBJECT(win), "expose-event",
- G_CALLBACK(draw_border), windata);
+ g_signal_connect(G_OBJECT(win), "expose_event",
+ G_CALLBACK(paint_window), windata);
+ g_signal_connect(G_OBJECT(win), "configure_event",
+ G_CALLBACK(configure_event_cb), windata);
main_vbox = gtk_vbox_new(FALSE, 0);
gtk_widget_show(main_vbox);
@@ -274,6 +539,9 @@
gtk_misc_set_alignment(GTK_MISC(windata->summary_label), 0, 0);
gtk_label_set_line_wrap(GTK_LABEL(windata->summary_label), TRUE);
+ atkobj = gtk_widget_get_accessible(windata->summary_label);
+ atk_object_set_description(atkobj, "Notification summary text.");
+
#ifdef ENABLE_CLOSE_BUTTON
/* Add the close button */
close_button = gtk_button_new();
@@ -285,6 +553,12 @@
g_signal_connect_swapped(G_OBJECT(close_button), "clicked",
G_CALLBACK(gtk_widget_destroy), win);
+ atkobj = gtk_widget_get_accessible(close_button);
+ atk_action_set_description(ATK_ACTION(atkobj), 0,
+ "Closes the notification.");
+ atk_object_set_name(atkobj, "");
+ atk_object_set_description(atkobj, "Closes the notification.");
+
image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
gtk_widget_show(image);
gtk_container_add(GTK_CONTAINER(close_button), image);
@@ -315,6 +589,9 @@
g_signal_connect_swapped(G_OBJECT(windata->body_label), "url_activated",
G_CALLBACK(windata->url_clicked), win);
+ atkobj = gtk_widget_get_accessible(windata->body_label);
+ atk_object_set_description(atkobj, "Notification body text.");
+
alignment = gtk_alignment_new(1, 0.5, 0, 0);
gtk_widget_show(alignment);
gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, TRUE, 0);
@@ -335,8 +612,16 @@
value = (GValue *)g_hash_table_lookup(hints, "urgency");
- if (value)
+ if (value != NULL)
+ {
windata->urgency = g_value_get_uchar(value);
+
+ if (windata->urgency == URGENCY_CRITICAL) {
+ gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification");
+ } else {
+ gtk_window_set_title(GTK_WINDOW(nw), "Notification");
+ }
+ }
}
void
@@ -414,7 +699,7 @@
}
void
-set_notification_arrow(GtkWindow *nw, gboolean visible, int x, int y)
+set_notification_arrow(GtkWidget *nw, gboolean visible, int x, int y)
{
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
g_assert(windata != NULL);
@@ -423,11 +708,7 @@
windata->point_x = x;
windata->point_y = y;
- if (!visible)
- {
- gtk_widget_hide(windata->top_spacer);
- gtk_widget_hide(windata->bottom_spacer);
- }
+ update_spacers(nw);
}
static gboolean
@@ -435,10 +716,8 @@
WindowData *windata)
{
GtkStyle *style = gtk_widget_get_style(windata->win);
- GdkGC *bg_gc = style->base_gc[GTK_STATE_NORMAL];
- gdk_draw_rectangle(GDK_DRAWABLE(pie->window), bg_gc, TRUE,
- 0, 0, pie->allocation.width, pie->allocation.height);
+ fill_background(pie, windata);
if (windata->timeout > 0)
{
@@ -561,230 +840,15 @@
(GtkCallback)gtk_object_destroy, NULL);
}
-#define ADD_POINT(_x, _y, shapeoffset_x, shapeoffset_y) \
- G_STMT_START { \
- windata->border_points[i].x = (_x); \
- windata->border_points[i].y = (_y); \
- shape_points[i].x = (_x) + (shapeoffset_x); \
- shape_points[i].y = (_y) + (shapeoffset_y); \
- i++;\
- } G_STMT_END
-
-static void
-create_border_with_arrow(GtkWidget *nw, WindowData *windata)
-{
- GtkRequisition req;
- GtkArrowType arrow_type;
- GdkScreen *screen;
- int screen_width;
- int screen_height;
- int arrow_side1_width = DEFAULT_ARROW_WIDTH / 2;
- int arrow_side2_width = DEFAULT_ARROW_WIDTH / 2;
- int arrow_offset = DEFAULT_ARROW_OFFSET;
- GdkPoint *shape_points;
- int i = 0;
-
- 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);
-
- 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)
- arrow_type = GTK_ARROW_DOWN;
- else
- arrow_type = GTK_ARROW_UP;
-
- /* Handle the offset and such */
- switch (arrow_type)
- {
- case GTK_ARROW_UP:
- case GTK_ARROW_DOWN:
- if (windata->point_x < arrow_side1_width)
- {
- arrow_side1_width = 0;
- arrow_offset = 0;
- }
- else if (windata->point_x > screen_width - arrow_side2_width)
- {
- arrow_side2_width = 0;
- arrow_offset = req.width - arrow_side1_width;
- }
- else
- {
- if (windata->point_x - arrow_side2_width + req.width >=
- screen_width)
- {
- arrow_offset =
- req.width - arrow_side1_width - arrow_side2_width -
- (screen_width - MAX(windata->point_x +
- arrow_side1_width,
- screen_width -
- DEFAULT_ARROW_OFFSET));
- }
- else
- {
- arrow_offset = MIN(windata->point_x - arrow_side1_width,
- DEFAULT_ARROW_OFFSET);
- }
-
- if (arrow_offset == 0 ||
- arrow_offset == req.width - arrow_side1_width)
- windata->num_border_points++;
- else
- windata->num_border_points += 2;
- }
-
- /*
- * Why risk this for official builds? If it's somehow off the
- * screen, it won't horribly impact the user. Definitely less
- * than an assertion would...
- */
-#if 0
- g_assert(arrow_offset + arrow_side1_width >= 0);
- g_assert(arrow_offset + arrow_side1_width + arrow_side2_width <=
- req.width);
-#endif
-
- windata->border_points = g_new0(GdkPoint,
- windata->num_border_points);
- shape_points = g_new0(GdkPoint, windata->num_border_points);
-
- windata->drawn_arrow_begin_x = arrow_offset;
- windata->drawn_arrow_middle_x = arrow_offset + arrow_side1_width;
- windata->drawn_arrow_end_x = arrow_offset + arrow_side1_width +
- arrow_side2_width;
-
- if (arrow_type == GTK_ARROW_UP)
- {
- gtk_widget_show(windata->top_spacer);
- windata->drawn_arrow_begin_y = DEFAULT_ARROW_HEIGHT;
- windata->drawn_arrow_middle_y = 0;
- windata->drawn_arrow_end_y = DEFAULT_ARROW_HEIGHT;
-
- if (arrow_side1_width == 0)
- {
- ADD_POINT(0, 0, 0, 0);
- }
- else
- {
- ADD_POINT(0, DEFAULT_ARROW_HEIGHT, 0, 0);
-
- if (arrow_offset > 0)
- ADD_POINT(arrow_offset -
- (arrow_side2_width > 0 ? 0 : 1),
- DEFAULT_ARROW_HEIGHT, 0, 0);
-
- ADD_POINT(arrow_offset + arrow_side1_width -
- (arrow_side2_width > 0 ? 0 : 1),
- 0, 0, 0);
- }
-
- if (arrow_side2_width > 0)
- {
- ADD_POINT(windata->drawn_arrow_end_x,
- windata->drawn_arrow_end_y, 1, 0);
- ADD_POINT(req.width - 1, DEFAULT_ARROW_HEIGHT, 1, 0);
- }
-
- ADD_POINT(req.width - 1,
- req.height + DEFAULT_ARROW_HEIGHT - 1, 1, 1);
- ADD_POINT(0, req.height + DEFAULT_ARROW_HEIGHT - 1, 0, 1);
- }
- else
- {
- gtk_widget_show(windata->bottom_spacer);
- windata->drawn_arrow_begin_y = req.height;
- windata->drawn_arrow_middle_y = req.height +
- DEFAULT_ARROW_HEIGHT;
- windata->drawn_arrow_end_y = req.height;
-
- ADD_POINT(0, 0, 0, 0);
- ADD_POINT(req.width - 1, 0, 1, 0);
-
- if (arrow_side2_width == 0)
- {
- ADD_POINT(req.width - 1,
- req.height + DEFAULT_ARROW_HEIGHT,
- (arrow_side1_width > 0 ? 0 : 1), 0);
- }
- else
- {
- ADD_POINT(req.width - 1, req.height, 1, 1);
-
- if (arrow_offset < req.width - arrow_side1_width)
- {
- ADD_POINT(arrow_offset + arrow_side1_width +
- arrow_side2_width, req.height, 0, 1);
- }
-
- ADD_POINT(arrow_offset + arrow_side1_width,
- req.height + DEFAULT_ARROW_HEIGHT, 0, 1);
- }
-
- if (arrow_side1_width > 0)
- {
- ADD_POINT(windata->drawn_arrow_begin_x -
- (arrow_side2_width > 0 ? 0 : 1),
- windata->drawn_arrow_begin_y, 0, 0);
- ADD_POINT(0, req.height, 0, 1);
- }
- }
-
-#if 0
- g_assert(i == windata->num_border_points);
- g_assert(windata->point_x - arrow_offset - arrow_side1_width >= 0);
-#endif
- gtk_window_move(GTK_WINDOW(nw),
- windata->point_x - arrow_offset -
- arrow_side1_width,
- (arrow_type == GTK_ARROW_UP
- ? windata->point_y
- : windata->point_y - req.height -
- DEFAULT_ARROW_HEIGHT));
-
- break;
-
- case GTK_ARROW_LEFT:
- case GTK_ARROW_RIGHT:
- if (windata->point_y < arrow_side1_width)
- {
- arrow_side1_width = 0;
- arrow_offset = windata->point_y;
- }
- else if (windata->point_y > screen_height - arrow_side2_width)
- {
- arrow_side2_width = 0;
- arrow_offset = windata->point_y - arrow_side1_width;
- }
- break;
- default:
- break;
- }
-
- windata->window_region =
- gdk_region_polygon(shape_points, windata->num_border_points,
- GDK_EVEN_ODD_RULE);
- g_free(shape_points);
-
- draw_border(nw, NULL, windata);
-}
-
void
-move_notification(GtkWindow *nw, int x, int y)
+move_notification(GtkWidget *nw, int x, int y)
{
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
g_assert(windata != NULL);
if (windata->has_arrow)
{
- create_border_with_arrow(GTK_WIDGET(nw), windata);
+ gtk_widget_queue_resize(nw);
}
else
{
More information about the Goodies-commits
mailing list