X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fdialog%2Fdialog.cpp;h=ac147d65652230b5fbf53e55f01206de641ade64;hb=4d79affe53b5c0e7dbc67014aee9be5251dc56df;hp=1a4816c882fd9e5211e85269b2d61c3b5d7abed6;hpb=c87d0307348fcfdc65b6b4ab6999a3cb0de2431f;p=inkscape.git diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 1a4816c88..ac147d656 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -4,9 +4,10 @@ * * Author: * Bryce W. Harrington - * buliabyak@gmail.com + * buliabyak@gmail.com + * Johan Engelen * - * Copyright (C) 2004, 2005 Authors + * Copyright (C) 2004-2007 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -31,19 +32,22 @@ #include "interface.h" #include "verbs.h" + +#define MIN_ONSCREEN_DISTANCE 50 + + + namespace Inkscape { namespace UI { namespace Dialog { -#ifndef WIN32 -static bool +static gboolean sp_retransientize_again (gpointer dlgPtr) { Dialog *dlg = (Dialog *)dlgPtr; dlg->retransientize_suppress = false; return FALSE; // so that it is only called once } -#endif static void sp_retransientize (Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr) @@ -62,6 +66,7 @@ sp_dialog_shutdown (GtkObject *object, gpointer dlgPtr) void Dialog::present() { + _user_hidden = false; Gtk::Dialog::present(); } @@ -96,18 +101,16 @@ Dialog::read_geometry() // g_print ("read %d %d %d %d\n", x, y, w, h); - if (x<0) x=0; - if (y<0) y=0; - // If there are stored height and width values for the dialog, // resize the window to match; otherwise we leave it at its default if (w != 0 && h != 0) { resize (w, h); } - + // If there are stored values for where the dialog should be // located, then restore the dialog to that position. - if (x != -1000 && y != -1000) { + // also check if (x,y) is actually onscreen with the current screen dimensions + if ( (x >= 0) && (y >= 0) && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE)) ) { move(x, y); } else { // ...otherwise just put it in the middle of the screen @@ -168,9 +171,6 @@ Dialog::Dialog(const char *prefs_path, int verb_num, const char *apply_label) set_title(title); } - sp_transientize(dlg); - retransientize_suppress = false; - gtk_signal_connect( GTK_OBJECT (dlg), "event", GTK_SIGNAL_FUNC(sp_dialog_event_handler), dlg ); _hiddenF12 = false; @@ -193,6 +193,8 @@ Dialog::Dialog(const char *prefs_path, int verb_num, const char *apply_label) read_geometry(); present(); + sp_transientize(dlg); + retransientize_suppress = false; } Dialog::Dialog(BaseObjectType *gobj) @@ -287,10 +289,18 @@ Dialog::onDesktopActivated (SPDesktop *desktop) { gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2); - if (!transient_policy) +#ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs + if (prefs_get_int_attribute ( "options.dialogsontopwin32", "value", 0)) + transient_policy = 2; + else return; +#endif + + if (!transient_policy) + return; + + -#ifndef WIN32 GtkWindow *dialog_win = GTK_WINDOW(gobj()); if (retransientize_suppress) { @@ -324,7 +334,6 @@ Dialog::onDesktopActivated (SPDesktop *desktop) // we're done, allow next retransientizing not sooner than after 120 msec gtk_timeout_add (120, (GtkFunction) sp_retransientize_again, (gpointer) this); -#endif }