Merge lp:~unity-team/unity/unity.hide-cleanup into lp:unity
- unity.hide-cleanup
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 978 |
Proposed branch: | lp:~unity-team/unity/unity.hide-cleanup |
Merge into: | lp:unity |
Diff against target: |
1705 lines (+569/-288) 17 files modified
src/Launcher.cpp (+177/-229) src/Launcher.h (+13/-22) src/LauncherHideMachine.cpp (+203/-0) src/LauncherHideMachine.h (+87/-0) src/PanelHomeButton.cpp (+4/-3) src/PanelMenuView.cpp (+6/-4) src/PanelMenuView.h (+2/-2) src/PlacesController.cpp (+2/-5) src/PlacesHomeView.cpp (+1/-0) src/PlacesTile.cpp (+2/-1) src/PluginAdapter.cpp (+30/-4) src/PluginAdapter.h (+4/-0) src/UBusMessages.h (+1/-1) src/WindowManager.h (+6/-2) src/unityshell.cpp (+27/-14) src/unityshell.h (+3/-0) unityshell.xml.in (+1/-1) |
To merge this branch: | bzr merge lp:~unity-team/unity/unity.hide-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alejandro Piñeiro (community) | Approve | ||
Didier Roche-Tolomelli | Approve | ||
Rodrigo Moya | Pending | ||
Neil J. Patel | Pending | ||
Review via email: mp+54167@code.launchpad.net |
Commit message
Description of the change
Alejandro Piñeiro (apinheiro) wrote : | # |
I have just tested it, and the orca support on the launcher is still working (although right now this is true with at-spi2, not with at-spi). As I told Jason Smith on IRC, current a11y support on the Launcher is based on the icon selection change (signal selection_change) and the Launcher having the focus (signals OnStartFocus and OnEndFocus) and this branch doesn't modify it.
In the case of places, right now the support is zero, as I just made some user-tests, and start to review the object hierarchy. But as the real support is zero, it doesn't matter if it changes suddenly.
So from my part it is ok.
Anyway, this also touches the Panel. So as Rodrigo was the one implementing the a11y support for the panel-service, I will let him to review this part.
Preview Diff
1 | === modified file 'src/Launcher.cpp' |
2 | --- src/Launcher.cpp 2011-03-18 18:35:33 +0000 |
3 | +++ src/Launcher.cpp 2011-03-21 19:14:32 +0000 |
4 | @@ -51,6 +51,10 @@ |
5 | |
6 | #define BACKLIGHT_STRENGTH 0.9f |
7 | |
8 | +#define TRIGGER_SQR_RADIUS 9 |
9 | + |
10 | +#define MOUSE_DEADZONE 15 |
11 | + |
12 | #define S_DBUS_NAME "com.canonical.Unity.Launcher" |
13 | #define S_DBUS_PATH "/com/canonical/Unity/Launcher" |
14 | #define S_DBUS_IFACE "com.canonical.Unity.Launcher" |
15 | @@ -220,6 +224,9 @@ |
16 | _parent = parent; |
17 | _screen = screen; |
18 | _active_quicklist = 0; |
19 | + |
20 | + _hide_machine = new LauncherHideMachine (); |
21 | + _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden)); |
22 | |
23 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
24 | |
25 | @@ -251,6 +258,11 @@ |
26 | |
27 | PluginAdapter::Default ()->window_mapped.connect (sigc::mem_fun (this, &Launcher::OnWindowMapped)); |
28 | PluginAdapter::Default ()->window_unmapped.connect (sigc::mem_fun (this, &Launcher::OnWindowUnmapped)); |
29 | + |
30 | + PluginAdapter::Default ()->initiate_spread.connect (sigc::mem_fun (this, &Launcher::OnPluginStateChanged)); |
31 | + PluginAdapter::Default ()->initiate_expo.connect (sigc::mem_fun (this, &Launcher::OnPluginStateChanged)); |
32 | + PluginAdapter::Default ()->terminate_spread.connect (sigc::mem_fun (this, &Launcher::OnPluginStateChanged)); |
33 | + PluginAdapter::Default ()->terminate_expo.connect (sigc::mem_fun (this, &Launcher::OnPluginStateChanged)); |
34 | |
35 | m_ActiveTooltipIcon = NULL; |
36 | m_ActiveMenuIcon = NULL; |
37 | @@ -327,11 +339,9 @@ |
38 | _superkey_labels[i] = cairoToTexture2D ((char) ('0' + ((i + 1) % 10)), _icon_size, _icon_size); |
39 | |
40 | _enter_y = 0; |
41 | - _dnd_security = 15; |
42 | _launcher_drag_delta = 0; |
43 | _dnd_delta_y = 0; |
44 | _dnd_delta_x = 0; |
45 | - _autohide_handle = 0; |
46 | _autoscroll_handle = 0; |
47 | _redraw_handle = 0; |
48 | _start_dragicon_handle = 0; |
49 | @@ -339,25 +349,19 @@ |
50 | _floating = false; |
51 | _hovered = false; |
52 | _hidden = false; |
53 | - _hidden_state_check = true; |
54 | - _mouse_inside_launcher = false; |
55 | - _mouse_inside_trigger = false; |
56 | - _mouseover_launcher_locked = false; |
57 | - _super_show_launcher = false; |
58 | - _navmod_show_launcher = false; |
59 | - _placeview_show_launcher = false; |
60 | - _window_over_launcher = false; |
61 | - _hide_on_drag_hover = false; |
62 | _render_drag_window = false; |
63 | - _dnd_window_is_mapped = false; |
64 | _drag_edge_touching = false; |
65 | _backlight_mode = BACKLIGHT_NORMAL; |
66 | _last_button_press = 0; |
67 | _selection_atom = 0; |
68 | + |
69 | + _check_window_over_launcher = true; |
70 | + _postreveal_mousemove_delta_x = 0; |
71 | + _postreveal_mousemove_delta_y = 0; |
72 | |
73 | // set them to 1 instead of 0 to avoid :0 in case something is racy |
74 | - _trigger_width = 1; |
75 | - _trigger_height = 1; |
76 | + _bfb_width = 1; |
77 | + _bfb_height = 1; |
78 | |
79 | // 0 out timers to avoid wonky startups |
80 | int i; |
81 | @@ -379,8 +383,8 @@ |
82 | (UBusCallback)&Launcher::OnPlaceViewHidden, |
83 | this); |
84 | |
85 | - ubus_server_register_interest (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE, |
86 | - (UBusCallback)&Launcher::OnTriggerUpdate, |
87 | + ubus_server_register_interest (ubus, UBUS_HOME_BUTTON_BFB_UPDATE, |
88 | + (UBusCallback)&Launcher::OnBFBUpdate, |
89 | this); |
90 | |
91 | ubus_server_register_interest (ubus, UBUS_LAUNCHER_ACTION_DONE, |
92 | @@ -533,8 +537,8 @@ |
93 | void |
94 | Launcher::startKeyNavMode () |
95 | { |
96 | - _navmod_show_launcher = true; |
97 | - EnsureHiddenState (); |
98 | + _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, true); |
99 | + _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
100 | |
101 | GrabKeyboard (); |
102 | GrabPointer (); |
103 | @@ -552,14 +556,14 @@ |
104 | Launcher *self = (Launcher*) data; |
105 | |
106 | // move focus to key nav mode when activated |
107 | - if (!(self->_navmod_show_launcher)) |
108 | + if (!(self->_hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE))) |
109 | return false; |
110 | |
111 | if (self->_last_icon_index == -1) |
112 | self->_current_icon_index = 0; |
113 | else |
114 | self->_current_icon_index = self->_last_icon_index; |
115 | - self->NeedRedraw (); |
116 | + self->EnsureAnimation (); |
117 | |
118 | ubus_server_send_message (ubus_server_get_default (), |
119 | UBUS_LAUNCHER_START_KEY_NAV, |
120 | @@ -587,13 +591,12 @@ |
121 | void |
122 | Launcher::exitKeyNavMode () |
123 | { |
124 | - if (!_navmod_show_launcher) |
125 | + if (!_hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE)) |
126 | return; |
127 | - |
128 | + |
129 | UnGrabKeyboard (); |
130 | UnGrabPointer (); |
131 | - _navmod_show_launcher = false; |
132 | - EnsureHiddenState (); |
133 | + _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, false); |
134 | |
135 | _current_icon_index = -1; |
136 | _last_icon_index = _current_icon_index; |
137 | @@ -619,7 +622,7 @@ |
138 | g_variant_builder_add (builder, "{sv}", "hovered", g_variant_new_boolean (_hovered)); |
139 | g_variant_builder_add (builder, "{sv}", "hidemode", g_variant_new_int32 (_hidemode)); |
140 | g_variant_builder_add (builder, "{sv}", "hidden", g_variant_new_boolean (_hidden)); |
141 | - g_variant_builder_add (builder, "{sv}", "mouse-inside-launcher", g_variant_new_boolean (_mouse_inside_launcher)); |
142 | + g_variant_builder_add (builder, "{sv}", "mouse-over-launcher", g_variant_new_boolean (_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER))); |
143 | } |
144 | |
145 | void Launcher::SetMousePosition (int x, int y) |
146 | @@ -658,15 +661,12 @@ |
147 | { |
148 | |
149 | // bfb position progress. Go from GetAutohidePositionMin() -> GetAutohidePositionMax() linearly |
150 | - if (_mouse_inside_trigger && !_mouseover_launcher_locked) |
151 | + if (_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_BFB) && _hidden) |
152 | { |
153 | - // all this code should only be triggered when _hidden is true |
154 | - if (!_hidden) |
155 | - return 0.0f; |
156 | - |
157 | - // "dead" zone |
158 | - if ((_trigger_mouse_position.x < 3) && (_trigger_mouse_position.y < 3)) |
159 | - return GetAutohidePositionMin (); |
160 | + |
161 | + // Be evil, but safe: position based == removing all existing time-based autohide |
162 | + _times[TIME_AUTOHIDE].tv_sec = 0; |
163 | + _times[TIME_AUTOHIDE].tv_nsec = 0; |
164 | |
165 | /* |
166 | * most of the mouse movement should be done by the inferior part |
167 | @@ -674,23 +674,22 @@ |
168 | */ |
169 | |
170 | float _max_size_on_position; |
171 | - float position_on_border = _trigger_mouse_position.x * _trigger_height / _trigger_mouse_position.y; |
172 | + float position_on_border = _bfb_mouse_position.x * _bfb_height / _bfb_mouse_position.y; |
173 | |
174 | - if (position_on_border < _trigger_width) |
175 | - _max_size_on_position = pow(pow(position_on_border, 2) + pow(_trigger_height, 2), 0.5); |
176 | + if (position_on_border < _bfb_width) |
177 | + _max_size_on_position = pow(pow(position_on_border, 2) + pow(_bfb_height, 2), 0.5); |
178 | else |
179 | { |
180 | - position_on_border = _trigger_mouse_position.y * _trigger_width / _trigger_mouse_position.x; |
181 | - _max_size_on_position = pow(pow(position_on_border, 2) + pow(_trigger_width, 2), 0.5); |
182 | + position_on_border = _bfb_mouse_position.y * _bfb_width / _bfb_mouse_position.x; |
183 | + _max_size_on_position = pow(pow(position_on_border, 2) + pow(_bfb_width, 2), 0.5); |
184 | } |
185 | |
186 | float _position_min = GetAutohidePositionMin (); |
187 | - return pow(pow(_trigger_mouse_position.x, 2) + pow(_trigger_mouse_position.y, 2), 0.5) / _max_size_on_position * (GetAutohidePositionMax () - _position_min) + _position_min; |
188 | + return pow(pow(_bfb_mouse_position.x, 2) + pow(_bfb_mouse_position.y, 2), 0.5) / _max_size_on_position * (GetAutohidePositionMax () - _position_min) + _position_min; |
189 | } |
190 | - |
191 | - // time-based progress (full scale or finish the TRIGGER_AUTOHIDE_MIN -> 0.00f on bfb) |
192 | else |
193 | { |
194 | + // time-based progress (full scale or finish the TRIGGER_AUTOHIDE_MIN -> 0.00f on bfb) |
195 | float animation_progress; |
196 | animation_progress = CLAMP ((float) (TimeDelta (¤t, &_times[TIME_AUTOHIDE])) / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f); |
197 | if (_hidden) |
198 | @@ -795,11 +794,9 @@ |
199 | if (TimeDelta (¤t, &_times[TIME_DRAG_END]) < ANIM_DURATION_LONG) |
200 | return true; |
201 | |
202 | - // hide animation (time or position) |
203 | + // hide animation (time only), position is trigger manually on the bfb |
204 | if (TimeDelta (¤t, &_times[TIME_AUTOHIDE]) < ANIM_DURATION_SHORT) |
205 | return true; |
206 | - if (_mouse_inside_trigger && !_mouseover_launcher_locked) |
207 | - return true; |
208 | |
209 | // collapse animation on DND out of launcher space |
210 | if (TimeDelta (¤t, &_times[TIME_DRAG_THRESHOLD]) < ANIM_DURATION_SHORT) |
211 | @@ -837,7 +834,7 @@ |
212 | timer->tv_sec = current.tv_sec; |
213 | timer->tv_nsec = current.tv_nsec; |
214 | } |
215 | -/* Min is when you lock the trigger */ |
216 | +/* Min is when you are on the trigger */ |
217 | float Launcher::GetAutohidePositionMin () |
218 | { |
219 | if (_autohide_animation == SLIDE_ONLY) |
220 | @@ -845,7 +842,7 @@ |
221 | else |
222 | return 0.25f; |
223 | } |
224 | -/* Max is the initial state */ |
225 | +/* Max is the initial state over the bfb */ |
226 | float Launcher::GetAutohidePositionMax () |
227 | { |
228 | if (_autohide_animation == SLIDE_ONLY) |
229 | @@ -1287,28 +1284,16 @@ |
230 | *launcher_alpha = 1.0f; |
231 | if (_hidemode != LAUNCHER_HIDE_NEVER) |
232 | { |
233 | + |
234 | float autohide_progress = AutohideProgress (current); |
235 | - |
236 | if (_autohide_animation == FADE_ONLY |
237 | - || (_autohide_animation == FADE_SLIDE && _mouse_inside_trigger)) |
238 | + || (_autohide_animation == FADE_SLIDE && _hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_BFB))) |
239 | *launcher_alpha = 1.0f - autohide_progress; |
240 | else |
241 | { |
242 | if (autohide_progress > 0.0f) |
243 | autohide_offset -= geo.width * autohide_progress; |
244 | } |
245 | - /* _mouse_inside_trigger is particular because we don't change _hidden state |
246 | - * as we can go back and for. We have to lock the launcher manually changing |
247 | - * the _hidden state then |
248 | - */ |
249 | - float _position_min = GetAutohidePositionMin (); |
250 | - if (autohide_progress == _position_min && _mouse_inside_trigger && !_mouseover_launcher_locked) |
251 | - { |
252 | - ForceHiddenState (false); // lock the launcher |
253 | - _times[TIME_AUTOHIDE] = current; |
254 | - SetTimeBack (&_times[TIME_AUTOHIDE], ANIM_DURATION_SHORT * _position_min); |
255 | - SetTimeStruct (&_times[TIME_AUTOHIDE], &_times[TIME_AUTOHIDE], ANIM_DURATION_SHORT); // finish the animation |
256 | - } |
257 | } |
258 | |
259 | float drag_hide_progress = DragHideProgress (current); |
260 | @@ -1317,10 +1302,7 @@ |
261 | autohide_offset -= geo.width * 0.25f * drag_hide_progress; |
262 | |
263 | if (drag_hide_progress >= 1.0f) |
264 | - { |
265 | - _hide_on_drag_hover = true; |
266 | - EnsureHiddenState (); |
267 | - } |
268 | + _hide_machine->SetQuirk (LauncherHideMachine::DND_PUSHED_OFF, true); |
269 | } |
270 | |
271 | // Inform the painter where to paint the box |
272 | @@ -1387,62 +1369,74 @@ |
273 | |
274 | void Launcher::StartKeyShowLauncher () |
275 | { |
276 | - bool was_hidden = _hidden; |
277 | - |
278 | - _super_show_launcher = true; |
279 | + _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, true); |
280 | + _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
281 | QueueDraw (); |
282 | SetTimeStruct (&_times[TIME_TAP_SUPER], NULL, SUPER_TAP_DURATION); |
283 | if (_redraw_handle > 0) |
284 | g_source_remove (_redraw_handle); |
285 | _redraw_handle = g_timeout_add (SUPER_TAP_DURATION, &Launcher::DrawLauncherTimeout, this); |
286 | - EnsureHiddenState (); |
287 | - |
288 | - // don't lock on mouseover state to avoid locking it the pointer was already there but not moved |
289 | - if (was_hidden) |
290 | - _mouseover_launcher_locked = false; |
291 | } |
292 | |
293 | void Launcher::EndKeyShowLauncher () |
294 | { |
295 | - |
296 | - _super_show_launcher = false; |
297 | + |
298 | + _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, false); |
299 | QueueDraw (); |
300 | |
301 | // it's a tap on super |
302 | if (TapOnSuper ()) |
303 | ubus_server_send_message (ubus_server_get_default (), UBUS_DASH_EXTERNAL_ACTIVATION, NULL); |
304 | - |
305 | - SetupAutohideTimer (); |
306 | } |
307 | |
308 | void Launcher::OnPlaceViewShown (GVariant *data, void *val) |
309 | { |
310 | Launcher *self = (Launcher*)val; |
311 | - self->_placeview_show_launcher = true; |
312 | - self->EnsureHiddenState (); |
313 | + self->_hide_machine->SetQuirk (LauncherHideMachine::PLACES_VISIBLE, true); |
314 | + |
315 | + // hack around issue in nux where leave events dont always come after a grab |
316 | + self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, false); |
317 | } |
318 | |
319 | void Launcher::OnPlaceViewHidden (GVariant *data, void *val) |
320 | { |
321 | Launcher *self = (Launcher*)val; |
322 | - self->_placeview_show_launcher = false; |
323 | - self->EnsureHiddenState (); |
324 | + self->_hide_machine->SetQuirk (LauncherHideMachine::PLACES_VISIBLE, false); |
325 | } |
326 | |
327 | -void Launcher::OnTriggerUpdate (GVariant *data, gpointer user_data) |
328 | +void Launcher::OnBFBUpdate (GVariant *data, gpointer user_data) |
329 | { |
330 | gchar *prop_key; |
331 | GVariant *prop_value; |
332 | GVariantIter *prop_iter; |
333 | - int x, y, trigger_width, trigger_height; |
334 | + int x, y, bfb_width, bfb_height; |
335 | |
336 | Launcher *self = (Launcher*)user_data; |
337 | |
338 | - g_variant_get (data, "(iiiia{sv})", &x, &y, &trigger_width, &trigger_height, &prop_iter); |
339 | - self->_trigger_mouse_position = nux::Point2 (x, y); |
340 | - |
341 | - self->_trigger_width = trigger_width; |
342 | - self->_trigger_height = trigger_height; |
343 | + g_variant_get (data, "(iiiia{sv})", &x, &y, &bfb_width, &bfb_height, &prop_iter); |
344 | + self->_bfb_mouse_position = nux::Point2 (x, y); |
345 | + |
346 | + bool inside_trigger_area = (pow (x, 2) + pow (y, 2) < TRIGGER_SQR_RADIUS); |
347 | + /* |
348 | + * if we are currently hidden and we are over the trigger, prepare the change |
349 | + * from a position-based move to a time-based one |
350 | + * Fake that we were currently hiding with a corresponding position of GetAutohidePositionMin () |
351 | + * translated time-based so that we pick from the current position |
352 | + */ |
353 | + if (inside_trigger_area && self->_hidden) { |
354 | + self->_hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
355 | + |
356 | + struct timespec current; |
357 | + clock_gettime (CLOCK_MONOTONIC, ¤t); |
358 | + self->_times[TIME_AUTOHIDE] = current; |
359 | + SetTimeBack (&(self->_times[TIME_AUTOHIDE]), ANIM_DURATION_SHORT * (1.0f - self->GetAutohidePositionMin ())); |
360 | + SetTimeStruct (&(self->_times[TIME_AUTOHIDE]), &(self->_times[TIME_AUTOHIDE]), ANIM_DURATION_SHORT); |
361 | + self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, true); |
362 | + } |
363 | + self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_TRIGGER, inside_trigger_area); |
364 | + |
365 | + self->_bfb_width = bfb_width; |
366 | + self->_bfb_height = bfb_height; |
367 | |
368 | g_return_if_fail (prop_iter != NULL); |
369 | |
370 | @@ -1450,49 +1444,34 @@ |
371 | { |
372 | if (g_str_equal ("hovered", prop_key)) |
373 | { |
374 | - self->_mouse_inside_trigger = g_variant_get_boolean (prop_value); |
375 | - if (self->_mouse_inside_trigger) |
376 | - self->_hide_on_drag_hover = false; |
377 | - self->EnsureHiddenState (); |
378 | + self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, g_variant_get_boolean (prop_value)); |
379 | + |
380 | self->EnsureHoverState (); |
381 | self->EnsureScrollTimer (); |
382 | } |
383 | } |
384 | + |
385 | + self->EnsureAnimation (); |
386 | } |
387 | |
388 | void Launcher::OnActionDone (GVariant *data, void *val) |
389 | { |
390 | - Launcher *self = (Launcher*)val; |
391 | - self->_mouseover_launcher_locked = false; |
392 | - self->SetupAutohideTimer (); |
393 | -} |
394 | - |
395 | -void Launcher::ForceHiddenState (bool hidden) |
396 | -{ |
397 | - // force hidden state skipping the animation |
398 | - SetHidden (hidden); |
399 | - _times[TIME_AUTOHIDE].tv_sec = 0; |
400 | - _times[TIME_AUTOHIDE].tv_nsec = 0; |
401 | + Launcher *self = (Launcher*)val; |
402 | + self->_hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, true); |
403 | } |
404 | |
405 | void Launcher::SetHidden (bool hidden) |
406 | { |
407 | if (hidden == _hidden) |
408 | return; |
409 | - |
410 | - // auto lock/unlock the launcher depending on the state switch |
411 | - if (hidden) |
412 | - { |
413 | - _mouseover_launcher_locked = false; |
414 | - // RecvMouseLeave isn't receive if the launcher is hiding while we have the mouse on it |
415 | - // (like, click on a icon, wait the timeout time without moving the mouse, then the launcher hide) |
416 | - if (_mouse_inside_launcher) |
417 | - RecvMouseLeave(-1, -1, 0, 0); |
418 | - } |
419 | - else |
420 | - _mouseover_launcher_locked = true; |
421 | |
422 | _hidden = hidden; |
423 | + _hide_machine->SetQuirk (LauncherHideMachine::LAUNCHER_HIDDEN, hidden); |
424 | + _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
425 | + _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, false); |
426 | + _postreveal_mousemove_delta_x = 0; |
427 | + _postreveal_mousemove_delta_y = 0; |
428 | + |
429 | SetTimeStruct (&_times[TIME_AUTOHIDE], &_times[TIME_AUTOHIDE], ANIM_DURATION_SHORT); |
430 | |
431 | _parent->EnableInputWindow(!hidden, "launcher", false, false); |
432 | @@ -1503,15 +1482,6 @@ |
433 | EnsureAnimation (); |
434 | } |
435 | |
436 | -gboolean Launcher::OnAutohideTimeout (gpointer data) |
437 | -{ |
438 | - Launcher *self = (Launcher*) data; |
439 | - |
440 | - self->_autohide_handle = 0; |
441 | - self->EnsureHiddenState (); |
442 | - return false; |
443 | -} |
444 | - |
445 | int |
446 | Launcher::GetMouseX () |
447 | { |
448 | @@ -1532,40 +1502,6 @@ |
449 | return false; |
450 | } |
451 | |
452 | -void |
453 | -Launcher::EnableHiddenStateCheck (bool enabled) |
454 | -{ |
455 | - _hidden_state_check = enabled; |
456 | -} |
457 | - |
458 | -void |
459 | -Launcher::EnsureHiddenState () |
460 | -{ |
461 | - |
462 | - // Ensure that the hidden state is relevant |
463 | - // /!\ Only use that for a transitionning state (like viewport switch) |
464 | - if (!_hidden_state_check) |
465 | - return; |
466 | - |
467 | - // compiler should optimize this, we do this for readability |
468 | - bool mouse_over_launcher = _mouseover_launcher_locked && (_mouse_inside_trigger || _mouse_inside_launcher); |
469 | - |
470 | - bool required_for_external_purpose = _super_show_launcher || _placeview_show_launcher || _navmod_show_launcher || |
471 | - QuicklistManager::Default ()->Current() || PluginAdapter::Default ()->IsScaleActive (); |
472 | - |
473 | - bool in_must_be_open_mode = GetActionState () != ACTION_NONE || _dnd_window_is_mapped; |
474 | - |
475 | - bool must_be_hidden = _hide_on_drag_hover && _hidemode != LAUNCHER_HIDE_NEVER; |
476 | - |
477 | - bool autohide_handle_hold = _autohide_handle && !_hidden; |
478 | - |
479 | - if (must_be_hidden || (!mouse_over_launcher && !required_for_external_purpose && |
480 | - !in_must_be_open_mode && _window_over_launcher && !autohide_handle_hold)) |
481 | - SetHidden (true); |
482 | - else |
483 | - SetHidden (false); |
484 | -} |
485 | - |
486 | bool |
487 | Launcher::CheckIntersectWindow (CompWindow *window) |
488 | { |
489 | @@ -1583,31 +1519,44 @@ |
490 | } |
491 | |
492 | void |
493 | +Launcher::EnableCheckWindowOverLauncher (gboolean enabled) |
494 | +{ |
495 | + _check_window_over_launcher = enabled; |
496 | +} |
497 | + |
498 | +void |
499 | Launcher::CheckWindowOverLauncher () |
500 | { |
501 | CompWindowList window_list = _screen->windows (); |
502 | CompWindowList::iterator it; |
503 | CompWindow *window = NULL; |
504 | |
505 | - if (_hidemode == LAUNCHER_HIDE_DODGE_ACTIVE_WINDOW) |
506 | + bool any = false; |
507 | + bool active = false; |
508 | + |
509 | + // state has no mean right now, the check will be done again later |
510 | + if (!_check_window_over_launcher) |
511 | + return; |
512 | + |
513 | + window = _screen->findWindow (_screen->activeWindow ()); |
514 | + if (CheckIntersectWindow (window)) |
515 | { |
516 | - window = _screen->findWindow (_screen->activeWindow ()); |
517 | - if (!CheckIntersectWindow (window)) |
518 | - window = NULL; |
519 | + any = true; |
520 | + active = true; |
521 | } |
522 | else |
523 | { |
524 | for (it = window_list.begin (); it != window_list.end (); it++) |
525 | { |
526 | - if (CheckIntersectWindow (*it)) { |
527 | - window = *it; |
528 | + if (CheckIntersectWindow (*it)) |
529 | + { |
530 | + any = true; |
531 | break; |
532 | } |
533 | } |
534 | } |
535 | - |
536 | - _window_over_launcher = (window != NULL); |
537 | - EnsureHiddenState (); |
538 | + _hide_machine->SetQuirk (LauncherHideMachine::ANY_WINDOW_UNDER, any); |
539 | + _hide_machine->SetQuirk (LauncherHideMachine::ACTIVE_WINDOW_UNDER, active); |
540 | } |
541 | |
542 | gboolean |
543 | @@ -1622,14 +1571,13 @@ |
544 | |
545 | if (drag_owner) |
546 | { |
547 | - self->_dnd_window_is_mapped = true; |
548 | + self->_hide_machine->SetQuirk (LauncherHideMachine::EXTERNAL_DND_ACTIVE, true); |
549 | } |
550 | else |
551 | { |
552 | - self->_hide_on_drag_hover = false; |
553 | - self->_dnd_window_is_mapped = false; |
554 | + self->_hide_machine->SetQuirk (LauncherHideMachine::EXTERNAL_DND_ACTIVE, false); |
555 | + self->_hide_machine->SetQuirk (LauncherHideMachine::DND_PUSHED_OFF, false); |
556 | } |
557 | - self->EnsureHiddenState (); |
558 | |
559 | return false; |
560 | } |
561 | @@ -1658,27 +1606,14 @@ |
562 | Launcher::OnWindowMaybeIntellihide (guint32 xid) |
563 | { |
564 | if (_hidemode != LAUNCHER_HIDE_NEVER) |
565 | - { |
566 | - if (_hidemode == LAUNCHER_HIDE_AUTOHIDE) |
567 | - { |
568 | - _window_over_launcher = true; |
569 | - EnsureHiddenState (); |
570 | - } |
571 | - else |
572 | - { |
573 | - CheckWindowOverLauncher (); |
574 | - } |
575 | - } |
576 | + CheckWindowOverLauncher (); |
577 | } |
578 | |
579 | -void Launcher::SetupAutohideTimer () |
580 | +void |
581 | +Launcher::OnPluginStateChanged () |
582 | { |
583 | - if (_hidemode != LAUNCHER_HIDE_NEVER) |
584 | - { |
585 | - if (_autohide_handle > 0) |
586 | - g_source_remove (_autohide_handle); |
587 | - _autohide_handle = g_timeout_add (1000, &Launcher::OnAutohideTimeout, this); |
588 | - } |
589 | + _hide_machine->SetQuirk (LauncherHideMachine::EXPO_ACTIVE, PluginAdapter::Default ()->IsExpoActive ()); |
590 | + _hide_machine->SetQuirk (LauncherHideMachine::SCALE_ACTIVE, PluginAdapter::Default ()->IsScaleActive ()); |
591 | } |
592 | |
593 | Launcher::LauncherHideMode Launcher::GetHideMode () |
594 | @@ -1717,6 +1652,7 @@ |
595 | } |
596 | |
597 | _hidemode = hidemode; |
598 | + _hide_machine->SetMode ((LauncherHideMachine::HideMode) hidemode); |
599 | EnsureAnimation (); |
600 | } |
601 | |
602 | @@ -1793,8 +1729,8 @@ |
603 | return; |
604 | |
605 | _launcher_action_state = actionstate; |
606 | - |
607 | - if (_navmod_show_launcher) |
608 | + |
609 | + if (_hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE)) |
610 | exitKeyNavMode (); |
611 | } |
612 | |
613 | @@ -1807,7 +1743,7 @@ |
614 | void |
615 | Launcher::EnsureHoverState () |
616 | { |
617 | - if (_mouse_inside_launcher || _mouse_inside_trigger || |
618 | + if (_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER) || _hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_BFB) || |
619 | QuicklistManager::Default ()->Current() || GetActionState () != ACTION_NONE) |
620 | { |
621 | SetHover (); |
622 | @@ -1837,23 +1773,22 @@ |
623 | |
624 | _hovered = false; |
625 | SetTimeStruct (&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION); |
626 | - SetupAutohideTimer (); |
627 | EnsureAnimation (); |
628 | } |
629 | |
630 | bool Launcher::MouseOverTopScrollArea () |
631 | { |
632 | if (GetActionState () == ACTION_NONE) |
633 | - return _mouse_inside_trigger; |
634 | + return _hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_BFB); |
635 | |
636 | return _mouse_position.y < 0; |
637 | } |
638 | |
639 | bool Launcher::MouseOverTopScrollExtrema () |
640 | { |
641 | - // since we are not dragging the trigger will pick up events |
642 | + // since we are not dragging the bfb will pick up events |
643 | if (GetActionState () == ACTION_NONE) |
644 | - return _trigger_mouse_position.y == 0; |
645 | + return _bfb_mouse_position.y == 0; |
646 | |
647 | return _mouse_position.y == 0 - _parent->GetGeometry ().y; |
648 | } |
649 | @@ -2381,7 +2316,7 @@ |
650 | geo); |
651 | |
652 | /* draw superkey-shortcut label */ |
653 | - if (_super_show_launcher && !TapOnSuper ()) |
654 | + if (_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN) && !TapOnSuper ()) |
655 | { |
656 | guint64 shortcut = arg.icon->GetShortcut (); |
657 | |
658 | @@ -2566,7 +2501,8 @@ |
659 | { |
660 | if (!icon) |
661 | return; |
662 | - |
663 | + |
664 | + _hide_machine->SetQuirk (LauncherHideMachine::INTERNAL_DND_ACTIVE, true); |
665 | _drag_icon = icon; |
666 | |
667 | if (_drag_window) |
668 | @@ -2596,6 +2532,7 @@ |
669 | SetTimeStruct (&_times[TIME_DRAG_THRESHOLD], &_times[TIME_DRAG_THRESHOLD], ANIM_DURATION_SHORT); |
670 | |
671 | _render_drag_window = false; |
672 | + _hide_machine->SetQuirk (LauncherHideMachine::INTERNAL_DND_ACTIVE, false); |
673 | } |
674 | |
675 | void Launcher::UpdateDragWindowPosition (int x, int y) |
676 | @@ -2632,7 +2569,7 @@ |
677 | |
678 | void Launcher::RecvMouseDownOutsideArea (int x, int y, unsigned long button_flags, unsigned long key_flags) |
679 | { |
680 | - if (_navmod_show_launcher) |
681 | + if (_hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE)) |
682 | exitKeyNavMode (); |
683 | } |
684 | |
685 | @@ -2648,10 +2585,12 @@ |
686 | } |
687 | |
688 | MouseUpLogic (x, y, button_flags, key_flags); |
689 | - |
690 | + |
691 | if (GetActionState () == ACTION_DRAG_ICON) |
692 | EndIconDrag (); |
693 | - |
694 | + |
695 | + if (GetActionState () == ACTION_DRAG_LAUNCHER) |
696 | + _hide_machine->SetQuirk (LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, false); |
697 | SetActionState (ACTION_NONE); |
698 | _dnd_delta_x = 0; |
699 | _dnd_delta_y = 0; |
700 | @@ -2667,8 +2606,8 @@ |
701 | _dnd_delta_y += dy; |
702 | _dnd_delta_x += dx; |
703 | |
704 | - if (nux::Abs (_dnd_delta_y) < 15 && |
705 | - nux::Abs (_dnd_delta_x) < 15 && |
706 | + if (nux::Abs (_dnd_delta_y) < MOUSE_DEADZONE && |
707 | + nux::Abs (_dnd_delta_x) < MOUSE_DEADZONE && |
708 | GetActionState () == ACTION_NONE) |
709 | return; |
710 | |
711 | @@ -2685,6 +2624,7 @@ |
712 | { |
713 | _launcher_drag_delta += _dnd_delta_y; |
714 | SetActionState (ACTION_DRAG_LAUNCHER); |
715 | + _hide_machine->SetQuirk (LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, true); |
716 | } |
717 | else |
718 | { |
719 | @@ -2705,8 +2645,13 @@ |
720 | |
721 | void Launcher::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags) |
722 | { |
723 | + |
724 | + // FIXME: Ugly workaround for nux sending mouse enter signal on super key release or keynav enter |
725 | + if (x < 0) |
726 | + return; |
727 | + |
728 | SetMousePosition (x, y); |
729 | - _mouse_inside_launcher = true; |
730 | + _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, true); |
731 | |
732 | EnsureHoverState (); |
733 | |
734 | @@ -2716,21 +2661,17 @@ |
735 | |
736 | void Launcher::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags) |
737 | { |
738 | + |
739 | + // FIXME: Ugly workaround for nux sending mouse leave signal on super key release or keynav exit |
740 | + if (x < 0) |
741 | + return; |
742 | + |
743 | SetMousePosition (x, y); |
744 | - _mouse_inside_launcher = false; |
745 | - |
746 | + _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, false); |
747 | + |
748 | if (GetActionState () == ACTION_NONE) |
749 | EnsureHoverState (); |
750 | |
751 | - // exit immediatly on action and mouse leaving the launcher (avoid loop when called manually) |
752 | - if (!_mouseover_launcher_locked && (x != -1) && (y != -1)) |
753 | - { |
754 | - if (_autohide_handle > 0) |
755 | - g_source_remove (_autohide_handle); |
756 | - _autohide_handle = 0; |
757 | - EnsureHiddenState (); |
758 | - } |
759 | - |
760 | EventLogic (); |
761 | EnsureAnimation (); |
762 | } |
763 | @@ -2738,6 +2679,16 @@ |
764 | void Launcher::RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags) |
765 | { |
766 | SetMousePosition (x, y); |
767 | + |
768 | + _postreveal_mousemove_delta_x += dx; |
769 | + _postreveal_mousemove_delta_y += dy; |
770 | + |
771 | + // check the state before changing it to avoid uneeded hide calls |
772 | + if (!_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_MOVE_POST_REVEAL) && |
773 | + (nux::Abs (_postreveal_mousemove_delta_x) > MOUSE_DEADZONE || |
774 | + nux::Abs (_postreveal_mousemove_delta_y) > MOUSE_DEADZONE)) |
775 | + _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, true); |
776 | + |
777 | |
778 | // Every time the mouse moves, we check if it is inside an icon... |
779 | EventLogic (); |
780 | @@ -2767,7 +2718,7 @@ |
781 | unsigned long key_code, |
782 | unsigned long key_state) |
783 | { |
784 | - if (!_super_show_launcher) |
785 | + if (!_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN)) |
786 | return false; |
787 | |
788 | LauncherModel::iterator it; |
789 | @@ -2817,7 +2768,7 @@ |
790 | if (it != (LauncherModel::iterator)NULL) |
791 | _current_icon_index = temp_current_icon_index; |
792 | } |
793 | - NeedRedraw (); |
794 | + EnsureAnimation (); |
795 | selection_change.emit (); |
796 | break; |
797 | |
798 | @@ -2836,7 +2787,7 @@ |
799 | if (it != (LauncherModel::iterator)NULL) |
800 | _current_icon_index = temp_current_icon_index; |
801 | |
802 | - NeedRedraw (); |
803 | + EnsureAnimation (); |
804 | selection_change.emit (); |
805 | } |
806 | break; |
807 | @@ -2891,6 +2842,7 @@ |
808 | |
809 | void Launcher::RecvQuicklistOpened (QuicklistView *quicklist) |
810 | { |
811 | + _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true); |
812 | EventLogic (); |
813 | EnsureHoverState (); |
814 | EnsureAnimation (); |
815 | @@ -2898,7 +2850,7 @@ |
816 | |
817 | void Launcher::RecvQuicklistClosed (QuicklistView *quicklist) |
818 | { |
819 | - SetupAutohideTimer (); |
820 | + _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, false); |
821 | |
822 | EventLogic (); |
823 | EnsureHoverState (); |
824 | @@ -2912,14 +2864,9 @@ |
825 | return; |
826 | |
827 | LauncherIcon* launcher_icon = 0; |
828 | - bool should_lock_launcher = false; |
829 | |
830 | - if (_mouse_inside_launcher) { |
831 | + if (_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER)) { |
832 | launcher_icon = MouseIconIntersection (_mouse_position.x, _mouse_position.y); |
833 | - // indicate if the mouse should relock the launcher or not (it doesn't explicitely lock the launcher |
834 | - // when it's entering the launcher. This is for the case: Super reveals the launcher, mouse doesn't move) |
835 | - if (_icon_under_mouse && !_hidden) |
836 | - should_lock_launcher = true; |
837 | } |
838 | |
839 | |
840 | @@ -2935,9 +2882,8 @@ |
841 | launcher_icon->MouseEnter.emit (); |
842 | launcher_icon->_mouse_inside = true; |
843 | _icon_under_mouse = launcher_icon; |
844 | - // reset trigger only when in right context |
845 | - if (should_lock_launcher) |
846 | - _mouseover_launcher_locked = true; |
847 | + |
848 | + _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
849 | } |
850 | } |
851 | |
852 | @@ -2945,6 +2891,8 @@ |
853 | { |
854 | LauncherIcon* launcher_icon = 0; |
855 | launcher_icon = MouseIconIntersection (_mouse_position.x, _mouse_position.y); |
856 | + |
857 | + _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
858 | |
859 | if (launcher_icon) |
860 | { |
861 | @@ -3449,7 +3397,7 @@ |
862 | void |
863 | Launcher::ProcessDndLeave () |
864 | { |
865 | - _mouse_inside_launcher = false; |
866 | + _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, false); |
867 | _drag_edge_touching = false; |
868 | |
869 | SetActionState (ACTION_NONE); |
870 | @@ -3549,7 +3497,7 @@ |
871 | |
872 | // only set hover once we know our first x/y |
873 | SetActionState (ACTION_DRAG_EXTERNAL); |
874 | - _mouse_inside_launcher = true; |
875 | + _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, true); |
876 | |
877 | LauncherModel::iterator it; |
878 | for (it = _model->begin (); it != _model->end () && !_steal_drag; it++) |
879 | |
880 | === modified file 'src/Launcher.h' |
881 | --- src/Launcher.h 2011-03-18 16:26:04 +0000 |
882 | +++ src/Launcher.h 2011-03-21 19:14:32 +0000 |
883 | @@ -30,6 +30,7 @@ |
884 | #include "Introspectable.h" |
885 | #include "LauncherIcon.h" |
886 | #include "LauncherDragWindow.h" |
887 | +#include "LauncherHideMachine.h" |
888 | #include "NuxGraphics/IOpenGLAsmShader.h" |
889 | #include "Nux/TimerProc.h" |
890 | #include "PluginAdapter.h" |
891 | @@ -157,7 +158,7 @@ |
892 | int GetMouseY (); |
893 | |
894 | void CheckWindowOverLauncher (); |
895 | - void EnableHiddenStateCheck (bool enabled); |
896 | + void EnableCheckWindowOverLauncher (gboolean enabled); |
897 | |
898 | sigc::signal<void, char *, LauncherIcon *> launcher_addrequest; |
899 | sigc::signal<void> selection_change; |
900 | @@ -220,9 +221,10 @@ |
901 | void OnWindowMaybeIntellihide (guint32 xid); |
902 | void OnWindowMapped (guint32 xid); |
903 | void OnWindowUnmapped (guint32 xid); |
904 | - |
905 | + |
906 | + void OnPluginStateChanged (); |
907 | + |
908 | static gboolean AnimationTimeout (gpointer data); |
909 | - static gboolean OnAutohideTimeout (gpointer data); |
910 | static gboolean DrawLauncherTimeout (gpointer data); |
911 | static gboolean StrutHack (gpointer data); |
912 | static gboolean MoveFocusToKeyNavModeTimeout (gpointer data); |
913 | @@ -241,10 +243,8 @@ |
914 | LauncherActionState GetActionState(); |
915 | |
916 | void EnsureHoverState (); |
917 | - void EnsureHiddenState (); |
918 | void EnsureAnimation (); |
919 | void EnsureScrollTimer (); |
920 | - void SetupAutohideTimer (); |
921 | |
922 | bool MouseOverTopScrollArea (); |
923 | bool MouseOverTopScrollExtrema (); |
924 | @@ -277,7 +277,6 @@ |
925 | |
926 | void SetHover (); |
927 | void UnsetHover (); |
928 | - void ForceHiddenState (bool hidden); |
929 | void SetHidden (bool hidden); |
930 | |
931 | void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec const ¤t); |
932 | @@ -309,7 +308,7 @@ |
933 | static void OnPlaceViewHidden (GVariant *data, void *val); |
934 | static void OnPlaceViewShown (GVariant *data, void *val); |
935 | |
936 | - static void OnTriggerUpdate (GVariant *data, gpointer user_data); |
937 | + static void OnBFBUpdate (GVariant *data, gpointer user_data); |
938 | |
939 | static void OnActionDone (GVariant *data, void *val); |
940 | |
941 | @@ -396,16 +395,8 @@ |
942 | bool _hovered; |
943 | bool _floating; |
944 | bool _hidden; |
945 | - bool _hidden_state_check; |
946 | - bool _mouse_inside_launcher; |
947 | - bool _mouse_inside_trigger; |
948 | - bool _mouseover_launcher_locked; |
949 | - bool _super_show_launcher; |
950 | - bool _navmod_show_launcher; |
951 | - bool _placeview_show_launcher; |
952 | - bool _window_over_launcher; |
953 | - bool _hide_on_drag_hover; |
954 | bool _render_drag_window; |
955 | + bool _check_window_over_launcher; |
956 | |
957 | BacklightMode _backlight_mode; |
958 | |
959 | @@ -433,13 +424,14 @@ |
960 | int _icon_glow_size; |
961 | int _dnd_delta_y; |
962 | int _dnd_delta_x; |
963 | + int _postreveal_mousemove_delta_x; |
964 | + int _postreveal_mousemove_delta_y; |
965 | int _launcher_drag_delta; |
966 | - int _dnd_security; |
967 | int _enter_y; |
968 | int _last_button_press; |
969 | |
970 | - int _trigger_width; |
971 | - int _trigger_height; |
972 | + int _bfb_width; |
973 | + int _bfb_height; |
974 | |
975 | nux::BaseTexture* _icon_bkg_texture; |
976 | nux::BaseTexture* _icon_shine_texture; |
977 | @@ -461,23 +453,22 @@ |
978 | nux::IntrusiveSP<nux::IOpenGLBaseTexture> _offscreen_drag_texture; |
979 | nux::IntrusiveSP<nux::IOpenGLBaseTexture> _offscreen_progress_texture; |
980 | |
981 | - guint _autohide_handle; |
982 | guint _autoscroll_handle; |
983 | guint _focus_keynav_handle; |
984 | guint _redraw_handle; |
985 | guint _start_dragicon_handle; |
986 | |
987 | nux::Point2 _mouse_position; |
988 | - nux::Point2 _trigger_mouse_position; |
989 | + nux::Point2 _bfb_mouse_position; |
990 | nux::IntrusiveSP<nux::IOpenGLShaderProgram> _shader_program_uv_persp_correction; |
991 | nux::IntrusiveSP<nux::IOpenGLAsmShaderProgram> _AsmShaderProg; |
992 | nux::AbstractPaintLayer* m_BackgroundLayer; |
993 | nux::BaseWindow* _parent; |
994 | LauncherModel* _model; |
995 | LauncherDragWindow* _drag_window; |
996 | + LauncherHideMachine *_hide_machine; |
997 | CompScreen* _screen; |
998 | |
999 | - bool _dnd_window_is_mapped; |
1000 | std::list<char *> _drag_data; |
1001 | nux::DndAction _drag_action; |
1002 | bool _data_checked; |
1003 | |
1004 | === added file 'src/LauncherHideMachine.cpp' |
1005 | --- src/LauncherHideMachine.cpp 1970-01-01 00:00:00 +0000 |
1006 | +++ src/LauncherHideMachine.cpp 2011-03-21 19:14:32 +0000 |
1007 | @@ -0,0 +1,203 @@ |
1008 | +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- |
1009 | +/* |
1010 | + * Copyright (C) 2011 Canonical Ltd |
1011 | + * |
1012 | + * This program is free software: you can redistribute it and/or modify |
1013 | + * it under the terms of the GNU General Public License version 3 as |
1014 | + * published by the Free Software Foundation. |
1015 | + * |
1016 | + * This program is distributed in the hope that it will be useful, |
1017 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1018 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1019 | + * GNU General Public License for more details. |
1020 | + * |
1021 | + * You should have received a copy of the GNU General Public License |
1022 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1023 | + * |
1024 | + * Authored by: Jason Smith <jason.smith@canonical.com> |
1025 | + */ |
1026 | + |
1027 | +#include "LauncherHideMachine.h" |
1028 | + |
1029 | +LauncherHideMachine::LauncherHideMachine () |
1030 | +{ |
1031 | + _mode = HIDE_NEVER; |
1032 | + _quirks = DEFAULT; |
1033 | + _should_hide = false; |
1034 | + |
1035 | + _hide_delay_handle = 0; |
1036 | + _hide_delay_timeout_length = 750; |
1037 | +} |
1038 | + |
1039 | +LauncherHideMachine::~LauncherHideMachine () |
1040 | +{ |
1041 | + if (_hide_delay_handle) |
1042 | + { |
1043 | + g_source_remove (_hide_delay_handle); |
1044 | + _hide_delay_handle = 0; |
1045 | + } |
1046 | +} |
1047 | + |
1048 | +void |
1049 | +LauncherHideMachine::SetShouldHide (bool value, bool skip_delay) |
1050 | +{ |
1051 | + if (_should_hide == value) |
1052 | + return; |
1053 | + |
1054 | + if (value && !skip_delay) |
1055 | + { |
1056 | + if (_hide_delay_handle) |
1057 | + g_source_remove (_hide_delay_handle); |
1058 | + |
1059 | + _hide_delay_handle = g_timeout_add (_hide_delay_timeout_length, &OnHideDelayTimeout, this); |
1060 | + } |
1061 | + else |
1062 | + { |
1063 | + _should_hide = value; |
1064 | + should_hide_changed.emit (value); |
1065 | + } |
1066 | +} |
1067 | + |
1068 | +/* == Quick Quirk Reference : please keep up to date == |
1069 | + LAUNCHER_HIDDEN = 1 << 0, 1 |
1070 | + MOUSE_OVER_LAUNCHER = 1 << 1, 2 |
1071 | + MOUSE_OVER_BFB = 1 << 2, 4 |
1072 | + MOUSE_OVER_TRIGGER = 1 << 3, 8 |
1073 | + QUICKLIST_OPEN = 1 << 4, 16 #VISIBLE_REQUIRED |
1074 | + EXTERNAL_DND_ACTIVE = 1 << 5, 32 #VISIBLE_REQUIRED |
1075 | + INTERNAL_DND_ACTIVE = 1 << 6, 64 #VISIBLE_REQUIRED |
1076 | + TRIGGER_BUTTON_DOWN = 1 << 7, 128 #VISIBLE_REQUIRED |
1077 | + ANY_WINDOW_UNDER = 1 << 8, 256 |
1078 | + ACTIVE_WINDOW_UNDER = 1 << 9, 512 |
1079 | + DND_PUSHED_OFF = 1 << 10, 1024 |
1080 | + MOUSE_MOVE_POST_REVEAL = 1 << 11, 2k |
1081 | + VERTICAL_SLIDE_ACTIVE = 1 << 12, 4k #VISIBLE_REQUIRED |
1082 | + KEY_NAV_ACTIVE = 1 << 13, 8k #VISIBLE_REQUIRED |
1083 | + PLACES_VISIBLE = 1 << 14, 16k #VISIBLE_REQUIRED |
1084 | + LAST_ACTION_ACTIVATE = 1 << 15, 32k |
1085 | + SCALE_ACTIVE = 1 << 16, 64k #VISIBLE_REQUIRED |
1086 | + EXPO_ACTIVE = 1 << 17, 128k #VISIBLE_REQUIRED |
1087 | +*/ |
1088 | + |
1089 | +#define VISIBLE_REQUIRED (QUICKLIST_OPEN | EXTERNAL_DND_ACTIVE | \ |
1090 | +INTERNAL_DND_ACTIVE | TRIGGER_BUTTON_DOWN | VERTICAL_SLIDE_ACTIVE |\ |
1091 | +KEY_NAV_ACTIVE | PLACES_VISIBLE | SCALE_ACTIVE | EXPO_ACTIVE) |
1092 | + |
1093 | +void |
1094 | +LauncherHideMachine::EnsureHideState (bool skip_delay) |
1095 | +{ |
1096 | + bool should_hide; |
1097 | + |
1098 | + if (_mode == HIDE_NEVER) |
1099 | + { |
1100 | + SetShouldHide (false, skip_delay); |
1101 | + return; |
1102 | + } |
1103 | + |
1104 | + do |
1105 | + { |
1106 | + // first we check the condition where external DND is active and the push off has happened |
1107 | + if (GetQuirk ((HideQuirk) (EXTERNAL_DND_ACTIVE | DND_PUSHED_OFF), false)) |
1108 | + { |
1109 | + should_hide = true; |
1110 | + break; |
1111 | + } |
1112 | + |
1113 | + if (GetQuirk (LAST_ACTION_ACTIVATE)) |
1114 | + { |
1115 | + should_hide = true; |
1116 | + break; |
1117 | + } |
1118 | + |
1119 | + HideQuirk _should_show_quirk; |
1120 | + |
1121 | + if (GetQuirk (LAUNCHER_HIDDEN)) |
1122 | + _should_show_quirk = (HideQuirk) (VISIBLE_REQUIRED | MOUSE_OVER_TRIGGER); |
1123 | + else { |
1124 | + _should_show_quirk = (HideQuirk) (VISIBLE_REQUIRED | MOUSE_OVER_BFB); |
1125 | + // mouse position over launcher is only taken into account if we move it after the revealing state |
1126 | + if (GetQuirk (MOUSE_MOVE_POST_REVEAL)) |
1127 | + _should_show_quirk = (HideQuirk) (_should_show_quirk | MOUSE_OVER_LAUNCHER); |
1128 | + } |
1129 | + |
1130 | + if (GetQuirk (_should_show_quirk)) |
1131 | + { |
1132 | + should_hide = false; |
1133 | + break; |
1134 | + } |
1135 | + |
1136 | + if (_mode == AUTOHIDE) |
1137 | + should_hide = true; |
1138 | + else if (_mode == DODGE_WINDOWS) |
1139 | + should_hide = GetQuirk (ANY_WINDOW_UNDER); |
1140 | + else if (_mode == DODGE_ACTIVE_WINDOW) |
1141 | + should_hide = GetQuirk (ACTIVE_WINDOW_UNDER); |
1142 | + |
1143 | + } while (false); |
1144 | + |
1145 | + SetShouldHide (should_hide, skip_delay); |
1146 | +} |
1147 | + |
1148 | +void |
1149 | +LauncherHideMachine::SetMode (LauncherHideMachine::HideMode mode) |
1150 | +{ |
1151 | + if (_mode == mode) |
1152 | + return; |
1153 | + |
1154 | + _mode = mode; |
1155 | + EnsureHideState (true); |
1156 | +} |
1157 | + |
1158 | +LauncherHideMachine::HideMode |
1159 | +LauncherHideMachine::GetMode () |
1160 | +{ |
1161 | + return _mode; |
1162 | +} |
1163 | + |
1164 | +#define SKIP_DELAY_QUIRK (EXTERNAL_DND_ACTIVE | DND_PUSHED_OFF | ACTIVE_WINDOW_UNDER | \ |
1165 | +ANY_WINDOW_UNDER | EXPO_ACTIVE | SCALE_ACTIVE) |
1166 | + |
1167 | +void |
1168 | +LauncherHideMachine::SetQuirk (LauncherHideMachine::HideQuirk quirk, bool active) |
1169 | +{ |
1170 | + if (GetQuirk (quirk) == active) |
1171 | + return; |
1172 | + |
1173 | + if (active) |
1174 | + _quirks = (HideQuirk) (_quirks | quirk); |
1175 | + else |
1176 | + _quirks = (HideQuirk) (_quirks & ~quirk); |
1177 | + |
1178 | + // no skipping when last action was activate on general case |
1179 | + bool skip = quirk & SKIP_DELAY_QUIRK && !GetQuirk (LAST_ACTION_ACTIVATE); |
1180 | + |
1181 | + // but skip on last action if we were out of the launcher/bfb |
1182 | + if (GetQuirk (LAST_ACTION_ACTIVATE) && !active && (quirk & (MOUSE_OVER_LAUNCHER | MOUSE_OVER_BFB))) |
1183 | + skip = true; |
1184 | + |
1185 | + EnsureHideState (skip); |
1186 | +} |
1187 | + |
1188 | +bool |
1189 | +LauncherHideMachine::GetQuirk (LauncherHideMachine::HideQuirk quirk, bool allow_partial) |
1190 | +{ |
1191 | + if (allow_partial) |
1192 | + return _quirks & quirk; |
1193 | + return (_quirks & quirk) == quirk; |
1194 | +} |
1195 | + |
1196 | +bool |
1197 | +LauncherHideMachine::ShouldHide () |
1198 | +{ |
1199 | + return _should_hide; |
1200 | +} |
1201 | + |
1202 | +gboolean |
1203 | +LauncherHideMachine::OnHideDelayTimeout (gpointer data) |
1204 | +{ |
1205 | + LauncherHideMachine *self = static_cast<LauncherHideMachine *> (data); |
1206 | + self->EnsureHideState (true); |
1207 | + |
1208 | + self->_hide_delay_handle = 0; |
1209 | + return false; |
1210 | +} |
1211 | |
1212 | === added file 'src/LauncherHideMachine.h' |
1213 | --- src/LauncherHideMachine.h 1970-01-01 00:00:00 +0000 |
1214 | +++ src/LauncherHideMachine.h 2011-03-21 19:14:32 +0000 |
1215 | @@ -0,0 +1,87 @@ |
1216 | +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- |
1217 | +/* |
1218 | + * Copyright (C) 2011 Canonical Ltd |
1219 | + * |
1220 | + * This program is free software: you can redistribute it and/or modify |
1221 | + * it under the terms of the GNU General Public License version 3 as |
1222 | + * published by the Free Software Foundation. |
1223 | + * |
1224 | + * This program is distributed in the hope that it will be useful, |
1225 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1226 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1227 | + * GNU General Public License for more details. |
1228 | + * |
1229 | + * You should have received a copy of the GNU General Public License |
1230 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1231 | + * |
1232 | + * Authored by: Jason Smith <jason.smith@canonical.com> |
1233 | + */ |
1234 | + |
1235 | +#ifndef LAUNCHERHIDEMACHINE |
1236 | +#define LAUNCHERHIDEMACHINE |
1237 | + |
1238 | +#include <sigc++/sigc++.h> |
1239 | +#include <glib.h> |
1240 | + |
1241 | +class LauncherHideMachine : public sigc::trackable |
1242 | +{ |
1243 | + public: |
1244 | + typedef enum |
1245 | + { |
1246 | + HIDE_NEVER, |
1247 | + AUTOHIDE, |
1248 | + DODGE_WINDOWS, |
1249 | + DODGE_ACTIVE_WINDOW, |
1250 | + } HideMode; |
1251 | + |
1252 | + typedef enum |
1253 | + { |
1254 | + DEFAULT = 0, |
1255 | + LAUNCHER_HIDDEN = 1 << 0, |
1256 | + MOUSE_OVER_LAUNCHER = 1 << 1, |
1257 | + MOUSE_OVER_BFB = 1 << 2, |
1258 | + MOUSE_OVER_TRIGGER = 1 << 3, |
1259 | + QUICKLIST_OPEN = 1 << 4, |
1260 | + EXTERNAL_DND_ACTIVE = 1 << 5, |
1261 | + INTERNAL_DND_ACTIVE = 1 << 6, |
1262 | + TRIGGER_BUTTON_DOWN = 1 << 7, |
1263 | + ANY_WINDOW_UNDER = 1 << 8, |
1264 | + ACTIVE_WINDOW_UNDER = 1 << 9, |
1265 | + DND_PUSHED_OFF = 1 << 10, |
1266 | + MOUSE_MOVE_POST_REVEAL = 1 << 11, |
1267 | + VERTICAL_SLIDE_ACTIVE = 1 << 12, |
1268 | + KEY_NAV_ACTIVE = 1 << 13, |
1269 | + PLACES_VISIBLE = 1 << 14, |
1270 | + LAST_ACTION_ACTIVATE = 1 << 15, |
1271 | + SCALE_ACTIVE = 1 << 16, |
1272 | + EXPO_ACTIVE = 1 << 17, |
1273 | + } HideQuirk; |
1274 | + |
1275 | + LauncherHideMachine (); |
1276 | + virtual ~LauncherHideMachine (); |
1277 | + |
1278 | + void SetMode (HideMode mode); |
1279 | + HideMode GetMode (); |
1280 | + |
1281 | + void SetQuirk (HideQuirk quirk, bool active); |
1282 | + bool GetQuirk (HideQuirk quirk, bool allow_partial = true); |
1283 | + |
1284 | + bool ShouldHide (); |
1285 | + |
1286 | + sigc::signal<void, bool> should_hide_changed; |
1287 | + |
1288 | + private: |
1289 | + void EnsureHideState (bool skip_delay); |
1290 | + void SetShouldHide (bool value, bool skip_delay); |
1291 | + |
1292 | + static gboolean OnHideDelayTimeout (gpointer data); |
1293 | + |
1294 | + bool _should_hide; |
1295 | + HideQuirk _quirks; |
1296 | + HideMode _mode; |
1297 | + unsigned int _hide_delay_timeout_length; |
1298 | + |
1299 | + guint _hide_delay_handle; |
1300 | +}; |
1301 | + |
1302 | +#endif |
1303 | |
1304 | === modified file 'src/PanelHomeButton.cpp' |
1305 | --- src/PanelHomeButton.cpp 2011-03-10 14:42:25 +0000 |
1306 | +++ src/PanelHomeButton.cpp 2011-03-21 19:14:32 +0000 |
1307 | @@ -170,7 +170,7 @@ |
1308 | |
1309 | |
1310 | UBusServer *ubus = ubus_server_get_default (); |
1311 | - ubus_server_send_message (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE, g_variant_builder_end (&builder)); |
1312 | + ubus_server_send_message (ubus, UBUS_HOME_BUTTON_BFB_UPDATE, g_variant_builder_end (&builder)); |
1313 | } |
1314 | |
1315 | void |
1316 | @@ -190,7 +190,7 @@ |
1317 | |
1318 | |
1319 | UBusServer *ubus = ubus_server_get_default (); |
1320 | - ubus_server_send_message (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE, g_variant_builder_end (&builder)); |
1321 | + ubus_server_send_message (ubus, UBUS_HOME_BUTTON_BFB_UPDATE, g_variant_builder_end (&builder)); |
1322 | } |
1323 | |
1324 | void |
1325 | @@ -205,11 +205,12 @@ |
1326 | g_variant_builder_add (&builder, "i", PANEL_HEIGHT); |
1327 | |
1328 | g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}")); |
1329 | + g_variant_builder_add (&builder, "{sv}", "hovered", g_variant_new_boolean (true)); |
1330 | g_variant_builder_close (&builder); |
1331 | |
1332 | |
1333 | UBusServer *ubus = ubus_server_get_default (); |
1334 | - ubus_server_send_message (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE, g_variant_builder_end (&builder)); |
1335 | + ubus_server_send_message (ubus, UBUS_HOME_BUTTON_BFB_UPDATE, g_variant_builder_end (&builder)); |
1336 | } |
1337 | |
1338 | void |
1339 | |
1340 | === modified file 'src/PanelMenuView.cpp' |
1341 | --- src/PanelMenuView.cpp 2011-03-17 09:41:28 +0000 |
1342 | +++ src/PanelMenuView.cpp 2011-03-21 19:14:32 +0000 |
1343 | @@ -181,8 +181,10 @@ |
1344 | |
1345 | if (_is_maximized) |
1346 | { |
1347 | - ret = _window_buttons->ProcessEvent (ievent, ret, ProcessEventInfo); |
1348 | - ret = _panel_titlebar_grab_area->OnEvent (ievent, ret, ProcessEventInfo); |
1349 | + if (_window_buttons) |
1350 | + ret = _window_buttons->ProcessEvent (ievent, ret, ProcessEventInfo); |
1351 | + if (_panel_titlebar_grab_area) |
1352 | + ret = _panel_titlebar_grab_area->OnEvent (ievent, ret, ProcessEventInfo); |
1353 | } |
1354 | |
1355 | if (!_is_own_window) |
1356 | @@ -702,7 +704,7 @@ |
1357 | } |
1358 | |
1359 | void |
1360 | -PanelMenuView::OnSpreadInitiate (std::list <guint32> &windows) |
1361 | +PanelMenuView::OnSpreadInitiate () |
1362 | { |
1363 | /*foreach (guint32 &xid, windows) |
1364 | { |
1365 | @@ -712,7 +714,7 @@ |
1366 | } |
1367 | |
1368 | void |
1369 | -PanelMenuView::OnSpreadTerminate (std::list <guint32> &windows) |
1370 | +PanelMenuView::OnSpreadTerminate () |
1371 | { |
1372 | /*foreach (guint32 &xid, windows) |
1373 | { |
1374 | |
1375 | === modified file 'src/PanelMenuView.h' |
1376 | --- src/PanelMenuView.h 2011-03-17 09:41:28 +0000 |
1377 | +++ src/PanelMenuView.h 2011-03-21 19:14:32 +0000 |
1378 | @@ -67,8 +67,8 @@ |
1379 | void OnActiveWindowChanged (BamfView *old_view, BamfView *new_view); |
1380 | void OnNameChanged (gchar* new_name, gchar* old_name); |
1381 | |
1382 | - void OnSpreadInitiate (std::list <guint32> &); |
1383 | - void OnSpreadTerminate (std::list <guint32> &); |
1384 | + void OnSpreadInitiate (); |
1385 | + void OnSpreadTerminate (); |
1386 | void OnWindowMinimized (guint32 xid); |
1387 | void OnWindowUnminimized (guint32 xid); |
1388 | void OnWindowUnmapped (guint32 xid); |
1389 | |
1390 | === modified file 'src/PlacesController.cpp' |
1391 | --- src/PlacesController.cpp 2011-03-13 21:42:18 +0000 |
1392 | +++ src/PlacesController.cpp 2011-03-21 19:14:32 +0000 |
1393 | @@ -59,7 +59,6 @@ |
1394 | _window->SinkReference (); |
1395 | _window->SetConfigureNotifyCallback(&PlacesController::WindowConfigureCallback, this); |
1396 | _window->ShowWindow(false); |
1397 | - _window->InputWindowEnableStruts(false); |
1398 | _window->SetOpacity (0.0f); |
1399 | |
1400 | _window->OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &PlacesController::RecvMouseDownOutsideOfView)); |
1401 | @@ -118,9 +117,8 @@ |
1402 | _window->ShowWindow (true, false); |
1403 | // Raise this window on top of all other BaseWindows |
1404 | _window->PushToFront (); |
1405 | - _window->EnableInputWindow (true, "places", false, true); |
1406 | _window->GrabPointer (); |
1407 | - //_window->GrabKeyboard (); |
1408 | + _window->GrabKeyboard (); |
1409 | _window->QueueDraw (); |
1410 | _window->CaptureMouseDownAnyWhereElse (true); |
1411 | |
1412 | @@ -138,8 +136,7 @@ |
1413 | _window->CaptureMouseDownAnyWhereElse (false); |
1414 | _window->ForceStopFocus (1, 1); |
1415 | _window->UnGrabPointer (); |
1416 | - //_window->UnGrabKeyboard (); |
1417 | - _window->EnableInputWindow (false); |
1418 | + _window->UnGrabKeyboard (); |
1419 | _visible = false; |
1420 | _fullscren_request = false; |
1421 | |
1422 | |
1423 | === modified file 'src/PlacesHomeView.cpp' |
1424 | --- src/PlacesHomeView.cpp 2011-03-15 12:30:55 +0000 |
1425 | +++ src/PlacesHomeView.cpp 2011-03-21 19:14:32 +0000 |
1426 | @@ -64,6 +64,7 @@ |
1427 | _place_section (0), |
1428 | _exec (NULL) |
1429 | { |
1430 | + SetDndEnabled (false, false); |
1431 | } |
1432 | |
1433 | ~Shortcut () |
1434 | |
1435 | === modified file 'src/PlacesTile.cpp' |
1436 | --- src/PlacesTile.cpp 2011-03-10 13:03:21 +0000 |
1437 | +++ src/PlacesTile.cpp 2011-03-21 19:14:32 +0000 |
1438 | @@ -323,7 +323,8 @@ |
1439 | void |
1440 | PlacesTile::RecvMouseClick (int x, int y, unsigned long button_flags, unsigned long key_flags) |
1441 | { |
1442 | - sigClick.emit (this); |
1443 | + if (nux::GetEventButton (button_flags) == 1) |
1444 | + sigClick.emit (this); |
1445 | QueueDraw (); |
1446 | } |
1447 | |
1448 | |
1449 | === modified file 'src/PluginAdapter.cpp' |
1450 | --- src/PluginAdapter.cpp 2011-02-10 21:06:26 +0000 |
1451 | +++ src/PluginAdapter.cpp 2011-03-21 19:14:32 +0000 |
1452 | @@ -46,6 +46,8 @@ |
1453 | m_ExpoActionList (0), |
1454 | m_ScaleActionList (0) |
1455 | { |
1456 | + _spread_state = false; |
1457 | + _expo_state = false; |
1458 | } |
1459 | |
1460 | PluginAdapter::~PluginAdapter() |
1461 | @@ -56,13 +58,33 @@ |
1462 | void |
1463 | PluginAdapter::OnScreenGrabbed () |
1464 | { |
1465 | + if (!_spread_state && screen->grabExist ("scale")) |
1466 | + { |
1467 | + _spread_state = true; |
1468 | + initiate_spread.emit (); |
1469 | + } |
1470 | + |
1471 | + if (!_expo_state && screen->grabExist ("expo")) |
1472 | + { |
1473 | + _expo_state = true; |
1474 | + initiate_expo.emit (); |
1475 | + } |
1476 | } |
1477 | |
1478 | void |
1479 | PluginAdapter::OnScreenUngrabbed () |
1480 | { |
1481 | - if (m_SpreadedWindows.size () && !screen->grabExist ("scale")) |
1482 | - terminate_spread.emit (m_SpreadedWindows); |
1483 | + if (_spread_state && !screen->grabExist ("scale")) |
1484 | + { |
1485 | + _spread_state = false; |
1486 | + terminate_spread.emit (); |
1487 | + } |
1488 | + |
1489 | + if (_expo_state && !screen->grabExist ("expo")) |
1490 | + { |
1491 | + _expo_state = false; |
1492 | + terminate_expo.emit (); |
1493 | + } |
1494 | } |
1495 | |
1496 | void |
1497 | @@ -258,7 +280,6 @@ |
1498 | } |
1499 | } |
1500 | |
1501 | - initiate_spread.emit (xids); |
1502 | m_ScaleActionList.InitiateAll (argument, state); |
1503 | } |
1504 | |
1505 | @@ -267,7 +288,6 @@ |
1506 | { |
1507 | CompOption::Vector argument (0); |
1508 | |
1509 | - terminate_spread.emit (m_SpreadedWindows); |
1510 | m_SpreadedWindows.clear (); |
1511 | m_ScaleActionList.TerminateAll (argument); |
1512 | } |
1513 | @@ -278,6 +298,12 @@ |
1514 | return m_Screen->grabExist ("scale"); |
1515 | } |
1516 | |
1517 | +bool |
1518 | +PluginAdapter::IsExpoActive () |
1519 | +{ |
1520 | + return m_Screen->grabExist ("expo"); |
1521 | +} |
1522 | + |
1523 | void |
1524 | PluginAdapter::InitiateExpo () |
1525 | { |
1526 | |
1527 | === modified file 'src/PluginAdapter.h' |
1528 | --- src/PluginAdapter.h 2011-02-10 21:06:26 +0000 |
1529 | +++ src/PluginAdapter.h 2011-03-21 19:14:32 +0000 |
1530 | @@ -69,6 +69,7 @@ |
1531 | bool IsScaleActive (); |
1532 | |
1533 | void InitiateExpo (); |
1534 | + bool IsExpoActive (); |
1535 | |
1536 | void Notify (CompWindow *window, CompWindowNotify notify); |
1537 | void NotifyMoved (CompWindow *window, int x, int y); |
1538 | @@ -94,6 +95,9 @@ |
1539 | MultiActionList m_ScaleActionList; |
1540 | std::list <guint32> m_SpreadedWindows; |
1541 | |
1542 | + bool _spread_state; |
1543 | + bool _expo_state; |
1544 | + |
1545 | static PluginAdapter *_default; |
1546 | }; |
1547 | |
1548 | |
1549 | === modified file 'src/UBusMessages.h' |
1550 | --- src/UBusMessages.h 2011-03-01 09:22:43 +0000 |
1551 | +++ src/UBusMessages.h 2011-03-21 19:14:32 +0000 |
1552 | @@ -23,7 +23,7 @@ |
1553 | // keep ordered |
1554 | |
1555 | #define UBUS_DASH_EXTERNAL_ACTIVATION "DASH_EXTERNAL_ACTIVATION" |
1556 | -#define UBUS_HOME_BUTTON_TRIGGER_UPDATE "PANEL_HOME_BUTTON_TRIGGER_UPDATE" |
1557 | +#define UBUS_HOME_BUTTON_BFB_UPDATE "PANEL_HOME_BUTTON_BFB_UPDATE" |
1558 | |
1559 | // When other parts of Unity want to close the place view |
1560 | #define UBUS_PLACE_VIEW_CLOSE_REQUEST "PLACE_VIEW_CLOSE_REQUEST" |
1561 | |
1562 | === modified file 'src/WindowManager.h' |
1563 | --- src/WindowManager.h 2011-02-09 14:28:54 +0000 |
1564 | +++ src/WindowManager.h 2011-03-21 19:14:32 +0000 |
1565 | @@ -74,8 +74,12 @@ |
1566 | sigc::signal<void, guint32> window_hidden; |
1567 | sigc::signal<void, guint32> window_resized; |
1568 | sigc::signal<void, guint32> window_moved; |
1569 | - sigc::signal<void, std::list<guint32> &> initiate_spread; |
1570 | - sigc::signal<void, std::list<guint32> &> terminate_spread; |
1571 | + |
1572 | + sigc::signal<void> initiate_spread; |
1573 | + sigc::signal<void> terminate_spread; |
1574 | + |
1575 | + sigc::signal<void> initiate_expo; |
1576 | + sigc::signal<void> terminate_expo; |
1577 | |
1578 | private: |
1579 | Atom m_MoveResizeAtom; |
1580 | |
1581 | === modified file 'src/unityshell.cpp' |
1582 | --- src/unityshell.cpp 2011-03-18 18:35:33 +0000 |
1583 | +++ src/unityshell.cpp 2011-03-21 19:14:32 +0000 |
1584 | @@ -201,6 +201,9 @@ |
1585 | if (_key_nav_mode_requested) |
1586 | launcher->startKeyNavMode (); |
1587 | _key_nav_mode_requested = false; |
1588 | + if (_need_send_execute_command) |
1589 | + SendExecuteCommand (); |
1590 | + _need_send_execute_command = false; |
1591 | break; |
1592 | case KeyPress: |
1593 | KeySym key_sym; |
1594 | @@ -225,19 +228,20 @@ |
1595 | CompOption::Vector &option) |
1596 | { |
1597 | |
1598 | - if (strcmp (event, "begin_viewport_switch") == 0) |
1599 | - { |
1600 | - launcher->EnableHiddenStateCheck (false); |
1601 | - } |
1602 | - if (strcmp (event, "end_viewport_switch") == 0) |
1603 | + /* |
1604 | + * don't take into account window over launcher state during |
1605 | + * the ws switch as we can get false positives |
1606 | + * (like switching to an empty viewport while grabbing a fullscreen window) |
1607 | + */ |
1608 | + if (strcmp (event, "start_viewport_switch") == 0) |
1609 | + launcher->EnableCheckWindowOverLauncher (false); |
1610 | + else if (strcmp (event, "end_viewport_switch") == 0) |
1611 | { |
1612 | // compute again the list of all window on the new viewport |
1613 | // to decide if we should or not hide the launcher |
1614 | - launcher->EnableHiddenStateCheck (true); |
1615 | + launcher->EnableCheckWindowOverLauncher (true); |
1616 | launcher->CheckWindowOverLauncher (); |
1617 | } |
1618 | - |
1619 | - |
1620 | screen->handleCompizEvent (plugin, event, option); |
1621 | |
1622 | } |
1623 | @@ -286,10 +290,8 @@ |
1624 | return false; |
1625 | } |
1626 | |
1627 | -bool |
1628 | -UnityScreen::executeCommand (CompAction *action, |
1629 | - CompAction::State state, |
1630 | - CompOption::Vector &options) |
1631 | +void |
1632 | +UnityScreen::SendExecuteCommand () |
1633 | { |
1634 | ubus_server_send_message (ubus_server_get_default (), |
1635 | UBUS_PLACE_ENTRY_ACTIVATE_REQUEST, |
1636 | @@ -297,6 +299,18 @@ |
1637 | "/com/canonical/unity/applicationsplace/runner", |
1638 | 0, |
1639 | "")); |
1640 | +} |
1641 | + |
1642 | +bool |
1643 | +UnityScreen::executeCommand (CompAction *action, |
1644 | + CompAction::State state, |
1645 | + CompOption::Vector &options) |
1646 | +{ |
1647 | + if (!screen->grabbed ()) |
1648 | + SendExecuteCommand (); |
1649 | + else |
1650 | + _need_send_execute_command = true; |
1651 | + |
1652 | return false; |
1653 | } |
1654 | |
1655 | @@ -750,6 +764,7 @@ |
1656 | doShellRepaint (false) |
1657 | { |
1658 | _key_nav_mode_requested = false; |
1659 | + _need_send_execute_command = false; |
1660 | START_FUNCTION (); |
1661 | int (*old_handler) (Display *, XErrorEvent *); |
1662 | old_handler = XSetErrorHandler (NULL); |
1663 | @@ -889,8 +904,6 @@ |
1664 | self->launcherWindow->SetLayout(layout); |
1665 | self->launcherWindow->SetBackgroundColor(nux::Color(0x00000000)); |
1666 | self->launcherWindow->ShowWindow(true); |
1667 | - self->launcherWindow->EnableInputWindow(true, "launcher", false, false); |
1668 | - self->launcherWindow->InputWindowEnableStruts(true); |
1669 | self->launcherWindow->SetEnterFocusInputArea (self->launcher); |
1670 | |
1671 | /* FIXME: this should not be manual, should be managed with a |
1672 | |
1673 | === modified file 'src/unityshell.h' |
1674 | --- src/unityshell.h 2011-03-18 04:34:41 +0000 |
1675 | +++ src/unityshell.h 2011-03-21 19:14:32 +0000 |
1676 | @@ -150,6 +150,8 @@ |
1677 | |
1678 | private: |
1679 | |
1680 | + void SendExecuteCommand (); |
1681 | + |
1682 | static gboolean |
1683 | initPluginActions (gpointer data); |
1684 | |
1685 | @@ -222,6 +224,7 @@ |
1686 | bool allowWindowPaint; |
1687 | bool damaged; |
1688 | bool _key_nav_mode_requested; |
1689 | + bool _need_send_execute_command; |
1690 | CompOutput *_last_output; |
1691 | CompWindowList _withRemovedNuxWindows; |
1692 | |
1693 | |
1694 | === modified file 'unityshell.xml.in' |
1695 | --- unityshell.xml.in 2011-03-10 15:39:00 +0000 |
1696 | +++ unityshell.xml.in 2011-03-21 19:14:32 +0000 |
1697 | @@ -162,7 +162,7 @@ |
1698 | <_long>Animation played when the launcher is showing or hiding</_long> |
1699 | <min>0</min> |
1700 | <max>2</max> |
1701 | - <default>0</default> |
1702 | + <default>1</default> |
1703 | <desc> |
1704 | <value>0</value> |
1705 | <_name>Fade on bfb and Slide</_name> |
Thanks Jason, that's an amazing work!
I'll fix the remaining issues in a further branch. I'm sure that setting last_action_ activate to false in the set_hidden() function has some side effect as I did it that way before
280 + _hide_machine- >SetQuirk (LauncherHideMa chine:: LAUNCHER_ HIDDEN, hidden); >SetQuirk (LauncherHideMa chine:: LAST_ACTION_ ACTIVATE, false);
281 + _hide_machine-
On that part:
This is wrong, I'm sure that we get false positive here, because on some workspace transition, with a slow cpu maybe, the computation is redone between a two ws switch and the we get false positive like: apps in fullscreen on ws1 -> apps in fullscreen on ws2 if the refresh is done at the wrong time.
I'll keep it removed for now, but keeping that in mind…
235 - if (strcmp (event, "begin_ viewport_ switch" ) == 0) >EnableHiddenSt ateCheck (false); switch" ) == 0) >EnableHiddenSt ateCheck (true); >CheckWindowOve rLauncher (); >CheckWindowOve rLauncher ();
1236 - {
1237 - launcher-
1238 - }
1239 - if (strcmp (event, "end_viewport_
1240 - {
1241 - // compute again the list of all window on the new viewport
1242 - // to decide if we should or not hide the launcher
1243 - launcher-
1244 - launcher-
1245 - }
1246 -
1247 -
1248 + launcher-
We still have some duplicated variables between the QUIRK and the launcher, I'll ensure to remove them properly.
Also, some false positive, like:
- activate the keynav, mouse doesn't move (but was over launcher), end keynav without doing any move: launcher stays visible
- exiting keynav should exit immediatly.
and as we discussed, fixing the fade effect on bfb as well. Seems you pushed th 0x0 in two places, will get it back to one/ (and push the slide effect by default as well)
(ok, this is more or less ends up as my TODO :))
Apart from those, very nice refactoring! Starting working from there and waiting for the nux branch to be approved and merged! :)