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: Wed, 23 Nov 2022 19:31:15 +0200 Message-ID: <83y1s1y3vg.fsf@gnu.org> References: <87tu2wlku7.fsf@elite.giraud> <878rk8ee6d.fsf@yahoo.com> <8735agr0g4.fsf@elite.giraud> <83o7t4bhk4.fsf@gnu.org> <87zgcov1ps.fsf@elite.giraud> <8335agbai5.fsf@gnu.org> <875yfcuw5r.fsf@elite.giraud> <83r0y09td6.fsf@gnu.org> <87zgcotbw9.fsf@elite.giraud> <83iljc9k5s.fsf@gnu.org> <871qpt7hac.fsf@elite.giraud> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33993"; 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 Wed Nov 23 18:32: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 1oxtbZ-0008dM-3R for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Nov 2022 18:32:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxtbQ-0004ji-QM; Wed, 23 Nov 2022 12:32:04 -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 1oxtbO-0004jP-EV for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 12:32: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 1oxtbO-00016i-4Z for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 12:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxtbN-0000Ef-WD for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 12:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Nov 2022 17:32: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.1669224686844 (code B ref 59351); Wed, 23 Nov 2022 17:32:01 +0000 Original-Received: (at 59351) by debbugs.gnu.org; 23 Nov 2022 17:31:26 +0000 Original-Received: from localhost ([127.0.0.1]:56070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxtan-0000DU-Kx for submit@debbugs.gnu.org; Wed, 23 Nov 2022 12:31:26 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxtal-0000DA-6L for 59351@debbugs.gnu.org; Wed, 23 Nov 2022 12:31: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 1oxtae-00011b-AN; Wed, 23 Nov 2022 12:31:16 -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=sG8s8L1EwbkCHrtY6fnvJAMzK1dbMgMvPeI3ij7ctbw=; b=WySZp8SDjEaO Wzi8IihwfqQM0Pp4CwlVfKM3wUXHeVt9d0gPsXAZWH7l+pwMcWHE+0xP3YuUnqk/LaGKFR7lL34Cd OJ9oImIV8yeGQgg7gZt8MWRL8nTgRAYCj9rDYRArgSNx8KDg2W7K8dCd79bdUw0uTBuPFZ0Aq+ONO oIf2n+50upgyYLcSxoRUvXJSntJB0oCM8N/0EM7Z7ZSA985jEUyoSjgth+Ygy9WgPJe8HWZjWc5dq wwpVe6+hBYtONMH8i0IMprjdw2y3o2ketR/z6c2r/GAg2rf/DkA2MwuCfdcT48G2sCbZRxcBYm3/q Vsy9g0PiCvvixsSnEpuc4w==; 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 1oxtaN-0008P4-AN; Wed, 23 Nov 2022 12:31:03 -0500 In-Reply-To: <871qpt7hac.fsf@elite.giraud> (message from Manuel Giraud on Wed, 23 Nov 2022 17:43:39 +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:248760 Archived-At: > From: Manuel Giraud > Cc: luangruo@yahoo.com, 59351@debbugs.gnu.org > Date: Wed, 23 Nov 2022 17:43:39 +0100 > > This last step goes into this compute_line_metrics call. Everything > seems fine up to xdisp.c:22886. Before this conditional, I have the > following values: > > --8<---------------cut here---------------start------------->8--- > row->y = 0 > row->height = 31 > row->visible_height = 31 > max_y = 13 > --8<---------------cut here---------------end--------------->8--- > > And so after it, row->visible_height becomes 13. So maybe that is why > the menu bar is not update to have more height here. WDYT? Why do you think row->visible_height plays any role in this? Maybe I'm missing something, but it looks like it has nothing to do with the non-resizing of the menu bar. It looks like we never actually supported this situation. Think about it: in the no-toolkit build, the menu bar is just a window. A special kind of window, but a window nonetheless. And when a font changes, the dimensions of the window only change if we force that, it isn't automatic. If we don't force resizing, we keep the window at its dimensions and redisplay the text inside, so fewer or more lines of text will be visible in the window. And that is what happens here: we just take note that the menu bar will be partially visible, but don't do anything to resize the menu-bar window. What I think we need to do is something like this: /* Compute the total height of the lines. */ compute_line_metrics (&it); if (FRAME_WINDOW_P (it.f)) { struct glyph_row *row = it.glyph_row; if (row->y + row->height > WINDOW_BOX_HEIGHT_NO_MODE_LINE (w)) { FRAME_MENU_BAR_HEIGHT (it.f) = it.row->height; it.f->fonts_changed = true; } } I hope that setting the frame's fonts_changed flag will cause Emacs resize the menu-bar window. You should see a call to adjust_frame_glyphs from redisplay_internal; if that doesn't happen, perhaps we should force such a call right after display_menu_bar returns. Can you try this?