unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51988: [PATCH] Implement the buttonForeground resource color
@ 2021-11-19 23:07 Gregory Heytings
  2021-11-20  0:24 ` Gregory Heytings
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Heytings @ 2021-11-19 23:07 UTC (permalink / raw)
  To: 51988

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


The manual documents, in Lucid Resources, a "buttonForeground" resource 
color, which is read and allocated, but never actually used.  Patch 
attached, and a screenshot without and with the patch.  Without the patch, 
selected items are hard to differentiate from unselected ones, with the 
patch and without setting that resource color they become visibly 
different.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=Implement-the-buttonForeground-resource.patch, Size: 1961 bytes --]

From 673e32e100e94d96d9a42a4a7b64d9b951aba957 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Fri, 19 Nov 2021 22:58:10 +0000
Subject: [PATCH] Implement the buttonForeground resource

* lwlib/xlwmenu.c (draw_shadow_rectangle, draw_shadow_rhombus):
Use the buttonForeground resource color.
---
 lwlib/xlwmenu.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 702fad49ba..f8b20c308d 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -641,6 +641,21 @@ draw_shadow_rectangle (XlwMenuWidget mw,
   int thickness = !x && !y ? mw->menu.border_thickness : mw->menu.shadow_thickness;
   XPoint points [4];
 
+  if (!erase_p && width == height)
+    {
+      points [0].x = x;
+      points [0].y = y;
+      points [1].x = x + width;
+      points [1].y = y;
+      points [2].x = x + width;
+      points [2].y = y + height;
+      points [3].x = x;
+      points [3].y = y + height;
+      XFillPolygon (dpy, window,
+                    down_p ? mw->menu.button_gc : mw->menu.inactive_button_gc,
+                    points, 4, Convex, CoordModeOrigin);
+    }
+
   if (!erase_p && down_p)
     {
       GC temp;
@@ -704,6 +719,21 @@ draw_shadow_rhombus (XlwMenuWidget mw,
   int thickness = mw->menu.shadow_thickness;
   XPoint points [4];
 
+  if (!erase_p && width == height)
+    {
+      points [0].x = x;
+      points [0].y = y + width / 2;
+      points [1].x = x + height / 2;
+      points [1].y = y + width;
+      points [2].x = x + height;
+      points [2].y = y + width / 2;
+      points [3].x = x + height / 2;
+      points [3].y = y;
+      XFillPolygon (dpy, window,
+                    down_p ? mw->menu.button_gc : mw->menu.inactive_button_gc,
+                    points, 4, Convex, CoordModeOrigin);
+    }
+
   if (!erase_p && down_p)
     {
       GC temp;
-- 
2.33.0


[-- Attachment #3: Type: image/png, Size: 1189 bytes --]

[-- Attachment #4: Type: image/png, Size: 1226 bytes --]

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

* bug#51988: [PATCH] Implement the buttonForeground resource color
  2021-11-19 23:07 bug#51988: [PATCH] Implement the buttonForeground resource color Gregory Heytings
@ 2021-11-20  0:24 ` Gregory Heytings
  2021-11-20  9:37   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Heytings @ 2021-11-20  0:24 UTC (permalink / raw)
  To: 51988

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


Slightly improved patch attached.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=Implement-the-buttonForeground-resource.patch, Size: 2034 bytes --]

From 0a76e0d3f78bf740ab1ca2d9bd00c44a255680a2 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Sat, 20 Nov 2021 00:22:16 +0000
Subject: [PATCH] Implement the buttonForeground resource

* lwlib/xlwmenu.c (draw_shadow_rectangle, draw_shadow_rhombus):
Use the buttonForeground resource color.
---
 lwlib/xlwmenu.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 702fad49ba..5f8832bb36 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -641,6 +641,21 @@ draw_shadow_rectangle (XlwMenuWidget mw,
   int thickness = !x && !y ? mw->menu.border_thickness : mw->menu.shadow_thickness;
   XPoint points [4];
 
+  if (!erase_p && width == height && width == toggle_button_width (mw))
+    {
+      points [0].x = x;
+      points [0].y = y;
+      points [1].x = x + width;
+      points [1].y = y;
+      points [2].x = x + width;
+      points [2].y = y + height;
+      points [3].x = x;
+      points [3].y = y + height;
+      XFillPolygon (dpy, window,
+                    down_p ? mw->menu.button_gc : mw->menu.inactive_button_gc,
+                    points, 4, Convex, CoordModeOrigin);
+    }
+
   if (!erase_p && down_p)
     {
       GC temp;
@@ -704,6 +719,21 @@ draw_shadow_rhombus (XlwMenuWidget mw,
   int thickness = mw->menu.shadow_thickness;
   XPoint points [4];
 
+  if (!erase_p && width == height && width == radio_button_width (mw))
+    {
+      points [0].x = x;
+      points [0].y = y + width / 2;
+      points [1].x = x + height / 2;
+      points [1].y = y + width;
+      points [2].x = x + height;
+      points [2].y = y + width / 2;
+      points [3].x = x + height / 2;
+      points [3].y = y;
+      XFillPolygon (dpy, window,
+                    down_p ? mw->menu.button_gc : mw->menu.inactive_button_gc,
+                    points, 4, Convex, CoordModeOrigin);
+    }
+
   if (!erase_p && down_p)
     {
       GC temp;
-- 
2.33.0


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

* bug#51988: [PATCH] Implement the buttonForeground resource color
  2021-11-20  0:24 ` Gregory Heytings
@ 2021-11-20  9:37   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-20  9:37 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 51988

Gregory Heytings <gregory@heytings.org> writes:

> Slightly improved patch attached.

Looks good to me; pushed to Emacs 29.

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





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

end of thread, other threads:[~2021-11-20  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 23:07 bug#51988: [PATCH] Implement the buttonForeground resource color Gregory Heytings
2021-11-20  0:24 ` Gregory Heytings
2021-11-20  9:37   ` 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).