summarylogtreecommitdiffstats
path: root/14-Hover.patch
blob: 39db38e1b9b46f08ddf80a788dd2cca7bb7a243e (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
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
diff -U3 -r fvwm/borders.c fvwm/borders.c
--- fvwm/borders.c	2011-12-09 21:47:16.004017302 +0100
+++ fvwm/borders.c	2011-12-09 21:49:27.363961242 +0100
@@ -67,6 +67,7 @@
 /* ---------------------------- imports ------------------------------------ */
 
 extern Window PressedW;
+extern Window HoverW;
 
 /* ---------------------------- included code files ------------------------ */
 
@@ -244,6 +245,7 @@
 	unsigned clear_bmask : NUMBER_OF_TITLE_BUTTONS;
 	unsigned draw_bmask : NUMBER_OF_TITLE_BUTTONS;
 	unsigned max_bmask : NUMBER_OF_TITLE_BUTTONS;
+	unsigned hover_bmask : NUMBER_OF_TITLE_BUTTONS;
 	ButtonState bstate[NUMBER_OF_TITLE_BUTTONS];
 	unsigned is_title_pressed : 1;
 	unsigned is_title_lit : 1;
@@ -349,8 +351,12 @@
 
 /* rules to get button state */
 static ButtonState border_flags_to_button_state(
-	int is_pressed, int is_lit, int is_toggled)
+	int is_pressed, int is_lit, int is_toggled, int is_hover)
 {
+	if (is_lit && is_hover && Scr.gs.use_hover_buttons)
+	{
+		return BS_ActiveHover;
+	}
 	if (!is_lit && Scr.gs.use_inactive_buttons)
 	{
 		if (is_pressed && Scr.gs.use_inactive_down_buttons)
@@ -871,7 +877,7 @@
 	/* check if state changed */
 	old_state = border_flags_to_button_state(
 		(fw->decor_state.parts_inverted & PART_TITLE),
-		(fw->decor_state.parts_lit & PART_TITLE), 0);
+		(fw->decor_state.parts_lit & PART_TITLE), 0, 0);
 	if (old_state != td->tbstate.tstate)
 	{
 		draw_parts |= PART_TITLE;
@@ -895,7 +901,8 @@
 		old_state = border_flags_to_button_state(
 			(fw->decor_state.buttons_inverted & mask),
 			(fw->decor_state.buttons_lit & mask),
-			(fw->decor_state.buttons_toggled & mask));
+			(fw->decor_state.buttons_toggled & mask),
+			(fw->decor_state.buttons_hover & mask));
 		if (old_state != td->tbstate.bstate[i])
 		{
 			draw_parts |= PART_BUTTONS;
@@ -4401,6 +4408,7 @@
 	fw->decor_state.buttons_inverted = td->tbstate.pressed_bmask;
 	fw->decor_state.buttons_lit = td->tbstate.lit_bmask;
 	fw->decor_state.buttons_toggled = td->tbstate.toggled_bmask;
+	fw->decor_state.buttons_hover = td->tbstate.hover_bmask;
 
 	return;
 }
@@ -4669,13 +4677,18 @@
 		{
 			tbstate->toggled_bmask |= mask;
 		}
+		if (FW_W_BUTTON(fw, i) == HoverW)
+		{
+			tbstate->hover_bmask |= mask;
+		}
 		tbstate->bstate[i] = border_flags_to_button_state(
 			tbstate->pressed_bmask & mask,
 			tbstate->lit_bmask & mask,
-			tbstate->toggled_bmask & mask);
+			tbstate->toggled_bmask & mask,
+			tbstate->hover_bmask & mask);
 	}
 	tbstate->tstate = border_flags_to_button_state(
-		tbstate->is_title_pressed, tbstate->is_title_lit, 0);
+		tbstate->is_title_pressed, tbstate->is_title_lit, 0, 0);
 }
 
 static window_parts border_get_titlebar_descr(
@@ -4940,6 +4953,7 @@
 		fw->decor_state.buttons_lit = 0;
 		fw->decor_state.buttons_inverted = 0;
 		fw->decor_state.buttons_toggled = 0;
+		fw->decor_state.buttons_hover = 0;
 		return;
 	}
 	memset(&td, 0, sizeof(td));
@@ -4991,6 +5005,7 @@
 		fw->decor_state.buttons_toggled =
 			(fw->decor_state.buttons_toggled &
 			 ~td.tbstate.max_bmask) | td.tbstate.toggled_bmask;
+		fw->decor_state.buttons_hover &= td.tbstate.hover_bmask;
 	}
 
 	return;
@@ -5081,11 +5096,12 @@
 	ButtonState bs;
 	int is_pressed;
 	int is_toggled;
+	int is_hover;
 	int i;
 
 	/* title */
 	is_pressed = (FW_W_TITLE(fw) == PressedW);
-	bs = border_flags_to_button_state(is_pressed, has_focus, 0);
+	bs = border_flags_to_button_state(is_pressed, has_focus, 0, 0);
 	if (DFS_USE_BORDER_STYLE(TB_STATE(GetDecor(fw, titlebar))[bs].style))
 	{
 		return 1;
@@ -5098,8 +5114,9 @@
 		}
 		is_pressed = (FW_W_BUTTON(fw, i) == PressedW);
 		is_toggled = (is_button_toggled(fw, i) == True);
+		is_hover = (FW_W_BUTTON(fw, i) == HoverW);
 		bs = border_flags_to_button_state(
-			is_pressed, (has_focus == True), is_toggled);
+			is_pressed, (has_focus == True), is_toggled, is_hover);
 		if (DFS_USE_BORDER_STYLE(
 			    TB_STATE(GetDecor(fw, buttons[i]))[bs].style))
 		{
@@ -5560,6 +5577,7 @@
 				DEFAULT_USE_INACTIVE_BUTTONS;
 			Scr.gs.use_inactive_down_buttons =
 				DEFAULT_USE_INACTIVE_DOWN_BUTTONS;
+			Scr.gs.use_hover_buttons = 0;
 			return;
 		}
 		first = False;
@@ -5581,6 +5599,12 @@
 				action, &action,
 				DEFAULT_USE_INACTIVE_DOWN_BUTTONS, True);
 		}
+		else if (StrEquals("hover", token))
+		{
+			Scr.gs.use_hover_buttons = ParseToggleArgument(
+				action, &action,
+				0, True);
+		}
 		else
 		{
 			Scr.gs.use_active_down_buttons =
@@ -5589,6 +5613,7 @@
 				DEFAULT_USE_INACTIVE_BUTTONS;
 			Scr.gs.use_inactive_down_buttons =
 				DEFAULT_USE_INACTIVE_DOWN_BUTTONS;
+			Scr.gs.use_hover_buttons = 0;
 			fvwm_msg(ERR, "cmd_button_state",
 				 "Unknown button state %s", token);
 			return;
diff -U3 -r fvwm/builtins.c fvwm/builtins.c
--- fvwm/builtins.c	2011-12-09 21:47:16.007350549 +0100
+++ fvwm/builtins.c	2011-12-09 21:49:27.360627994 +0100
@@ -102,12 +102,16 @@
 {
 	"ActiveUp",
 	"ActiveDown",
+	"ActiveHover",
 	"InactiveUp",
 	"InactiveDown",
+	"InactiveHover",
 	"ToggledActiveUp",
 	"ToggledActiveDown",
+	"ToggledActiveHover",
 	"ToggledInactiveUp",
 	"ToggledInactiveDown",
+	"ToggledInactiveHover",
 	"Active",
 	"Inactive",
 	"ToggledActive",
@@ -118,10 +122,13 @@
 	"AllInactive",
 	"AllUp",
 	"AllDown",
+	"AllHover",
 	"AllActiveUp",
 	"AllActiveDown",
+	"AllActiveHover",
 	"AllInactiveUp",
 	"AllInactiveDown",
+	"AllInactiveHover",
 	NULL
 };
 
diff -U3 -r fvwm/events.c fvwm/events.c
--- fvwm/events.c	2011-09-27 23:03:34.000000000 +0200
+++ fvwm/events.c	2011-12-09 21:49:27.360627994 +0100
@@ -163,6 +163,7 @@
 
 int last_event_type = 0;
 Window PressedW = None;
+Window HoverW = None;
 
 /* ---------------------------- local functions ---------------------------- */
 
@@ -1727,6 +1728,23 @@
 	return;
 }
 
+static void redraw_hover(FvwmWindow* fw, Window w)
+{
+	if (fw)
+	{
+		int i;
+		for (i = 0; i < NUMBER_OF_TITLE_BUTTONS; i++)
+		{
+			if (w == FW_W_BUTTON(fw, i))
+			{
+				HoverW = FW_W_BUTTON(fw, i);
+			}
+		}
+		border_redraw_decorations(fw);
+		HoverW = None;
+	}
+}
+
 /* ---------------------------- event handlers ----------------------------- */
 
 void HandleButtonPress(const evh_args_t *ea)
@@ -1938,6 +1956,8 @@
 	ewp = &te->xcrossing;
 ENTER_DBG((stderr, "++++++++ en (%d): fw 0x%08x w 0x%08x sw 0x%08xmode 0x%x detail 0x%x '%s'\n", ++ecount, (int)fw, (int)ewp->window, (int)ewp->subwindow, ewp->mode, ewp->detail, fw?fw->visible_name:"(none)"));
 
+	redraw_hover(fw, ewp->window);
+
 	if (
 		ewp->window == Scr.Root &&
 		ewp->detail == NotifyInferior && ewp->mode == NotifyNormal)
@@ -2615,6 +2635,8 @@
 
 	DBUG("HandleLeaveNotify", "Routine Entered");
 
+	redraw_hover(fw, te->xcrossing.window);
+
 ENTER_DBG((stderr, "-------- ln (%d): fw 0x%08x w 0x%08x sw 0x%08x mode 0x%x detail 0x%x '%s'\n", ++ecount, (int)fw, (int)te->xcrossing.window, (int)te->xcrossing.subwindow, te->xcrossing.mode, te->xcrossing.detail, fw?fw->visible_name:"(none)"));
 	lwp = &te->xcrossing;
 	if (
diff -U3 -r fvwm/fvwm.h fvwm/fvwm.h
--- fvwm/fvwm.h	2011-12-09 21:47:15.997350808 +0100
+++ fvwm/fvwm.h	2011-12-09 21:49:27.360627994 +0100
@@ -827,6 +827,7 @@
 		unsigned buttons_lit : NUMBER_OF_TITLE_BUTTONS;
 		unsigned buttons_inverted : NUMBER_OF_TITLE_BUTTONS;
 		unsigned buttons_toggled : NUMBER_OF_TITLE_BUTTONS;
+		unsigned buttons_hover : NUMBER_OF_TITLE_BUTTONS;
 		unsigned parts_drawn : 12;
 		unsigned parts_lit : 12;
 		unsigned parts_inverted : 12;
diff -U3 -r fvwm/screen.h fvwm/screen.h
--- fvwm/screen.h	2011-12-09 21:47:16.007350549 +0100
+++ fvwm/screen.h	2011-12-09 21:49:27.360627994 +0100
@@ -202,12 +202,16 @@
 	BS_All = -1,
 	BS_ActiveUp,
 	BS_ActiveDown,
+	BS_ActiveHover,
 	BS_InactiveUp,
 	BS_InactiveDown,
+	BS_InactiveHover,
 	BS_ToggledActiveUp,
 	BS_ToggledActiveDown,
+	BS_ToggledActiveHover,
 	BS_ToggledInactiveUp,
 	BS_ToggledInactiveDown,
+	BS_ToggledInactiveHover,
 	BS_MaxButtonState,
 	BS_MaxButtonStateMask = BS_MaxButtonState - 1,
 	BS_Active,
@@ -220,10 +224,13 @@
 	BS_AllInactive,
 	BS_AllUp,
 	BS_AllDown,
+	BS_AllHover,
 	BS_AllActiveUp,
 	BS_AllActiveDown,
+	BS_AllActiveHover,
 	BS_AllInactiveUp,
 	BS_AllInactiveDown,
+	BS_AllInactiveHover,
 	BS_MaxButtonStateName
 } ButtonState;
 
@@ -513,6 +520,7 @@
 		unsigned use_active_down_buttons : 1;
 		unsigned use_inactive_buttons : 1;
 		unsigned use_inactive_down_buttons : 1;
+		unsigned use_hover_buttons : 1;
 	} gs; /* global style structure */
 	struct
 	{
Seulement dans modules/FvwmIconMan: FvwmIconMan.h.orig
Seulement dans modules/FvwmIconMan: readconfig.c.orig
Seulement dans modules/FvwmIconMan: xmanager.c.orig