Merge lp:~marcobiscaro2112/unity/fixes-724045 into lp:unity

Proposed by Marco Biscaro
Status: Merged
Approved by: Alex Launi
Approved revision: no longer in the source branch.
Merge reported by: Alex Launi
Merged at revision: not available
Proposed branch: lp:~marcobiscaro2112/unity/fixes-724045
Merge into: lp:unity
Diff against target: 162 lines (+43/-35)
5 files modified
src/BamfLauncherIcon.cpp (+41/-20)
src/BamfLauncherIcon.h (+1/-0)
src/Launcher.cpp (+0/-8)
src/Launcher.h (+0/-6)
src/LauncherIcon.h (+1/-1)
To merge this branch: bzr merge lp:~marcobiscaro2112/unity/fixes-724045
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+63461@code.launchpad.net

Description of the change

The first problem was that BamfLauncherIcon::ActivateLauncherIcon was never receiving the scaleWasActive flag because the method that call it (LauncherIcon::Activate) was always terminating scale.

So, I turned LauncherIcon::Activate into virtual and overwrote it in BamfLauncherIcon.

The second problem was that method BamfLauncherIcon::ActivateLauncherIcon was not working as expected. I've rewrite the method following the desired behaviour in its comment. Below there is a pseudo-code of the method.

// Pseudo-code
When a BamfLauncherIcon is clicked:

If the application is not running
  Finish scale, if scale was active
  Launch it
If the application is running
  If the application is active
    If the scale was active
      Terminate scale
    If the scale was not active
      Spread application
  If the application is not active
    If the scale was active
      Change spread
    If the scale was not active
      Focus application
Send a UBUS_LAUNCHER_ACTION_DONE message
// End of pseudo-code

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

As stated at UDS i will review my first merge proposal.

The code seems code, just two thing.

1) SetLastSpreadIcon (and GetLastSpreadIcon) is deprecated (there is a FIXME in Launcher.cpp). You should completely remove this function both in Launcher.cpp and BamfLauncherIcon.cpp.

2) The «ccsm->scale->bindings->click dekstop to show dekstop» option is unchecked by default, but if we activate this option the scale doesn't work well (it doesn't work either now).

Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote :

The first problem is fixed now. I'll need some more time to look to the another one.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1 for me!

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-06-02 15:14:17 +0000
3+++ src/BamfLauncherIcon.cpp 2011-06-09 16:11:21 +0000
4@@ -57,6 +57,13 @@
5 }
6
7 void
8+BamfLauncherIcon::Activate ()
9+{
10+ ActivateLauncherIcon ();
11+}
12+
13+
14+void
15 BamfLauncherIcon::ActivateLauncherIcon ()
16 {
17 bool scaleWasActive = PluginAdapter::Default ()->IsScaleActive ();
18@@ -77,27 +84,42 @@
19 {
20 if (GetQuirk (QUIRK_STARTING))
21 return;
22+
23+ if (scaleWasActive)
24+ {
25+ PluginAdapter::Default ()->TerminateScale ();
26+ }
27+
28 SetQuirk (QUIRK_STARTING, true);
29 OpenInstanceLauncherIcon ();
30- return;
31- }
32- else if (scaleWasActive)
33- {
34- if (active || // #5 above
35- !Spread (0, false)) // #4 above
36- {
37- PluginAdapter::Default ()->TerminateScale ();
38- Focus ();
39- _launcher->SetLastSpreadIcon (NULL);
40- }
41- }
42- else if (!active) // #3 above
43- {
44- Focus ();
45- }
46- else if (active && !scaleWasActive) // #2 above
47- {
48- Spread (0, false);
49+ }
50+ else // app is running
51+ {
52+ if (active)
53+ {
54+ if (scaleWasActive) // #5 above
55+ {
56+ PluginAdapter::Default ()->TerminateScale ();
57+ Focus ();
58+ }
59+ else // #2 above
60+ {
61+ Spread (0, false);
62+ }
63+ }
64+ else
65+ {
66+ if (scaleWasActive) // #4 above
67+ {
68+ PluginAdapter::Default ()->TerminateScale ();
69+ Focus ();
70+ Spread (0, false);
71+ }
72+ else // #3 above
73+ {
74+ Focus ();
75+ }
76+ }
77 }
78
79 ubus_server_send_message (ubus_server_get_default (), UBUS_LAUNCHER_ACTION_DONE, NULL);
80@@ -503,7 +525,6 @@
81 if (windowList.size () > 1 || (windowList.size () > 0 && force))
82 {
83 std::string match = PluginAdapter::Default ()->MatchStringForXids (&windowList);
84- _launcher->SetLastSpreadIcon ((LauncherIcon *) this);
85 PluginAdapter::Default ()->InitiateScale (match, state);
86 g_list_free (children);
87 return true;
88
89=== modified file 'src/BamfLauncherIcon.h'
90--- src/BamfLauncherIcon.h 2011-04-07 21:46:48 +0000
91+++ src/BamfLauncherIcon.h 2011-06-09 16:11:21 +0000
92@@ -43,6 +43,7 @@
93 bool IsSticky ();
94 void UnStick ();
95
96+ virtual void Activate ();
97 void ActivateLauncherIcon ();
98
99 protected:
100
101=== modified file 'src/Launcher.cpp'
102--- src/Launcher.cpp 2011-06-09 12:05:12 +0000
103+++ src/Launcher.cpp 2011-06-09 16:11:21 +0000
104@@ -308,10 +308,6 @@
105 _on_drag_update_connection = (sigc::connection) adapter->drag_update.connect (sigc::mem_fun (this, &Launcher::OnDragUpdate));
106 _on_drag_finish_connection = (sigc::connection) adapter->drag_finish.connect (sigc::mem_fun (this, &Launcher::OnDragFinish));
107
108- // FIXME: not used, remove (with Get function) in O
109- m_ActiveMenuIcon = NULL;
110- m_LastSpreadIcon = NULL;
111-
112 _current_icon = NULL;
113 _current_icon_index = -1;
114 _last_icon_index = -1;
115@@ -2299,10 +2295,6 @@
116
117 if (icon == _current_icon)
118 _current_icon = 0;
119- if (icon == m_ActiveMenuIcon)
120- m_ActiveMenuIcon = 0;
121- if (icon == m_LastSpreadIcon)
122- m_LastSpreadIcon = 0;
123 if (icon == _icon_under_mouse)
124 _icon_under_mouse = 0;
125 if (icon == _icon_mouse_down)
126
127=== modified file 'src/Launcher.h'
128--- src/Launcher.h 2011-04-20 03:59:36 +0000
129+++ src/Launcher.h 2011-06-09 16:11:21 +0000
130@@ -104,10 +104,6 @@
131 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
132 virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
133
134- LauncherIcon* GetActiveMenuIcon() {return m_ActiveMenuIcon;}
135- LauncherIcon* GetLastSpreadIcon() {return m_LastSpreadIcon;}
136- void SetLastSpreadIcon(LauncherIcon *i) {m_LastSpreadIcon = i;}
137-
138 LauncherIcon* GetSelectedMenuIcon ();
139
140 void SetIconSize(int tile_size, int icon_size);
141@@ -404,8 +400,6 @@
142 // used by keyboard/a11y-navigation
143 LauncherIcon* _current_icon;
144 LauncherIcon* m_ActiveTooltipIcon;
145- LauncherIcon* m_ActiveMenuIcon;
146- LauncherIcon* m_LastSpreadIcon;
147 LauncherIcon* _icon_under_mouse;
148 LauncherIcon* _icon_mouse_down;
149 LauncherIcon* _drag_icon;
150
151=== modified file 'src/LauncherIcon.h'
152--- src/LauncherIcon.h 2011-05-27 18:57:49 +0000
153+++ src/LauncherIcon.h 2011-06-09 16:11:21 +0000
154@@ -103,7 +103,7 @@
155 void SetCenter (nux::Point3 center);
156 nux::Point3 GetCenter ();
157
158- void Activate ();
159+ virtual void Activate ();
160 void OpenInstance ();
161
162 void SaveCenter ();