From 9fc128b158b385eb6148d741114d4dfe6a3942a7 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sat, 6 Jan 2007 19:25:28 +0000 Subject: [PATCH] Special #ifdef win32 code to enable Dialogs on Top for windows. Note the removal of options from the global preferences on win32! just one option left: dialogs on top yes/no. Does have one "bug" though... read note! --- src/dialogs/dialog-events.cpp | 25 +++++++++++++++++++++---- src/preferences-skeleton.h | 3 +++ src/ui/dialog/dialog.cpp | 17 ++++++++++++----- src/ui/dialog/inkscape-preferences.cpp | 12 ++++++++++++ src/ui/dialog/inkscape-preferences.h | 5 +++++ src/ui/view/edit-widget.cpp | 2 -- src/widgets/desktop-widget.cpp | 5 ++--- 7 files changed, 55 insertions(+), 14 deletions(-) diff --git a/src/dialogs/dialog-events.cpp b/src/dialogs/dialog-events.cpp index deabcf383..c2ac1b12f 100644 --- a/src/dialogs/dialog-events.cpp +++ b/src/dialogs/dialog-events.cpp @@ -145,12 +145,24 @@ sp_dialog_event_handler (GtkWindow *win, GdkEvent *event, gpointer data) void sp_transientize (GtkWidget *dialog) { +#ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs + // _set_skip_taskbar_hint makes transient dialogs NON-transient! When dialogs + // are made transient (_set_transient_for), they are already removed from + // the taskbar in Win32. if (prefs_get_int_attribute ( "options.dialogsskiptaskbar", "value", 0)) { gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE); - } + } +#endif gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2 ); +#ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs + if (prefs_get_int_attribute ( "options.dialogsontopwin32", "value", 0)) + transient_policy = 2; + else + transient_policy = 0; +#endif + if (transient_policy) { // if there's an active document window, attach dialog to it as a transient: @@ -171,9 +183,14 @@ void sp_transientize_callback ( Inkscape::Application * /*inkscape*/, SPDesktop *desktop, win_data *wd ) { - gint transient_policy = - prefs_get_int_attribute_limited ( "options.transientpolicy", "value", - 1, 0, 2); + gint transient_policy = prefs_get_int_attribute_limited ( "options.transientpolicy", "value", 1, 0, 2); + +#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; diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index d18f07612..49cc63237 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -181,6 +181,9 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" +#ifdef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs +" \n" +#endif " \n" " \n" " \n" diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 8fb04a91f..d57083951 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -40,7 +40,7 @@ namespace Inkscape { namespace UI { namespace Dialog { -#ifndef WIN32 +//#ifndef WIN32 static gboolean sp_retransientize_again (gpointer dlgPtr) { @@ -48,7 +48,7 @@ sp_retransientize_again (gpointer dlgPtr) dlg->retransientize_suppress = false; return FALSE; // so that it is only called once } -#endif +//#endif static void sp_retransientize (Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr) @@ -290,10 +290,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) { @@ -327,7 +335,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 } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index caf86161a..aa0ab8c6f 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -408,21 +408,33 @@ void InkscapePreferences::initPageWindows() _win_ontop_normal.init ( _("Normal"), "options.transientpolicy", "value", 1, true, &_win_ontop_none); _win_ontop_agressive.init ( _("Aggressive"), "options.transientpolicy", "value", 2, false, &_win_ontop_none); +// FIXME: Temporary Win32 special code to enable transient dialogs +#ifdef WIN32 + _win_ontop_win32.init ( _("Dialogs stay on top (experimental!)"), "options.dialogsontopwin32", "value", false); +#endif + _page_windows.add_line( false, "", _win_save_geom, "", _("Save the window size and position with each document (only for Inkscape SVG format)")); +#ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs _page_windows.add_line( false, "", _win_hide_task, "", _("Whether dialog windows are to be hidden in the window manager taskbar")); +#endif _page_windows.add_line( false, "", _win_zoom_resize, "", _("Zoom drawing when document window is resized, to keep the same area visible (this is the default which can be changed in any window using the button above the right scrollbar)")); _page_windows.add_line( false, "", _win_show_close, "", _("Whether dialog windows have a close button (requires restart)")); _page_windows.add_group_header( _("Dialogs on top:")); +#ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs _page_windows.add_line( true, "", _win_ontop_none, "", _("Dialogs are treated as regular windows")); _page_windows.add_line( true, "", _win_ontop_normal, "", _("Dialogs stay on top of document windows")); _page_windows.add_line( true, "", _win_ontop_agressive, "", _("Same as Normal but may work better with some window managers")); +#else + _page_windows.add_line( false, "", _win_ontop_win32, "", + _("Whether dialogs should stay on top of document windows. Read the ReleaseNotes on this issue! (Rightclick the taskbar button and press 'Restore' to bring back a minimized document window)")); +#endif this->AddPage(_page_windows, _("Windows"), PREFS_PAGE_WINDOWS); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 4188268ec..9f052b1d3 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -115,6 +115,11 @@ protected: PrefRadioButton _win_ontop_none, _win_ontop_normal, _win_ontop_agressive; PrefCheckButton _win_save_geom, _win_hide_task, _win_zoom_resize , _win_show_close; +// FIXME: Temporary Win32 special code to enable transient dialogs +#ifdef WIN32 + PrefCheckButton _win_ontop_win32; +#endif + PrefCheckButton _calligrapy_use_abs_size; PrefCheckButton _calligrapy_keep_selected; diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 0053ea1b7..187ec04fa 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -1152,11 +1152,9 @@ EditWidget::setPosition (NR::Point p) void EditWidget::setTransient (void* p, int i) { -#ifndef WIN32 gtk_window_set_transient_for (static_cast(p), this->gobj()); if (i==2) this->Gtk::Window::present(); -#endif } NR::Point diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 106df37d7..c84292e50 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -765,12 +765,12 @@ SPDesktopWidget::setWindowSize (gint w, gint h) /** * \note transientizing does not work on windows; when you minimize a document * and then open it back, only its transient emerges and you cannot access - * the document window. + * the document window. The document window must be restored by rightclicking + * the taskbar button and pressing "Restore" */ void SPDesktopWidget::setWindowTransient (void *p, int transient_policy) { -#ifndef WIN32 GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(this))); if (w) { @@ -788,7 +788,6 @@ SPDesktopWidget::setWindowTransient (void *p, int transient_policy) // without this, a transient window not always emerges on top gtk_window_present (w); } -#endif } void -- 2.39.5