summaryrefslogtreecommitdiff
path: root/src/xfns.c
diff options
context:
space:
mode:
authorJan D <jhd@f20.localdomain>2015-02-27 18:46:26 +0100
committerJan D <jhd@f20.localdomain>2015-02-27 18:46:26 +0100
commit0537943561a37b54467bec19d1b8afbeba8e1e58 (patch)
tree314fc4a4f61da5b881aae1a7add66a498d21adb3 /src/xfns.c
parentb2a590d4e3dc692a97c1b53e015b945d84b4b4c7 (diff)
downloademacs-0537943561a37b54467bec19d1b8afbeba8e1e58.tar.gz
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/xfns.c')
-rw-r--r--src/xfns.c36
1 files changed, 29 insertions, 7 deletions
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,
int *x_pixels_diff,
int *y_pixels_diff,
int *xptr,
- int *yptr)
+ int *yptr,
+ int *outer_border)
{
int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
int real_x = 0, real_y = 0;
@@ -206,6 +207,16 @@ x_real_pos_and_offsets (struct frame *f,
x_catch_errors (dpy);
+ if (x_pixels_diff) *x_pixels_diff = 0;
+ if (y_pixels_diff) *y_pixels_diff = 0;
+ if (left_offset_x) *left_offset_x = 0;
+ if (top_offset_y) *top_offset_y = 0;
+ if (right_offset_x) *right_offset_x = 0;
+ if (bottom_offset_y) *bottom_offset_y = 0;
+ if (xptr) *xptr = 0;
+ if (yptr) *yptr = 0;
+ if (outer_border) *outer_border = 0;
+
if (win == dpyinfo->root_window)
win = FRAME_OUTER_WINDOW (f);
@@ -246,6 +257,13 @@ x_real_pos_and_offsets (struct frame *f,
XGetGeometry (FRAME_X_DISPLAY (f), win,
&rootw, &real_x, &real_y, &ow, &oh, &ign, &ign);
+ if (outer_border)
+ {
+ XWindowAttributes atts;
+ XGetWindowAttributes (FRAME_X_DISPLAY (f), win, &atts);
+ *outer_border = atts.border_width;
+ }
+
/* Translate real coordinates to coordinates relative to our
window. For our window, the upper left corner is 0, 0.
Since the upper left corner of the WM window is outside
@@ -328,7 +346,7 @@ x_real_pos_and_offsets (struct frame *f,
if (y_pixels_diff) *y_pixels_diff = -win_y;
if (left_offset_x) *left_offset_x = -outer_x;
- if (top_offset_y) *top_offset_y = -outer_x;
+ if (top_offset_y) *top_offset_y = -outer_y;
if (xptr) *xptr = real_x;
if (yptr) *yptr = real_y;
@@ -353,7 +371,8 @@ x_real_pos_and_offsets (struct frame *f,
void
x_real_positions (struct frame *f, int *xptr, int *yptr)
{
- x_real_pos_and_offsets (f, NULL, NULL, NULL, NULL, NULL, NULL, xptr, yptr);
+ x_real_pos_and_offsets (f, NULL, NULL, NULL, NULL, NULL, NULL, xptr, yptr,
+ NULL);
}
@@ -4324,7 +4343,7 @@ elements (all size values are in pixels).
Lisp_Object fullscreen = Fframe_parameter (frame, Qfullscreen);
int menu_bar_height, menu_bar_width, tool_bar_height, tool_bar_width;
- int left_off, right_off, top_off, bottom_off;
+ int left_off, right_off, top_off, bottom_off, outer_border;
XWindowAttributes atts;
block_input ();
@@ -4332,15 +4351,18 @@ elements (all size values are in pixels).
XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &atts);
x_real_pos_and_offsets (f, &left_off, &right_off, &top_off, &bottom_off,
- NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, &outer_border);
+
unblock_input ();
border = atts.border_width;
title = top_off;
- outer_width = FRAME_PIXEL_WIDTH (f) + 2 * border + right_off + left_off;
- outer_height = FRAME_PIXEL_HEIGHT (f) + 2 * border + top_off + bottom_off;
+ outer_width = atts.width + 2 * border + right_off + left_off
+ + 2 * outer_border;
+ outer_height = atts.height + 2 * border + top_off + bottom_off
+ + 2 * outer_border;
#if defined (USE_GTK)
{