summarylogtreecommitdiffstats
path: root/06-BorderUnderTitle.patch
blob: 170670be4ef5dc73f0fcefbfba722b6ac077bcfe (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
diff -U3 -r fvwm/borders.c fvwm/borders.c
--- fvwm/borders.c	2011-12-09 19:19:30.354527773 +0100
+++ fvwm/borders.c	2011-12-09 19:32:33.277812649 +0100
@@ -4992,6 +4992,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,
@@ -5062,7 +5063,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;
diff -U3 -r fvwm/borders.h fvwm/borders.h
--- fvwm/borders.h	2003-06-29 21:53:23.000000000 +0200
+++ fvwm/borders.h	2011-12-09 19:32:33.277812649 +0100
@@ -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 -U3 -r fvwm/fvwm.h fvwm/fvwm.h
--- fvwm/fvwm.h	2011-12-09 19:19:30.357861021 +0100
+++ fvwm/fvwm.h	2011-12-09 19:32:33.277812649 +0100
@@ -271,6 +271,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;
diff -U3 -r fvwm/geometry.c fvwm/geometry.c
--- fvwm/geometry.c	2009-08-22 17:58:23.000000000 +0200
+++ fvwm/geometry.c	2011-12-09 19:32:33.277812649 +0100
@@ -46,6 +46,9 @@
 
 /* ---------------------------- forward declarations ----------------------- */
 
+static void __get_window_borders(
+	const FvwmWindow *fw, size_borders *borders, Bool is_shaded);
+
 /* ---------------------------- local variables ---------------------------- */
 
 /* ---------------------------- exported variables (globals) --------------- */
@@ -343,7 +346,8 @@
 	int big_height = big_g->height;
 	int d;
 
-	get_window_borders(fw, &b);
+	__get_window_borders(fw, &b, 1);
+	
 	*small_g = *big_g;
 	d = 0;
 	switch (SHADED_DIR(fw))
@@ -469,23 +473,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 =
diff -U3 -r fvwm/geometry.h fvwm/geometry.h
--- fvwm/geometry.h	2007-01-13 16:07:14.000000000 +0100
+++ fvwm/geometry.h	2011-12-09 19:32:33.277812649 +0100
@@ -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(
Seulement dans fvwm: menustyle.c.rej
diff -U3 -r fvwm/style.c fvwm/style.c
--- fvwm/style.c	2011-12-09 19:19:30.361194269 +0100
+++ fvwm/style.c	2011-12-09 19:32:33.274479401 +0100
@@ -2259,6 +2259,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))
@@ -5229,6 +5235,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 */
diff -U3 -r fvwm/style.h fvwm/style.h
--- fvwm/style.h	2011-12-09 19:19:30.361194269 +0100
+++ fvwm/style.h	2011-12-09 19:32:33.274479401 +0100
@@ -376,6 +376,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) \
diff -U3 -r fvwm/window_flags.h fvwm/window_flags.h
--- fvwm/window_flags.h	2011-12-09 19:19:30.361194269 +0100
+++ fvwm/window_flags.h	2011-12-09 19:32:33.277812649 +0100
@@ -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) \