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#64440: 30.0.50; [PATCH] Highlight on non toolkit menu bar items Date: Sun, 10 Sep 2023 10:31:22 +0300 Message-ID: <83tts2scvp.fsf@gnu.org> References: <87zg4d56l8.fsf@ledu-giraud.fr> <87ilaz1wol.fsf@ledu-giraud.fr> <87fs3xo13z.fsf@yahoo.com> <83zg259iwz.fsf@gnu.org> <878r9losil.fsf@ledu-giraud.fr> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19577"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, stefankangas@gmail.com, 64440@debbugs.gnu.org To: Manuel Giraud Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 10 09:32:14 2023 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 1qfEvW-0004uV-73 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Sep 2023 09:32:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfEvJ-0006rs-1y; Sun, 10 Sep 2023 03:32:01 -0400 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 1qfEvH-0006rd-Rn for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 03:32:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfEvH-0007wQ-Jg for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 03:31:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfEvK-0003yR-6E for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 03:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Sep 2023 07:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64440 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64440-submit@debbugs.gnu.org id=B64440.169433111715260 (code B ref 64440); Sun, 10 Sep 2023 07:32:02 +0000 Original-Received: (at 64440) by debbugs.gnu.org; 10 Sep 2023 07:31:57 +0000 Original-Received: from localhost ([127.0.0.1]:48888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfEvF-0003y3-7n for submit@debbugs.gnu.org; Sun, 10 Sep 2023 03:31:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33160) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfEv9-0003xm-Bb for 64440@debbugs.gnu.org; Sun, 10 Sep 2023 03:31:55 -0400 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 1qfEv0-0007rP-1U; Sun, 10 Sep 2023 03:31:42 -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=HvTqN50f3601gUeiqJQ9UtE9C7ocSLmm9u/K89eSRM8=; b=DDNKhWzJlmKM /PTgqUYlDYXpA3wAmn2dBm2Bqz9XNfP3KW5UMwIbymIHWkWdvsghcR5s8sH9UF9lGAcrdzXwMgWG4 8SwwO14wlyj44l+xAXYpvdKziLram2zCiTC6yLngCzOkGFzSsSLlGlryN4iOcKNUW/MJ1KOohpTHr h8FV4N2xyVuay+rfZm6b/HDpw5iINaLHFJmcXoE05c82nbJK/o1q+OAEW3eV1OR+mn8NudP+EZlvE XAjRa7drBNWLVe60sxtsx/QLuIsMB2qRhoG1DHJyU5E9b6dOpYlEQbcu13bViMwcHZkw5/6GpUFzq 7JHSdERMRd5+0jdaUHqkRQ==; In-Reply-To: <878r9losil.fsf@ledu-giraud.fr> (message from Manuel Giraud on Tue, 05 Sep 2023 11:53:38 +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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:269920 Archived-At: > From: Manuel Giraud > Cc: Po Lu , stefankangas@gmail.com, 64440@debbugs.gnu.org > Date: Tue, 05 Sep 2023 11:53:38 +0200 > > Eli Zaretskii writes: > > > I'd appreciate a walkthrough of the patches with explanations for the > > significant hunks. It's a non-trivial change, so I think the > > rationale and the main ideas of the implementation should be described > > and discussed. > > Hi, > > For this walkthrough, I have inserted the 4 patches, made some elisions > and comment inline. Thanks. > + /* Convert to pixels bounds. */ > + row = MATRIX_ROW (w->current_matrix, *vpos); > + *x_start = 0; > + for (i = 0; i < *h_start; ++i) > + *x_start += row->glyphs[TEXT_AREA][i].pixel_width; > + > + *x_end = *x_start; > + for (i = *h_start; i < *h_end; ++i) > + *x_end += row->glyphs[TEXT_AREA][i].pixel_width; > > Here, I convert those limits from chars to pixels. What does this glyph_row look like? Does it include several strings one after the other or something? In general, we always test the index of a glyph in a glyph row against glyphs[TEXT_AREA].used, and I'm worried that these tests are absent from the code above. Which is why I'm asking for more details about the arrangement of the menu text in these glyph rows. > +/* Possibly highlight a menu-bar item on frame F when mouse moves to > + menu-bar window-relative coordinates X/Y. Called from > + note_mouse_highlight. */ > + > +static void > +note_menu_bar_highlight (struct frame *f, int x, int y) > +{ Is this function under a suitable #if condition? AFAIU, it is only appropriate in a build with X but without any toolkit, so it shouldn't be compiled in other configurations. > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -33878,6 +33878,9 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) > if (FRAME_WINDOW_P (f) && NILP (track_mouse)) > { > if (draw == DRAW_NORMAL_TEXT > +#ifndef HAVE_EXT_MENU_BAR > + && !EQ (hlinfo->mouse_face_window, f->menu_bar_window) > +#endif Won't this cpp conditional be true in a build --without-x? Should it? Thanks for working on this.