Merge lp:~didrocks/unity/launcher-bug-fix-fest into lp:unity

Proposed by Didier Roche on 2011-03-28
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
Reviewer Review Type Date Requested Status
Jason Smith (community) 2011-03-28 Approve on 2011-03-28
Review via email: mp+55182@code.launchpad.net

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.
Jason Smith (jassmith) wrote :

+1 Awesome work didier!

review: Approve

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 }
6
7 void
8-BamfLauncherIcon::OnMouseClick (int button)
9-{
10- if (button == 1)
11- ActivateLauncherIcon ();
12- else if (button == 2)
13- OpenInstanceLauncherIcon ();
14-}
15-
16-void
17 BamfLauncherIcon::OnClosed (BamfView *view, gpointer data)
18 {
19 BamfLauncherIcon *self = (BamfLauncherIcon *) data;
20
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 void ActivateLauncherIcon ();
26
27 protected:
28- void OnMouseClick (int button);
29 std::list<DbusmenuMenuitem *> GetMenus ();
30
31 void UpdateIconGeometries (nux::Point3 center);
32
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
38 _hide_machine = new LauncherHideMachine ();
39 _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden));
40+
41+ _hover_machine = new LauncherHoverMachine ();
42+ _hover_machine->should_hover_changed.connect (sigc::mem_fun (this, &Launcher::SetHover));
43
44 m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION);
45
46@@ -537,11 +540,11 @@
47 Launcher::startKeyNavMode ()
48 {
49 _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, true);
50+ _hover_machine->SetQuirk (LauncherHoverMachine::KEY_NAV_ACTIVE, true);
51 _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
52
53 GrabKeyboard ();
54 GrabPointer ();
55- EnsureHoverState ();
56
57 // FIXME: long term solution is to rewrite the keynav handle
58 if (_focus_keynav_handle > 0)
59@@ -597,11 +600,11 @@
60 UnGrabKeyboard ();
61 UnGrabPointer ();
62 _hide_machine->SetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE, false);
63+ _hover_machine->SetQuirk (LauncherHoverMachine::KEY_NAV_ACTIVE, false);
64
65 _current_icon_index = -1;
66 _last_icon_index = _current_icon_index;
67 QueueDraw ();
68- EnsureHoverState ();
69 ubus_server_send_message (ubus_server_get_default (),
70 UBUS_LAUNCHER_END_KEY_NAV,
71 NULL);
72@@ -637,6 +640,18 @@
73 EnsureScrollTimer ();
74 }
75
76+void Launcher::SetStateMouseOverLauncher (bool over_launcher)
77+{
78+ _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, over_launcher);
79+ _hover_machine->SetQuirk (LauncherHoverMachine::MOUSE_OVER_LAUNCHER, over_launcher);
80+}
81+
82+void Launcher::SetStateMouseOverBFB (bool over_bfb)
83+{
84+ _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, over_bfb);
85+ _hover_machine->SetQuirk (LauncherHoverMachine::MOUSE_OVER_BFB, over_bfb);
86+}
87+
88 bool Launcher::MouseBeyondDragThreshold ()
89 {
90 if (GetActionState () == ACTION_DRAG_ICON)
91@@ -1379,9 +1394,19 @@
92 gboolean Launcher::TapOnSuper ()
93 {
94 struct timespec current;
95- clock_gettime (CLOCK_MONOTONIC, &current);
96+ bool tap_on_super;
97+ bool shortcuts_shown = false;
98+ clock_gettime (CLOCK_MONOTONIC, &current);
99
100- return (TimeDelta (&current, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION);
101+ tap_on_super = (TimeDelta (&current, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION);
102+
103+ if (_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN))
104+ shortcuts_shown = !tap_on_super;
105+
106+ _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, shortcuts_shown);
107+
108+ return tap_on_super;
109+
110 }
111
112 /* Launcher Show/Hide logic */
113@@ -1391,7 +1416,6 @@
114 _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, true);
115 _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
116 QueueDraw ();
117- EnsureHoverState ();
118 SetTimeStruct (&_times[TIME_TAP_SUPER], NULL, SUPER_TAP_DURATION);
119 if (_redraw_handle > 0)
120 g_source_remove (_redraw_handle);
121@@ -1402,8 +1426,8 @@
122 {
123
124 _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, false);
125+ _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, false);
126 QueueDraw ();
127- EnsureHoverState ();
128
129 // it's a tap on super
130 if (TapOnSuper ())
131@@ -1416,7 +1440,7 @@
132 self->_hide_machine->SetQuirk (LauncherHideMachine::PLACES_VISIBLE, true);
133
134 // hack around issue in nux where leave events dont always come after a grab
135- self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, false);
136+ self->SetStateMouseOverBFB (false);
137 }
138
139 void Launcher::OnPlaceViewHidden (GVariant *data, void *val)
140@@ -1465,9 +1489,7 @@
141 {
142 if (g_str_equal ("hovered", prop_key))
143 {
144- self->_hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_BFB, g_variant_get_boolean (prop_value));
145-
146- self->EnsureHoverState ();
147+ self->SetStateMouseOverBFB (g_variant_get_boolean (prop_value));
148 self->EnsureScrollTimer ();
149 }
150 }
151@@ -1490,6 +1512,8 @@
152
153 _hidden = hidden;
154 _hide_machine->SetQuirk (LauncherHideMachine::LAUNCHER_HIDDEN, hidden);
155+ _hover_machine->SetQuirk (LauncherHoverMachine::LAUNCHER_HIDDEN, hidden);
156+
157 _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
158 _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, false);
159
160@@ -1756,6 +1780,8 @@
161
162 _launcher_action_state = actionstate;
163
164+ _hover_machine->SetQuirk (LauncherHoverMachine::LAUNCHER_IN_ACTION, (actionstate != ACTION_NONE));
165+
166 if (_hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE))
167 exitKeyNavMode ();
168 }
169@@ -1766,40 +1792,24 @@
170 return _launcher_action_state;
171 }
172
173-void
174-Launcher::EnsureHoverState ()
175+void Launcher::SetHover (bool hovered)
176 {
177- if (_hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER) || _hide_machine->GetQuirk (LauncherHideMachine::MOUSE_OVER_BFB) ||
178- _hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN) || _hide_machine->GetQuirk (LauncherHideMachine::KEY_NAV_ACTIVE) ||
179- QuicklistManager::Default ()->Current() || GetActionState () != ACTION_NONE)
180- {
181- SetHover ();
182- }
183- else
184- {
185- UnsetHover ();
186- }
187-}
188+
189+ if (hovered == _hovered)
190+ return;
191+
192+ _hovered = hovered;
193
194-void Launcher::SetHover ()
195-{
196 if (_hovered)
197- return;
198-
199- _enter_y = (int) _mouse_position.y;
200-
201- _hovered = true;
202- SetTimeStruct (&_times[TIME_ENTER], &_times[TIME_LEAVE], ANIM_DURATION);
203- EnsureAnimation ();
204-}
205-
206-void Launcher::UnsetHover ()
207-{
208- if (!_hovered)
209- return;
210-
211- _hovered = false;
212- SetTimeStruct (&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION);
213+ {
214+ _enter_y = (int) _mouse_position.y;
215+ SetTimeStruct (&_times[TIME_ENTER], &_times[TIME_LEAVE], ANIM_DURATION);
216+ }
217+ else
218+ {
219+ SetTimeStruct (&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION);
220+ }
221+
222 EnsureAnimation ();
223 }
224
225@@ -2631,12 +2641,6 @@
226 {
227 SetMousePosition (x, y);
228 nux::Geometry geo = GetGeometry ();
229-
230- if (GetActionState () != ACTION_NONE && !geo.IsInside(nux::Point(x, y)))
231- {
232- // we are no longer hovered
233- EnsureHoverState ();
234- }
235
236 MouseUpLogic (x, y, button_flags, key_flags);
237
238@@ -2649,7 +2653,6 @@
239 _dnd_delta_x = 0;
240 _dnd_delta_y = 0;
241 _last_button_press = 0;
242- EnsureHoverState ();
243 EnsureAnimation ();
244 }
245
246@@ -2705,9 +2708,7 @@
247 return;
248
249 SetMousePosition (x, y);
250- _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, true);
251-
252- EnsureHoverState ();
253+ SetStateMouseOverLauncher (true);
254
255 EventLogic ();
256 EnsureAnimation ();
257@@ -2721,10 +2722,7 @@
258 return;
259
260 SetMousePosition (x, y);
261- _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, false);
262-
263- if (GetActionState () == ACTION_NONE)
264- EnsureHoverState ();
265+ SetStateMouseOverLauncher (false);
266
267 EventLogic ();
268 EnsureAnimation ();
269@@ -2866,8 +2864,8 @@
270 it = _model->at (_current_icon_index);
271 if (it != (LauncherModel::iterator)NULL)
272 {
273- (*it)->OpenQuicklist (true);
274- leaveKeyNavMode ();
275+ if ((*it)->OpenQuicklist (true))
276+ leaveKeyNavMode ();
277 }
278 break;
279
280@@ -2901,17 +2899,17 @@
281 void Launcher::RecvQuicklistOpened (QuicklistView *quicklist)
282 {
283 _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true);
284+ _hover_machine->SetQuirk (LauncherHoverMachine::QUICKLIST_OPEN, true);
285 EventLogic ();
286- EnsureHoverState ();
287 EnsureAnimation ();
288 }
289
290 void Launcher::RecvQuicklistClosed (QuicklistView *quicklist)
291 {
292 _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, false);
293+ _hover_machine->SetQuirk (LauncherHoverMachine::QUICKLIST_OPEN, false);
294
295 EventLogic ();
296- EnsureHoverState ();
297 EnsureAnimation ();
298 }
299
300@@ -3456,7 +3454,7 @@
301 void
302 Launcher::ProcessDndLeave ()
303 {
304- _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, false);
305+ SetStateMouseOverLauncher (false);
306 _drag_edge_touching = false;
307
308 SetActionState (ACTION_NONE);
309@@ -3494,7 +3492,6 @@
310 _steal_drag = false;
311 _dnd_hovered_icon = 0;
312
313- EnsureHoverState ();
314 }
315
316 std::list<char *>
317@@ -3556,7 +3553,7 @@
318
319 // only set hover once we know our first x/y
320 SetActionState (ACTION_DRAG_EXTERNAL);
321- _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_LAUNCHER, true);
322+ SetStateMouseOverLauncher (true);
323
324 LauncherModel::iterator it;
325 for (it = _model->begin (); it != _model->end () && !_steal_drag; it++)
326@@ -3567,7 +3564,6 @@
327 (*it)->SetQuirk (LauncherIcon::QUIRK_DROP_DIM, true);
328 }
329
330- EnsureHoverState ();
331 }
332
333 g_free (uri_list_const);
334
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 #include "LauncherIcon.h"
340 #include "LauncherDragWindow.h"
341 #include "LauncherHideMachine.h"
342+#include "LauncherHoverMachine.h"
343 #include "NuxGraphics/IOpenGLAsmShader.h"
344 #include "Nux/TimerProc.h"
345 #include "PluginAdapter.h"
346@@ -240,6 +241,9 @@
347
348 void SetMousePosition (int x, int y);
349
350+ void SetStateMouseOverLauncher (bool over_launcher);
351+ void SetStateMouseOverBFB (bool over_bfb);
352+
353 bool MouseBeyondDragThreshold ();
354
355 void OnDragWindowAnimCompleted ();
356@@ -250,7 +254,6 @@
357 void SetActionState (LauncherActionState actionstate);
358 LauncherActionState GetActionState();
359
360- void EnsureHoverState ();
361 void EnsureAnimation ();
362 void EnsureScrollTimer ();
363
364@@ -284,8 +287,7 @@
365 float IconDropDimValue (LauncherIcon *icon, struct timespec const &current);
366 float IconCenterTransitionProgress (LauncherIcon *icon, struct timespec const &current);
367
368- void SetHover ();
369- void UnsetHover ();
370+ void SetHover (bool hovered);
371 void SetHidden (bool hidden);
372
373 void SetDndDelta (float x, float y, nux::Geometry geo, struct timespec const &current);
374@@ -469,6 +471,7 @@
375 LauncherModel* _model;
376 LauncherDragWindow* _drag_window;
377 LauncherHideMachine *_hide_machine;
378+ LauncherHoverMachine *_hover_machine;
379 CompScreen* _screen;
380
381 std::list<char *> _drag_data;
382
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+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
388+/*
389+ * Copyright (C) 2011 Canonical Ltd
390+ *
391+ * This program is free software: you can redistribute it and/or modify
392+ * it under the terms of the GNU General Public License version 3 as
393+ * published by the Free Software Foundation.
394+ *
395+ * This program is distributed in the hope that it will be useful,
396+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
397+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
398+ * GNU General Public License for more details.
399+ *
400+ * You should have received a copy of the GNU General Public License
401+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
402+ *
403+ * Authored by: Didier Roche <didrocks@ubuntu.com>
404+ */
405+
406+#include "LauncherHoverMachine.h"
407+
408+LauncherHoverMachine::LauncherHoverMachine ()
409+{
410+ _quirks = DEFAULT;
411+ _should_hover = false;
412+ _pending_should_hover = false; // avoid building a struct in the callback
413+ _hover_changed_emit_handle = 0;
414+
415+}
416+
417+LauncherHoverMachine::~LauncherHoverMachine ()
418+{
419+ if (_hover_changed_emit_handle)
420+ {
421+ g_source_remove (_hover_changed_emit_handle);
422+ _hover_changed_emit_handle = 0;
423+ }
424+}
425+
426+/* == Quick Quirk Reference : please keep up to date ==
427+ DEFAULT = 0,
428+ LAUNCHER_HIDDEN = 1 << 0, 1
429+ MOUSE_OVER_LAUNCHER = 1 << 1, 2
430+ MOUSE_OVER_BFB = 1 << 2, 4
431+ SHOTCUT_KEYS_VISIBLE = 1 << 3, 8
432+ QUICKLIST_OPEN = 1 << 4, 16
433+ KEY_NAV_ACTIVE = 1 << 5, 32
434+ LAUNCHER_IN_ACTION = 1 << 6, 64
435+*/
436+
437+void
438+LauncherHoverMachine::EnsureHoverState ()
439+{
440+ bool should_hover;
441+
442+ if (GetQuirk (LAUNCHER_HIDDEN))
443+ {
444+ SetShouldHover (false);
445+ return;
446+ }
447+
448+ if (GetQuirk ((HoverQuirk) (MOUSE_OVER_LAUNCHER | MOUSE_OVER_BFB |
449+ SHOTCUT_KEYS_VISIBLE | KEY_NAV_ACTIVE |
450+ QUICKLIST_OPEN | LAUNCHER_IN_ACTION)))
451+ should_hover = true;
452+ else
453+ should_hover = false;
454+
455+
456+ SetShouldHover (should_hover);
457+}
458+
459+void
460+LauncherHoverMachine::SetShouldHover (bool value)
461+{
462+ if (_hover_changed_emit_handle)
463+ g_source_remove (_hover_changed_emit_handle);
464+
465+ _pending_should_hover = value;
466+ _hover_changed_emit_handle = g_timeout_add (0, &EmitShouldHoverChanged, this);
467+}
468+
469+gboolean
470+LauncherHoverMachine::EmitShouldHoverChanged (gpointer data)
471+{
472+ LauncherHoverMachine *self = static_cast<LauncherHoverMachine *> (data);
473+
474+ if (self->_should_hover == self->_pending_should_hover)
475+ return false;
476+
477+ self->_should_hover = self->_pending_should_hover;
478+ self->_hover_changed_emit_handle = 0;
479+
480+ self->should_hover_changed.emit (self->_should_hover);
481+ return false;
482+}
483+
484+void
485+LauncherHoverMachine::SetQuirk (LauncherHoverMachine::HoverQuirk quirk, bool active)
486+{
487+ if (GetQuirk (quirk) == active)
488+ return;
489+
490+ if (active)
491+ _quirks = (HoverQuirk) (_quirks | quirk);
492+ else
493+ _quirks = (HoverQuirk) (_quirks & ~quirk);
494+
495+ EnsureHoverState ();
496+}
497+
498+bool
499+LauncherHoverMachine::GetQuirk (LauncherHoverMachine::HoverQuirk quirk, bool allow_partial)
500+{
501+ if (allow_partial)
502+ return _quirks & quirk;
503+ return (_quirks & quirk) == quirk;
504+}
505+
506
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+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
512+/*
513+ * Copyright (C) 2011 Canonical Ltd
514+ *
515+ * This program is free software: you can redistribute it and/or modify
516+ * it under the terms of the GNU General Public License version 3 as
517+ * published by the Free Software Foundation.
518+ *
519+ * This program is distributed in the hope that it will be useful,
520+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
521+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
522+ * GNU General Public License for more details.
523+ *
524+ * You should have received a copy of the GNU General Public License
525+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
526+ *
527+ * Authored by: Didier Roche <didrocks@ubuntu.com>
528+ */
529+
530+#ifndef LAUNCHERHOVERMACHINE
531+#define LAUNCHERHOVERMACHINE
532+
533+#include <sigc++/sigc++.h>
534+#include <glib.h>
535+
536+class LauncherHoverMachine : public sigc::trackable
537+{
538+ public:
539+
540+ typedef enum
541+ {
542+ DEFAULT = 0,
543+ LAUNCHER_HIDDEN = 1 << 0,
544+ MOUSE_OVER_LAUNCHER = 1 << 1,
545+ MOUSE_OVER_BFB = 1 << 2,
546+ SHOTCUT_KEYS_VISIBLE = 1 << 3,
547+ QUICKLIST_OPEN = 1 << 4,
548+ KEY_NAV_ACTIVE = 1 << 5,
549+ LAUNCHER_IN_ACTION = 1 << 6,
550+ } HoverQuirk;
551+
552+ LauncherHoverMachine ();
553+ virtual ~LauncherHoverMachine ();
554+
555+ void SetQuirk (HoverQuirk quirk, bool active);
556+ bool GetQuirk (HoverQuirk quirk, bool allow_partial = true);
557+
558+ sigc::signal<void, bool> should_hover_changed;
559+
560+ private:
561+ void EnsureHoverState ();
562+ void SetShouldHover (bool value);
563+
564+ static gboolean EmitShouldHoverChanged (gpointer data);
565+
566+ bool _should_hover;
567+ bool _pending_should_hover;
568+ HoverQuirk _quirks;
569+
570+ guint _hover_changed_emit_handle;
571+
572+};
573+
574+#endif
575
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 MouseLeave.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseLeave));
581 MouseDown.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseDown));
582 MouseUp.connect (sigc::mem_fun(this, &LauncherIcon::RecvMouseUp));
583+ MouseClick.connect (sigc::mem_fun (this, &LauncherIcon::RecvMouseClick));
584
585 }
586
587@@ -150,12 +151,18 @@
588 void
589 LauncherIcon::Activate ()
590 {
591+ if (PluginAdapter::Default ()->IsScaleActive())
592+ PluginAdapter::Default ()->TerminateScale ();
593+
594 ActivateLauncherIcon ();
595 }
596
597 void
598 LauncherIcon::OpenInstance ()
599 {
600+ if (PluginAdapter::Default ()->IsScaleActive())
601+ PluginAdapter::Default ()->TerminateScale ();
602+
603 OpenInstanceLauncherIcon ();
604 }
605
606@@ -387,14 +394,17 @@
607 _tooltip->ShowWindow (false);
608 }
609
610-void LauncherIcon::OpenQuicklist (bool default_to_first_item)
611+gboolean LauncherIcon::OpenQuicklist (bool default_to_first_item)
612 {
613 _tooltip->ShowWindow (false);
614 _quicklist->RemoveAllMenuItem ();
615
616 std::list<DbusmenuMenuitem *> menus = Menus ();
617 if (menus.empty ())
618- return;
619+ return false;
620+
621+ if (PluginAdapter::Default ()->IsScaleActive())
622+ PluginAdapter::Default ()->TerminateScale ();
623
624 std::list<DbusmenuMenuitem *>::iterator it;
625 for (it = menus.begin (); it != menus.end (); it++)
626@@ -433,6 +443,8 @@
627 int tip_x = geo.x + geo.width + 1;
628 int tip_y = geo.y + _center.y;
629 QuicklistManager::Default ()->ShowQuicklist (_quicklist, tip_x, tip_y);
630+
631+ return true;
632 }
633
634 void LauncherIcon::RecvMouseDown (int button)
635@@ -450,6 +462,14 @@
636 }
637 }
638
639+void LauncherIcon::RecvMouseClick (int button)
640+{
641+ if (button == 1)
642+ Activate ();
643+ else if (button == 2)
644+ OpenInstance ();
645+}
646+
647 void LauncherIcon::HideTooltip ()
648 {
649 _tooltip->ShowWindow (false);
650
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 void RecvMouseLeave ();
656 void RecvMouseDown (int button);
657 void RecvMouseUp (int button);
658+ void RecvMouseClick (int button);
659
660 void HideTooltip ();
661- void OpenQuicklist (bool default_to_first_item = false);
662+ gboolean OpenQuicklist (bool default_to_first_item = false);
663
664 void SetCenter (nux::Point3 center);
665 nux::Point3 GetCenter ();
666
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 _icon (NULL),
672 _description (NULL),
673 _searchhint (_("Search")),
674- _shortcut (10), // impossible shortcut
675+ _shortcut (0),
676 _position (0),
677 _mimetypes (NULL),
678 _sensitive (true),
679
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 }
685
686 void
687-PlaceLauncherIcon::OnMouseClick (int button)
688-{
689- SimpleLauncherIcon::OnMouseClick (button);
690-
691- if (button == 1)
692- {
693- ActivateLauncherIcon ();
694- }
695-}
696-
697-void
698 PlaceLauncherIcon::ActivateLauncherIcon ()
699 {
700 ActivatePlace (0, "");
701
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 virtual nux::Color GlowColor ();
707
708 protected:
709- void OnMouseClick (int button);
710 void UpdatePlaceIcon ();
711 std::list<DbusmenuMenuitem *> GetMenus ();
712
713
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 void
719 SimpleLauncherIcon::OnMouseClick (int button)
720 {
721- if (button == 1 && PluginAdapter::Default ()->IsScaleActive())
722- PluginAdapter::Default ()->TerminateScale ();
723 }
724
725 void
726@@ -86,7 +84,6 @@
727 void
728 SimpleLauncherIcon::ActivateLauncherIcon ()
729 {
730- MouseClick.emit (1);
731 }
732
733 nux::BaseTexture *
734
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 return nux::Color (0xFF333333);
740 }
741
742-void
743-TrashLauncherIcon::EnsureMenuItemsReady ()
744+std::list<DbusmenuMenuitem *>
745+TrashLauncherIcon::GetMenus ()
746 {
747+ std::list<DbusmenuMenuitem *> result;
748 DbusmenuMenuitem *menu_item;
749-
750+
751 /* Empty Trash */
752 menu_item = dbusmenu_menuitem_new ();
753 g_object_ref (menu_item);
754@@ -82,36 +83,12 @@
755 dbusmenu_menuitem_property_set (menu_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Empty Trash..."));
756 dbusmenu_menuitem_property_set_bool (menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, !_empty);
757 dbusmenu_menuitem_property_set_bool (menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true);
758-
759 g_signal_connect (menu_item,
760 DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
761 (GCallback)&TrashLauncherIcon::OnEmptyTrash, this);
762-
763- _menu_items["Empty"] = menu_item;
764-}
765-
766-void
767-TrashLauncherIcon::OnMouseClick (int button)
768-{
769- SimpleLauncherIcon::OnMouseClick (button);
770-
771- if (button == 1)
772- ActivateLauncherIcon ();
773-
774- else if (button == 3)
775- {
776- EnsureMenuItemsReady ();
777-
778- _quicklist->RemoveAllMenuItem ();
779- QuicklistMenuItemLabel* item = new QuicklistMenuItemLabel (_menu_items["Empty"], NUX_TRACKER_LOCATION);
780- _quicklist->AddMenuItem (item);
781-
782- int tip_x = _launcher->GetBaseWidth () + 1; //icon_x + icon_w;
783- nux::Point3 center = GetCenter ();
784- int tip_y = center.y+ _launcher->GetParent ()->GetGeometry ().y;
785- QuicklistManager::Default ()->ShowQuicklist (_quicklist, tip_x, tip_y);
786- nux::GetWindowCompositor ().SetAlwaysOnFrontWindow (_quicklist);
787- }
788+ result.push_back(menu_item);
789+
790+ return result;
791 }
792
793 void
794
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 virtual nux::Color GlowColor ();
800
801 protected:
802- void OnMouseClick (int button);
803 void UpdateTrashIcon ();
804
805 nux::DndAction OnQueryAcceptDrop (std::list<char *> uris);
806 void OnAcceptDrop (std::list<char *> uris);
807
808 private:
809- std::map<std::string, DbusmenuMenuitem *> _menu_items;
810 GFileMonitor *m_TrashMonitor;
811 gboolean _empty;
812
813 void ActivateLauncherIcon ();
814- void EnsureMenuItemsReady ();
815+ std::list<DbusmenuMenuitem *> GetMenus ();
816
817 static void UpdateTrashIconCb (GObject *source, GAsyncResult *res, gpointer data);
818 static void OnTrashChanged (GFileMonitor *monitor, GFile *file, GFile *other_file,