emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5917b79: Don't use OUTER_TO_INNER macros for plain


From: Jan D.
Subject: [Emacs-diffs] master 5917b79: Don't use OUTER_TO_INNER macros for plain X and lucid.
Date: Thu, 26 Feb 2015 15:42:13 +0000

branch: master
commit 5917b7907ad0cdc38f14967d16aa8472be572e3f
Author: Jan Djärv <address@hidden>
Commit: Jan Djärv <address@hidden>

    Don't use OUTER_TO_INNER macros for plain X and lucid.
    
    * xmenu.c (create_and_show_popup_menu): Call XTranslateCoordinates,
    dont use OUTER_TO_INNER macros.
    (x_menu_show): Call x_real_pos_and_offsets, don't use
    OUTER_TO_INNER macros.
---
 src/ChangeLog |    7 +++++++
 src/xmenu.c   |   31 +++++++++++++++++++++++++------
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index f0ec092..bf40436 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-26  Jan Djärv  <address@hidden>
+
+       * xmenu.c (create_and_show_popup_menu): Call XTranslateCoordinates,
+       dont use OUTER_TO_INNER macros.
+       (x_menu_show): Call x_real_pos_and_offsets, don't use
+       OUTER_TO_INNER macros.
+
 2015-02-26  Eli Zaretskii  <address@hidden>
 
        * dispextern.h (FACE_FOR_CHAR): Fix the commentary.
diff --git a/src/xmenu.c b/src/xmenu.c
index c9f150f..5794f12 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1313,6 +1313,7 @@ create_and_show_popup_menu (struct frame *f, widget_value 
*first_wv,
   XButtonPressedEvent *event = &(dummy.xbutton);
   LWLIB_ID menu_id;
   Widget menu;
+  Window dummy_window;
 
   eassert (FRAME_X_P (f));
 
@@ -1338,8 +1339,20 @@ create_and_show_popup_menu (struct frame *f, 
widget_value *first_wv,
   event->y = y;
 
   /* Adjust coordinates to be root-window-relative.  */
-  x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
-  y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
+  block_input ();
+  x += FRAME_LEFT_SCROLL_BAR_AREA_WIDTH (f);
+  XTranslateCoordinates (FRAME_X_DISPLAY (f),
+
+                         /* From-window, to-window.  */
+                         FRAME_X_WINDOW (f),
+                         FRAME_DISPLAY_INFO (f)->root_window,
+
+                         /* From-position, to-position.  */
+                         x, y, &x, &y,
+
+                         /* Child of win.  */
+                         &dummy_window);
+  unblock_input ();
 
   event->x_root = x;
   event->y_root = y;
@@ -2059,12 +2072,18 @@ x_menu_show (struct frame *f, int x, int y, int 
menuflags,
   inhibit_garbage_collection ();
 
 #ifdef HAVE_X_WINDOWS
-  /* Adjust coordinates to relative to the outer (window manager) window.  */
-  x += FRAME_OUTER_TO_INNER_DIFF_X (f);
-  y += FRAME_OUTER_TO_INNER_DIFF_Y (f);
+  {
+    /* Adjust coordinates to relative to the outer (window manager) window. */
+    int left_off, top_off;
+
+    x_real_pos_and_offsets (f, &left_off, NULL, &top_off, NULL,
+                            NULL, NULL, NULL, NULL);
+
+    x += left_off;
+    y += top_off;
+  }
 #endif /* HAVE_X_WINDOWS */
 
-  /* Adjust coordinates to be root-window-relative.  */
   x += f->left_pos;
   y += f->top_pos;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]