[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0537943: Adjust offset and border calculations for
From: |
Jan D. |
Subject: |
[Emacs-diffs] master 0537943: Adjust offset and border calculations for X. |
Date: |
Fri, 27 Feb 2015 17:46:42 +0000 |
branch: master
commit 0537943561a37b54467bec19d1b8afbeba8e1e58
Author: Jan D <address@hidden>
Commit: Jan D <address@hidden>
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.
---
src/ChangeLog | 12 ++++++++++++
src/xfns.c | 36 +++++++++++++++++++++++++++++-------
src/xmenu.c | 2 +-
src/xterm.h | 3 ++-
4 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 61bb32164..df68791 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+2015-02-27 Jan Djärv <address@hidden>
+
+ * xterm.h (x_real_pos_and_offsets): Take outer_border as arg also.
+
+ * xmenu.c (x_menu_show): Adjust for new arg to x_real_pos_and_offsets.
+
+ * 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.
+
2015-02-27 Mark Laws <address@hidden>
Support daemon mode on MS-Windows (bug#19688)
diff --git a/src/xfns.c b/src/xfns.c
index 4fc92c3..bd1db10 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)
{
diff --git a/src/xmenu.c b/src/xmenu.c
index 5794f12..f183c70 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,
int left_off, top_off;
x_real_pos_and_offsets (f, &left_off, NULL, &top_off, NULL,
- NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL);
x += left_off;
y += top_off;
diff --git a/src/xterm.h b/src/xterm.h
index 16868f1..0366261 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -960,7 +960,8 @@ extern void 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);
/* From xrdb.c. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 0537943: Adjust offset and border calculations for X.,
Jan D. <=