From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59351: 29.0.50; [PATCH] Fix mouse click position to menu bar entry Date: Fri, 18 Nov 2022 13:58:19 +0200 Message-ID: <83o7t4bhk4.fsf@gnu.org> References: <87tu2wlku7.fsf@elite.giraud> <878rk8ee6d.fsf@yahoo.com> <8735agr0g4.fsf@elite.giraud> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40198"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 59351@debbugs.gnu.org To: Manuel Giraud Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 18 12:59:13 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow01Y-000AEw-Sy for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Nov 2022 12:59:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ow01P-0002IZ-T8; Fri, 18 Nov 2022 06:59:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow01O-0002IO-8V for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 06:59:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ow01O-0006yd-0K for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 06:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ow01N-0002oV-TE for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 06:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Nov 2022 11:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59351 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59351-submit@debbugs.gnu.org id=B59351.166877270710769 (code B ref 59351); Fri, 18 Nov 2022 11:59:01 +0000 Original-Received: (at 59351) by debbugs.gnu.org; 18 Nov 2022 11:58:27 +0000 Original-Received: from localhost ([127.0.0.1]:35514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow00o-0002nd-Pu for submit@debbugs.gnu.org; Fri, 18 Nov 2022 06:58:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow00k-0002nO-Rs for 59351@debbugs.gnu.org; Fri, 18 Nov 2022 06:58:24 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow00f-0006vq-7X; Fri, 18 Nov 2022 06:58:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+HAC60y7ppZX+qpxPokU3OtBJVsYg+4IetJ+y62PRYE=; b=bBChggqbBprP 92AuwD9sPO5aA+8x6tKU9Q9AOAw8LLIVSkVWnFnsw3c0l0PdSXU8YrOw3NFDt0GhZgYlCWter/cH2 ZotgOgd4WFU+OOVoIVyQYk8FfOPaQC4x9Z2Jh7eWQe2nNAax/duMxtZnyqFFPblahVNXqPrO5E4+u HzFAXRxm6IYTu6zwcJrRTAnGhAliMnPlOGTuYMoH229K7sQif8aLcJ9SfQNLcoJ1ReElLOnq8sQNR 6RrKrLXOMy1SiTTflA+zQxgiiU3nnALZxE2tyaQ4EEtLYbiR5FYxp+y6IHxQR2cNmmaLX1DUKON5W A7+8nsPqP3cPJHIY1Qo9EQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow00d-0002Kh-VN; Fri, 18 Nov 2022 06:58:16 -0500 In-Reply-To: <8735agr0g4.fsf@elite.giraud> (message from Manuel Giraud on Fri, 18 Nov 2022 12:01:15 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248208 Archived-At: > Cc: 59351@debbugs.gnu.org > From: Manuel Giraud > Date: Fri, 18 Nov 2022 12:01:15 +0100 > > diff --git a/src/keyboard.c b/src/keyboard.c > index 069cf0627b..5cc7209846 100644 > --- a/src/keyboard.c > +++ b/src/keyboard.c > @@ -5974,8 +5974,17 @@ make_lispy_event (struct input_event *event) > in a menu (non-toolkit version). */ > if (!toolkit_menubar_in_use (f)) > { > - pixel_to_glyph_coords (f, XFIXNUM (event->x), XFIXNUM (event->y), > - &column, &row, NULL, 1); > + int dummy; > + > + /* I guess this works because the menu bar is always > + at position (0, 0) in a frame. Should this changed > + and we need a way to calculate the correct position > + into the menu bar from the position of the event in > + the frame. */ > + x_y_to_hpos_vpos (XWINDOW (f->menu_bar_window), > + XFIXNUM (event->x), XFIXNUM (event->y), > + &column, &row, > + NULL, NULL, &dummy); Did you test the results on a TTY frame that has a mouse? Also, does this work after the user clicks the menu bar and Emacs drops down a menu for the menu item on which the user clicked? I don't remember what happens to the pseudo-window geometry when that happens.