updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / fvwm+ / 14-Hover.patch
blob39db38e1b9b46f08ddf80a788dd2cca7bb7a243e
1 diff -U3 -r fvwm/borders.c fvwm/borders.c
2 --- fvwm/borders.c 2011-12-09 21:47:16.004017302 +0100
3 +++ fvwm/borders.c 2011-12-09 21:49:27.363961242 +0100
4 @@ -67,6 +67,7 @@
5 /* ---------------------------- imports ------------------------------------ */
7 extern Window PressedW;
8 +extern Window HoverW;
10 /* ---------------------------- included code files ------------------------ */
12 @@ -244,6 +245,7 @@
13 unsigned clear_bmask : NUMBER_OF_TITLE_BUTTONS;
14 unsigned draw_bmask : NUMBER_OF_TITLE_BUTTONS;
15 unsigned max_bmask : NUMBER_OF_TITLE_BUTTONS;
16 + unsigned hover_bmask : NUMBER_OF_TITLE_BUTTONS;
17 ButtonState bstate[NUMBER_OF_TITLE_BUTTONS];
18 unsigned is_title_pressed : 1;
19 unsigned is_title_lit : 1;
20 @@ -349,8 +351,12 @@
22 /* rules to get button state */
23 static ButtonState border_flags_to_button_state(
24 - int is_pressed, int is_lit, int is_toggled)
25 + int is_pressed, int is_lit, int is_toggled, int is_hover)
27 + if (is_lit && is_hover && Scr.gs.use_hover_buttons)
28 + {
29 + return BS_ActiveHover;
30 + }
31 if (!is_lit && Scr.gs.use_inactive_buttons)
33 if (is_pressed && Scr.gs.use_inactive_down_buttons)
34 @@ -871,7 +877,7 @@
35 /* check if state changed */
36 old_state = border_flags_to_button_state(
37 (fw->decor_state.parts_inverted & PART_TITLE),
38 - (fw->decor_state.parts_lit & PART_TITLE), 0);
39 + (fw->decor_state.parts_lit & PART_TITLE), 0, 0);
40 if (old_state != td->tbstate.tstate)
42 draw_parts |= PART_TITLE;
43 @@ -895,7 +901,8 @@
44 old_state = border_flags_to_button_state(
45 (fw->decor_state.buttons_inverted & mask),
46 (fw->decor_state.buttons_lit & mask),
47 - (fw->decor_state.buttons_toggled & mask));
48 + (fw->decor_state.buttons_toggled & mask),
49 + (fw->decor_state.buttons_hover & mask));
50 if (old_state != td->tbstate.bstate[i])
52 draw_parts |= PART_BUTTONS;
53 @@ -4401,6 +4408,7 @@
54 fw->decor_state.buttons_inverted = td->tbstate.pressed_bmask;
55 fw->decor_state.buttons_lit = td->tbstate.lit_bmask;
56 fw->decor_state.buttons_toggled = td->tbstate.toggled_bmask;
57 + fw->decor_state.buttons_hover = td->tbstate.hover_bmask;
59 return;
61 @@ -4669,13 +4677,18 @@
63 tbstate->toggled_bmask |= mask;
65 + if (FW_W_BUTTON(fw, i) == HoverW)
66 + {
67 + tbstate->hover_bmask |= mask;
68 + }
69 tbstate->bstate[i] = border_flags_to_button_state(
70 tbstate->pressed_bmask & mask,
71 tbstate->lit_bmask & mask,
72 - tbstate->toggled_bmask & mask);
73 + tbstate->toggled_bmask & mask,
74 + tbstate->hover_bmask & mask);
76 tbstate->tstate = border_flags_to_button_state(
77 - tbstate->is_title_pressed, tbstate->is_title_lit, 0);
78 + tbstate->is_title_pressed, tbstate->is_title_lit, 0, 0);
81 static window_parts border_get_titlebar_descr(
82 @@ -4940,6 +4953,7 @@
83 fw->decor_state.buttons_lit = 0;
84 fw->decor_state.buttons_inverted = 0;
85 fw->decor_state.buttons_toggled = 0;
86 + fw->decor_state.buttons_hover = 0;
87 return;
89 memset(&td, 0, sizeof(td));
90 @@ -4991,6 +5005,7 @@
91 fw->decor_state.buttons_toggled =
92 (fw->decor_state.buttons_toggled &
93 ~td.tbstate.max_bmask) | td.tbstate.toggled_bmask;
94 + fw->decor_state.buttons_hover &= td.tbstate.hover_bmask;
97 return;
98 @@ -5081,11 +5096,12 @@
99 ButtonState bs;
100 int is_pressed;
101 int is_toggled;
102 + int is_hover;
103 int i;
105 /* title */
106 is_pressed = (FW_W_TITLE(fw) == PressedW);
107 - bs = border_flags_to_button_state(is_pressed, has_focus, 0);
108 + bs = border_flags_to_button_state(is_pressed, has_focus, 0, 0);
109 if (DFS_USE_BORDER_STYLE(TB_STATE(GetDecor(fw, titlebar))[bs].style))
111 return 1;
112 @@ -5098,8 +5114,9 @@
114 is_pressed = (FW_W_BUTTON(fw, i) == PressedW);
115 is_toggled = (is_button_toggled(fw, i) == True);
116 + is_hover = (FW_W_BUTTON(fw, i) == HoverW);
117 bs = border_flags_to_button_state(
118 - is_pressed, (has_focus == True), is_toggled);
119 + is_pressed, (has_focus == True), is_toggled, is_hover);
120 if (DFS_USE_BORDER_STYLE(
121 TB_STATE(GetDecor(fw, buttons[i]))[bs].style))
123 @@ -5560,6 +5577,7 @@
124 DEFAULT_USE_INACTIVE_BUTTONS;
125 Scr.gs.use_inactive_down_buttons =
126 DEFAULT_USE_INACTIVE_DOWN_BUTTONS;
127 + Scr.gs.use_hover_buttons = 0;
128 return;
130 first = False;
131 @@ -5581,6 +5599,12 @@
132 action, &action,
133 DEFAULT_USE_INACTIVE_DOWN_BUTTONS, True);
135 + else if (StrEquals("hover", token))
137 + Scr.gs.use_hover_buttons = ParseToggleArgument(
138 + action, &action,
139 + 0, True);
141 else
143 Scr.gs.use_active_down_buttons =
144 @@ -5589,6 +5613,7 @@
145 DEFAULT_USE_INACTIVE_BUTTONS;
146 Scr.gs.use_inactive_down_buttons =
147 DEFAULT_USE_INACTIVE_DOWN_BUTTONS;
148 + Scr.gs.use_hover_buttons = 0;
149 fvwm_msg(ERR, "cmd_button_state",
150 "Unknown button state %s", token);
151 return;
152 diff -U3 -r fvwm/builtins.c fvwm/builtins.c
153 --- fvwm/builtins.c 2011-12-09 21:47:16.007350549 +0100
154 +++ fvwm/builtins.c 2011-12-09 21:49:27.360627994 +0100
155 @@ -102,12 +102,16 @@
157 "ActiveUp",
158 "ActiveDown",
159 + "ActiveHover",
160 "InactiveUp",
161 "InactiveDown",
162 + "InactiveHover",
163 "ToggledActiveUp",
164 "ToggledActiveDown",
165 + "ToggledActiveHover",
166 "ToggledInactiveUp",
167 "ToggledInactiveDown",
168 + "ToggledInactiveHover",
169 "Active",
170 "Inactive",
171 "ToggledActive",
172 @@ -118,10 +122,13 @@
173 "AllInactive",
174 "AllUp",
175 "AllDown",
176 + "AllHover",
177 "AllActiveUp",
178 "AllActiveDown",
179 + "AllActiveHover",
180 "AllInactiveUp",
181 "AllInactiveDown",
182 + "AllInactiveHover",
183 NULL
186 diff -U3 -r fvwm/events.c fvwm/events.c
187 --- fvwm/events.c 2011-09-27 23:03:34.000000000 +0200
188 +++ fvwm/events.c 2011-12-09 21:49:27.360627994 +0100
189 @@ -163,6 +163,7 @@
191 int last_event_type = 0;
192 Window PressedW = None;
193 +Window HoverW = None;
195 /* ---------------------------- local functions ---------------------------- */
197 @@ -1727,6 +1728,23 @@
198 return;
201 +static void redraw_hover(FvwmWindow* fw, Window w)
203 + if (fw)
205 + int i;
206 + for (i = 0; i < NUMBER_OF_TITLE_BUTTONS; i++)
208 + if (w == FW_W_BUTTON(fw, i))
210 + HoverW = FW_W_BUTTON(fw, i);
213 + border_redraw_decorations(fw);
214 + HoverW = None;
218 /* ---------------------------- event handlers ----------------------------- */
220 void HandleButtonPress(const evh_args_t *ea)
221 @@ -1938,6 +1956,8 @@
222 ewp = &te->xcrossing;
223 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)"));
225 + redraw_hover(fw, ewp->window);
227 if (
228 ewp->window == Scr.Root &&
229 ewp->detail == NotifyInferior && ewp->mode == NotifyNormal)
230 @@ -2615,6 +2635,8 @@
232 DBUG("HandleLeaveNotify", "Routine Entered");
234 + redraw_hover(fw, te->xcrossing.window);
236 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)"));
237 lwp = &te->xcrossing;
238 if (
239 diff -U3 -r fvwm/fvwm.h fvwm/fvwm.h
240 --- fvwm/fvwm.h 2011-12-09 21:47:15.997350808 +0100
241 +++ fvwm/fvwm.h 2011-12-09 21:49:27.360627994 +0100
242 @@ -827,6 +827,7 @@
243 unsigned buttons_lit : NUMBER_OF_TITLE_BUTTONS;
244 unsigned buttons_inverted : NUMBER_OF_TITLE_BUTTONS;
245 unsigned buttons_toggled : NUMBER_OF_TITLE_BUTTONS;
246 + unsigned buttons_hover : NUMBER_OF_TITLE_BUTTONS;
247 unsigned parts_drawn : 12;
248 unsigned parts_lit : 12;
249 unsigned parts_inverted : 12;
250 diff -U3 -r fvwm/screen.h fvwm/screen.h
251 --- fvwm/screen.h 2011-12-09 21:47:16.007350549 +0100
252 +++ fvwm/screen.h 2011-12-09 21:49:27.360627994 +0100
253 @@ -202,12 +202,16 @@
254 BS_All = -1,
255 BS_ActiveUp,
256 BS_ActiveDown,
257 + BS_ActiveHover,
258 BS_InactiveUp,
259 BS_InactiveDown,
260 + BS_InactiveHover,
261 BS_ToggledActiveUp,
262 BS_ToggledActiveDown,
263 + BS_ToggledActiveHover,
264 BS_ToggledInactiveUp,
265 BS_ToggledInactiveDown,
266 + BS_ToggledInactiveHover,
267 BS_MaxButtonState,
268 BS_MaxButtonStateMask = BS_MaxButtonState - 1,
269 BS_Active,
270 @@ -220,10 +224,13 @@
271 BS_AllInactive,
272 BS_AllUp,
273 BS_AllDown,
274 + BS_AllHover,
275 BS_AllActiveUp,
276 BS_AllActiveDown,
277 + BS_AllActiveHover,
278 BS_AllInactiveUp,
279 BS_AllInactiveDown,
280 + BS_AllInactiveHover,
281 BS_MaxButtonStateName
282 } ButtonState;
284 @@ -513,6 +520,7 @@
285 unsigned use_active_down_buttons : 1;
286 unsigned use_inactive_buttons : 1;
287 unsigned use_inactive_down_buttons : 1;
288 + unsigned use_hover_buttons : 1;
289 } gs; /* global style structure */
290 struct
292 Seulement dans modules/FvwmIconMan: FvwmIconMan.h.orig
293 Seulement dans modules/FvwmIconMan: readconfig.c.orig
294 Seulement dans modules/FvwmIconMan: xmanager.c.orig