From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: x-popup-menu pops up at funny positions Date: Sat, 4 Jan 2003 14:25:26 +0100 (CET) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200301041432.h04EWje8032078@stubby.bodenonline.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1041687454 16968 80.91.224.249 (4 Jan 2003 13:37:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 4 Jan 2003 13:37:34 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18UoUX-0004PK-00 for ; Sat, 04 Jan 2003 14:37:33 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18UoXe-0005p7-00 for ; Sat, 04 Jan 2003 14:40:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18UoV6-0000Qx-01 for emacs-devel@quimby.gnus.org; Sat, 04 Jan 2003 08:38:08 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18UoUi-0000KF-00 for emacs-devel@gnu.org; Sat, 04 Jan 2003 08:37:44 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18UoUZ-0008Vv-00 for emacs-devel@gnu.org; Sat, 04 Jan 2003 08:37:36 -0500 Original-Received: from stubby.bodenonline.com ([193.201.16.94]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18UoUO-0008S7-00; Sat, 04 Jan 2003 08:37:24 -0500 Original-Received: from accessno42.bodenonline.com (IDENT:root@accessno42.bodenonline.com [193.201.16.44]) h04EWje8032078; Sat, 4 Jan 2003 15:32:52 +0100 In-Reply-To: "from Richard Stallman at Jan 3, 2003 11:20:02 pm" Original-To: rms@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10459 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10459 > 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.