r22284 - gnucash/trunk/src/gnome-utils - Avoid windows with saved positions to reopen off-screen if possible
Geert Janssens
gjanssens at code.gnucash.org
Sat Aug 4 12:08:44 EDT 2012
Author: gjanssens
Date: 2012-08-04 12:08:43 -0400 (Sat, 04 Aug 2012)
New Revision: 22284
Trac: http://svn.gnucash.org/trac/changeset/22284
Modified:
gnucash/trunk/src/gnome-utils/dialog-utils.c
Log:
Avoid windows with saved positions to reopen off-screen if possible
Modified: gnucash/trunk/src/gnome-utils/dialog-utils.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-utils.c 2012-08-04 16:08:31 UTC (rev 22283)
+++ gnucash/trunk/src/gnome-utils/dialog-utils.c 2012-08-04 16:08:43 UTC (rev 22284)
@@ -164,9 +164,20 @@
GCONF_VALUE_INT, NULL);
if (coord_list)
{
+ gint screen_width = gdk_screen_width();
+ gint screen_height = gdk_screen_height();
+
coords[0] = GPOINTER_TO_INT(g_slist_nth_data(coord_list, 0));
coords[1] = GPOINTER_TO_INT(g_slist_nth_data(coord_list, 1));
- DEBUG("coords[0]: %d, coords[1]: %d", coords[0], coords[1]);
+ DEBUG("from gconf - coords[0]: %d, coords[1]: %d", coords[0], coords[1]);
+
+ /* Keep the window on screen if possible */
+ if (screen_width != 0)
+ coords[0] = coords[0] % screen_width;
+ if (screen_height != 0)
+ coords[1] = coords[1] % screen_height;
+ DEBUG("after screen adaption - coords[0]: %d, coords[1]: %d", coords[0], coords[1]);
+
gtk_window_move(window, coords[0], coords[1]);
g_slist_free(coord_list);
}
More information about the gnucash-changes
mailing list