summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2013-03-03 20:30:04 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-03-03 11:56:51 -0800
commit9fcb28a6f5f5b9c3dcc6a6f40760cbe18f31f76f (patch)
tree2dfc81cb84ae5312acaa9a6b7f9e2bfba04022a6 /gtk-gui.c
parent0e7f0cc1ed98633ae3e8b855fc7a5051d3e37d42 (diff)
downloadsubsurface-9fcb28a6f5f5b9c3dcc6a6f40760cbe18f31f76f.tar.gz
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>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 6125db3f5..d06d06e6f 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -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);