summarylogtreecommitdiffstats
path: root/09-TopBorder.patch
blob: e31159d0df8cfb9dbc95b215ac3819d038503b36 (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
diff -U3 -r fvwm/builtins.c fvwm/builtins.c
--- fvwm/builtins.c	2011-08-07 00:03:31.000000000 +0200
+++ fvwm/builtins.c	2011-12-09 20:53:09.537508019 +0100
@@ -494,6 +494,21 @@
 			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 -U3 -r fvwm/frame.c fvwm/frame.c
--- fvwm/frame.c	2011-12-09 19:51:38.705188705 +0100
+++ fvwm/frame.c	2011-12-09 20:53:09.537508019 +0100
@@ -1369,7 +1369,14 @@
 	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 -U3 -r fvwm/fvwm.h fvwm/fvwm.h
--- fvwm/fvwm.h	2011-12-09 19:51:38.705188705 +0100
+++ fvwm/fvwm.h	2011-12-09 20:53:09.534174771 +0100
@@ -277,6 +277,7 @@
 		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 -U3 -r fvwm/geometry.c fvwm/geometry.c
--- fvwm/geometry.c	2011-12-09 19:51:38.705188705 +0100
+++ fvwm/geometry.c	2011-12-09 20:53:09.534174771 +0100
@@ -480,6 +480,7 @@
 	const FvwmWindow *fw, size_borders *borders, Bool is_shaded)
 {
 	int title_thickness;
+	int *title_border = NULL;
 	int bw;
 	
 	bw = HAS_FLUXBOX_HANDLES(fw) ? 1 : fw->boundary_width;
@@ -497,18 +498,25 @@
 	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 =
@@ -529,6 +537,26 @@
 	borders->bottom_right.width = bw;
 	borders->top_left.height = bw;
 	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 -U3 -r fvwm/screen.h fvwm/screen.h
--- fvwm/screen.h	2011-12-09 19:51:38.675189480 +0100
+++ fvwm/screen.h	2011-12-09 20:53:09.537508019 +0100
@@ -286,6 +286,7 @@
 #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 -U3 -r fvwm/style.c fvwm/style.c
--- fvwm/style.c	2011-12-09 19:51:38.708521953 +0100
+++ fvwm/style.c	2011-12-09 20:53:09.534174771 +0100
@@ -4734,6 +4734,12 @@
 			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);
@@ -5360,6 +5366,11 @@
 	{
 		flags->do_redecorate = True;
 	}
+
+	if (S_HAS_NO_TOP_BORDER(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:51:38.708521953 +0100
+++ fvwm/style.h	2011-12-09 20:53:09.534174771 +0100
@@ -402,6 +402,11 @@
 	((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 -U3 -r fvwm/window_flags.h fvwm/window_flags.h
--- fvwm/window_flags.h	2011-12-09 19:51:38.708521953 +0100
+++ fvwm/window_flags.h	2011-12-09 20:53:09.534174771 +0100
@@ -358,6 +358,12 @@
 	(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) \