]> git.eshelyaron.com Git - emacs.git/commitdiff
Add support for flat buttons
authorPedro Andres Aranda Gutierrez <paaguti@gmail.com>
Sun, 10 Jan 2021 13:10:18 +0000 (14:10 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 10 Jan 2021 13:10:18 +0000 (14:10 +0100)
* 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
etc/NEWS
src/xfaces.c

index b149a665fed4e2fc2f3a133277769102303aea9c..93e935ccf8665d94fd1b6314aedeea77d3920b89 100644 (file)
@@ -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
index eaaf9bfb0efb717d3842634bfc1902158a3ac79f..cd7e0574bf88f9661703303e4e79685531bbd9df 100644 (file)
--- 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='.
index b3b19a9cb2e5fdf30288762cde70c011084d2a67..258b365eda3972cf1f9588eceaf90156197bd5e4 100644 (file)
@@ -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");