summaryrefslogtreecommitdiffstats
path: root/src/gui.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2009-09-23 16:14:49 +0000
committerBram Moolenaar <Bram@vim.org>2009-09-23 16:14:49 +0000
commit09736232affa71893b93293cc9c4681b84b0cbf2 (patch)
treeb75925987f2f5279ec67ea670617a1118694b814 /src/gui.c
parent79ef6d642e7a5f8ee5333940e397f27e57268786 (diff)
updated for version 7.2-264v7.2.264
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/gui.c b/src/gui.c
index c25f760ea7..48e7b0fb08 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1386,6 +1386,10 @@ gui_set_shellsize(mustset, fit_to_display, direction)
int min_height;
int screen_w;
int screen_h;
+#ifdef HAVE_GTK2
+ int un_maximize = mustset;
+ int did_adjust = 0;
+#endif
if (!gui.shell_created)
return;
@@ -1425,22 +1429,47 @@ gui_set_shellsize(mustset, fit_to_display, direction)
if (Columns < MIN_COLUMNS)
Columns = MIN_COLUMNS;
width = Columns * gui.char_width + base_width;
+#ifdef HAVE_GTK2
+ ++did_adjust;
+#endif
}
if ((direction & RESIZE_VERT) && height > screen_h)
{
Rows = (screen_h - base_height) / gui.char_height;
check_shellsize();
height = Rows * gui.char_height + base_height;
+#ifdef HAVE_GTK2
+ ++did_adjust;
+#endif
}
+#ifdef HAVE_GTK2
+ if (did_adjust == 2 || (width + gui.char_width >= screen_w
+ && height + gui.char_height >= screen_h))
+ /* don't unmaximize if at maximum size */
+ un_maximize = FALSE;
+#endif
}
gui.num_cols = Columns;
gui.num_rows = Rows;
min_width = base_width + MIN_COLUMNS * gui.char_width;
min_height = base_height + MIN_LINES * gui.char_height;
-# ifdef FEAT_WINDOWS
+#ifdef FEAT_WINDOWS
min_height += tabline_height() * gui.char_height;
-# endif
+#endif
+
+#ifdef HAVE_GTK2
+ if (un_maximize)
+ {
+ /* If the window size is smaller than the screen unmaximize the
+ * window, otherwise resizing won't work. */
+ gui_mch_get_screen_dimensions(&screen_w, &screen_h);
+ if ((width + gui.char_width < screen_w
+ || height + gui.char_height * 2 < screen_h)
+ && gui_mch_maximized())
+ gui_mch_unmaximize();
+ }
+#endif
gui_mch_set_shellsize(width, height, min_width, min_height,
base_width, base_height, direction);