aboutsummaryrefslogtreecommitdiff
path: root/src/alertpanel.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-03-01 08:42:04 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-03-01 08:42:04 +0000
commitf632fff2b4dc230f7c9ce10681444fcacc301ba1 (patch)
treefde7e29e9fab54c92261f6967eb79dd0e7247706 /src/alertpanel.c
parent14d7714988f2f3887fdef04a7e18d701b3ee1912 (diff)
place alert dialog center if it is out of range.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1018 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/alertpanel.c')
-rw-r--r--src/alertpanel.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/alertpanel.c b/src/alertpanel.c
index 91e1559d..9e1313a8 100644
--- a/src/alertpanel.c
+++ b/src/alertpanel.c
@@ -29,6 +29,7 @@
#include <gdk/gdkkeysyms.h>
#include "alertpanel.h"
+#include "mainwindow.h"
#include "manage_window.h"
#include "utils.h"
#include "gtkutils.h"
@@ -169,9 +170,24 @@ void alertpanel_error(const gchar *format, ...)
static void alertpanel_show(void)
{
+ gint x, y, w, h, sx, sy;
value = G_ALERTWAIT;
inc_lock();
+
+ sx = gdk_screen_width();
+ sy = gdk_screen_height();
+ gdk_window_get_origin(dialog->window, &x, &y);
+ w = dialog->allocation.width;
+ h = dialog->allocation.height;
+ if (x < 0 || y < 0 || x + w > sx || y + h > sy) {
+ debug_print("sx, sy, x, y, w, h = %d, %d, %d, %d, %d, %d\n",
+ sx, sy, x, y, w, h);
+ debug_print("alert dialog position out of range\n");
+ gtk_window_set_position(GTK_WINDOW(dialog),
+ GTK_WIN_POS_CENTER_ALWAYS);
+ }
+
while ((value & G_ALERT_VALUE_MASK) == G_ALERTWAIT)
gtk_main_iteration();