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.devel Subject: Re: Menu bar items structure Date: Thu, 17 Nov 2022 13:16:29 +0200 Message-ID: <834juxesqa.fsf@gnu.org> References: <87pmdmkdrh.fsf@elite.giraud> <83iljednq6.fsf@gnu.org> <87sfiiezv0.fsf@yahoo.com> <87cz9lkino.fsf@elite.giraud> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7968"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, emacs-devel@gnu.org To: Manuel Giraud Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 17 12:17:20 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ovctU-0001mH-4L for ged-emacs-devel@m.gmane-mx.org; Thu, 17 Nov 2022 12:17:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovctH-0005Xy-Ft; Thu, 17 Nov 2022 06:17:07 -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 1ovcsi-0005Fe-ER for emacs-devel@gnu.org; Thu, 17 Nov 2022 06:16:35 -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 1ovcsg-0003yn-Op; Thu, 17 Nov 2022 06:16:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=nVRjsMaofJHjc/J+FMt/jZCY2m+o377Qo9wLPfBAvMI=; b=Bf/BtGNW0rlk5Tux49Qs Oex9Yj9UremDlNy5nenewVBn/tELHHufboAU5mJMb8Et3Qp3y7LE5jLaQ9pJr+JAc5f/fsfpvCD1Y 4Pwvk3R8xkiBDMmaCmCLaaI1UETFSAIctLtAQfWcrM/s8l7AlrBUdgxzMiaCtSUYZk88DKrXRdKt/ CZX+qXYvjCzNIttd7/HCfqrzCrnaVUIYBPK1M4d18xbjlDsvZ2hIhcrUyjVBdGBElXRtIK3oimGXz kSWCVATIcLZPvVFzcwWexX3OGc3itzCfryLpwCRbOOkO+tlmgf4zFkGtY6BhU6PS4HGX0R9iGaYkE 93+6pkl+S3taYg==; 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 1ovcse-0004k0-UN; Thu, 17 Nov 2022 06:16:30 -0500 In-Reply-To: <87cz9lkino.fsf@elite.giraud> (message from Manuel Giraud on Thu, 17 Nov 2022 10:57:31 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300040 Archived-At: > From: Manuel Giraud > Cc: Eli Zaretskii , emacs-devel@gnu.org > Date: Thu, 17 Nov 2022 10:57:31 +0100 > > The 4th element of a menu item is a char position in the menu bar for > this menu entry (filled with xdisp.c/display_menu_bar). This char > position is then used to identify if mouse click is on this menu entry > (around line 6000 of keyboard.c)… but that does not work well if you > have changed your menu face font (eg. with (set-face-font 'menu > "AnotherFont-20")). This seems to be because pixel_to_glyph_coords will > then be off. > > To overcome this issue my idea was two fold: > > 1- change the semantics of this index from a char position to a > pixel position > > 2- add a fifth element to a menu item that records the end > position of a menu entry (also in pixel and filled in > display_menu_bar) The first alternative is better, IMO: on TTY frames each character is 1 pixel, so the change doesn't affect TTY menus.