all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Manuel Giraud <manuel@ledu-giraud.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 59778@debbugs.gnu.org
Subject: bug#59778: 30.0.50; [PATCH] Fix boxed menu bar in non-toolkit X builds
Date: Sat, 03 Dec 2022 22:59:03 +0100	[thread overview]
Message-ID: <87wn78b13s.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <83cz90ck64.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Dec 2022 22:21:55 +0200")

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks, this LGTM.  Could you please rebase on the current HEAD of the
> master branch and resubmit?  The patch doesn't apply otherwise.

Thanks Eli.  Here a new version compiled and (lighly) tested.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-a-boxed-menu-bar-have-a-shadow-at-its-right-end.patch --]
[-- Type: text/x-patch, Size: 2632 bytes --]

From 225955bf5ce69e49588137a4f5febbb28494f8e1 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Sat, 3 Dec 2022 22:47:02 +0100
Subject: [PATCH] Make a boxed menu bar have a shadow at its right end
 (bug#59778)

* src/xdisp.c (display_menu_bar) [HAVE_X_WINDOWS]: Make a boxed
menu bar have a shadow at its right end in non-toolkit X builds.
---
 src/xdisp.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index b7333dc1ee..4e087bc39b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -26312,9 +26312,8 @@ display_menu_bar (struct window *w)
   it.first_visible_x = 0;
   it.last_visible_x = FRAME_PIXEL_WIDTH (f);
 #elif defined (HAVE_X_WINDOWS) /* X without toolkit.  */
-  struct window *menu_window;
-
-  menu_window = NULL;
+  struct window *menu_window = NULL;
+  struct face *face = FACE_FROM_ID (f, MENU_FACE_ID);
 
   if (FRAME_WINDOW_P (f))
     {
@@ -26324,8 +26323,6 @@ display_menu_bar (struct window *w)
       init_iterator (&it, menu_window, -1, -1,
 		     menu_window->desired_matrix->rows,
 		     MENU_FACE_ID);
-      it.first_visible_x = 0;
-      it.last_visible_x = FRAME_PIXEL_WIDTH (f);
     }
   else
 #endif /* not USE_X_TOOLKIT and not USE_GTK */
@@ -26379,8 +26376,31 @@ display_menu_bar (struct window *w)
 
   /* Compute the total height of the lines.  */
   compute_line_metrics (&it);
+  it.glyph_row->full_width_p = true;
+  it.glyph_row->continued_p = false;
+  it.glyph_row->truncated_on_left_p = false;
+  it.glyph_row->truncated_on_right_p = false;
 
 #if defined (HAVE_X_WINDOWS) && !defined (USE_X_TOOLKIT) && !defined (USE_GTK)
+  /* Make a 3D menu bar have a shadow at its right end.  */
+  extend_face_to_end_of_line (&it);
+  if (face->box != FACE_NO_BOX)
+    {
+      struct glyph *last = (it.glyph_row->glyphs[TEXT_AREA]
+			    + it.glyph_row->used[TEXT_AREA] - 1);
+      int box_thickness = face->box_vertical_line_width;
+      last->right_box_line_p = true;
+      /* Add back the space for the right box line we subtracted in
+	 init_iterator, since the right_box_line_p flag will make the
+	 glyph wider.  We actually add only as much space as is
+	 available for the last glyph of the menu bar and whatever
+	 space is left beyond it, since that glyph could be only
+	 partially visible.  */
+      if (box_thickness > 0)
+	last->pixel_width += max (0, (box_thickness
+				      - (it.current_x - it.last_visible_x)));
+    }
+
   /* With the non-toolkit version, modify the menu bar window height
      accordingly.  */
   if (FRAME_WINDOW_P (it.f) && menu_window)
-- 
2.38.1


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

  reply	other threads:[~2022-12-03 21:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 14:03 bug#59778: 30.0.50; [PATCH] Fix boxed menu bar in non-toolkit X builds Manuel Giraud
2022-12-03 20:21 ` Eli Zaretskii
2022-12-03 21:59   ` Manuel Giraud [this message]
2022-12-04 12:46     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wn78b13s.fsf@ledu-giraud.fr \
    --to=manuel@ledu-giraud.fr \
    --cc=59778@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.