From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#64440: 30.0.50; [PATCH] Highlight on non toolkit menu bar items Date: Mon, 11 Sep 2023 14:32:39 +0200 Message-ID: <87cyyo28m0.fsf@ledu-giraud.fr> References: <87zg4d56l8.fsf@ledu-giraud.fr> <87ilaz1wol.fsf@ledu-giraud.fr> <87fs3xo13z.fsf@yahoo.com> <83zg259iwz.fsf@gnu.org> <878r9losil.fsf@ledu-giraud.fr> <83tts2scvp.fsf@gnu.org> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5036"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: luangruo@yahoo.com, stefankangas@gmail.com, 64440@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 11 14:33:13 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 1qfg6K-00016D-5b for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Sep 2023 14:33:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfg6C-000490-Fb; Mon, 11 Sep 2023 08:33:04 -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 1qfg67-00048H-38 for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 08:33: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 1qfg66-0003Yj-C7 for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 08:32:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfg6A-0003Lj-2a for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 08:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Sep 2023 12:33: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.169443557312861 (code B ref 64440); Mon, 11 Sep 2023 12:33:02 +0000 Original-Received: (at 64440) by debbugs.gnu.org; 11 Sep 2023 12:32:53 +0000 Original-Received: from localhost ([127.0.0.1]:52299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfg60-0003LM-FY for submit@debbugs.gnu.org; Mon, 11 Sep 2023 08:32:53 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]:23478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfg5u-0003LA-MU for 64440@debbugs.gnu.org; Mon, 11 Sep 2023 08:32:51 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=eX2jUf9L R9ntHdOSbM6fE4+pl/0kkb76XcTAktv6uHk=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=m083YX2LEL1uq3CgVrmjL87oBQMF5W zPOqIcT2nriixcx+pv8+d6ywW6/Q3oDbb71CVpcDGvlbVVklwLBCIBDA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=eX2jUf9LR9ntHdOS bM6fE4+pl/0kkb76XcTAktv6uHk=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=hERwPVg5JY+F/vNzu+MW7QILznOXoxIlLwKi4C lf+h7GilnULCQmWCQhgkDkx/Za9iRK21fg2MDxBosV99vscRQ/a2aOkl7DufLzi3Vpeyu1 4hfw3VqKhHWw8BIm3WotXWiCH8Hf8WAdVaGCec4IcZrYx44VHDUnOMUQbY6tn8U8sMA1aY hwDkgimyKfpxQH+XLGqMU6ZuG1trgl6GD46DEzbmnkhlwXGDaFp4I7vUxSkiC7ts6tR0VR 09gIaQMBnsWBeJsYcddrg6eeDEART26VBjUHIP4J6lNCdrELKLQ+WSTlAZ7RdjyIAbudmy UkpyA1j6QUZzBQoaZCIynHCQ== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 3aa1cb0b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 11 Sep 2023 14:32:40 +0200 (CEST) In-Reply-To: <83tts2scvp.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 10 Sep 2023 10:31:22 +0300") 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:270038 Archived-At: Eli Zaretskii writes: >> 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. Hi, Here's what a "p *row" returns right after the "row = MATRIX_ROW (w->current_matrix, *vpos);" line: (gdb) p *row $9 = { glyphs = {0xef4a19dd000, 0xef4a19dd000, 0xef4a19e0510, 0xef4a19e0510}, used = {0, 120, 0, 0}, hash = 221095522, x = 0, y = 0, pixel_width = 840, ascent = 11, height = 13, phys_ascent = 10, phys_height = 12, visible_height = 13, extra_line_spacing = 0, start = { pos = { charpos = 0, bytepos = 0 }, overlay_string_index = 0, string_pos = { charpos = 0, bytepos = 0 }, dpvec_index = 0 }, end = { pos = { charpos = 0, bytepos = 0 }, overlay_string_index = 0, string_pos = { charpos = 0, bytepos = 0 }, dpvec_index = 0 }, minpos = { charpos = 0, bytepos = 0 }, maxpos = { charpos = 0, bytepos = 0 }, overlay_arrow_bitmap = 0, left_user_fringe_bitmap = 0, right_user_fringe_bitmap = 0, left_fringe_bitmap = 0, right_fringe_bitmap = 0, left_user_fringe_face_id = 0, right_user_fringe_face_id = 0, left_fringe_face_id = 0, right_fringe_face_id = 0, left_fringe_offset = 0, right_fringe_offset = 0, fringe_bitmap_periodic_p = false, redraw_fringe_bitmaps_p = false, enabled_p = true, truncated_on_left_p = false, truncated_on_right_p = false, continued_p = false, displays_text_p = false, ends_at_zv_p = false, fill_line_p = false, indicate_empty_line_p = false, contains_overlapping_glyphs_p = false, full_width_p = true, mode_line_p = false, tab_line_p = false, overlapped_p = false, ends_in_middle_of_char_p = false, starts_in_middle_of_char_p = false, overlapping_p = false, mouse_face_p = false, ends_in_newline_from_string_p = false, exact_window_width_line_p = false, cursor_in_fringe_p = false, ends_in_ellipsis_p = false, indicate_bob_p = false, indicate_top_line_p = false, indicate_eob_p = false, indicate_bottom_line_p = false, reversed_p = false, stipple_p = false, continuation_lines_width = 0, clip = 0x0 } Is that what you are looking for? >> +/* 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. Yes, you are right. I'll had the #ifdef proposed by Po. >> --- 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? Same. -- Manuel Giraud