gnucash maint: Restore mechanism to prevent windows from being restored off-screen on opening a book

Geert Janssens gjanssens at code.gnucash.org
Thu Jun 21 10:23:26 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/32e79948 (commit)
	from  https://github.com/Gnucash/gnucash/commit/4485966b (commit)



commit 32e799484313dc3390f97fca38f6906e7c683048
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Thu Jun 21 16:23:20 2018 +0200

    Restore mechanism to prevent windows from being restored off-screen on opening a book
    
    This got disabled in commit 54019608ee in the gtk3 refactoring by accident.
    While we now no longer save the negative coordinates for hidden windows,
    there are still other situations in which this could happen, like switching
    from a dual monitor to a single monitor setup (common with laptops).

diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 1b0b651..d28da6b 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -762,15 +762,15 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
         g_warning("invalid number of values for group %s key %s",
                   window_group, WINDOW_POSITION);
     }
-// This does not do any thing ?
-//    else if ((pos[0] + (geom ? geom[0] : 0) < 0) ||
-//             (pos[0] > gdk_screen_width()) ||
-//             (pos[1] + (geom ? geom[1] : 0) < 0) ||
-//             (pos[1] > gdk_screen_height()))
-//    {
-//    g_debug("position %dx%d, size%dx%d is offscreen; will not move",
-//	    pos[0], pos[1], geom[0], geom[1]);
-//    }
+    /* Prevent restoring coordinates if this would move the window off-screen */
+    else if ((pos[0] + (geom ? geom[0] : 0) < 0) ||
+             (pos[0] > gdk_screen_width()) ||
+             (pos[1] + (geom ? geom[1] : 0) < 0) ||
+             (pos[1] > gdk_screen_height()))
+    {
+        g_debug("position %dx%d, size%dx%d is offscreen; will not move",
+                pos[0], pos[1], geom[0], geom[1]);
+    }
     else
     {
         gtk_window_move(GTK_WINDOW(window), pos[0], pos[1]);



Summary of changes:
 gnucash/gnome-utils/gnc-main-window.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)



More information about the gnucash-changes mailing list