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).
pull/410/head
Geert Janssens 8 years ago
parent 4485966bec
commit 32e7994843

@ -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]);

Loading…
Cancel
Save