unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51867: [PATCH] Add new X resource for the Lucid toolkit
@ 2021-11-15 13:08 Gregory Heytings
  2021-11-16  8:00 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Gregory Heytings @ 2021-11-15 13:08 UTC (permalink / raw)
  To: 51867

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


Currently a single X resource controls the thickness of both the menu 
external borders and the border of their internal elements.  The added 
resource makes it possible to control the two separately.

Patch attached.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=New-X-resource-to-control-the-border-thickness-of-me.patch, Size: 3434 bytes --]

From 10834c97c1b594e12584c3ac82df18562c0832ca Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Mon, 15 Nov 2021 12:55:22 +0000
Subject: [PATCH] New X resource to control the border thickness of menus

With the new borderThickness resource, the thickness of the external
borders can be controlled independently of the thickness of the shadows
of the internal elements, given by the shadowThickness resource.

* lwlib/xlwmenu.h (XtNborderThickness, XtCBorderThickness): New X
resource name.
* lwlib/xlwmenuP.h (XlwMenuPart): New border_thickness field.
* lwlib/xlwmenu.c (xlwMenuResources): Access the new resource.
(draw_shadow_rectangle): Use the new resource value.
* doc/emacs/xresources.texi (Lucid Resources): Document the new
resource.
---
 doc/emacs/xresources.texi | 3 +++
 lwlib/xlwmenu.c           | 5 ++++-
 lwlib/xlwmenu.h           | 2 ++
 lwlib/xlwmenuP.h          | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi
index 00fa6c0aa3..0e0070829c 100644
--- a/doc/emacs/xresources.texi
+++ b/doc/emacs/xresources.texi
@@ -406,6 +406,9 @@ Lucid Resources
 @item shadowThickness
 Thickness of shadow lines for 3D buttons, arrows, and other graphical
 elements.  Default is 1.
+@item borderThickness
+Thickness of the external borders of the menu bars and pop-up menus.
+Default is 1.
 @end ifnottex
 @item margin
 Margin of the menu bar, in characters.  Default is 1.
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index cc73d9aa49..702fad49ba 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -157,6 +157,9 @@ #define DEFAULT_FONTNAME "XtDefaultFont"
      offset(menu.cursor_shape), XtRString, (XtPointer)"right_ptr"},
   {XtNhorizontal, XtCHorizontal, XtRInt, sizeof(int),
      offset(menu.horizontal), XtRImmediate, (XtPointer)True},
+  {XtNborderThickness, XtCBorderThickness, XtRDimension,
+     sizeof (Dimension), offset (menu.border_thickness),
+     XtRImmediate, (XtPointer)1}
 };
 #undef offset
 
@@ -635,7 +638,7 @@ draw_shadow_rectangle (XlwMenuWidget mw,
   Display *dpy = XtDisplay (mw);
   GC top_gc = !erase_p ? mw->menu.shadow_top_gc : mw->menu.background_gc;
   GC bottom_gc = !erase_p ? mw->menu.shadow_bottom_gc : mw->menu.background_gc;
-  int thickness = mw->menu.shadow_thickness;
+  int thickness = !x && !y ? mw->menu.border_thickness : mw->menu.shadow_thickness;
   XPoint points [4];
 
   if (!erase_p && down_p)
diff --git a/lwlib/xlwmenu.h b/lwlib/xlwmenu.h
index 9143edba9a..89e548bc8d 100644
--- a/lwlib/xlwmenu.h
+++ b/lwlib/xlwmenu.h
@@ -56,6 +56,8 @@ #define XtNresizeToPreferred "resizeToPreferred"
 #define XtCResizeToPreferred "ResizeToPreferred"
 #define XtNallowResize "allowResize"
 #define XtCAllowResize "AllowResize"
+#define XtNborderThickness "borderThickness"
+#define XtCBorderThickness "BorderThickness"
 
 /* Motif-compatible resource names */
 #define XmNshadowThickness	"shadowThickness"
diff --git a/lwlib/xlwmenuP.h b/lwlib/xlwmenuP.h
index fc77ec4bfd..bb37b0dee2 100644
--- a/lwlib/xlwmenuP.h
+++ b/lwlib/xlwmenuP.h
@@ -75,6 +75,7 @@ #define _XlwMenuP_h
   Dimension	vertical_spacing;
   Dimension	arrow_spacing;
   Dimension	shadow_thickness;
+  Dimension	border_thickness;
   Pixel 	top_shadow_color;
   Pixel 	bottom_shadow_color;
   Pixmap	top_shadow_pixmap;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#51867: [PATCH] Add new X resource for the Lucid toolkit
  2021-11-15 13:08 bug#51867: [PATCH] Add new X resource for the Lucid toolkit Gregory Heytings
@ 2021-11-16  8:00 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-16  8:00 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 51867

Gregory Heytings <gregory@heytings.org> writes:

> Currently a single X resource controls the thickness of both the menu
> external borders and the border of their internal elements.  The added
> resource makes it possible to control the two separately.
>
> Patch attached.

Makes sense to me, so pushed to Emacs 29 now (with a NEWS entry).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-16  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 13:08 bug#51867: [PATCH] Add new X resource for the Lucid toolkit Gregory Heytings
2021-11-16  8:00 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).