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
5 /* ---------------------------- imports ------------------------------------ */
7 extern Window PressedW;
10 /* ---------------------------- included code files ------------------------ */
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;
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)
29 + return BS_ActiveHover;
31 if (!is_lit && Scr.gs.use_inactive_buttons)
33 if (is_pressed && Scr.gs.use_inactive_down_buttons)
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;
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;
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;
61 @@ -4669,13 +4677,18 @@
63 tbstate->toggled_bmask |= mask;
65 + if (FW_W_BUTTON(fw, i) == HoverW)
67 + tbstate->hover_bmask |= mask;
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(
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;
89 memset(&td, 0, sizeof(td));
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;
98 @@ -5081,11 +5096,12 @@
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))
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;
131 @@ -5581,6 +5599,12 @@
133 DEFAULT_USE_INACTIVE_DOWN_BUTTONS, True);
135 + else if (StrEquals("hover", token))
137 + Scr.gs.use_hover_buttons = ParseToggleArgument(
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);
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 @@
165 + "ToggledActiveHover",
167 "ToggledInactiveDown",
168 + "ToggledInactiveHover",
172 @@ -118,10 +122,13 @@
182 + "AllInactiveHover",
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
191 int last_event_type = 0;
192 Window PressedW = None;
193 +Window HoverW = None;
195 /* ---------------------------- local functions ---------------------------- */
197 @@ -1727,6 +1728,23 @@
201 +static void redraw_hover(FvwmWindow* fw, Window w)
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);
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);
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;
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
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 @@
262 BS_ToggledActiveDown,
263 + BS_ToggledActiveHover,
264 BS_ToggledInactiveUp,
265 BS_ToggledInactiveDown,
266 + BS_ToggledInactiveHover,
268 BS_MaxButtonStateMask = BS_MaxButtonState - 1,
270 @@ -220,10 +224,13 @@
280 + BS_AllInactiveHover,
281 BS_MaxButtonStateName
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 */
292 Seulement dans modules/FvwmIconMan: FvwmIconMan.h.orig
293 Seulement dans modules/FvwmIconMan: readconfig.c.orig
294 Seulement dans modules/FvwmIconMan: xmanager.c.orig