Revision: 3666 http://geany.svn.sourceforge.net/geany/?rev=3666&view=rev Author: eht16 Date: 2009-03-27 16:25:57 +0000 (Fri, 27 Mar 2009)
Log Message: ----------- Allow negative window coordinates when saving and restoring the position of the main window. Restore the main window position and size *after* the window has been realised to get it positioned accordingly (this affects at least Windows).
Modified Paths: -------------- trunk/ChangeLog trunk/src/keyfile.c trunk/src/main.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-03-27 16:14:29 UTC (rev 3665) +++ trunk/ChangeLog 2009-03-27 16:25:57 UTC (rev 3666) @@ -3,6 +3,12 @@ * src/keyfile.c, src/utils.c, src/utils.h: Add utils_path_skip_root(), a relative path safe variant of g_path_skip_root (forgotten patch by Colomban Wendling, #2518658). + * src/keyfile.c, src/main.c: + Allow negative window coordinates when saving and restoring the + position of the main window. + Restore the main window position and size *after* the window has + been realised to get it positioned accordingly + (this affects at least Windows).
2009-03-26 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2009-03-27 16:14:29 UTC (rev 3665) +++ trunk/src/keyfile.c 2009-03-27 16:25:57 UTC (rev 3666) @@ -800,10 +800,10 @@ ui_prefs.geometry[4] = geo[4];
/* don't use insane values but when main windows was maximized last time, pos might be - * negative at least on Windows for some reason */ + * negative (due to differences in root window and window decorations) */ if (ui_prefs.geometry[4] != 1) { - for (i = 0; i < 4; i++) + for (i = 2; i < 4; i++) { if (ui_prefs.geometry[i] < -1) ui_prefs.geometry[i] = -1;
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2009-03-27 16:14:29 UTC (rev 3665) +++ trunk/src/main.c 2009-03-27 16:25:57 UTC (rev 3666) @@ -150,6 +150,17 @@ };
+static void setup_window_position(void) +{ + /* interprets the saved window geometry */ + if (prefs.save_winpos) + { + gtk_window_move(GTK_WINDOW(main_widgets.window), ui_prefs.geometry[0], ui_prefs.geometry[1]); + gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), ui_prefs.geometry[2], ui_prefs.geometry[3]); + if (ui_prefs.geometry[4] == 1) + gtk_window_maximize(GTK_WINDOW(main_widgets.window)); + } +}
/* special things for the initial setup of the checkboxes and related stuff * an action on a setting is only performed if the setting is not equal to the program default @@ -214,15 +225,6 @@
ui_update_view_editor_menu_items();
- /* interprets the saved window geometry */ - if (prefs.save_winpos && ui_prefs.geometry[0] != -1) - { - gtk_window_move(GTK_WINDOW(main_widgets.window), ui_prefs.geometry[0], ui_prefs.geometry[1]); - gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), ui_prefs.geometry[2], ui_prefs.geometry[3]); - if (ui_prefs.geometry[4] == 1) - gtk_window_maximize(GTK_WINDOW(main_widgets.window)); - } - /* hide statusbar if desired */ if (! interface_prefs.statusbar_visible) { @@ -1051,7 +1053,14 @@ build_menu_update(doc); treeviews_update_tag_list(doc, FALSE);
- /* finally realize the window to show the user what we have done */ +#ifdef G_OS_WIN32 + /* Manually realise the main window to be able to set the position but don't show it. + * We don't set the position after showing the window to avoid flickering. */ + gtk_widget_realize(main_widgets.window); +#endif + setup_window_position(); + + /* finally show the window */ gtk_widget_show(main_widgets.window); main_status.main_window_realized = TRUE;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.