[Top][All Lists]

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

Re: x-popup-menu pops up at funny positions

From: Jan D.
Subject: Re: x-popup-menu pops up at funny positions
Date: Sat, 4 Jan 2003 14:25:26 +0100 (CET)

> Your patch changes two things:
> 1. It offsets the values for x_root and y_root but not for dummy.x and
> dummy.y.

When popping up a menu, only x_root and y_root are actually used.
But for correctnes sake, these should not be the same.

> 2. It deletes the code to read the current position.
> Why did you do #2?

Because it did not in fact read the current position.  It read
the position of the inner window in coordinates that are valid
for the parent window.  Now, if the parent window is the root
window, then it reads the current position.  But in all other
cases it does not.  For example, a window manager may put
any number of windows between the root window and the inner
window.  It may even put a window that is identical to the
inner window in size and placement as a parent to the inner
window (as the window manager I was running while testing does).

One could replace parent_desc with the root window, but it
seemd pointless to do a query to the X server when Emacs
has all the information already and a simple addition finds
the current position.

But I found more problems when x-popup-menu is supposed
to pop up at the mouse position.  It works if the mouse is in
the Emacs edit window, but not for any other case.  This is
because mouse_position_hook is called to get the pointer
position.  If the pointer is in the menu bar, x/y is the
position in the menu bar, not in the edit window.  So
if the pointer is in 1/1 in the menu bar, the code thinks
it is in 1/1 in the edit widget.  Similar errors occur
when the pointer is outside any Emacs window, or in the title
bar of the X window.

Replacing mouse_position_hook with a simple XQueryPointer
cures this.

        Jan D.

reply via email to

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