-
Notifications
You must be signed in to change notification settings - Fork 1
/
0004-Flat-Separators.patch
190 lines (181 loc) · 6.12 KB
/
0004-Flat-Separators.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
From c88e03c711f0b7b33f5bf09a0301287116a7dbbb Mon Sep 17 00:00:00 2001
From: Anupam Srivastava <[email protected]>
Date: Sat, 2 May 2015 11:09:18 +0530
Subject: [PATCH 04/13] Flat Separators
---
doc/commands/MenuStyle.xml | 7 ++++++-
fvwm/menuitem.c | 25 ++++++++++++++++---------
fvwm/menus.c | 4 ++++
fvwm/menustyle.c | 8 +++++++-
fvwm/menustyle.h | 3 +++
5 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/doc/commands/MenuStyle.xml b/doc/commands/MenuStyle.xml
index 4e8e74e..ce431e1 100644
--- a/doc/commands/MenuStyle.xml
+++ b/doc/commands/MenuStyle.xml
@@ -58,7 +58,7 @@ PopupDelay,
PopupOffset,
TitleWarp / !TitleWarp,
TitleUnderlines0 / TitleUnderlines1 / TitleUnderlines2,
-SeparatorsLong / SeparatorsShort,
+SeparatorsLong / SeparatorsShort / FlatSeparators,
TrianglesSolid / TrianglesRelief,
PopupImmediately / PopupDelayed,
PopdownImmediately / PopdownDelayed,
@@ -436,6 +436,11 @@ left edge all the way to the right edge. Short separators leave a
few pixels to the edges of the menu.</para>
<para>
+<fvwmopt cmd="MenuStyle" opt="FlatSeparators"/>
+changes the separators so that they are a single pixel thick and
+colored the same as the text.</para>
+
+<para>
<fvwmopt cmd="MenuStyle" opt="TrianglesSolid"/> and
<fvwmopt cmd="MenuStyle" opt="TrianglesRelief"/>
affect how the small triangles for sub menus is drawn. Solid
diff --git a/fvwm/menuitem.c b/fvwm/menuitem.c
index 3e4ea2c..de1e7ef 100644
--- a/fvwm/menuitem.c
+++ b/fvwm/menuitem.c
@@ -82,10 +82,14 @@ static void clear_menu_item_background(
*
*/
static void draw_separator(
- Window w, GC TopGC, GC BottomGC, int x1, int y, int x2)
+ Window w, GC TopGC, GC BottomGC, GC ForeGC, int x1, int y, int x2,
+ Bool do_flat_separators)
{
XDrawLine(dpy, w, TopGC , x1, y, x2, y);
- XDrawLine(dpy, w, BottomGC, x1-1, y+1, x2+1, y+1);
+ if (!do_flat_separators)
+ {
+ XDrawLine(dpy, w, BottomGC, x1-1, y+1, x2+1, y+1);
+ }
return;
}
@@ -381,6 +385,7 @@ void menuitem_paint(
/*Pixel fg, fgsh;*/
int relief_thickness = ST_RELIEF_THICKNESS(ms);
Bool is_item_selected;
+ Bool do_flat_separators;
Bool item_cleared = False;
Bool xft_clear = False;
Bool empty_inter = False;
@@ -599,6 +604,8 @@ void menuitem_paint(
* Draw the item itself.
*/
+ do_flat_separators = ST_DO_FLAT_SEPARATOR(ms);
+
/* Calculate the separator offsets. */
if (ST_HAS_LONG_SEPARATORS(ms))
{
@@ -619,9 +626,9 @@ void menuitem_paint(
{
/* It's a separator. */
draw_separator(
- mpip->w, gcs.shadow_gc, gcs.hilight_gc, sx1,
- y_offset + y_height - MENU_SEPARATOR_HEIGHT,
- sx2);
+ mpip->w, gcs.shadow_gc, gcs.hilight_gc, gcs.fore_gc,
+ sx1, y_offset + y_height - MENU_SEPARATOR_HEIGHT,
+ sx2, do_flat_separators);
/* Nothing else to do. */
}
return;
@@ -661,8 +668,8 @@ void menuitem_paint(
if (sx1 < sx2)
{
draw_separator(
- mpip->w, gcs.shadow_gc, gcs.hilight_gc,
- sx1, y, sx2);
+ mpip->w, gcs.shadow_gc, gcs.hilight_gc, gcs.fore_gc,
+ sx1, y, sx2, do_flat_separators);
}
}
/* Underline the title. */
@@ -675,8 +682,8 @@ void menuitem_paint(
{
y = y_offset + y_height - MENU_SEPARATOR_HEIGHT;
draw_separator(
- mpip->w, gcs.shadow_gc, gcs.hilight_gc,
- sx1, y, sx2);
+ mpip->w, gcs.shadow_gc, gcs.hilight_gc, gcs.fore_gc,
+ sx1, y, sx2, do_flat_separators);
}
break;
default:
diff --git a/fvwm/menus.c b/fvwm/menus.c
index 6772dee..96fcfad 100644
--- a/fvwm/menus.c
+++ b/fvwm/menus.c
@@ -1658,6 +1658,10 @@ static Bool size_menu_vertically(MenuSizingParameters *msp)
separator_height = (last_item_has_relief) ?
MENU_SEPARATOR_HEIGHT + relief_thickness :
MENU_SEPARATOR_TOTAL_HEIGHT;
+ if (MST_DO_FLAT_SEPARATOR(msp->menu))
+ {
+ separator_height += 1;
+ }
MI_Y_OFFSET(mi) = y;
if (MI_IS_TITLE(mi))
{
diff --git a/fvwm/menustyle.c b/fvwm/menustyle.c
index 88e2f9a..8ec99f7 100644
--- a/fvwm/menustyle.c
+++ b/fvwm/menustyle.c
@@ -431,7 +431,7 @@ static int menustyle_get_styleopt_index(char *option)
"TrianglesUseFore",
"TitleColorset", "HilightTitleBack",
"TitleFont",
- "VerticalMargins",
+ "VerticalMargins", "FlatSeparators",
"UniqueHotkeyActivatesImmediate",
NULL
};
@@ -901,6 +901,7 @@ MenuStyle *menustyle_parse_style(F_CMD_ARGS)
ST_SCROLL_OFF_PAGE(tmpms) = 1;
ST_DO_HILIGHT_TITLE_BACK(tmpms) = 0;
ST_USING_DEFAULT_TITLEFONT(tmpms) = True;
+ ST_DO_FLAT_SEPARATOR(tmpms) = 0;
has_gc_changed = True;
option = "fvwm";
}
@@ -1606,6 +1607,9 @@ MenuStyle *menustyle_parse_style(F_CMD_ARGS)
case 63: /* UniqueHotKeyActivatesImmediate */
ST_HOTKEY_ACTIVATES_IMMEDIATE(tmpms) = on;
break;
+ case 64: /* FlatSeparators */
+ ST_DO_FLAT_SEPARATOR(tmpms) = on;
+ break;
#if 0
case 99: /* PositionHints */
@@ -1864,6 +1868,8 @@ void menustyle_copy(MenuStyle *origms, MenuStyle *destms)
ST_TRIANGLES_USE_FORE(destms) = ST_TRIANGLES_USE_FORE(origms);
/* Title */
ST_DO_HILIGHT_TITLE_BACK(destms) = ST_DO_HILIGHT_TITLE_BACK(origms);
+ /* FlatSeparators */
+ ST_DO_FLAT_SEPARATOR(destms) = ST_DO_FLAT_SEPARATOR(origms);
menustyle_update(destms);
diff --git a/fvwm/menustyle.h b/fvwm/menustyle.h
index fa97555..34dc524 100644
--- a/fvwm/menustyle.h
+++ b/fvwm/menustyle.h
@@ -23,6 +23,8 @@
#define MST_FACE(m) ((m)->s->ms->look.face)
#define ST_DO_HILIGHT_BACK(s) ((s)->look.flags.do_hilight_back)
#define MST_DO_HILIGHT_BACK(m) ((m)->s->ms->look.flags.do_hilight_back)
+#define ST_DO_FLAT_SEPARATOR(s) ((s)->look.flags.do_flat_separator)
+#define MST_DO_FLAT_SEPARATOR(m) ((m)->s->ms->look.flags.do_flat_separator)
#define ST_DO_HILIGHT_FORE(s) ((s)->look.flags.do_hilight_fore)
#define MST_DO_HILIGHT_FORE(m) ((m)->s->ms->look.flags.do_hilight_fore)
#define ST_DO_HILIGHT_TITLE_BACK(s) ((s)->look.flags.do_hilight_title_back)
@@ -282,6 +284,7 @@ typedef struct MenuLook
unsigned has_title_cset : 1;
unsigned do_hilight_title_back : 1;
unsigned using_default_titlefont : 1;
+ unsigned do_flat_separator : 1;
} flags;
unsigned char ReliefThickness;
unsigned char TitleUnderlines;
--
2.3.6