aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan D2015-02-27 18:46:26 +0100
committerJan D2015-02-27 18:46:26 +0100
commit0537943561a37b54467bec19d1b8afbeba8e1e58 (patch)
tree314fc4a4f61da5b881aae1a7add66a498d21adb3 /src
parentb2a590d4e3dc692a97c1b53e015b945d84b4b4c7 (diff)
downloademacs-0537943561a37b54467bec19d1b8afbeba8e1e58.tar.gz
emacs-0537943561a37b54467bec19d1b8afbeba8e1e58.zip
Adjust offset and border calculations for X.
* xfns.c (x_real_pos_and_offsets): Take outer_border as arg also. Initialize all args. Get outer_border from window attributes. Fix typo for top_offset_y. (x_real_positions): Adjust for new arg to x_real_pos_and_offsets. (Fx_frame_geometry): Get outer_border also. Use attrs.width/height. * xmenu.c (x_menu_show): Adjust for new arg to x_real_pos_and_offsets. * xterm.h (x_real_pos_and_offsets): Take outer_border as arg also.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/xfns.c36
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xterm.h3
4 files changed, 44 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 61bb321649f..df687914911 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12015-02-27 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xterm.h (x_real_pos_and_offsets): Take outer_border as arg also.
4
5 * xmenu.c (x_menu_show): Adjust for new arg to x_real_pos_and_offsets.
6
7 * xfns.c (x_real_pos_and_offsets): Take outer_border as arg also.
8 Initialize all args. Get outer_border from window attributes.
9 Fix typo for top_offset_y.
10 (x_real_positions): Adjust for new arg to x_real_pos_and_offsets.
11 (Fx_frame_geometry): Get outer_border also. Use attrs.width/height.
12
12015-02-27 Mark Laws <mdl@60hz.org> 132015-02-27 Mark Laws <mdl@60hz.org>
2 14
3 Support daemon mode on MS-Windows (bug#19688) 15 Support daemon mode on MS-Windows (bug#19688)
diff --git a/src/xfns.c b/src/xfns.c
index 4fc92c3fed2..bd1db1013d0 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -186,7 +186,8 @@ x_real_pos_and_offsets (struct frame *f,
186 int *x_pixels_diff, 186 int *x_pixels_diff,
187 int *y_pixels_diff, 187 int *y_pixels_diff,
188 int *xptr, 188 int *xptr,
189 int *yptr) 189 int *yptr,
190 int *outer_border)
190{ 191{
191 int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0); 192 int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
192 int real_x = 0, real_y = 0; 193 int real_x = 0, real_y = 0;
@@ -206,6 +207,16 @@ x_real_pos_and_offsets (struct frame *f,
206 207
207 x_catch_errors (dpy); 208 x_catch_errors (dpy);
208 209
210 if (x_pixels_diff) *x_pixels_diff = 0;
211 if (y_pixels_diff) *y_pixels_diff = 0;
212 if (left_offset_x) *left_offset_x = 0;
213 if (top_offset_y) *top_offset_y = 0;
214 if (right_offset_x) *right_offset_x = 0;
215 if (bottom_offset_y) *bottom_offset_y = 0;
216 if (xptr) *xptr = 0;
217 if (yptr) *yptr = 0;
218 if (outer_border) *outer_border = 0;
219
209 if (win == dpyinfo->root_window) 220 if (win == dpyinfo->root_window)
210 win = FRAME_OUTER_WINDOW (f); 221 win = FRAME_OUTER_WINDOW (f);
211 222
@@ -246,6 +257,13 @@ x_real_pos_and_offsets (struct frame *f,
246 XGetGeometry (FRAME_X_DISPLAY (f), win, 257 XGetGeometry (FRAME_X_DISPLAY (f), win,
247 &rootw, &real_x, &real_y, &ow, &oh, &ign, &ign); 258 &rootw, &real_x, &real_y, &ow, &oh, &ign, &ign);
248 259
260 if (outer_border)
261 {
262 XWindowAttributes atts;
263 XGetWindowAttributes (FRAME_X_DISPLAY (f), win, &atts);
264 *outer_border = atts.border_width;
265 }
266
249 /* Translate real coordinates to coordinates relative to our 267 /* Translate real coordinates to coordinates relative to our
250 window. For our window, the upper left corner is 0, 0. 268 window. For our window, the upper left corner is 0, 0.
251 Since the upper left corner of the WM window is outside 269 Since the upper left corner of the WM window is outside
@@ -328,7 +346,7 @@ x_real_pos_and_offsets (struct frame *f,
328 if (y_pixels_diff) *y_pixels_diff = -win_y; 346 if (y_pixels_diff) *y_pixels_diff = -win_y;
329 347
330 if (left_offset_x) *left_offset_x = -outer_x; 348 if (left_offset_x) *left_offset_x = -outer_x;
331 if (top_offset_y) *top_offset_y = -outer_x; 349 if (top_offset_y) *top_offset_y = -outer_y;
332 350
333 if (xptr) *xptr = real_x; 351 if (xptr) *xptr = real_x;
334 if (yptr) *yptr = real_y; 352 if (yptr) *yptr = real_y;
@@ -353,7 +371,8 @@ x_real_pos_and_offsets (struct frame *f,
353void 371void
354x_real_positions (struct frame *f, int *xptr, int *yptr) 372x_real_positions (struct frame *f, int *xptr, int *yptr)
355{ 373{
356 x_real_pos_and_offsets (f, NULL, NULL, NULL, NULL, NULL, NULL, xptr, yptr); 374 x_real_pos_and_offsets (f, NULL, NULL, NULL, NULL, NULL, NULL, xptr, yptr,
375 NULL);
357} 376}
358 377
359 378
@@ -4324,7 +4343,7 @@ elements (all size values are in pixels).
4324 Lisp_Object fullscreen = Fframe_parameter (frame, Qfullscreen); 4343 Lisp_Object fullscreen = Fframe_parameter (frame, Qfullscreen);
4325 int menu_bar_height, menu_bar_width, tool_bar_height, tool_bar_width; 4344 int menu_bar_height, menu_bar_width, tool_bar_height, tool_bar_width;
4326 4345
4327 int left_off, right_off, top_off, bottom_off; 4346 int left_off, right_off, top_off, bottom_off, outer_border;
4328 XWindowAttributes atts; 4347 XWindowAttributes atts;
4329 4348
4330 block_input (); 4349 block_input ();
@@ -4332,15 +4351,18 @@ elements (all size values are in pixels).
4332 XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &atts); 4351 XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &atts);
4333 4352
4334 x_real_pos_and_offsets (f, &left_off, &right_off, &top_off, &bottom_off, 4353 x_real_pos_and_offsets (f, &left_off, &right_off, &top_off, &bottom_off,
4335 NULL, NULL, NULL, NULL); 4354 NULL, NULL, NULL, NULL, &outer_border);
4355
4336 4356
4337 unblock_input (); 4357 unblock_input ();
4338 4358
4339 border = atts.border_width; 4359 border = atts.border_width;
4340 title = top_off; 4360 title = top_off;
4341 4361
4342 outer_width = FRAME_PIXEL_WIDTH (f) + 2 * border + right_off + left_off; 4362 outer_width = atts.width + 2 * border + right_off + left_off
4343 outer_height = FRAME_PIXEL_HEIGHT (f) + 2 * border + top_off + bottom_off; 4363 + 2 * outer_border;
4364 outer_height = atts.height + 2 * border + top_off + bottom_off
4365 + 2 * outer_border;
4344 4366
4345#if defined (USE_GTK) 4367#if defined (USE_GTK)
4346 { 4368 {
diff --git a/src/xmenu.c b/src/xmenu.c
index 5794f12ccb7..f183c70b110 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -2077,7 +2077,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
2077 int left_off, top_off; 2077 int left_off, top_off;
2078 2078
2079 x_real_pos_and_offsets (f, &left_off, NULL, &top_off, NULL, 2079 x_real_pos_and_offsets (f, &left_off, NULL, &top_off, NULL,
2080 NULL, NULL, NULL, NULL); 2080 NULL, NULL, NULL, NULL, NULL);
2081 2081
2082 x += left_off; 2082 x += left_off;
2083 y += top_off; 2083 y += top_off;
diff --git a/src/xterm.h b/src/xterm.h
index 16868f114e8..0366261b2f4 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -960,7 +960,8 @@ extern void x_real_pos_and_offsets (struct frame *f,
960 int *x_pixels_diff, 960 int *x_pixels_diff,
961 int *y_pixels_diff, 961 int *y_pixels_diff,
962 int *xptr, 962 int *xptr,
963 int *yptr); 963 int *yptr,
964 int *outer_border);
964 965
965/* From xrdb.c. */ 966/* From xrdb.c. */
966 967