unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan D." <jan.h.d@swipnet.se>
Subject: Re: x-popup-menu pops up at funny positions
Date: Fri, 03 Jan 2003 18:14:12 +0100	[thread overview]
Message-ID: <3E15C4E4.5060508@swipnet.se> (raw)
In-Reply-To: 3E15B716.6080301@swipnet.se

[-- Attachment #1: Type: text/plain, Size: 725 bytes --]

Jan D. wrote:
> Hello.
> 
> While trying to reproduce a reported problem with x-popup-menu (that 
> problem seems to be gone), I saw that x-popup-menu doesn't put the menu 
> in the correct position if the (x y) variant is used, like this:
> 
> (x-popup-menu
>  (list '(1 1) (selected-window))
>  (list "title" (cons "title" '(("ignore" 'ignore)))
>        ))
> 
> For lucid and motif, this puts the popup menu at a position that would 
> be correct if the Emacs edit window is at (0 0) on the root window.  If 
> Emacs is
> anywhere else on the root window, this is wrong.
> 
> Here is a patch to fix that.  Is it OK to check in?

Since I normally don't use the menu bar, I got it wrong.  Here is a correct patch.

	Jan D.


[-- Attachment #2: xmenu.c.patch --]
[-- Type: text/plain, Size: 2335 bytes --]

Index: src/xmenu.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xmenu.c,v
retrieving revision 1.239
diff -c -r1.239 xmenu.c
*** src/xmenu.c	23 Dec 2002 18:06:42 -0000	1.239
--- src/xmenu.c	3 Jan 2003 17:12:49 -0000
***************
*** 2279,2315 ****
  			   popup_deactivate_callback,
  			   menu_highlight_callback);
  
-   /* Adjust coordinates to relative to the outer (window manager) window.  */
-   {
-     Window child;
-     int win_x = 0, win_y = 0;
- 
-     /* Find the position of the outside upper-left corner of
-        the inner window, with respect to the outer window.  */
-     if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
-       {
- 	BLOCK_INPUT;
- 	XTranslateCoordinates (FRAME_X_DISPLAY (f),
- 
- 			       /* From-window, to-window.  */
- 			       f->output_data.x->window_desc,
- 			       f->output_data.x->parent_desc,
- 
- 			       /* From-position, to-position.  */
- 			       0, 0, &win_x, &win_y,
- 
- 			       /* Child of window.  */
- 			       &child);
- 	UNBLOCK_INPUT;
- 	x += win_x;
- 	y += win_y;
-       }
-   }
- 
-   /* Adjust coordinates to be root-window-relative.  */
-   x += f->output_data.x->left_pos;
-   y += f->output_data.x->top_pos;
- 
    dummy.type = ButtonPress;
    dummy.serial = 0;
    dummy.send_event = 0;
--- 2279,2284 ----
***************
*** 2318,2327 ****
    dummy.root = FRAME_X_DISPLAY_INFO (f)->root_window;
    dummy.window = dummy.root;
    dummy.subwindow = dummy.root;
-   dummy.x_root = x;
-   dummy.y_root = y;
    dummy.x = x;
    dummy.y = y;
    dummy.state = (FRAME_X_DISPLAY_INFO (f)->grabbed >> 1) * Button1Mask;
    dummy.button = 0;
    for (i = 0; i < 5; i++)
--- 2287,2302 ----
    dummy.root = FRAME_X_DISPLAY_INFO (f)->root_window;
    dummy.window = dummy.root;
    dummy.subwindow = dummy.root;
    dummy.x = x;
    dummy.y = y;
+   /* Adjust coordinates to be root-window-relative.  */
+   x += f->output_data.x->left_pos + f->output_data.x->x_pixels_diff;
+   y += f->output_data.x->top_pos
+     + f->output_data.x->menubar_height
+     + f->output_data.x->y_pixels_outer_diff;
+   
+   dummy.x_root = x;
+   dummy.y_root = y;
    dummy.state = (FRAME_X_DISPLAY_INFO (f)->grabbed >> 1) * Button1Mask;
    dummy.button = 0;
    for (i = 0; i < 5; i++)

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2003-01-03 17:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03 16:15 x-popup-menu pops up at funny positions Jan D.
2003-01-03 17:14 ` Jan D. [this message]
2003-01-04  4:20 ` Richard Stallman
2003-01-04 13:25   ` Jan D.
2003-01-05 18:33     ` Richard Stallman
2003-01-05 22:05       ` Jan D.
2003-01-06  0:13         ` Jan D.
2003-01-06 17:13         ` Richard Stallman
2003-01-06 18:41           ` Jan D.
2003-01-07 13:40             ` Richard Stallman
2003-01-07 17:47               ` Jan D.
2003-01-08  8:00                 ` Richard Stallman
2003-01-08 20:07                   ` Jan D.
  -- strict thread matches above, loose matches on Subject: below --
2003-01-06 18:46 Jan D.
2003-01-09  7:27 ` Richard Stallman
2003-01-09 21:02   ` Jan D.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E15C4E4.5060508@swipnet.se \
    --to=jan.h.d@swipnet.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).