]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.264
- new
[packages/vim.git] / 7.2.264
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.264
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.2.264
11 Problem:    GTK2: When the Vim window is maximized setting 'columns' or
12             'lines' doesn't work.
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
15
16
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
19 ***************
20 *** 1386,1391 ****
21 --- 1386,1395 ----
22       int               min_height;
23       int               screen_w;
24       int               screen_h;
25 + #ifdef HAVE_GTK2
26 +     int               un_maximize = mustset;
27 +     int         did_adjust = 0;
28 + #endif
29   
30       if (!gui.shell_created)
31         return;
32 ***************
33 *** 1425,1446 ****
34             if (Columns < MIN_COLUMNS)
35                 Columns = MIN_COLUMNS;
36             width = Columns * gui.char_width + base_width;
37         }
38         if ((direction & RESIZE_VERT) && height > screen_h)
39         {
40             Rows = (screen_h - base_height) / gui.char_height;
41             check_shellsize();
42             height = Rows * gui.char_height + base_height;
43         }
44       }
45       gui.num_cols = Columns;
46       gui.num_rows = Rows;
47   
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;
52 ! # endif
53   
54       gui_mch_set_shellsize(width, height, min_width, min_height,
55                                           base_width, base_height, direction);
56 --- 1429,1475 ----
57             if (Columns < MIN_COLUMNS)
58                 Columns = MIN_COLUMNS;
59             width = Columns * gui.char_width + base_width;
60 + #ifdef HAVE_GTK2
61 +           ++did_adjust;
62 + #endif
63         }
64         if ((direction & RESIZE_VERT) && height > screen_h)
65         {
66             Rows = (screen_h - base_height) / gui.char_height;
67             check_shellsize();
68             height = Rows * gui.char_height + base_height;
69 + #ifdef HAVE_GTK2
70 +           ++did_adjust;
71 + #endif
72         }
73 + #ifdef HAVE_GTK2
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;
78 + #endif
79       }
80       gui.num_cols = Columns;
81       gui.num_rows = Rows;
82   
83       min_width = base_width + MIN_COLUMNS * gui.char_width;
84       min_height = base_height + MIN_LINES * gui.char_height;
85 ! #ifdef FEAT_WINDOWS
86       min_height += tabline_height() * gui.char_height;
87 ! #endif
88
89 ! #ifdef HAVE_GTK2
90 !     if (un_maximize)
91 !     {
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();
99 !     }
100 ! #endif
101   
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
106 ***************
107 *** 4376,4381 ****
108 --- 4376,4404 ----
109   #endif
110   #endif /* HAVE_GTK2 */
111   
112 + #if defined(HAVE_GTK2) || defined(PROTO)
113 + /*
114 +  * Return TRUE if the main window is maximized.
115 +  */
116 +     int
117 + gui_mch_maximized()
118 + {
119 +     return (gui.mainwin != NULL && gui.mainwin->window != NULL
120 +           && (gdk_window_get_state(gui.mainwin->window)
121 +                                              & GDK_WINDOW_STATE_MAXIMIZED));
122 + }
123
124 + /*
125 +  * Unmaximize the main window
126 +  */
127 +     void
128 + gui_mch_unmaximize()
129 + {
130 +     if (gui.mainwin != NULL)
131 +       gtk_window_unmaximize(GTK_WINDOW(gui.mainwin));
132 + }
133 + #endif
134
135   /*
136    * Set the windows size.
137    */
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
140 ***************
141 *** 16,21 ****
142 --- 16,23 ----
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
153 ***************
154 *** 678,679 ****
155 --- 678,681 ----
156   {   /* Add new patch number below this line */
157 + /**/
158 +     264,
159   /**/
160
161 -- 
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.
164
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    ///
This page took 0.035714 seconds and 3 git commands to generate.