-
Notifications
You must be signed in to change notification settings - Fork 1
/
0007-Top-Border.patch
265 lines (258 loc) · 8.16 KB
/
0007-Top-Border.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
From 5798b6719e4b0111db3f49da42b9fa7586c51cf6 Mon Sep 17 00:00:00 2001
From: Anupam Srivastava <ansrivastava@corp.ebay.com>
Date: Sat, 2 May 2015 13:56:23 +0530
Subject: [PATCH 07/13] Top Border
---
fvwm/builtins.c | 15 +++++++++++++++
fvwm/frame.c | 9 ++++++++-
fvwm/fvwm.h | 5 +++++
fvwm/geometry.c | 37 +++++++++++++++++++++++++++++++++----
fvwm/screen.h | 1 +
fvwm/style.c | 11 +++++++++++
fvwm/style.h | 21 +++++++++++++++++++++
fvwm/window_flags.h | 30 ++++++++++++++++++++++++++++++
8 files changed, 124 insertions(+), 5 deletions(-)
diff --git a/fvwm/builtins.c b/fvwm/builtins.c
index 0ef90d2..ce22c42 100644
--- a/fvwm/builtins.c
+++ b/fvwm/builtins.c
@@ -495,6 +495,21 @@ static void do_title_style(F_CMD_ARGS, Bool do_add)
if (action)
action += next;
}
+ else if (!do_add && StrEquals(parm,"buttonwidth"))
+ {
+ int width = 0;
+ int next = 0;
+
+ sscanf(action, "%d%n", &width, &next);
+
+ if (decor->button_width != width)
+ {
+ decor->button_width = width;
+ decor->flags.has_changed = 1;
+ }
+ if (action)
+ action += next;
+ }
else if (!do_add && StrEquals(parm,"MinHeight"))
{
int height = 0;
diff --git a/fvwm/frame.c b/fvwm/frame.c
index 10cf3a6..bb55a3a 100644
--- a/fvwm/frame.c
+++ b/fvwm/frame.c
@@ -1371,7 +1371,14 @@ void frame_get_titlebar_dimensions(
tb_thick = fw->title_thickness;
nbuttons = fw->nr_left_buttons + fw->nr_right_buttons;
nbuttons_big = 0;
- b_length = tb_thick;
+ if (fw->decor->button_width == 0)
+ {
+ b_length = tb_thick;
+ }
+ else
+ {
+ b_length = fw->decor->button_width;
+ }
t_length = tb_length - nbuttons * b_length;
if (nbuttons > 0 && t_length < MIN_WINDOW_TITLE_LENGTH)
{
diff --git a/fvwm/fvwm.h b/fvwm/fvwm.h
index 425a49c..3651236 100644
--- a/fvwm/fvwm.h
+++ b/fvwm/fvwm.h
@@ -273,6 +273,11 @@ typedef struct
unsigned windowshade_laziness : 2;
unsigned use_title_decor_rotation : 1;
unsigned has_border_under_title : 1;
+ unsigned has_fluxbox_handles : 1;
+ unsigned has_rounded_corners_top : 1;
+ unsigned has_rounded_corners_bottom : 1;
+ unsigned has_slightly_rounded_corners : 1;
+ unsigned has_no_top_border : 1;
focus_policy_t focus_policy;
} s;
} common_flags_t;
diff --git a/fvwm/geometry.c b/fvwm/geometry.c
index 8edb052..d8964c9 100644
--- a/fvwm/geometry.c
+++ b/fvwm/geometry.c
@@ -490,6 +490,8 @@ static void __get_window_borders(
const FvwmWindow *fw, size_borders *borders, Bool is_shaded)
{
int title_thickness;
+ int *title_border = NULL;
+ int bw;
borders->top_left.width = fw->boundary_width;
borders->bottom_right.width = fw->boundary_width;
@@ -505,18 +507,25 @@ static void __get_window_borders(
switch (GET_TITLE_DIR(fw))
{
case DIR_N:
- borders->top_left.height += title_thickness;
+ title_border = &borders->top_left.height;
break;
case DIR_S:
- borders->bottom_right.height += title_thickness;
+ title_border = &borders->bottom_right.height;
break;
case DIR_W:
- borders->top_left.width += title_thickness;
+ title_border = &borders->top_left.width;
break;
case DIR_E:
- borders->bottom_right.width += title_thickness;
+ title_border = &borders->bottom_right.width;
break;
}
+
+ if (HAS_NO_TOP_BORDER(fw))
+ {
+ *title_border = 1;
+ }
+ *title_border += title_thickness;
+
borders->total_size.width =
borders->top_left.width + borders->bottom_right.width;
borders->total_size.height =
@@ -533,6 +542,26 @@ void get_window_borders_no_title(
borders->bottom_right.width = fw->boundary_width;
borders->top_left.height = fw->boundary_width;
borders->bottom_right.height = fw->boundary_width;
+
+ if (HAS_NO_TOP_BORDER(fw))
+ {
+ switch (GET_TITLE_DIR(fw))
+ {
+ case DIR_N:
+ borders->top_left.height = 1;
+ break;
+ case DIR_S:
+ borders->bottom_right.height = 1;
+ break;
+ case DIR_W:
+ borders->top_left.width = 1;
+ break;
+ case DIR_E:
+ borders->bottom_right.width = 1;
+ break;
+ }
+ }
+
borders->total_size.width =
borders->top_left.width + borders->bottom_right.width;
borders->total_size.height =
diff --git a/fvwm/screen.h b/fvwm/screen.h
index 71e85a1..ab14d1b 100644
--- a/fvwm/screen.h
+++ b/fvwm/screen.h
@@ -286,6 +286,7 @@ typedef struct FvwmDecor
#endif
int title_height; /* explicitly specified title bar height */
int min_title_height;
+ int button_width;
/* titlebar buttons */
TitleButton buttons[NUMBER_OF_TITLE_BUTTONS];
TitleButton titlebar;
diff --git a/fvwm/style.c b/fvwm/style.c
index fe76440..df9945e 100644
--- a/fvwm/style.c
+++ b/fvwm/style.c
@@ -4659,6 +4659,12 @@ static Bool style_parse_one_style_option(
ps->change_mask.has_title_format_string = 1;
}
+ else if (StrEquals(token, "TopBorder"))
+ {
+ S_SET_HAS_NO_TOP_BORDER(SCF(*ps), !on);
+ S_SET_HAS_NO_TOP_BORDER(SCM(*ps), 1);
+ S_SET_HAS_NO_TOP_BORDER(SCC(*ps), 1);
+ }
else if (StrEquals(token, "TopTitleRotated"))
{
S_SET_IS_TOP_TITLE_ROTATED(SCF(*ps), on);
@@ -5272,6 +5278,11 @@ void check_window_style_change(
flags->do_redecorate = True;
}
+ if (S_HAS_NO_TOP_BORDER(SCC(*ret_style)))
+ {
+ flags->do_redecorate = True;
+ }
+
/* has_mwm_border
* has_mwm_buttons */
if (S_HAS_MWM_BORDER(SCC(*ret_style)) ||
diff --git a/fvwm/style.h b/fvwm/style.h
index 9fec6c6..f1cb989 100644
--- a/fvwm/style.h
+++ b/fvwm/style.h
@@ -384,6 +384,27 @@
((c).s.has_border_under_title)
#define S_SET_HAS_BORDER_UNDER_TITLE(c,x) \
((c).s.has_border_under_title = !!(x))
+#define S_HAS_FLUXBOX_HANDLES(c) \
+ ((c).s.has_fluxbox_handles)
+#define S_SET_HAS_FLUXBOX_HANDLES(c,x) \
+ ((c).s.has_fluxbox_handles = !!(x))
+#define S_HAS_ROUNDED_CORNERS_TOP(c) \
+ ((c).s.has_rounded_corners_top)
+#define S_SET_HAS_ROUNDED_CORNERS_TOP(c,x) \
+ ((c).s.has_rounded_corners_top = !!(x))
+#define S_HAS_ROUNDED_CORNERS_BOTTOM(c) \
+ ((c).s.has_rounded_corners_bottom)
+#define S_SET_HAS_ROUNDED_CORNERS_BOTTOM(c,x) \
+ ((c).s.has_rounded_corners_bottom = !!(x))
+#define S_HAS_SLIGHTLY_ROUNDED_CORNERS(c) \
+ ((c).s.has_slightly_rounded_corners)
+#define S_SET_HAS_SLIGHTLY_ROUNDED_CORNERS(c,x) \
+ ((c).s.has_slightly_rounded_corners = !!(x))
+#define S_HAS_NO_TOP_BORDER(c) \
+ ((c).s.has_no_top_border)
+#define S_SET_HAS_NO_TOP_BORDER(c,x) \
+ ((c).s.has_no_top_border = !!(x))
+
#define S_DO_EWMH_MINI_ICON_OVERRIDE(c) \
((c).s.do_ewmh_mini_icon_override)
#define S_SET_DO_EWMH_MINI_ICON_OVERRIDE(c,x) \
diff --git a/fvwm/window_flags.h b/fvwm/window_flags.h
index f37b4ba..6abda4d 100644
--- a/fvwm/window_flags.h
+++ b/fvwm/window_flags.h
@@ -334,6 +334,36 @@
(fw)->flags.common.s.has_border_under_title = !!(x)
#define SETM_HAS_BORDER_UNDER_TITLE(fw,x) \
(fw)->flag_mask.common.s.has_border_under_title = !!(x)
+#define HAS_FLUXBOX_HANDLES(fw) \
+ ((fw)->flags.common.s.has_fluxbox_handles && (fw->flags.has_handles))
+#define SET_HAS_FLUXBOX_HANDLES(fw,x) \
+ (fw)->flags.common.s.has_fluxbox_handles = !!(x)
+#define SETM_HAS_FLUXBOX_HANDLES(fw,x) \
+ (fw)->flag_mask.common.s.has_fluxbox_handles = !!(x)
+#define HAS_ROUNDED_CORNERS_TOP(fw) \
+ ((fw)->flags.common.s.has_rounded_corners_top)
+#define SET_HAS_ROUNDED_CORNERS_TOP(fw,x) \
+ (fw)->flags.common.s.has_rounded_corners_top = !!(x)
+#define SETM_HAS_ROUNDED_CORNERS_TOP(fw,x) \
+ (fw)->flag_mask.common.s.has_rounded_corners_top = !!(x)
+#define HAS_ROUNDED_CORNERS_BOTTOM(fw) \
+ ((fw)->flags.common.s.has_rounded_corners_bottom)
+#define SET_HAS_ROUNDED_CORNERS_BOTTOM(fw,x) \
+ (fw)->flags.common.s.has_rounded_corners_bottom = !!(x)
+#define SETM_HAS_ROUNDED_CORNERS_BOTTOM(fw,x) \
+ (fw)->flag_mask.common.s.has_rounded_corners_bottom = !!(x)
+#define HAS_SLIGHTLY_ROUNDED_CORNERS(fw) \
+ ((fw)->flags.common.s.has_slightly_rounded_corners)
+#define SET_HAS_SLIGHTLY_ROUNDED_CORNERS_BOTTOM(fw,x) \
+ (fw)->flags.common.s.has_slightly_rounded_corners = !!(x)
+#define SETM_HAS_SLIGHTLY_ROUNDED_CORNERS(fw,x) \
+ (fw)->flag_mask.common.s.has_slightly_rounded_corners = !!(x)
+#define HAS_NO_TOP_BORDER(fw) \
+ ((fw)->flags.common.s.has_no_top_border)
+#define SET_HAS_NO_TOP_BORDER(fw,x) \
+ (fw)->flags.common.s.has_no_top_border = !!(x)
+#define SETM_HAS_NO_TOP_BORDER(fw,x) \
+ (fw)->flag_mask.common.s.has_no_top_border = !!(x)
/* access to the special flags of a window */
#define DO_REUSE_DESTROYED(fw) \
--
2.3.6