Fix pane position bug

Argh. Maxint is not at the bottom or at the right. We have to check
against the size of the window to determine we are not saving a maximized
position.  Here is a fix.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2013-03-03 20:30:04 +01:00 committed by Dirk Hohndel
parent 0e7f0cc1ed
commit 9fcb28a6f5

View file

@ -327,9 +327,12 @@ void save_pane_position()
{
gint vpane_position = gtk_paned_get_position(GTK_PANED(vpane));
gint hpane_position = gtk_paned_get_position(GTK_PANED(hpane));
if (vpane_position && vpane_position != 65535)
int window_width, window_height;
gtk_window_get_size(GTK_WINDOW (main_window), &window_width, &window_height);
if (vpane_position && vpane_position < window_height - 12)
subsurface_set_conf_int("vpane_position", vpane_position);
if (hpane_position && hpane_position != 65535)
if (hpane_position && hpane_position < window_width - 6 )
subsurface_set_conf_int("hpane_position", hpane_position);
}
@ -1198,7 +1201,7 @@ static void view_three(GtkWidget *w, gpointer data)
gtk_widget_get_allocation(hpane, &alloc);
if (hpane_position && hpane_position != 65535)
if (hpane_position)
gtk_paned_set_position(GTK_PANED(hpane), hpane_position);
else
gtk_paned_set_position(GTK_PANED(hpane), alloc.width/2);
@ -1206,7 +1209,7 @@ static void view_three(GtkWidget *w, gpointer data)
gtk_widget_get_allocation(vpane, &alloc);
gtk_widget_size_request(notebook, &requisition);
/* pick the requested size for the notebook plus 6 pixels for frame */
if (vpane_position && vpane_position != 65535)
if (vpane_position)
gtk_paned_set_position(GTK_PANED(vpane), vpane_position);
else
gtk_paned_set_position(GTK_PANED(vpane), requisition.height + 6);