Merge lp:~vanvugt/unity/fix-773892 into lp:unity

Proposed by Daniel van Vugt
Status: Superseded
Proposed branch: lp:~vanvugt/unity/fix-773892
Merge into: lp:unity
Diff against target: 271 lines (+108/-25)
6 files modified
plugins/unityshell/src/Launcher.cpp (+52/-20)
plugins/unityshell/src/Launcher.h (+7/-1)
plugins/unityshell/src/PlacesController.cpp (+30/-0)
plugins/unityshell/src/PlacesController.h (+3/-1)
plugins/unityshell/src/PlacesSimpleTile.cpp (+12/-3)
plugins/unityshell/src/UBusMessages.h (+4/-0)
To merge this branch: bzr merge lp:~vanvugt/unity/fix-773892
Reviewer Review Type Date Requested Status
Gord Allott (community) Needs Fixing
Review via email: mp+67128@code.launchpad.net

This proposal has been superseded by a proposal from 2011-08-10.

Commit message

Keep dash open while dragging apps into the launcher (LP: #773892)

Description of the change

Keep dash open while dragging apps into the launcher (LP: #773892)

Old behaviour: The dash closes as soon as you start dragging any icon from the dash.

New behaviour: The dash stays open if you're dragging an application icon. This allows you to quickly drag several apps into the launcher. If it's not an app (usually a file) then the dash reverts to the old behaviour and closes as soon as you start dragging.

I think the new behaviour makes for a much more pleasant, and less frustrating, user experience.

IMPORTANT NOTE: This fix exposes Nux bug 805874. Ideally you should have the fix for bug 805874 (merge pending) before testing this fix. Otherwise it will look buggy.

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

Waiting for the nux branch

review: Abstain
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Judging by Jay's comments, it sounds like the fix for nux bug 805874 won't be merged at all because it will be superseded. We may be waiting forever... ?

Revision history for this message
Gord Allott (gordallott) wrote :

once the new input refactoring branch lands in Nux I'll take another look at this branch and see if it works without the bug you mentioned, its on my to do list don't worry :) if it doesn't work after that lands I'll let you know

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Jay says the new nux event architecture is released. Oneiric may not need a fix for bug 805874 any more. Please test this fix again...

Revision history for this message
Gord Allott (gordallott) wrote :

lots of conflicts with trunk, so trying to merge in trunk with it failed more than i am comfortable with, so needs the conflicts fixing

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yes I noticed the extensive style and clean-up changes that happened in lp:unity recently. While it's great in theory it has caused me a bit a grief with conflicts. But such conflicts are hopefully only once-off.

I'll revisit and rebase this fix soon.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Conflicts resolved.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/Launcher.cpp'
2--- plugins/unityshell/src/Launcher.cpp 2011-08-01 16:20:08 +0000
3+++ plugins/unityshell/src/Launcher.cpp 2011-08-02 06:24:40 +0000
4@@ -303,10 +303,20 @@
5 (UBusCallback) &Launcher::OnBFBDndEnter,
6 this);
7
8- _ubus_handles[5] = ubus_server_register_interest (ubus,
9- UBUS_BACKGROUND_COLOR_CHANGED,
10- (UBusCallback) &Launcher::OnBGColorChanged,
11- this);
12+ _ubus_handles[5] = ubus_server_register_interest(ubus,
13+ UBUS_BACKGROUND_COLOR_CHANGED,
14+ (UBusCallback) &Launcher::OnBGColorChanged,
15+ this);
16+
17+ _ubus_handles[6] = ubus_server_register_interest(ubus,
18+ UBUS_PLACES_APP_DND_STARTED,
19+ (UBusCallback) &Launcher::OnPlaceDndStart,
20+ this);
21+
22+ _ubus_handles[7] = ubus_server_register_interest(ubus,
23+ UBUS_PLACES_APP_DND_FINISHED,
24+ (UBusCallback) &Launcher::OnPlaceDndFinish,
25+ this);
26
27 _dbus_owner = g_bus_own_name(G_BUS_TYPE_SESSION,
28 S_DBUS_NAME,
29@@ -1500,22 +1510,35 @@
30 self->NeedRedraw();
31 }
32
33+void Launcher::Desaturate()
34+{
35+ LauncherModel::iterator it;
36+ // TODO: add in a timeout for seeing the animation (and make it smoother)
37+ for (it = _model->begin(); it != _model->end(); it++)
38+ {
39+ (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, true);
40+ (*it)->HideTooltip();
41+ }
42+}
43+
44+void Launcher::Resaturate()
45+{
46+ LauncherModel::iterator it;
47+ // TODO: add in a timeout for seeing the animation (and make it smoother)
48+ for (it = _model->begin(); it != _model->end(); it++)
49+ {
50+ (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, false);
51+ }
52+}
53+
54 void Launcher::OnPlaceViewShown(GVariant* data, void* val)
55 {
56 Launcher* self = (Launcher*)val;
57- LauncherModel::iterator it;
58
59 self->_dash_is_open = true;
60 self->_hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);
61 self->_hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);
62-
63- // TODO: add in a timeout for seeing the animation (and make it smoother)
64- for (it = self->_model->begin(); it != self->_model->end(); it++)
65- {
66- (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, true);
67- (*it)->HideTooltip();
68- }
69-
70+ self->Desaturate();
71 // hack around issue in nux where leave events dont always come after a grab
72 self->SetStateMouseOverBFB(false);
73 }
74@@ -1523,7 +1546,6 @@
75 void Launcher::OnPlaceViewHidden(GVariant* data, void* val)
76 {
77 Launcher* self = (Launcher*)val;
78- LauncherModel::iterator it;
79
80 self->_dash_is_open = false;
81 self->_hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);
82@@ -1535,12 +1557,7 @@
83
84 self->SetStateMouseOverLauncher(self->GetAbsoluteGeometry().IsInside(pt));
85 self->SetStateMouseOverBFB(false);
86-
87- // TODO: add in a timeout for seeing the animation (and make it smoother)
88- for (it = self->_model->begin(); it != self->_model->end(); it++)
89- {
90- (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, false);
91- }
92+ self->Resaturate();
93 }
94
95 void Launcher::OnBFBDndEnter(GVariant* data, gpointer user_data)
96@@ -1600,6 +1617,21 @@
97 g_variant_iter_free(prop_iter);
98 }
99
100+void Launcher::OnPlaceDndStart(GVariant *data, void *val)
101+{
102+ Launcher *self = (Launcher*)val;
103+ self->Resaturate();
104+}
105+
106+void Launcher::OnPlaceDndFinish(GVariant *data, void *val)
107+{
108+ Launcher *self = (Launcher*)val;
109+ if (self->_hide_machine->GetQuirk(LauncherHideMachine::PLACES_VISIBLE))
110+ {
111+ self->Desaturate();
112+ }
113+}
114+
115 void Launcher::OnActionDone(GVariant* data, void* val)
116 {
117 Launcher* self = (Launcher*)val;
118
119=== modified file 'plugins/unityshell/src/Launcher.h'
120--- plugins/unityshell/src/Launcher.h 2011-08-01 14:58:34 +0000
121+++ plugins/unityshell/src/Launcher.h 2011-08-02 06:24:40 +0000
122@@ -331,6 +331,9 @@
123
124 void OnIconNeedsRedraw(AbstractLauncherIcon* icon);
125
126+ void Desaturate();
127+ void Resaturate();
128+
129 static void OnPlaceViewHidden(GVariant* data, void* val);
130 static void OnPlaceViewShown(GVariant* data, void* val);
131
132@@ -338,6 +341,9 @@
133 static void OnBFBDndEnter(GVariant* data, gpointer user_data);
134 static void OnBGColorChanged (GVariant *data, void *val);
135
136+ static void OnPlaceDndStart(GVariant *data, gpointer user_data);
137+ static void OnPlaceDndFinish(GVariant *data, gpointer user_data);
138+
139 static void OnActionDone(GVariant* data, void* val);
140
141 void RenderIconToTexture(nux::GraphicsEngine& GfxContext, LauncherIcon* icon, nux::IntrusiveSP<nux::IOpenGLBaseTexture> texture);
142@@ -484,7 +490,7 @@
143 GSettings* _settings;
144 guint32 _settings_changed_id;
145
146- guint _ubus_handles[6];
147+ guint _ubus_handles[8];
148
149 nux::Color _background_color;
150 bool _dash_is_open;
151
152=== modified file 'plugins/unityshell/src/PlacesController.cpp'
153--- plugins/unityshell/src/PlacesController.cpp 2011-07-21 14:59:25 +0000
154+++ plugins/unityshell/src/PlacesController.cpp 2011-08-02 06:24:40 +0000
155@@ -60,6 +60,10 @@
156 UBUS_PLACE_VIEW_CLOSE_REQUEST,
157 (UBusCallback) &PlacesController::CloseRequest,
158 this);
159+ _ubus_handles[2] = ubus_server_register_interest(ubus,
160+ UBUS_PLACES_APP_DND_FINISHED,
161+ (UBusCallback) &PlacesController::DndFinished,
162+ this);
163
164 _factory = PlaceFactory::GetDefault();
165
166@@ -353,6 +357,32 @@
167 }
168
169 void
170+PlacesController::OnDndFinished()
171+{
172+ if (_visible)
173+ {
174+ //
175+ // We might think we own the pointer grab, but if we just finished DnD
176+ // then we probably lost the grab.
177+ // That might be a bug in Nux, but it's cleaner to put a workaround here
178+ // right now...
179+ //
180+ if (_window->OwnsPointerGrab())
181+ {
182+ _window->UnGrabPointer();
183+ _window->GrabPointer();
184+ }
185+ }
186+}
187+
188+void
189+PlacesController::DndFinished(GVariant *data, void *val)
190+{
191+ PlacesController *self = (PlacesController*)val;
192+ self->OnDndFinished();
193+}
194+
195+void
196 PlacesController::RecvMouseDownOutsideOfView(int x, int y, unsigned long button_flags, unsigned long key_flags)
197 {
198 if (IsActivationValid())
199
200=== modified file 'plugins/unityshell/src/PlacesController.h'
201--- plugins/unityshell/src/PlacesController.h 2011-07-21 14:59:25 +0000
202+++ plugins/unityshell/src/PlacesController.h 2011-08-02 06:24:40 +0000
203@@ -59,9 +59,11 @@
204 private:
205 static void ExternalActivation(GVariant* data, void* val);
206 static void CloseRequest(GVariant* data, void* val);
207+ static void DndFinished(GVariant *data, void *val);
208 static void WindowConfigureCallback(int WindowWidth, int WindowHeight,
209 nux::Geometry& geo, void* user_data);
210
211+ void OnDndFinished();
212 void RecvMouseDownOutsideOfView(int x, int y, unsigned long button_flags, unsigned long key_flags);
213 void OnActivePlaceEntryChanged(PlaceEntry* entry);
214 void OnSettingsChanged(PlacesSettings* settings);
215@@ -92,7 +94,7 @@
216
217 bool _need_show;
218
219- guint _ubus_handles[2];
220+ guint _ubus_handles[3];
221 };
222
223 #endif // PLACES_CONTROLLER_H
224
225=== modified file 'plugins/unityshell/src/PlacesSimpleTile.cpp'
226--- plugins/unityshell/src/PlacesSimpleTile.cpp 2011-07-26 03:49:30 +0000
227+++ plugins/unityshell/src/PlacesSimpleTile.cpp 2011-08-02 06:24:40 +0000
228@@ -83,9 +83,12 @@
229 PlacesSimpleTile::DndSourceDragBegin()
230 {
231 Reference();
232- ubus_server_send_message(ubus_server_get_default(),
233- UBUS_PLACE_VIEW_CLOSE_REQUEST,
234- NULL);
235+ const gchar *message;
236+ if (_uri && g_str_has_prefix(_uri, "application://"))
237+ message = UBUS_PLACES_APP_DND_STARTED;
238+ else
239+ message = UBUS_PLACE_VIEW_CLOSE_REQUEST;
240+ ubus_server_send_message(ubus_server_get_default(), message, NULL);
241 }
242
243 nux::NBitmapData*
244@@ -177,6 +180,12 @@
245 void
246 PlacesSimpleTile::DndSourceDragFinished(nux::DndAction result)
247 {
248+ if (_uri && g_str_has_prefix(_uri, "application://"))
249+ {
250+ ubus_server_send_message(ubus_server_get_default(),
251+ UBUS_PLACES_APP_DND_FINISHED,
252+ NULL);
253+ }
254 UnReference();
255 }
256
257
258=== modified file 'plugins/unityshell/src/UBusMessages.h'
259--- plugins/unityshell/src/UBusMessages.h 2011-07-29 07:15:54 +0000
260+++ plugins/unityshell/src/UBusMessages.h 2011-08-02 06:24:40 +0000
261@@ -27,6 +27,10 @@
262
263 #define UBUS_HOME_BUTTON_ACTIVATED "PANEL_HOME_ACTIVATED"
264
265+// When an app is being dragged (from the Dash)
266+#define UBUS_PLACES_APP_DND_STARTED "PLACES_APP_DND_STARTED"
267+#define UBUS_PLACES_APP_DND_FINISHED "PLACES_APP_DND_FINISHED"
268+
269 #define UBUS_DASH_EXTERNAL_ACTIVATION "DASH_EXTERNAL_ACTIVATION"
270 #define UBUS_HOME_BUTTON_BFB_UPDATE "PANEL_HOME_BUTTON_BFB_UPDATE"
271 #define UBUS_HOME_BUTTON_BFB_DND_ENTER "PANEL_HOME_BUTTON_BFB_DND_ENTER"