Merge lp:~didrocks/unity/launcher-bug-fix-fest into lp:unity
- launcher-bug-fix-fest
- Merge into trunk
Proposed by
Didier Roche-Tolomelli
Status: | Merged | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 1032 | ||||||||||||||||||||
Proposed branch: | lp:~didrocks/unity/launcher-bug-fix-fest | ||||||||||||||||||||
Merge into: | lp:unity | ||||||||||||||||||||
Diff against target: |
818 lines (+281/-128) 14 files modified
src/BamfLauncherIcon.cpp (+0/-9) src/BamfLauncherIcon.h (+0/-1) src/Launcher.cpp (+59/-63) src/Launcher.h (+6/-3) src/LauncherHoverMachine.cpp (+119/-0) src/LauncherHoverMachine.h (+64/-0) src/LauncherIcon.cpp (+22/-2) src/LauncherIcon.h (+2/-1) src/PlaceEntryRemote.cpp (+1/-1) src/PlaceLauncherIcon.cpp (+0/-11) src/PlaceLauncherIcon.h (+0/-1) src/SimpleLauncherIcon.cpp (+0/-3) src/TrashLauncherIcon.cpp (+7/-30) src/TrashLauncherIcon.h (+1/-3) |
||||||||||||||||||||
To merge this branch: | bzr merge lp:~didrocks/unity/launcher-bug-fix-fest | ||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jason Smith (community) | Approve | ||
Review via email: mp+55182@code.launchpad.net |
Commit message
Description of the change
This branch intends to:
- don't show empty shortcut for places not defining a label (LP: #742985)
- use regular and not tweaked quicklist system for trashlaunchericon (LP:
#741793)
- clean the activation, QL, opennewinstance stack, as it triggered a lot of bugs
and is more straightforward now (LP: #744196)
- only open quicklist if there is one to open (LP: #741772)
- add an HoverMachine and ensure we don't hover when tapping super (LP: #744344)
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/BamfLauncherIcon.cpp' | |||
2 | --- src/BamfLauncherIcon.cpp 2011-03-25 17:45:08 +0000 | |||
3 | +++ src/BamfLauncherIcon.cpp 2011-03-28 16:21:41 +0000 | |||
4 | @@ -434,15 +434,6 @@ | |||
5 | 434 | } | 434 | } |
6 | 435 | 435 | ||
7 | 436 | void | 436 | void |
8 | 437 | BamfLauncherIcon::OnMouseClick (int button) | ||
9 | 438 | { | ||
10 | 439 | if (button == 1) | ||
11 | 440 | ActivateLauncherIcon (); | ||
12 | 441 | else if (button == 2) | ||
13 | 442 | OpenInstanceLauncherIcon (); | ||
14 | 443 | } | ||
15 | 444 | |||
16 | 445 | void | ||
17 | 446 | BamfLauncherIcon::OnClosed (BamfView *view, gpointer data) | 437 | BamfLauncherIcon::OnClosed (BamfView *view, gpointer data) |
18 | 447 | { | 438 | { |
19 | 448 | BamfLauncherIcon *self = (BamfLauncherIcon *) data; | 439 | BamfLauncherIcon *self = (BamfLauncherIcon *) data; |
20 | 449 | 440 | ||
21 | === modified file 'src/BamfLauncherIcon.h' | |||
22 | --- src/BamfLauncherIcon.h 2011-03-24 01:34:07 +0000 | |||
23 | +++ src/BamfLauncherIcon.h 2011-03-28 16:21:41 +0000 | |||
24 | @@ -46,7 +46,6 @@ | |||
25 | 46 | void ActivateLauncherIcon (); | 46 | void ActivateLauncherIcon (); |
26 | 47 | 47 | ||
27 | 48 | protected: | 48 | protected: |
28 | 49 | void OnMouseClick (int button); | ||
29 | 50 | std::list<DbusmenuMenuitem *> GetMenus (); | 49 | std::list<DbusmenuMenuitem *> GetMenus (); |
30 | 51 | 50 | ||
31 | 52 | void UpdateIconGeometries (nux::Point3 center); | 51 | void UpdateIconGeometries (nux::Point3 center); |
32 | 53 | 52 | ||
33 | === modified file 'src/Launcher.cpp' | |||
34 | --- src/Launcher.cpp 2011-03-28 16:03:00 +0000 | |||
35 | +++ src/Launcher.cpp 2011-03-28 16:21:41 +0000 | |||
36 | @@ -229,6 +229,9 @@ | |||
37 | 229 | 229 | ||
38 | 230 | _hide_machine = new LauncherHideMachine (); | 230 | _hide_machine = new LauncherHideMachine (); |
39 | 231 | _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden)); | 231 | _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden)); |
40 | 232 | |||
41 | 233 | _hover_machine = new LauncherHoverMachine (); | ||
42 | 234 | _hover_machine->should_hover_changed.connect (sigc::mem_fun (this, &Launcher::SetHover)); | ||
43 | 232 | 235 | ||
44 | 233 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 236 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
45 | 234 | 237 | ||
46 | @@ -537,11 +540,11 @@ | |||
47 | 537 | Launcher::startKeyNavMode () | 540 | Launcher::startKeyNavMode () |
48 | 538 | { | 541 | { |
49 | 539 | _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, true); | 542 | _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, true); |
50 | 543 | _hover_machine->SetQuirk (LauncherHoverMachine::KEY_NAV_ACTIVE, true); | ||
51 | 540 | _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); | 544 | _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
52 | 541 | 545 | ||
53 | 542 | GrabKeyboard (); | 546 | GrabKeyboard (); |
54 | 543 | GrabPointer (); | 547 | GrabPointer (); |
55 | 544 | EnsureHoverState (); | ||
56 | 545 | 548 | ||
57 | 546 | // FIXME: long term solution is to rewrite the keynav handle | 549 | // FIXME: long term solution is to rewrite the keynav handle |
58 | 547 | if (_focus_keynav_handle > 0) | 550 | if (_focus_keynav_handle > 0) |
59 | @@ -597,11 +600,11 @@ | |||
60 | 597 | UnGrabKeyboard (); | 600 | UnGrabKeyboard (); |
61 | 598 | UnGrabPointer (); | 601 | UnGrabPointer (); |
62 | 599 | _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, false); | 602 | _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, false); |
63 | 603 | _hover_machine->SetQuirk (LauncherHoverMachine::KEY_NAV_ACTIVE, false); | ||
64 | 600 | 604 | ||
65 | 601 | _current_icon_index = -1; | 605 | _current_icon_index = -1; |
66 | 602 | _last_icon_index = _current_icon_index; | 606 | _last_icon_index = _current_icon_index; |
67 | 603 | QueueDraw (); | 607 | QueueDraw (); |
68 | 604 | EnsureHoverState (); | ||
69 | 605 | ubus_server_send_message (ubus_server_get_default (), | 608 | ubus_server_send_message (ubus_server_get_default (), |
70 | 606 | UBUS_LAUNCHER_END_KEY_NAV, | 609 | UBUS_LAUNCHER_END_KEY_NAV, |
71 | 607 | NULL); | 610 | NULL); |
72 | @@ -637,6 +640,18 @@ | |||
73 | 637 | EnsureScrollTimer (); | 640 | EnsureScrollTimer (); |
74 | 638 | } | 641 | } |
75 | 639 | 642 | ||
76 | 643 | void Launcher::SetStateMouseOverLauncher (bool over_launcher) | ||
77 | 644 | { | ||
78 | 645 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, over_launcher); | ||
79 | 646 | _hover_machine->SetQuirk (LauncherHoverMachine::MOUSE_OVER_LAUNCHER, over_launcher); | ||
80 | 647 | } | ||
81 | 648 | |||
82 | 649 | void Launcher::SetStateMouseOverBFB (bool over_bfb) | ||
83 | 650 | { | ||
84 | 651 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, over_bfb); | ||
85 | 652 | _hover_machine->SetQuirk (LauncherHoverMachine::MOUSE_OVER_BFB, over_bfb); | ||
86 | 653 | } | ||
87 | 654 | |||
88 | 640 | bool Launcher::MouseBeyondDragThreshold () | 655 | bool Launcher::MouseBeyondDragThreshold () |
89 | 641 | { | 656 | { |
90 | 642 | if (GetActionState () == ACTION_DRAG_ICON) | 657 | if (GetActionState () == ACTION_DRAG_ICON) |
91 | @@ -1379,9 +1394,19 @@ | |||
92 | 1379 | gboolean Launcher::TapOnSuper () | 1394 | gboolean Launcher::TapOnSuper () |
93 | 1380 | { | 1395 | { |
94 | 1381 | struct timespec current; | 1396 | struct timespec current; |
96 | 1382 | clock_gettime (CLOCK_MONOTONIC, ¤t); | 1397 | bool tap_on_super; |
97 | 1398 | bool shortcuts_shown = false; | ||
98 | 1399 | clock_gettime (CLOCK_MONOTONIC, ¤t); | ||
99 | 1383 | 1400 | ||
101 | 1384 | return (TimeDelta (¤t, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION); | 1401 | tap_on_super = (TimeDelta (¤t, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION); |
102 | 1402 | |||
103 | 1403 | if (_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN)) | ||
104 | 1404 | shortcuts_shown = !tap_on_super; | ||
105 | 1405 | |||
106 | 1406 | _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, shortcuts_shown); | ||
107 | 1407 | |||
108 | 1408 | return tap_on_super; | ||
109 | 1409 | |||
110 | 1385 | } | 1410 | } |
111 | 1386 | 1411 | ||
112 | 1387 | /* Launcher Show/Hide logic */ | 1412 | /* Launcher Show/Hide logic */ |
113 | @@ -1391,7 +1416,6 @@ | |||
114 | 1391 | _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, true); | 1416 | _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, true); |
115 | 1392 | _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); | 1417 | _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
116 | 1393 | QueueDraw (); | 1418 | QueueDraw (); |
117 | 1394 | EnsureHoverState (); | ||
118 | 1395 | SetTimeStruct (&_times[TIME_TAP_SUPER], NULL, SUPER_TAP_DURATION); | 1419 | SetTimeStruct (&_times[TIME_TAP_SUPER], NULL, SUPER_TAP_DURATION); |
119 | 1396 | if (_redraw_handle > 0) | 1420 | if (_redraw_handle > 0) |
120 | 1397 | g_source_remove (_redraw_handle); | 1421 | g_source_remove (_redraw_handle); |
121 | @@ -1402,8 +1426,8 @@ | |||
122 | 1402 | { | 1426 | { |
123 | 1403 | 1427 | ||
124 | 1404 | _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, false); | 1428 | _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, false); |
125 | 1429 | _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, false); | ||
126 | 1405 | QueueDraw (); | 1430 | QueueDraw (); |
127 | 1406 | EnsureHoverState (); | ||
128 | 1407 | 1431 | ||
129 | 1408 | // it's a tap on super | 1432 | // it's a tap on super |
130 | 1409 | if (TapOnSuper ()) | 1433 | if (TapOnSuper ()) |
131 | @@ -1416,7 +1440,7 @@ | |||
132 | 1416 | self->_hide_machine->SetQuirk (LauncherHideMachine::PLACES_VISIBLE, true); | 1440 | self->_hide_machine->SetQuirk (LauncherHideMachine::PLACES_VISIBLE, true); |
133 | 1417 | 1441 | ||
134 | 1418 | // hack around issue in nux where leave events dont always come after a grab | 1442 | // hack around issue in nux where leave events dont always come after a grab |
136 | 1419 | self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, false); | 1443 | self->SetStateMouseOverBFB (false); |
137 | 1420 | } | 1444 | } |
138 | 1421 | 1445 | ||
139 | 1422 | void Launcher::OnPlaceViewHidden (GVariant *data, void *val) | 1446 | void Launcher::OnPlaceViewHidden (GVariant *data, void *val) |
140 | @@ -1465,9 +1489,7 @@ | |||
141 | 1465 | { | 1489 | { |
142 | 1466 | if (g_str_equal ("hovered", prop_key)) | 1490 | if (g_str_equal ("hovered", prop_key)) |
143 | 1467 | { | 1491 | { |
147 | 1468 | self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, g_variant_get_boolean (prop_value)); | 1492 | self->SetStateMouseOverBFB (g_variant_get_boolean (prop_value)); |
145 | 1469 | |||
146 | 1470 | self->EnsureHoverState (); | ||
148 | 1471 | self->EnsureScrollTimer (); | 1493 | self->EnsureScrollTimer (); |
149 | 1472 | } | 1494 | } |
150 | 1473 | } | 1495 | } |
151 | @@ -1490,6 +1512,8 @@ | |||
152 | 1490 | 1512 | ||
153 | 1491 | _hidden = hidden; | 1513 | _hidden = hidden; |
154 | 1492 | _hide_machine->SetQuirk (LauncherHideMachine::LAUNCHER_HIDDEN, hidden); | 1514 | _hide_machine->SetQuirk (LauncherHideMachine::LAUNCHER_HIDDEN, hidden); |
155 | 1515 | _hover_machine->SetQuirk (LauncherHoverMachine::LAUNCHER_HIDDEN, hidden); | ||
156 | 1516 | |||
157 | 1493 | _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); | 1517 | _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false); |
158 | 1494 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, false); | 1518 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, false); |
159 | 1495 | 1519 | ||
160 | @@ -1756,6 +1780,8 @@ | |||
161 | 1756 | 1780 | ||
162 | 1757 | _launcher_action_state = actionstate; | 1781 | _launcher_action_state = actionstate; |
163 | 1758 | 1782 | ||
164 | 1783 | _hover_machine->SetQuirk (LauncherHoverMachine::LAUNCHER_IN_ACTION, (actionstate != ACTION_NONE)); | ||
165 | 1784 | |||
166 | 1759 | if (_hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE)) | 1785 | if (_hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE)) |
167 | 1760 | exitKeyNavMode (); | 1786 | exitKeyNavMode (); |
168 | 1761 | } | 1787 | } |
169 | @@ -1766,40 +1792,24 @@ | |||
170 | 1766 | return _launcher_action_state; | 1792 | return _launcher_action_state; |
171 | 1767 | } | 1793 | } |
172 | 1768 | 1794 | ||
175 | 1769 | void | 1795 | void Launcher::SetHover (bool hovered) |
174 | 1770 | Launcher::EnsureHoverState () | ||
176 | 1771 | { | 1796 | { |
188 | 1772 | if (_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER) || _hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_BFB) || | 1797 | |
189 | 1773 | _hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN) || _hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE) || | 1798 | if (hovered == _hovered) |
190 | 1774 | QuicklistManager::Default ()->Current() || GetActionState () != ACTION_NONE) | 1799 | return; |
191 | 1775 | { | 1800 | |
192 | 1776 | SetHover (); | 1801 | _hovered = hovered; |
182 | 1777 | } | ||
183 | 1778 | else | ||
184 | 1779 | { | ||
185 | 1780 | UnsetHover (); | ||
186 | 1781 | } | ||
187 | 1782 | } | ||
193 | 1783 | 1802 | ||
194 | 1784 | void Launcher::SetHover () | ||
195 | 1785 | { | ||
196 | 1786 | if (_hovered) | 1803 | if (_hovered) |
213 | 1787 | return; | 1804 | { |
214 | 1788 | 1805 | _enter_y = (int) _mouse_position.y; | |
215 | 1789 | _enter_y = (int) _mouse_position.y; | 1806 | SetTimeStruct (&_times[TIME_ENTER], &_times[TIME_LEAVE], ANIM_DURATION); |
216 | 1790 | 1807 | } | |
217 | 1791 | _hovered = true; | 1808 | else |
218 | 1792 | SetTimeStruct (&_times[TIME_ENTER], &_times[TIME_LEAVE], ANIM_DURATION); | 1809 | { |
219 | 1793 | EnsureAnimation (); | 1810 | SetTimeStruct (&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION); |
220 | 1794 | } | 1811 | } |
221 | 1795 | 1812 | ||
206 | 1796 | void Launcher::UnsetHover () | ||
207 | 1797 | { | ||
208 | 1798 | if (!_hovered) | ||
209 | 1799 | return; | ||
210 | 1800 | |||
211 | 1801 | _hovered = false; | ||
212 | 1802 | SetTimeStruct (&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION); | ||
222 | 1803 | EnsureAnimation (); | 1813 | EnsureAnimation (); |
223 | 1804 | } | 1814 | } |
224 | 1805 | 1815 | ||
225 | @@ -2631,12 +2641,6 @@ | |||
226 | 2631 | { | 2641 | { |
227 | 2632 | SetMousePosition (x, y); | 2642 | SetMousePosition (x, y); |
228 | 2633 | nux::Geometry geo = GetGeometry (); | 2643 | nux::Geometry geo = GetGeometry (); |
229 | 2634 | |||
230 | 2635 | if (GetActionState () != ACTION_NONE && !geo.IsInside(nux::Point(x, y))) | ||
231 | 2636 | { | ||
232 | 2637 | // we are no longer hovered | ||
233 | 2638 | EnsureHoverState (); | ||
234 | 2639 | } | ||
235 | 2640 | 2644 | ||
236 | 2641 | MouseUpLogic (x, y, button_flags, key_flags); | 2645 | MouseUpLogic (x, y, button_flags, key_flags); |
237 | 2642 | 2646 | ||
238 | @@ -2649,7 +2653,6 @@ | |||
239 | 2649 | _dnd_delta_x = 0; | 2653 | _dnd_delta_x = 0; |
240 | 2650 | _dnd_delta_y = 0; | 2654 | _dnd_delta_y = 0; |
241 | 2651 | _last_button_press = 0; | 2655 | _last_button_press = 0; |
242 | 2652 | EnsureHoverState (); | ||
243 | 2653 | EnsureAnimation (); | 2656 | EnsureAnimation (); |
244 | 2654 | } | 2657 | } |
245 | 2655 | 2658 | ||
246 | @@ -2705,9 +2708,7 @@ | |||
247 | 2705 | return; | 2708 | return; |
248 | 2706 | 2709 | ||
249 | 2707 | SetMousePosition (x, y); | 2710 | SetMousePosition (x, y); |
253 | 2708 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, true); | 2711 | SetStateMouseOverLauncher (true); |
251 | 2709 | |||
252 | 2710 | EnsureHoverState (); | ||
254 | 2711 | 2712 | ||
255 | 2712 | EventLogic (); | 2713 | EventLogic (); |
256 | 2713 | EnsureAnimation (); | 2714 | EnsureAnimation (); |
257 | @@ -2721,10 +2722,7 @@ | |||
258 | 2721 | return; | 2722 | return; |
259 | 2722 | 2723 | ||
260 | 2723 | SetMousePosition (x, y); | 2724 | SetMousePosition (x, y); |
265 | 2724 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, false); | 2725 | SetStateMouseOverLauncher (false); |
262 | 2725 | |||
263 | 2726 | if (GetActionState () == ACTION_NONE) | ||
264 | 2727 | EnsureHoverState (); | ||
266 | 2728 | 2726 | ||
267 | 2729 | EventLogic (); | 2727 | EventLogic (); |
268 | 2730 | EnsureAnimation (); | 2728 | EnsureAnimation (); |
269 | @@ -2866,8 +2864,8 @@ | |||
270 | 2866 | it = _model->at (_current_icon_index); | 2864 | it = _model->at (_current_icon_index); |
271 | 2867 | if (it != (LauncherModel::iterator)NULL) | 2865 | if (it != (LauncherModel::iterator)NULL) |
272 | 2868 | { | 2866 | { |
275 | 2869 | (*it)->OpenQuicklist (true); | 2867 | if ((*it)->OpenQuicklist (true)) |
276 | 2870 | leaveKeyNavMode (); | 2868 | leaveKeyNavMode (); |
277 | 2871 | } | 2869 | } |
278 | 2872 | break; | 2870 | break; |
279 | 2873 | 2871 | ||
280 | @@ -2901,17 +2899,17 @@ | |||
281 | 2901 | void Launcher::RecvQuicklistOpened (QuicklistView *quicklist) | 2899 | void Launcher::RecvQuicklistOpened (QuicklistView *quicklist) |
282 | 2902 | { | 2900 | { |
283 | 2903 | _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true); | 2901 | _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true); |
284 | 2902 | _hover_machine->SetQuirk (LauncherHoverMachine::QUICKLIST_OPEN, true); | ||
285 | 2904 | EventLogic (); | 2903 | EventLogic (); |
286 | 2905 | EnsureHoverState (); | ||
287 | 2906 | EnsureAnimation (); | 2904 | EnsureAnimation (); |
288 | 2907 | } | 2905 | } |
289 | 2908 | 2906 | ||
290 | 2909 | void Launcher::RecvQuicklistClosed (QuicklistView *quicklist) | 2907 | void Launcher::RecvQuicklistClosed (QuicklistView *quicklist) |
291 | 2910 | { | 2908 | { |
292 | 2911 | _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, false); | 2909 | _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, false); |
293 | 2910 | _hover_machine->SetQuirk (LauncherHoverMachine::QUICKLIST_OPEN, false); | ||
294 | 2912 | 2911 | ||
295 | 2913 | EventLogic (); | 2912 | EventLogic (); |
296 | 2914 | EnsureHoverState (); | ||
297 | 2915 | EnsureAnimation (); | 2913 | EnsureAnimation (); |
298 | 2916 | } | 2914 | } |
299 | 2917 | 2915 | ||
300 | @@ -3456,7 +3454,7 @@ | |||
301 | 3456 | void | 3454 | void |
302 | 3457 | Launcher::ProcessDndLeave () | 3455 | Launcher::ProcessDndLeave () |
303 | 3458 | { | 3456 | { |
305 | 3459 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, false); | 3457 | SetStateMouseOverLauncher (false); |
306 | 3460 | _drag_edge_touching = false; | 3458 | _drag_edge_touching = false; |
307 | 3461 | 3459 | ||
308 | 3462 | SetActionState (ACTION_NONE); | 3460 | SetActionState (ACTION_NONE); |
309 | @@ -3494,7 +3492,6 @@ | |||
310 | 3494 | _steal_drag = false; | 3492 | _steal_drag = false; |
311 | 3495 | _dnd_hovered_icon = 0; | 3493 | _dnd_hovered_icon = 0; |
312 | 3496 | 3494 | ||
313 | 3497 | EnsureHoverState (); | ||
314 | 3498 | } | 3495 | } |
315 | 3499 | 3496 | ||
316 | 3500 | std::list<char *> | 3497 | std::list<char *> |
317 | @@ -3556,7 +3553,7 @@ | |||
318 | 3556 | 3553 | ||
319 | 3557 | // only set hover once we know our first x/y | 3554 | // only set hover once we know our first x/y |
320 | 3558 | SetActionState (ACTION_DRAG_EXTERNAL); | 3555 | SetActionState (ACTION_DRAG_EXTERNAL); |
322 | 3559 | _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, true); | 3556 | SetStateMouseOverLauncher (true); |
323 | 3560 | 3557 | ||
324 | 3561 | LauncherModel::iterator it; | 3558 | LauncherModel::iterator it; |
325 | 3562 | for (it = _model->begin (); it != _model->end () && !_steal_drag; it++) | 3559 | for (it = _model->begin (); it != _model->end () && !_steal_drag; it++) |
326 | @@ -3567,7 +3564,6 @@ | |||
327 | 3567 | (*it)->SetQuirk (LauncherIcon::QUIRK_DROP_DIM, true); | 3564 | (*it)->SetQuirk (LauncherIcon::QUIRK_DROP_DIM, true); |
328 | 3568 | } | 3565 | } |
329 | 3569 | 3566 | ||
330 | 3570 | EnsureHoverState (); | ||
331 | 3571 | } | 3567 | } |
332 | 3572 | 3568 | ||
333 | 3573 | g_free (uri_list_const); | 3569 | g_free (uri_list_const); |
334 | 3574 | 3570 | ||
335 | === modified file 'src/Launcher.h' | |||
336 | --- src/Launcher.h 2011-03-23 20:33:39 +0000 | |||
337 | +++ src/Launcher.h 2011-03-28 16:21:41 +0000 | |||
338 | @@ -31,6 +31,7 @@ | |||
339 | 31 | #include "LauncherIcon.h" | 31 | #include "LauncherIcon.h" |
340 | 32 | #include "LauncherDragWindow.h" | 32 | #include "LauncherDragWindow.h" |
341 | 33 | #include "LauncherHideMachine.h" | 33 | #include "LauncherHideMachine.h" |
342 | 34 | #include "LauncherHoverMachine.h" | ||
343 | 34 | #include "NuxGraphics/IOpenGLAsmShader.h" | 35 | #include "NuxGraphics/IOpenGLAsmShader.h" |
344 | 35 | #include "Nux/TimerProc.h" | 36 | #include "Nux/TimerProc.h" |
345 | 36 | #include "PluginAdapter.h" | 37 | #include "PluginAdapter.h" |
346 | @@ -240,6 +241,9 @@ | |||
347 | 240 | 241 | ||
348 | 241 | void SetMousePosition (int x, int y); | 242 | void SetMousePosition (int x, int y); |
349 | 242 | 243 | ||
350 | 244 | void SetStateMouseOverLauncher (bool over_launcher); | ||
351 | 245 | void SetStateMouseOverBFB (bool over_bfb); | ||
352 | 246 | |||
353 | 243 | bool MouseBeyondDragThreshold (); | 247 | bool MouseBeyondDragThreshold (); |
354 | 244 | 248 | ||
355 | 245 | void OnDragWindowAnimCompleted (); | 249 | void OnDragWindowAnimCompleted (); |
356 | @@ -250,7 +254,6 @@ | |||
357 | 250 | void SetActionState (LauncherActionState actionstate); | 254 | void SetActionState (LauncherActionState actionstate); |
358 | 251 | LauncherActionState GetActionState(); | 255 | LauncherActionState GetActionState(); |
359 | 252 | 256 | ||
360 | 253 | void EnsureHoverState (); | ||
361 | 254 | void EnsureAnimation (); | 257 | void EnsureAnimation (); |
362 | 255 | void EnsureScrollTimer (); | 258 | void EnsureScrollTimer (); |
363 | 256 | 259 | ||
364 | @@ -284,8 +287,7 @@ | |||
365 | 284 | float IconDropDimValue (LauncherIcon *icon, struct timespec const ¤t); | 287 | float IconDropDimValue (LauncherIcon *icon, struct timespec const ¤t); |
366 | 285 | float IconCenterTransitionProgress (LauncherIcon *icon, struct timespec const ¤t); | 288 | float IconCenterTransitionProgress (LauncherIcon *icon, struct timespec const ¤t); |
367 | 286 | 289 | ||
370 | 287 | void SetHover (); | 290 | void SetHover (bool hovered); |
369 | 288 | void UnsetHover (); | ||
371 | 289 | void SetHidden (bool hidden); | 291 | void SetHidden (bool hidden); |
372 | 290 | 292 | ||
373 | 291 | void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec const ¤t); | 293 | void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec const ¤t); |
374 | @@ -469,6 +471,7 @@ | |||
375 | 469 | LauncherModel* _model; | 471 | LauncherModel* _model; |
376 | 470 | LauncherDragWindow* _drag_window; | 472 | LauncherDragWindow* _drag_window; |
377 | 471 | LauncherHideMachine *_hide_machine; | 473 | LauncherHideMachine *_hide_machine; |
378 | 474 | LauncherHoverMachine *_hover_machine; | ||
379 | 472 | CompScreen* _screen; | 475 | CompScreen* _screen; |
380 | 473 | 476 | ||
381 | 474 | std::list<char *> _drag_data; | 477 | std::list<char *> _drag_data; |
382 | 475 | 478 | ||
383 | === added file 'src/LauncherHoverMachine.cpp' | |||
384 | --- src/LauncherHoverMachine.cpp 1970-01-01 00:00:00 +0000 | |||
385 | +++ src/LauncherHoverMachine.cpp 2011-03-28 16:21:41 +0000 | |||
386 | @@ -0,0 +1,119 @@ | |||
387 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
388 | 2 | /* | ||
389 | 3 | * Copyright (C) 2011 Canonical Ltd | ||
390 | 4 | * | ||
391 | 5 | * This program is free software: you can redistribute it and/or modify | ||
392 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
393 | 7 | * published by the Free Software Foundation. | ||
394 | 8 | * | ||
395 | 9 | * This program is distributed in the hope that it will be useful, | ||
396 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
397 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
398 | 12 | * GNU General Public License for more details. | ||
399 | 13 | * | ||
400 | 14 | * You should have received a copy of the GNU General Public License | ||
401 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
402 | 16 | * | ||
403 | 17 | * Authored by: Didier Roche <didrocks@ubuntu.com> | ||
404 | 18 | */ | ||
405 | 19 | |||
406 | 20 | #include "LauncherHoverMachine.h" | ||
407 | 21 | |||
408 | 22 | LauncherHoverMachine::LauncherHoverMachine () | ||
409 | 23 | { | ||
410 | 24 | _quirks = DEFAULT; | ||
411 | 25 | _should_hover = false; | ||
412 | 26 | _pending_should_hover = false; // avoid building a struct in the callback | ||
413 | 27 | _hover_changed_emit_handle = 0; | ||
414 | 28 | |||
415 | 29 | } | ||
416 | 30 | |||
417 | 31 | LauncherHoverMachine::~LauncherHoverMachine () | ||
418 | 32 | { | ||
419 | 33 | if (_hover_changed_emit_handle) | ||
420 | 34 | { | ||
421 | 35 | g_source_remove (_hover_changed_emit_handle); | ||
422 | 36 | _hover_changed_emit_handle = 0; | ||
423 | 37 | } | ||
424 | 38 | } | ||
425 | 39 | |||
426 | 40 | /* == Quick Quirk Reference : please keep up to date == | ||
427 | 41 | DEFAULT = 0, | ||
428 | 42 | LAUNCHER_HIDDEN = 1 << 0, 1 | ||
429 | 43 | MOUSE_OVER_LAUNCHER = 1 << 1, 2 | ||
430 | 44 | MOUSE_OVER_BFB = 1 << 2, 4 | ||
431 | 45 | SHOTCUT_KEYS_VISIBLE = 1 << 3, 8 | ||
432 | 46 | QUICKLIST_OPEN = 1 << 4, 16 | ||
433 | 47 | KEY_NAV_ACTIVE = 1 << 5, 32 | ||
434 | 48 | LAUNCHER_IN_ACTION = 1 << 6, 64 | ||
435 | 49 | */ | ||
436 | 50 | |||
437 | 51 | void | ||
438 | 52 | LauncherHoverMachine::EnsureHoverState () | ||
439 | 53 | { | ||
440 | 54 | bool should_hover; | ||
441 | 55 | |||
442 | 56 | if (GetQuirk (LAUNCHER_HIDDEN)) | ||
443 | 57 | { | ||
444 | 58 | SetShouldHover (false); | ||
445 | 59 | return; | ||
446 | 60 | } | ||
447 | 61 | |||
448 | 62 | if (GetQuirk ((HoverQuirk) (MOUSE_OVER_LAUNCHER | MOUSE_OVER_BFB | | ||
449 | 63 | SHOTCUT_KEYS_VISIBLE | KEY_NAV_ACTIVE | | ||
450 | 64 | QUICKLIST_OPEN | LAUNCHER_IN_ACTION))) | ||
451 | 65 | should_hover = true; | ||
452 | 66 | else | ||
453 | 67 | should_hover = false; | ||
454 | 68 | |||
455 | 69 | |||
456 | 70 | SetShouldHover (should_hover); | ||
457 | 71 | } | ||
458 | 72 | |||
459 | 73 | void | ||
460 | 74 | LauncherHoverMachine::SetShouldHover (bool value) | ||
461 | 75 | { | ||
462 | 76 | if (_hover_changed_emit_handle) | ||
463 | 77 | g_source_remove (_hover_changed_emit_handle); | ||
464 | 78 | |||
465 | 79 | _pending_should_hover = value; | ||
466 | 80 | _hover_changed_emit_handle = g_timeout_add (0, &EmitShouldHoverChanged, this); | ||
467 | 81 | } | ||
468 | 82 | |||
469 | 83 | gboolean | ||
470 | 84 | LauncherHoverMachine::EmitShouldHoverChanged (gpointer data) | ||
471 | 85 | { | ||
472 | 86 | LauncherHoverMachine *self = static_cast<LauncherHoverMachine *> (data); | ||
473 | 87 | |||
474 | 88 | if (self->_should_hover == self->_pending_should_hover) | ||
475 | 89 | return false; | ||
476 | 90 | |||
477 | 91 | self->_should_hover = self->_pending_should_hover; | ||
478 | 92 | self->_hover_changed_emit_handle = 0; | ||
479 | 93 | |||
480 | 94 | self->should_hover_changed.emit (self->_should_hover); | ||
481 | 95 | return false; | ||
482 | 96 | } | ||
483 | 97 | |||
484 | 98 | void | ||
485 | 99 | LauncherHoverMachine::SetQuirk (LauncherHoverMachine::HoverQuirk quirk, bool active) | ||
486 | 100 | { | ||
487 | 101 | if (GetQuirk (quirk) == active) | ||
488 | 102 | return; | ||
489 | 103 | |||
490 | 104 | if (active) | ||
491 | 105 | _quirks = (HoverQuirk) (_quirks | quirk); | ||
492 | 106 | else | ||
493 | 107 | _quirks = (HoverQuirk) (_quirks & ~quirk); | ||
494 | 108 | |||
495 | 109 | EnsureHoverState (); | ||
496 | 110 | } | ||
497 | 111 | |||
498 | 112 | bool | ||
499 | 113 | LauncherHoverMachine::GetQuirk (LauncherHoverMachine::HoverQuirk quirk, bool allow_partial) | ||
500 | 114 | { | ||
501 | 115 | if (allow_partial) | ||
502 | 116 | return _quirks & quirk; | ||
503 | 117 | return (_quirks & quirk) == quirk; | ||
504 | 118 | } | ||
505 | 119 | |||
506 | 0 | 120 | ||
507 | === added file 'src/LauncherHoverMachine.h' | |||
508 | --- src/LauncherHoverMachine.h 1970-01-01 00:00:00 +0000 | |||
509 | +++ src/LauncherHoverMachine.h 2011-03-28 16:21:41 +0000 | |||
510 | @@ -0,0 +1,64 @@ | |||
511 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
512 | 2 | /* | ||
513 | 3 | * Copyright (C) 2011 Canonical Ltd | ||
514 | 4 | * | ||
515 | 5 | * This program is free software: you can redistribute it and/or modify | ||
516 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
517 | 7 | * published by the Free Software Foundation. | ||
518 | 8 | * | ||
519 | 9 | * This program is distributed in the hope that it will be useful, | ||
520 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
521 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
522 | 12 | * GNU General Public License for more details. | ||
523 | 13 | * | ||
524 | 14 | * You should have received a copy of the GNU General Public License | ||
525 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
526 | 16 | * | ||
527 | 17 | * Authored by: Didier Roche <didrocks@ubuntu.com> | ||
528 | 18 | */ | ||
529 | 19 | |||
530 | 20 | #ifndef LAUNCHERHOVERMACHINE | ||
531 | 21 | #define LAUNCHERHOVERMACHINE | ||
532 | 22 | |||
533 | 23 | #include <sigc++/sigc++.h> | ||
534 | 24 | #include <glib.h> | ||
535 | 25 | |||
536 | 26 | class LauncherHoverMachine : public sigc::trackable | ||
537 | 27 | { | ||
538 | 28 | public: | ||
539 | 29 | |||
540 | 30 | typedef enum | ||
541 | 31 | { | ||
542 | 32 | DEFAULT = 0, | ||
543 | 33 | LAUNCHER_HIDDEN = 1 << 0, | ||
544 | 34 | MOUSE_OVER_LAUNCHER = 1 << 1, | ||
545 | 35 | MOUSE_OVER_BFB = 1 << 2, | ||
546 | 36 | SHOTCUT_KEYS_VISIBLE = 1 << 3, | ||
547 | 37 | QUICKLIST_OPEN = 1 << 4, | ||
548 | 38 | KEY_NAV_ACTIVE = 1 << 5, | ||
549 | 39 | LAUNCHER_IN_ACTION = 1 << 6, | ||
550 | 40 | } HoverQuirk; | ||
551 | 41 | |||
552 | 42 | LauncherHoverMachine (); | ||
553 | 43 | virtual ~LauncherHoverMachine (); | ||
554 | 44 | |||
555 | 45 | void SetQuirk (HoverQuirk quirk, bool active); | ||
556 | 46 | bool GetQuirk (HoverQuirk quirk, bool allow_partial = true); | ||
557 | 47 | |||
558 | 48 | sigc::signal<void, bool> should_hover_changed; | ||
559 | 49 | |||
560 | 50 | private: | ||
561 | 51 | void EnsureHoverState (); | ||
562 | 52 | void SetShouldHover (bool value); | ||
563 | 53 | |||
564 | 54 | static gboolean EmitShouldHoverChanged (gpointer data); | ||
565 | 55 | |||
566 | 56 | bool _should_hover; | ||
567 | 57 | bool _pending_should_hover; | ||
568 | 58 | HoverQuirk _quirks; | ||
569 | 59 | |||
570 | 60 | guint _hover_changed_emit_handle; | ||
571 | 61 | |||
572 | 62 | }; | ||
573 | 63 | |||
574 | 64 | #endif | ||
575 | 0 | 65 | ||
576 | === modified file 'src/LauncherIcon.cpp' | |||
577 | --- src/LauncherIcon.cpp 2011-03-25 20:38:29 +0000 | |||
578 | +++ src/LauncherIcon.cpp 2011-03-28 16:21:41 +0000 | |||
579 | @@ -94,6 +94,7 @@ | |||
580 | 94 | MouseLeave.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseLeave)); | 94 | MouseLeave.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseLeave)); |
581 | 95 | MouseDown.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseDown)); | 95 | MouseDown.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseDown)); |
582 | 96 | MouseUp.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseUp)); | 96 | MouseUp.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseUp)); |
583 | 97 | MouseClick.connect (sigc::mem_fun (this, &LauncherIcon::RecvMouseClick)); | ||
584 | 97 | 98 | ||
585 | 98 | } | 99 | } |
586 | 99 | 100 | ||
587 | @@ -150,12 +151,18 @@ | |||
588 | 150 | void | 151 | void |
589 | 151 | LauncherIcon::Activate () | 152 | LauncherIcon::Activate () |
590 | 152 | { | 153 | { |
591 | 154 | if (PluginAdapter::Default ()->IsScaleActive()) | ||
592 | 155 | PluginAdapter::Default ()->TerminateScale (); | ||
593 | 156 | |||
594 | 153 | ActivateLauncherIcon (); | 157 | ActivateLauncherIcon (); |
595 | 154 | } | 158 | } |
596 | 155 | 159 | ||
597 | 156 | void | 160 | void |
598 | 157 | LauncherIcon::OpenInstance () | 161 | LauncherIcon::OpenInstance () |
599 | 158 | { | 162 | { |
600 | 163 | if (PluginAdapter::Default ()->IsScaleActive()) | ||
601 | 164 | PluginAdapter::Default ()->TerminateScale (); | ||
602 | 165 | |||
603 | 159 | OpenInstanceLauncherIcon (); | 166 | OpenInstanceLauncherIcon (); |
604 | 160 | } | 167 | } |
605 | 161 | 168 | ||
606 | @@ -387,14 +394,17 @@ | |||
607 | 387 | _tooltip->ShowWindow (false); | 394 | _tooltip->ShowWindow (false); |
608 | 388 | } | 395 | } |
609 | 389 | 396 | ||
611 | 390 | void LauncherIcon::OpenQuicklist (bool default_to_first_item) | 397 | gboolean LauncherIcon::OpenQuicklist (bool default_to_first_item) |
612 | 391 | { | 398 | { |
613 | 392 | _tooltip->ShowWindow (false); | 399 | _tooltip->ShowWindow (false); |
614 | 393 | _quicklist->RemoveAllMenuItem (); | 400 | _quicklist->RemoveAllMenuItem (); |
615 | 394 | 401 | ||
616 | 395 | std::list<DbusmenuMenuitem *> menus = Menus (); | 402 | std::list<DbusmenuMenuitem *> menus = Menus (); |
617 | 396 | if (menus.empty ()) | 403 | if (menus.empty ()) |
619 | 397 | return; | 404 | return false; |
620 | 405 | |||
621 | 406 | if (PluginAdapter::Default ()->IsScaleActive()) | ||
622 | 407 | PluginAdapter::Default ()->TerminateScale (); | ||
623 | 398 | 408 | ||
624 | 399 | std::list<DbusmenuMenuitem *>::iterator it; | 409 | std::list<DbusmenuMenuitem *>::iterator it; |
625 | 400 | for (it = menus.begin (); it != menus.end (); it++) | 410 | for (it = menus.begin (); it != menus.end (); it++) |
626 | @@ -433,6 +443,8 @@ | |||
627 | 433 | int tip_x = geo.x + geo.width + 1; | 443 | int tip_x = geo.x + geo.width + 1; |
628 | 434 | int tip_y = geo.y + _center.y; | 444 | int tip_y = geo.y + _center.y; |
629 | 435 | QuicklistManager::Default ()->ShowQuicklist (_quicklist, tip_x, tip_y); | 445 | QuicklistManager::Default ()->ShowQuicklist (_quicklist, tip_x, tip_y); |
630 | 446 | |||
631 | 447 | return true; | ||
632 | 436 | } | 448 | } |
633 | 437 | 449 | ||
634 | 438 | void LauncherIcon::RecvMouseDown (int button) | 450 | void LauncherIcon::RecvMouseDown (int button) |
635 | @@ -450,6 +462,14 @@ | |||
636 | 450 | } | 462 | } |
637 | 451 | } | 463 | } |
638 | 452 | 464 | ||
639 | 465 | void LauncherIcon::RecvMouseClick (int button) | ||
640 | 466 | { | ||
641 | 467 | if (button == 1) | ||
642 | 468 | Activate (); | ||
643 | 469 | else if (button == 2) | ||
644 | 470 | OpenInstance (); | ||
645 | 471 | } | ||
646 | 472 | |||
647 | 453 | void LauncherIcon::HideTooltip () | 473 | void LauncherIcon::HideTooltip () |
648 | 454 | { | 474 | { |
649 | 455 | _tooltip->ShowWindow (false); | 475 | _tooltip->ShowWindow (false); |
650 | 456 | 476 | ||
651 | === modified file 'src/LauncherIcon.h' | |||
652 | --- src/LauncherIcon.h 2011-03-23 19:21:46 +0000 | |||
653 | +++ src/LauncherIcon.h 2011-03-28 16:21:41 +0000 | |||
654 | @@ -93,9 +93,10 @@ | |||
655 | 93 | void RecvMouseLeave (); | 93 | void RecvMouseLeave (); |
656 | 94 | void RecvMouseDown (int button); | 94 | void RecvMouseDown (int button); |
657 | 95 | void RecvMouseUp (int button); | 95 | void RecvMouseUp (int button); |
658 | 96 | void RecvMouseClick (int button); | ||
659 | 96 | 97 | ||
660 | 97 | void HideTooltip (); | 98 | void HideTooltip (); |
662 | 98 | void OpenQuicklist (bool default_to_first_item = false); | 99 | gboolean OpenQuicklist (bool default_to_first_item = false); |
663 | 99 | 100 | ||
664 | 100 | void SetCenter (nux::Point3 center); | 101 | void SetCenter (nux::Point3 center); |
665 | 101 | nux::Point3 GetCenter (); | 102 | nux::Point3 GetCenter (); |
666 | 102 | 103 | ||
667 | === modified file 'src/PlaceEntryRemote.cpp' | |||
668 | --- src/PlaceEntryRemote.cpp 2011-03-23 19:35:06 +0000 | |||
669 | +++ src/PlaceEntryRemote.cpp 2011-03-28 16:21:41 +0000 | |||
670 | @@ -188,7 +188,7 @@ | |||
671 | 188 | _icon (NULL), | 188 | _icon (NULL), |
672 | 189 | _description (NULL), | 189 | _description (NULL), |
673 | 190 | _searchhint (_("Search")), | 190 | _searchhint (_("Search")), |
675 | 191 | _shortcut (10), // impossible shortcut | 191 | _shortcut (0), |
676 | 192 | _position (0), | 192 | _position (0), |
677 | 193 | _mimetypes (NULL), | 193 | _mimetypes (NULL), |
678 | 194 | _sensitive (true), | 194 | _sensitive (true), |
679 | 195 | 195 | ||
680 | === modified file 'src/PlaceLauncherIcon.cpp' | |||
681 | --- src/PlaceLauncherIcon.cpp 2011-03-24 10:40:26 +0000 | |||
682 | +++ src/PlaceLauncherIcon.cpp 2011-03-28 16:21:41 +0000 | |||
683 | @@ -61,17 +61,6 @@ | |||
684 | 61 | } | 61 | } |
685 | 62 | 62 | ||
686 | 63 | void | 63 | void |
687 | 64 | PlaceLauncherIcon::OnMouseClick (int button) | ||
688 | 65 | { | ||
689 | 66 | SimpleLauncherIcon::OnMouseClick (button); | ||
690 | 67 | |||
691 | 68 | if (button == 1) | ||
692 | 69 | { | ||
693 | 70 | ActivateLauncherIcon (); | ||
694 | 71 | } | ||
695 | 72 | } | ||
696 | 73 | |||
697 | 74 | void | ||
698 | 75 | PlaceLauncherIcon::ActivateLauncherIcon () | 64 | PlaceLauncherIcon::ActivateLauncherIcon () |
699 | 76 | { | 65 | { |
700 | 77 | ActivatePlace (0, ""); | 66 | ActivatePlace (0, ""); |
701 | 78 | 67 | ||
702 | === modified file 'src/PlaceLauncherIcon.h' | |||
703 | --- src/PlaceLauncherIcon.h 2011-03-09 17:25:03 +0000 | |||
704 | +++ src/PlaceLauncherIcon.h 2011-03-28 16:21:41 +0000 | |||
705 | @@ -36,7 +36,6 @@ | |||
706 | 36 | virtual nux::Color GlowColor (); | 36 | virtual nux::Color GlowColor (); |
707 | 37 | 37 | ||
708 | 38 | protected: | 38 | protected: |
709 | 39 | void OnMouseClick (int button); | ||
710 | 40 | void UpdatePlaceIcon (); | 39 | void UpdatePlaceIcon (); |
711 | 41 | std::list<DbusmenuMenuitem *> GetMenus (); | 40 | std::list<DbusmenuMenuitem *> GetMenus (); |
712 | 42 | 41 | ||
713 | 43 | 42 | ||
714 | === modified file 'src/SimpleLauncherIcon.cpp' | |||
715 | --- src/SimpleLauncherIcon.cpp 2011-03-28 10:04:47 +0000 | |||
716 | +++ src/SimpleLauncherIcon.cpp 2011-03-28 16:21:41 +0000 | |||
717 | @@ -69,8 +69,6 @@ | |||
718 | 69 | void | 69 | void |
719 | 70 | SimpleLauncherIcon::OnMouseClick (int button) | 70 | SimpleLauncherIcon::OnMouseClick (int button) |
720 | 71 | { | 71 | { |
721 | 72 | if (button == 1 && PluginAdapter::Default ()->IsScaleActive()) | ||
722 | 73 | PluginAdapter::Default ()->TerminateScale (); | ||
723 | 74 | } | 72 | } |
724 | 75 | 73 | ||
725 | 76 | void | 74 | void |
726 | @@ -86,7 +84,6 @@ | |||
727 | 86 | void | 84 | void |
728 | 87 | SimpleLauncherIcon::ActivateLauncherIcon () | 85 | SimpleLauncherIcon::ActivateLauncherIcon () |
729 | 88 | { | 86 | { |
730 | 89 | MouseClick.emit (1); | ||
731 | 90 | } | 87 | } |
732 | 91 | 88 | ||
733 | 92 | nux::BaseTexture * | 89 | nux::BaseTexture * |
734 | 93 | 90 | ||
735 | === modified file 'src/TrashLauncherIcon.cpp' | |||
736 | --- src/TrashLauncherIcon.cpp 2011-03-08 23:14:23 +0000 | |||
737 | +++ src/TrashLauncherIcon.cpp 2011-03-28 16:21:41 +0000 | |||
738 | @@ -70,11 +70,12 @@ | |||
739 | 70 | return nux::Color (0xFF333333); | 70 | return nux::Color (0xFF333333); |
740 | 71 | } | 71 | } |
741 | 72 | 72 | ||
744 | 73 | void | 73 | std::list<DbusmenuMenuitem *> |
745 | 74 | TrashLauncherIcon::EnsureMenuItemsReady () | 74 | TrashLauncherIcon::GetMenus () |
746 | 75 | { | 75 | { |
747 | 76 | std::list<DbusmenuMenuitem *> result; | ||
748 | 76 | DbusmenuMenuitem *menu_item; | 77 | DbusmenuMenuitem *menu_item; |
750 | 77 | 78 | ||
751 | 78 | /* Empty Trash */ | 79 | /* Empty Trash */ |
752 | 79 | menu_item = dbusmenu_menuitem_new (); | 80 | menu_item = dbusmenu_menuitem_new (); |
753 | 80 | g_object_ref (menu_item); | 81 | g_object_ref (menu_item); |
754 | @@ -82,36 +83,12 @@ | |||
755 | 82 | dbusmenu_menuitem_property_set (menu_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Empty Trash...")); | 83 | dbusmenu_menuitem_property_set (menu_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Empty Trash...")); |
756 | 83 | dbusmenu_menuitem_property_set_bool (menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, !_empty); | 84 | dbusmenu_menuitem_property_set_bool (menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, !_empty); |
757 | 84 | dbusmenu_menuitem_property_set_bool (menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true); | 85 | dbusmenu_menuitem_property_set_bool (menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true); |
758 | 85 | |||
759 | 86 | g_signal_connect (menu_item, | 86 | g_signal_connect (menu_item, |
760 | 87 | DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, | 87 | DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
761 | 88 | (GCallback)&TrashLauncherIcon::OnEmptyTrash, this); | 88 | (GCallback)&TrashLauncherIcon::OnEmptyTrash, this); |
788 | 89 | 89 | result.push_back(menu_item); | |
789 | 90 | _menu_items["Empty"] = menu_item; | 90 | |
790 | 91 | } | 91 | return result; |
765 | 92 | |||
766 | 93 | void | ||
767 | 94 | TrashLauncherIcon::OnMouseClick (int button) | ||
768 | 95 | { | ||
769 | 96 | SimpleLauncherIcon::OnMouseClick (button); | ||
770 | 97 | |||
771 | 98 | if (button == 1) | ||
772 | 99 | ActivateLauncherIcon (); | ||
773 | 100 | |||
774 | 101 | else if (button == 3) | ||
775 | 102 | { | ||
776 | 103 | EnsureMenuItemsReady (); | ||
777 | 104 | |||
778 | 105 | _quicklist->RemoveAllMenuItem (); | ||
779 | 106 | QuicklistMenuItemLabel* item = new QuicklistMenuItemLabel (_menu_items["Empty"], NUX_TRACKER_LOCATION); | ||
780 | 107 | _quicklist->AddMenuItem (item); | ||
781 | 108 | |||
782 | 109 | int tip_x = _launcher->GetBaseWidth () + 1; //icon_x + icon_w; | ||
783 | 110 | nux::Point3 center = GetCenter (); | ||
784 | 111 | int tip_y = center.y+ _launcher->GetParent ()->GetGeometry ().y; | ||
785 | 112 | QuicklistManager::Default ()->ShowQuicklist (_quicklist, tip_x, tip_y); | ||
786 | 113 | nux::GetWindowCompositor ().SetAlwaysOnFrontWindow (_quicklist); | ||
787 | 114 | } | ||
791 | 115 | } | 92 | } |
792 | 116 | 93 | ||
793 | 117 | void | 94 | void |
794 | 118 | 95 | ||
795 | === modified file 'src/TrashLauncherIcon.h' | |||
796 | --- src/TrashLauncherIcon.h 2011-02-22 13:46:36 +0000 | |||
797 | +++ src/TrashLauncherIcon.h 2011-03-28 16:21:41 +0000 | |||
798 | @@ -33,19 +33,17 @@ | |||
799 | 33 | virtual nux::Color GlowColor (); | 33 | virtual nux::Color GlowColor (); |
800 | 34 | 34 | ||
801 | 35 | protected: | 35 | protected: |
802 | 36 | void OnMouseClick (int button); | ||
803 | 37 | void UpdateTrashIcon (); | 36 | void UpdateTrashIcon (); |
804 | 38 | 37 | ||
805 | 39 | nux::DndAction OnQueryAcceptDrop (std::list<char *> uris); | 38 | nux::DndAction OnQueryAcceptDrop (std::list<char *> uris); |
806 | 40 | void OnAcceptDrop (std::list<char *> uris); | 39 | void OnAcceptDrop (std::list<char *> uris); |
807 | 41 | 40 | ||
808 | 42 | private: | 41 | private: |
809 | 43 | std::map<std::string, DbusmenuMenuitem *> _menu_items; | ||
810 | 44 | GFileMonitor *m_TrashMonitor; | 42 | GFileMonitor *m_TrashMonitor; |
811 | 45 | gboolean _empty; | 43 | gboolean _empty; |
812 | 46 | 44 | ||
813 | 47 | void ActivateLauncherIcon (); | 45 | void ActivateLauncherIcon (); |
815 | 48 | void EnsureMenuItemsReady (); | 46 | std::list<DbusmenuMenuitem *> GetMenus (); |
816 | 49 | 47 | ||
817 | 50 | static void UpdateTrashIconCb (GObject *source, GAsyncResult *res, gpointer data); | 48 | static void UpdateTrashIconCb (GObject *source, GAsyncResult *res, gpointer data); |
818 | 51 | static void OnTrashChanged (GFileMonitor *monitor, GFile *file, GFile *other_file, | 49 | static void OnTrashChanged (GFileMonitor *monitor, GFile *file, GFile *other_file, |
+1 Awesome work didier!