From f632fff2b4dc230f7c9ce10681444fcacc301ba1 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 1 Mar 2006 08:42:04 +0000 Subject: 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 --- ChangeLog | 6 ++++++ ChangeLog.ja | 6 ++++++ src/alertpanel.c | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2c7fddf8..9296dc3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-01 + + * src/alertpanel.c: place dialog center if it is out of range (fixes + main window becomes not responsive when alert dialog is shown while + it is minimized on win32). + 2006-03-01 * src/main.c: win32: do console initialization only once. diff --git a/ChangeLog.ja b/ChangeLog.ja index 9865570e..535ea4fe 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,9 @@ +2006-03-01 + + * src/alertpanel.c: ダイアログが範囲外の位置にあれば中央に配置する + ようにした(win32 においてメインウィンドウが最小化されているときに + 警告ダイアログが表示された場合操作不能になるのを修正)。 + 2006-03-01 * src/main.c: win32: コンソールの初期化を一度だけしか行わないように 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 #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(); -- cgit v1.2.3