emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 13bd909 2/2: Add support for flat buttons


From: Lars Ingebrigtsen
Subject: master 13bd909 2/2: Add support for flat buttons
Date: Sun, 10 Jan 2021 08:17:05 -0500 (EST)

branch: master
commit 13bd909591e9c1cf0228750b2d4a9e4364f61cc9
Author: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add support for flat buttons
    
    * src/xfaces.c (Finternal_set_lisp_face_attribute):
    (realize_gui_face): Add support for `flat-button' (bug#45735).
    
    Copyright-paperwork-exempt: yes
---
 doc/lispref/display.texi | 17 +++++++++--------
 etc/NEWS                 |  4 +++-
 src/xfaces.c             |  8 +++++++-
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index b149a66..93e935c 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2485,15 +2485,16 @@ avoiding any increase in the character height or width. 
For simplification
 the width could be specified with only a single number @var{n} instead
 of a list, such case is equivalent to @code{((abs @var{n}) . @var{n})}.
 
-The value @var{color} specifies the color to draw with.  The default is
-the foreground color of the face for simple boxes, and the background
-color of the face for 3D boxes.
-
 The value @var{style} specifies whether to draw a 3D box.  If it is
-@code{released-button}, the box looks like a 3D button that is not being
-pressed.  If it is @code{pressed-button}, the box looks like a 3D button
-that is being pressed.  If it is @code{nil} or omitted, a plain 2D box
-is used.
+@code{released-button}, the box looks like a 3D button that is not
+being pressed.  If it is @code{pressed-button}, the box looks like a
+3D button that is being pressed.  If it is @code{nil},
+@code{flat-button} or omitted, a plain 2D box is used.
+
+The value @var{color} specifies the color to draw with.  The default
+is the background color of the face for 3D boxes and
+@code{flat-button}, and the foreground color of the face for other
+boxes.
 @end table
 
 @item :inverse-video
diff --git a/etc/NEWS b/etc/NEWS
index eaaf9bf..cd7e057 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1514,7 +1514,9 @@ that makes it a valid button.
 ** Miscellaneous
 
 +++
-*** 'add-to-ordered-list' can now take a test predicate.
+*** New button face 'flat-button'.
+This is a plain 2D button, but uses the background color instead of
+the foreground color.
 
 +++
 *** New predicate functions 'length<', 'length>' and 'length='.
diff --git a/src/xfaces.c b/src/xfaces.c
index b3b19a9..258b365 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3293,7 +3293,8 @@ FRAME 0 means change the face on all frames, and change 
the default
                }
              else if (EQ (k, QCstyle))
                {
-                 if (!EQ (v, Qpressed_button) && !EQ (v, Qreleased_button))
+                 if (!EQ (v, Qpressed_button) && !EQ (v, Qreleased_button)
+                     && !EQ(v, Qflat_button))
                    break;
                }
              else
@@ -6031,6 +6032,10 @@ realize_gui_face (struct face_cache *cache, Lisp_Object 
attrs[LFACE_VECTOR_SIZE]
                face->box = FACE_RAISED_BOX;
              else if (EQ (value, Qpressed_button))
                face->box = FACE_SUNKEN_BOX;
+             else if (EQ (value, Qflat_button)) {
+               face->box = FACE_SIMPLE_BOX;
+               face->box_color = face->background;
+             }
            }
        }
     }
@@ -6919,6 +6924,7 @@ syms_of_xfaces (void)
   DEFSYM (Qwave, "wave");
   DEFSYM (Qreleased_button, "released-button");
   DEFSYM (Qpressed_button, "pressed-button");
+  DEFSYM (Qflat_button, "flat-button");
   DEFSYM (Qnormal, "normal");
   DEFSYM (Qextra_light, "extra-light");
   DEFSYM (Qlight, "light");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]