summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0301
blob: 71730f0a9bc4ecb125c414ad83202bf33d226a71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0301
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0301
Problem:    GTK: Input method popup displayed on wrong screen.
Solution:   Add the screen position offset. (Ken Takata, closes #3268)
Files:	    src/gui_beval.c, src/gui_gtk_x11.c, src/mbyte.c,
            src/proto/gui_gtk_x11.pro


*** ../vim-8.1.0300/src/gui_beval.c	2018-06-28 12:05:07.085006926 +0200
--- src/gui_beval.c	2018-08-19 22:45:48.731522222 +0200
***************
*** 944,949 ****
--- 944,951 ----
  	GtkRequisition	requisition;
  	int		screen_w;
  	int		screen_h;
+ 	int		screen_x;
+ 	int		screen_y;
  	int		x;
  	int		y;
  	int		x_offset = EVAL_OFFSET_X;
***************
*** 956,963 ****
  	screen = gtk_widget_get_screen(beval->target);
  	gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen);
  # endif
! 	gui_gtk_get_screen_size_of_win(beval->balloonShell,
! 							 &screen_w, &screen_h);
  # if !GTK_CHECK_VERSION(3,0,0)
  	gtk_widget_ensure_style(beval->balloonShell);
  	gtk_widget_ensure_style(beval->balloonLabel);
--- 958,965 ----
  	screen = gtk_widget_get_screen(beval->target);
  	gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen);
  # endif
! 	gui_gtk_get_screen_geom_of_win(beval->balloonShell,
! 				    &screen_x, &screen_y, &screen_w, &screen_h);
  # if !GTK_CHECK_VERSION(3,0,0)
  	gtk_widget_ensure_style(beval->balloonShell);
  	gtk_widget_ensure_style(beval->balloonLabel);
***************
*** 998,1011 ****
  	y += beval->y;
  
  	/* Get out of the way of the mouse pointer */
! 	if (x + x_offset + requisition.width > screen_w)
  	    y_offset += 15;
! 	if (y + y_offset + requisition.height > screen_h)
  	    y_offset = -requisition.height - EVAL_OFFSET_Y;
  
  	/* Sanitize values */
! 	x = CLAMP(x + x_offset, 0, MAX(0, screen_w - requisition.width));
! 	y = CLAMP(y + y_offset, 0, MAX(0, screen_h - requisition.height));
  
  	/* Show the balloon */
  # if GTK_CHECK_VERSION(3,0,0)
--- 1000,1015 ----
  	y += beval->y;
  
  	/* Get out of the way of the mouse pointer */
! 	if (x + x_offset + requisition.width > screen_x + screen_w)
  	    y_offset += 15;
! 	if (y + y_offset + requisition.height > screen_y + screen_h)
  	    y_offset = -requisition.height - EVAL_OFFSET_Y;
  
  	/* Sanitize values */
! 	x = CLAMP(x + x_offset, 0,
! 			    MAX(0, screen_x + screen_w - requisition.width));
! 	y = CLAMP(y + y_offset, 0,
! 			    MAX(0, screen_y + screen_h - requisition.height));
  
  	/* Show the balloon */
  # if GTK_CHECK_VERSION(3,0,0)
*** ../vim-8.1.0300/src/gui_gtk_x11.c	2018-08-07 20:01:34.245746660 +0200
--- src/gui_gtk_x11.c	2018-08-19 22:54:38.120976094 +0200
***************
*** 5008,5034 ****
  }
  
      void
! gui_gtk_get_screen_size_of_win(GtkWidget *wid, int *width, int *height)
  {
  #if GTK_CHECK_VERSION(3,22,0)
      GdkDisplay *dpy = gtk_widget_get_display(wid);
-     GdkWindow *win = gtk_widget_get_window(wid);
      GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
-     GdkRectangle geometry;
  
      gdk_monitor_get_geometry(monitor, &geometry);
-     *width = geometry.width;
-     *height = geometry.height;
  #else
      GdkScreen* screen;
  
      if (wid != NULL && gtk_widget_has_screen(wid))
  	screen = gtk_widget_get_screen(wid);
      else
  	screen = gdk_screen_get_default();
!     *width = gdk_screen_get_width(screen);
!     *height = gdk_screen_get_height(screen);
  #endif
  }
  
  /*
--- 5008,5042 ----
  }
  
      void
! gui_gtk_get_screen_geom_of_win(
! 	GtkWidget *wid,
! 	int *screen_x,
! 	int *screen_y,
! 	int *width,
! 	int *height)
  {
+     GdkRectangle geometry;
+     GdkWindow *win = gtk_widget_get_window(wid);
  #if GTK_CHECK_VERSION(3,22,0)
      GdkDisplay *dpy = gtk_widget_get_display(wid);
      GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
  
      gdk_monitor_get_geometry(monitor, &geometry);
  #else
      GdkScreen* screen;
+     int monitor;
  
      if (wid != NULL && gtk_widget_has_screen(wid))
  	screen = gtk_widget_get_screen(wid);
      else
  	screen = gdk_screen_get_default();
!     monitor = gdk_screen_get_monitor_at_window(screen, win);
!     gdk_screen_get_monitor_geometry(screen, monitor, &geometry);
  #endif
+     *screen_x = geometry.x;
+     *screen_y = geometry.y;
+     *width = geometry.width;
+     *height = geometry.height;
  }
  
  /*
***************
*** 5039,5045 ****
      void
  gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
  {
!     gui_gtk_get_screen_size_of_win(gui.mainwin, screen_w, screen_h);
  
      /* Subtract 'guiheadroom' from the height to allow some room for the
       * window manager (task list and window title bar). */
--- 5047,5055 ----
      void
  gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
  {
!     int	    x, y;
! 
!     gui_gtk_get_screen_geom_of_win(gui.mainwin, &x, &y, screen_w, screen_h);
  
      /* Subtract 'guiheadroom' from the height to allow some room for the
       * window manager (task list and window title bar). */
*** ../vim-8.1.0300/src/mbyte.c	2018-08-01 19:05:59.282223206 +0200
--- src/mbyte.c	2018-08-19 22:57:01.724150866 +0200
***************
*** 4951,4974 ****
       static void
  im_preedit_window_set_position(void)
  {
!     int x, y, w, h, sw, sh;
  
      if (preedit_window == NULL)
  	return;
  
!     gui_gtk_get_screen_size_of_win(preedit_window, &sw, &sh);
  #if GTK_CHECK_VERSION(3,0,0)
      gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y);
  #else
      gdk_window_get_origin(gui.drawarea->window, &x, &y);
  #endif
!     gtk_window_get_size(GTK_WINDOW(preedit_window), &w, &h);
      x = x + FILL_X(gui.col);
      y = y + FILL_Y(gui.row);
!     if (x + w > sw)
! 	x = sw - w;
!     if (y + h > sh)
! 	y = sh - h;
      gtk_window_move(GTK_WINDOW(preedit_window), x, y);
  }
  
--- 4951,4976 ----
       static void
  im_preedit_window_set_position(void)
  {
!     int x, y, width, height;
!     int screen_x, screen_y, screen_width, screen_height;
  
      if (preedit_window == NULL)
  	return;
  
!     gui_gtk_get_screen_geom_of_win(gui.drawarea,
! 			  &screen_x, &screen_y, &screen_width, &screen_height);
  #if GTK_CHECK_VERSION(3,0,0)
      gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y);
  #else
      gdk_window_get_origin(gui.drawarea->window, &x, &y);
  #endif
!     gtk_window_get_size(GTK_WINDOW(preedit_window), &width, &height);
      x = x + FILL_X(gui.col);
      y = y + FILL_Y(gui.row);
!     if (x + width > screen_x + screen_width)
! 	x = screen_x + screen_width - width;
!     if (y + height > screen_y + screen_height)
! 	y = screen_y + screen_height - height;
      gtk_window_move(GTK_WINDOW(preedit_window), x, y);
  }
  
*** ../vim-8.1.0300/src/proto/gui_gtk_x11.pro	2018-05-17 13:53:00.000000000 +0200
--- src/proto/gui_gtk_x11.pro	2018-08-19 22:57:22.476028708 +0200
***************
*** 25,31 ****
  void gui_mch_unmaximize(void);
  void gui_mch_newfont(void);
  void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction);
! void gui_gtk_get_screen_size_of_win(GtkWidget *wid, int *width, int *height);
  void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h);
  void gui_mch_settitle(char_u *title, char_u *icon);
  void gui_mch_enable_menu(int showit);
--- 25,31 ----
  void gui_mch_unmaximize(void);
  void gui_mch_newfont(void);
  void gui_mch_set_shellsize(int width, int height, int min_width, int min_height, int base_width, int base_height, int direction);
! void gui_gtk_get_screen_geom_of_win(GtkWidget *wid, int *screen_x, int *screen_y, int *width, int *height);
  void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h);
  void gui_mch_settitle(char_u *title, char_u *icon);
  void gui_mch_enable_menu(int showit);
*** ../vim-8.1.0300/src/version.c	2018-08-19 22:20:11.628993678 +0200
--- src/version.c	2018-08-19 22:48:57.714733757 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     301,
  /**/

-- 
SUPERIMPOSE "England AD 787".  After a few more seconds we hear hoofbeats in
the distance.  They come slowly closer.  Then out of the mist comes KING
ARTHUR followed by a SERVANT who is banging two half coconuts together.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///