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#58406: 29.0.50; Bars refactoring? Date: Mon, 10 Oct 2022 11:45:31 +0300 Message-ID: <83y1togj84.fsf@gnu.org> References: <87a6641648.fsf@elite.giraud> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19975"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58406@debbugs.gnu.org To: Manuel Giraud Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 10 10:47:05 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 1ohoRE-0004zB-Ls for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Oct 2022 10:47:04 +0200 Original-Received: from localhost ([::1]:43560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohoRD-0006ZO-KW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Oct 2022 04:47:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohoQE-0006Y0-4K for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 04:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohoQD-00055h-Sk for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 04:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ohoQD-0000yQ-OG for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 04:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Oct 2022 08:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58406 X-GNU-PR-Package: emacs Original-Received: via spool by 58406-submit@debbugs.gnu.org id=B58406.16653915373708 (code B ref 58406); Mon, 10 Oct 2022 08:46:01 +0000 Original-Received: (at 58406) by debbugs.gnu.org; 10 Oct 2022 08:45:37 +0000 Original-Received: from localhost ([127.0.0.1]:45934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohoPo-0000xj-NT for submit@debbugs.gnu.org; Mon, 10 Oct 2022 04:45:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohoPm-0000xW-Le for 58406@debbugs.gnu.org; Mon, 10 Oct 2022 04:45:35 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohoPg-0004wj-Kn; Mon, 10 Oct 2022 04:45:28 -0400 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=KkxhU/eRxyivyKIi77tWtPbeYmd/ZAD8Ibsxvp1HsuI=; b=qjhaOvjxDx+u 0qzC7DGkt70l9nRvxgqrumMcRIm61iM5yP4AZkWv+sywLuE3JtMdEOJTiKvVHLiQK8fdSqAV3HVw0 CSM6gP5c6qn5UvqCIFV3WlKURZULZzEyjvYixQiM1YuzeIidRqwmOszprQEamIk7zHe0JwucuJfwH Q2ckhWs8G4Sz3lyvWoYQtcq29n3uBcuCtgfKhVXq6ToGDKxQTeryfqtLR2EeMtJyXE9yl2hKVZIi9 MtTOAtsZD1ww7faVTKKViIQDR8TfCVnB/qu6uwwdqlsdEy7DEsmidwtxEv4B9Cy+KvFiKoNrZ5Zlp ZDXAQD8yXUn9vFx/Vr+g5A==; Original-Received: from [87.69.77.57] (port=3543 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 1ohoPd-0003Ny-Fh; Mon, 10 Oct 2022 04:45:27 -0400 In-Reply-To: <87a6641648.fsf@elite.giraud> (message from Manuel Giraud on Mon, 10 Oct 2022 09:37:43 +0200) 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" Xref: news.gmane.io gmane.emacs.bugs:244996 Archived-At: > From: Manuel Giraud > Date: Mon, 10 Oct 2022 09:37:43 +0200 > > I'm trying to have some kind of highlight feature on the no-toolkit menu > bar. As this feature is already present in tool/tab bar, I'd like to > mimic those. > > While trying this, I think that I found that some "bar" functions could > be factorized (up to a certain point I guess). Here is a patch that > shows my direction. > > Do you think that this approach could make it into master or would it be > frown upon? And if so, what would be a better way? The approach is OK, and welcome. But let's please wait with this refactoring until after the emacs-29 branch is cut. OK? Some minor comments below: > + /* Get the text property `menu-item' at pos. The value of that > + property is the start index of this item's properties in > + F->tool_bar_items. */ The "F->tool_bar_items" part of the comment is outdated. Also, our style is to leave two spaces between sentences in comments and documentation. > + /* Get the start of this tool-bar item's properties in > + f->tool_bar_items. */ Likewise here: outdated reference to tool_bar_items. > + /* Is mouse on the highlighted item? */ > + if (bar == TAB_BAR) > + return *prop_idx == f->last_tab_bar_item ? 0 : 1; > + else if (EQ (window, hlinfo->mouse_face_window) > + && *vpos >= hlinfo->mouse_face_beg_row > + && *vpos <= hlinfo->mouse_face_end_row > + && (*vpos > hlinfo->mouse_face_beg_row > + || *hpos >= hlinfo->mouse_face_beg_col) > + && (*vpos < hlinfo->mouse_face_end_row > + || *hpos < hlinfo->mouse_face_end_col > + || hlinfo->mouse_face_past_end)) > + return 0; The "else if" clause should only be used for the tool bar, not for the menu bar, AFAIU. > @@ -15485,6 +15451,7 @@ handle_tool_bar_click_with_device (struct frame *f, int x, int y, bool down_p, > Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); > struct window *w = XWINDOW (f->tool_bar_window); > int hpos, vpos, prop_idx; > + bool close_p; The value of this is ignored here, so it is better to call this variable 'ignored' or 'dummy' or something to that effect.