summarylogtreecommitdiffstats
path: root/06-BorderUnderTitle.patch
blob: 3d9d096e7421c5bdcd1449fca3a1c14c880c5ed6 (plain)
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
diff --unified --recursive --text fvwm-2.6.9/fvwm/borders.c fvwm-patched/fvwm/borders.c
--- fvwm-2.6.9/fvwm/borders.c	2020-08-21 15:30:39.087737712 -0600
+++ fvwm-patched/fvwm/borders.c	2020-08-21 15:58:30.667261464 -0600
@@ -4983,6 +4983,7 @@
 	rectangle *ret_g, Window *ret_w)
 {
 	int bw;
+	Bool title;
 
 	bw = fw->boundary_width;
 	/* ret_g->x and ret->y is just an offset relatively to the w,
@@ -5053,7 +5054,32 @@
 		ret_g->height = sidebar_g->y;
 		break;
 	default:
-		return;
+		break;
+	}
+
+	if (HAS_BORDER_UNDER_TITLE(fw))
+	{
+		title = False;
+		switch (GET_TITLE_DIR(fw))
+		{
+		case DIR_N: title = part & PART_TOP; break;
+		case DIR_E: title = part & PART_RIGHT; break;
+		case DIR_S: title = part & PART_BOTTOM; break;
+		case DIR_W: title = part & PART_LEFT; break;
+		}
+		if (title)
+		{
+			ret_g->width = max(ret_g->width, 2 * bw + fw->title_thickness);
+			ret_g->height = max(ret_g->height, 2 * bw + fw->title_thickness);
+			if (part & PART_RIGHT)
+			{
+				ret_g->x = 2 * sidebar_g->x + sidebar_g->width - ret_g->width;
+			}
+			if (part & PART_BOTTOM)
+			{
+				ret_g->y = 2 * sidebar_g->y + sidebar_g->height - ret_g->height;
+			}
+		}
 	}
 
 	return;
Only in fvwm-patched/fvwm: borders.c.orig
diff --unified --recursive --text fvwm-2.6.9/fvwm/borders.h fvwm-patched/fvwm/borders.h
--- fvwm-2.6.9/fvwm/borders.h	2016-10-15 08:51:45.000000000 -0600
+++ fvwm-patched/fvwm/borders.h	2020-08-21 15:58:30.667261464 -0600
@@ -36,7 +36,12 @@
 	PART_FRAME     = 0xff,
 	PART_TITLEBAR  = 0x300,
 	PART_HANDLES   = 0xc00,
-	PART_ALL       = 0xfff
+	PART_ALL       = 0xfff,
+
+	PART_TOP       = 0x31,
+	PART_BOTTOM    = 0xc2,
+	PART_LEFT      = 0x58,
+	PART_RIGHT     = 0xa4
 } window_parts;
 
 typedef enum
diff --unified --recursive --text fvwm-2.6.9/fvwm/fvwm.h fvwm-patched/fvwm/fvwm.h
--- fvwm-2.6.9/fvwm/fvwm.h	2020-08-21 15:48:43.507505372 -0600
+++ fvwm-patched/fvwm/fvwm.h	2020-08-21 15:58:30.667261464 -0600
@@ -268,6 +268,7 @@
 #define WINDOWSHADE_LAZY_MASK   0x3
 		unsigned windowshade_laziness : 2;
 		unsigned use_title_decor_rotation : 1;
+		unsigned has_border_under_title : 1;
 		focus_policy_t focus_policy;
 	} s;
 } common_flags_t;
Only in fvwm-patched/fvwm: fvwm.h.orig
diff --unified --recursive --text fvwm-2.6.9/fvwm/geometry.c fvwm-patched/fvwm/geometry.c
--- fvwm-2.6.9/fvwm/geometry.c	2018-04-28 05:46:28.000000000 -0600
+++ fvwm-patched/fvwm/geometry.c	2020-08-21 16:02:53.280322490 -0600
@@ -45,6 +45,9 @@
 
 /* ---------------------------- forward declarations ----------------------- */
 
+static void __get_window_borders(
+	const FvwmWindow *fw, size_borders *borders, Bool is_shaded);
+
 /* ---------------------------- local variables ---------------------------- */
 
 /* ---------------------------- exported variables (globals) --------------- */
@@ -351,7 +354,7 @@
 		get_window_borders_no_title(fw, &b);
 		break;
 	default:
-		get_window_borders(fw, &b);
+		__get_window_borders(fw, &b, 1);
 		break;
 	}
 	*small_g = *big_g;
@@ -479,23 +482,38 @@
 void get_window_borders(
 	const FvwmWindow *fw, size_borders *borders)
 {
+	__get_window_borders(fw, borders, 0);
+}
+
+static void __get_window_borders(
+	const FvwmWindow *fw, size_borders *borders, Bool is_shaded)
+{
+	int title_thickness;
+	
 	borders->top_left.width = fw->boundary_width;
 	borders->bottom_right.width = fw->boundary_width;
 	borders->top_left.height = fw->boundary_width;
 	borders->bottom_right.height = fw->boundary_width;
+
+	title_thickness = fw->title_thickness;
+	if (HAS_TITLE(fw) && HAS_BORDER_UNDER_TITLE(fw) && !is_shaded)
+	{
+		title_thickness += fw->boundary_width;
+	}
+	
 	switch (GET_TITLE_DIR(fw))
 	{
 	case DIR_N:
-		borders->top_left.height += fw->title_thickness;
+		borders->top_left.height += title_thickness;
 		break;
 	case DIR_S:
-		borders->bottom_right.height += fw->title_thickness;
+		borders->bottom_right.height += title_thickness;
 		break;
 	case DIR_W:
-		borders->top_left.width += fw->title_thickness;
+		borders->top_left.width += title_thickness;
 		break;
 	case DIR_E:
-		borders->bottom_right.width += fw->title_thickness;
+		borders->bottom_right.width += title_thickness;
 		break;
 	}
 	borders->total_size.width =
Only in fvwm-patched/fvwm: geometry.c.orig
diff --unified --recursive --text fvwm-2.6.9/fvwm/geometry.h fvwm-patched/fvwm/geometry.h
--- fvwm-2.6.9/fvwm/geometry.h	2016-10-15 08:51:45.000000000 -0600
+++ fvwm-patched/fvwm/geometry.h	2020-08-21 15:58:30.667261464 -0600
@@ -44,6 +44,8 @@
 	FvwmWindow *fw, rectangle *ret_g);
 void get_window_borders(
 	const FvwmWindow *fw, size_borders *borders);
+void get_window_borders_shaded(
+	const FvwmWindow *fw, size_borders *borders);
 void get_window_borders_no_title(
 	const FvwmWindow *fw, size_borders *borders);
 void set_window_border_size(
diff --unified --recursive --text fvwm-2.6.9/fvwm/style.c fvwm-patched/fvwm/style.c
--- fvwm-2.6.9/fvwm/style.c	2020-08-21 15:48:43.507505372 -0600
+++ fvwm-patched/fvwm/style.c	2020-08-21 15:58:30.671261536 -0600
@@ -2247,6 +2247,12 @@
 		{
 			rest = style_parse_button_style(ps, rest, on);
 		}
+		else if (StrEquals(token, "BORDERUNDERTITLE"))
+		{
+			S_SET_HAS_BORDER_UNDER_TITLE(SCF(*ps), on);
+			S_SET_HAS_BORDER_UNDER_TITLE(SCM(*ps), 1);
+			S_SET_HAS_BORDER_UNDER_TITLE(SCC(*ps), 1);
+		}
 		else if (StrEquals(token, "BorderWidth"))
 		{
 			if (GetIntegerArguments(rest, &rest, val, 1))
@@ -5184,6 +5190,11 @@
 	{
 		flags->do_update_rotated_title = 1;
 	}
+	
+	if (S_HAS_BORDER_UNDER_TITLE(SCC(*ret_style)))
+	{
+		flags->do_redecorate = True;
+	}
 
 	/* has_mwm_border
 	 * has_mwm_buttons */
Only in fvwm-patched/fvwm: style.c.orig
diff --unified --recursive --text fvwm-2.6.9/fvwm/style.h fvwm-patched/fvwm/style.h
--- fvwm-2.6.9/fvwm/style.h	2020-08-21 15:48:43.511505397 -0600
+++ fvwm-patched/fvwm/style.h	2020-08-21 15:58:30.671261536 -0600
@@ -369,6 +369,10 @@
 	((c).s.use_title_decor_rotation)
 #define S_SET_USE_TITLE_DECOR_ROTATION(c,x) \
 	((c).s.use_title_decor_rotation = !!(x))
+#define S_HAS_BORDER_UNDER_TITLE(c) \
+	((c).s.has_border_under_title)
+#define S_SET_HAS_BORDER_UNDER_TITLE(c,x) \
+	((c).s.has_border_under_title = !!(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) \
Only in fvwm-patched/fvwm: style.h.orig
diff --unified --recursive --text fvwm-2.6.9/fvwm/window_flags.h fvwm-patched/fvwm/window_flags.h
--- fvwm-2.6.9/fvwm/window_flags.h	2020-08-21 15:48:43.511505397 -0600
+++ fvwm-patched/fvwm/window_flags.h	2020-08-21 15:58:30.671261536 -0600
@@ -328,6 +328,12 @@
 	(fw)->flags.common.s.use_title_decor_rotation = !!(x)
 #define SETM_USE_TITLE_DECOR_ROTATION(fw,x) \
 	(fw)->flag_mask.common.s.use_title_decor_rotation = !!(x)
+#define HAS_BORDER_UNDER_TITLE(fw) \
+	((fw)->flags.common.s.has_border_under_title)
+#define SET_HAS_BORDER_UNDER_TITLE(fw,x) \
+	(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)
 
 /* access to the special flags of a window */
 #define DO_REUSE_DESTROYED(fw) \