4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: GTK2: When the Vim window is maximized setting 'columns' or
13 Solution: Unmaximize the window before setting the size. (Vitaly Minko)
14 Files: src/gui.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro
17 *** ../vim-7.2.263/src/gui.c 2009-07-29 11:10:31.000000000 +0200
18 --- src/gui.c 2009-09-23 16:28:09.000000000 +0200
26 + int un_maximize = mustset;
30 if (!gui.shell_created)
34 if (Columns < MIN_COLUMNS)
35 Columns = MIN_COLUMNS;
36 width = Columns * gui.char_width + base_width;
38 if ((direction & RESIZE_VERT) && height > screen_h)
40 Rows = (screen_h - base_height) / gui.char_height;
42 height = Rows * gui.char_height + base_height;
45 gui.num_cols = Columns;
48 min_width = base_width + MIN_COLUMNS * gui.char_width;
49 min_height = base_height + MIN_LINES * gui.char_height;
50 ! # ifdef FEAT_WINDOWS
51 min_height += tabline_height() * gui.char_height;
54 gui_mch_set_shellsize(width, height, min_width, min_height,
55 base_width, base_height, direction);
57 if (Columns < MIN_COLUMNS)
58 Columns = MIN_COLUMNS;
59 width = Columns * gui.char_width + base_width;
64 if ((direction & RESIZE_VERT) && height > screen_h)
66 Rows = (screen_h - base_height) / gui.char_height;
68 height = Rows * gui.char_height + base_height;
74 + if (did_adjust == 2 || (width + gui.char_width >= screen_w
75 + && height + gui.char_height >= screen_h))
76 + /* don't unmaximize if at maximum size */
77 + un_maximize = FALSE;
80 gui.num_cols = Columns;
83 min_width = base_width + MIN_COLUMNS * gui.char_width;
84 min_height = base_height + MIN_LINES * gui.char_height;
86 min_height += tabline_height() * gui.char_height;
92 ! /* If the window size is smaller than the screen unmaximize the
93 ! * window, otherwise resizing won't work. */
94 ! gui_mch_get_screen_dimensions(&screen_w, &screen_h);
95 ! if ((width + gui.char_width < screen_w
96 ! || height + gui.char_height * 2 < screen_h)
97 ! && gui_mch_maximized())
98 ! gui_mch_unmaximize();
102 gui_mch_set_shellsize(width, height, min_width, min_height,
103 base_width, base_height, direction);
104 *** ../vim-7.2.263/src/gui_gtk_x11.c 2009-09-23 17:35:17.000000000 +0200
105 --- src/gui_gtk_x11.c 2009-09-23 15:43:52.000000000 +0200
110 #endif /* HAVE_GTK2 */
112 + #if defined(HAVE_GTK2) || defined(PROTO)
114 + * Return TRUE if the main window is maximized.
117 + gui_mch_maximized()
119 + return (gui.mainwin != NULL && gui.mainwin->window != NULL
120 + && (gdk_window_get_state(gui.mainwin->window)
121 + & GDK_WINDOW_STATE_MAXIMIZED));
125 + * Unmaximize the main window
128 + gui_mch_unmaximize()
130 + if (gui.mainwin != NULL)
131 + gtk_window_unmaximize(GTK_WINDOW(gui.mainwin));
136 * Set the windows size.
138 *** ../vim-7.2.263/src/proto/gui_gtk_x11.pro 2007-05-05 19:18:54.000000000 +0200
139 --- src/proto/gui_gtk_x11.pro 2009-09-23 15:43:45.000000000 +0200
143 void gui_mch_exit __ARGS((int rc));
144 int gui_mch_get_winpos __ARGS((int *x, int *y));
145 void gui_mch_set_winpos __ARGS((int x, int y));
146 + int gui_mch_maximized __ARGS((void));
147 + void gui_mch_unmaximize __ARGS((void));
148 void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction));
149 void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h));
150 void gui_mch_settitle __ARGS((char_u *title, char_u *icon));
151 *** ../vim-7.2.263/src/version.c 2009-09-23 17:35:17.000000000 +0200
152 --- src/version.c 2009-09-23 18:12:21.000000000 +0200
156 { /* Add new patch number below this line */
162 hundred-and-one symptoms of being an internet addict:
163 268. You get up in the morning and go online before getting your coffee.
165 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
166 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
167 \\\ download, build and distribute -- http://www.A-A-P.org ///
168 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///