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
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2011-08-01 16:20:08 +0000
+++ plugins/unityshell/src/Launcher.cpp 2011-08-02 06:24:40 +0000
@@ -303,10 +303,20 @@
303 (UBusCallback) &Launcher::OnBFBDndEnter,303 (UBusCallback) &Launcher::OnBFBDndEnter,
304 this);304 this);
305305
306 _ubus_handles[5] = ubus_server_register_interest (ubus,306 _ubus_handles[5] = ubus_server_register_interest(ubus,
307 UBUS_BACKGROUND_COLOR_CHANGED,307 UBUS_BACKGROUND_COLOR_CHANGED,
308 (UBusCallback) &Launcher::OnBGColorChanged,308 (UBusCallback) &Launcher::OnBGColorChanged,
309 this);309 this);
310
311 _ubus_handles[6] = ubus_server_register_interest(ubus,
312 UBUS_PLACES_APP_DND_STARTED,
313 (UBusCallback) &Launcher::OnPlaceDndStart,
314 this);
315
316 _ubus_handles[7] = ubus_server_register_interest(ubus,
317 UBUS_PLACES_APP_DND_FINISHED,
318 (UBusCallback) &Launcher::OnPlaceDndFinish,
319 this);
310320
311 _dbus_owner = g_bus_own_name(G_BUS_TYPE_SESSION,321 _dbus_owner = g_bus_own_name(G_BUS_TYPE_SESSION,
312 S_DBUS_NAME,322 S_DBUS_NAME,
@@ -1500,22 +1510,35 @@
1500 self->NeedRedraw();1510 self->NeedRedraw();
1501}1511}
15021512
1513void Launcher::Desaturate()
1514{
1515 LauncherModel::iterator it;
1516 // TODO: add in a timeout for seeing the animation (and make it smoother)
1517 for (it = _model->begin(); it != _model->end(); it++)
1518 {
1519 (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, true);
1520 (*it)->HideTooltip();
1521 }
1522}
1523
1524void Launcher::Resaturate()
1525{
1526 LauncherModel::iterator it;
1527 // TODO: add in a timeout for seeing the animation (and make it smoother)
1528 for (it = _model->begin(); it != _model->end(); it++)
1529 {
1530 (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, false);
1531 }
1532}
1533
1503void Launcher::OnPlaceViewShown(GVariant* data, void* val)1534void Launcher::OnPlaceViewShown(GVariant* data, void* val)
1504{1535{
1505 Launcher* self = (Launcher*)val;1536 Launcher* self = (Launcher*)val;
1506 LauncherModel::iterator it;
15071537
1508 self->_dash_is_open = true;1538 self->_dash_is_open = true;
1509 self->_hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);1539 self->_hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);
1510 self->_hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);1540 self->_hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);
15111541 self->Desaturate();
1512 // TODO: add in a timeout for seeing the animation (and make it smoother)
1513 for (it = self->_model->begin(); it != self->_model->end(); it++)
1514 {
1515 (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, true);
1516 (*it)->HideTooltip();
1517 }
1518
1519 // hack around issue in nux where leave events dont always come after a grab1542 // hack around issue in nux where leave events dont always come after a grab
1520 self->SetStateMouseOverBFB(false);1543 self->SetStateMouseOverBFB(false);
1521}1544}
@@ -1523,7 +1546,6 @@
1523void Launcher::OnPlaceViewHidden(GVariant* data, void* val)1546void Launcher::OnPlaceViewHidden(GVariant* data, void* val)
1524{1547{
1525 Launcher* self = (Launcher*)val;1548 Launcher* self = (Launcher*)val;
1526 LauncherModel::iterator it;
15271549
1528 self->_dash_is_open = false;1550 self->_dash_is_open = false;
1529 self->_hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);1551 self->_hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);
@@ -1535,12 +1557,7 @@
15351557
1536 self->SetStateMouseOverLauncher(self->GetAbsoluteGeometry().IsInside(pt));1558 self->SetStateMouseOverLauncher(self->GetAbsoluteGeometry().IsInside(pt));
1537 self->SetStateMouseOverBFB(false);1559 self->SetStateMouseOverBFB(false);
15381560 self->Resaturate();
1539 // TODO: add in a timeout for seeing the animation (and make it smoother)
1540 for (it = self->_model->begin(); it != self->_model->end(); it++)
1541 {
1542 (*it)->SetQuirk(LauncherIcon::QUIRK_DESAT, false);
1543 }
1544}1561}
15451562
1546void Launcher::OnBFBDndEnter(GVariant* data, gpointer user_data)1563void Launcher::OnBFBDndEnter(GVariant* data, gpointer user_data)
@@ -1600,6 +1617,21 @@
1600 g_variant_iter_free(prop_iter);1617 g_variant_iter_free(prop_iter);
1601}1618}
16021619
1620void Launcher::OnPlaceDndStart(GVariant *data, void *val)
1621{
1622 Launcher *self = (Launcher*)val;
1623 self->Resaturate();
1624}
1625
1626void Launcher::OnPlaceDndFinish(GVariant *data, void *val)
1627{
1628 Launcher *self = (Launcher*)val;
1629 if (self->_hide_machine->GetQuirk(LauncherHideMachine::PLACES_VISIBLE))
1630 {
1631 self->Desaturate();
1632 }
1633}
1634
1603void Launcher::OnActionDone(GVariant* data, void* val)1635void Launcher::OnActionDone(GVariant* data, void* val)
1604{1636{
1605 Launcher* self = (Launcher*)val;1637 Launcher* self = (Launcher*)val;
16061638
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2011-08-01 14:58:34 +0000
+++ plugins/unityshell/src/Launcher.h 2011-08-02 06:24:40 +0000
@@ -331,6 +331,9 @@
331331
332 void OnIconNeedsRedraw(AbstractLauncherIcon* icon);332 void OnIconNeedsRedraw(AbstractLauncherIcon* icon);
333333
334 void Desaturate();
335 void Resaturate();
336
334 static void OnPlaceViewHidden(GVariant* data, void* val);337 static void OnPlaceViewHidden(GVariant* data, void* val);
335 static void OnPlaceViewShown(GVariant* data, void* val);338 static void OnPlaceViewShown(GVariant* data, void* val);
336339
@@ -338,6 +341,9 @@
338 static void OnBFBDndEnter(GVariant* data, gpointer user_data);341 static void OnBFBDndEnter(GVariant* data, gpointer user_data);
339 static void OnBGColorChanged (GVariant *data, void *val);342 static void OnBGColorChanged (GVariant *data, void *val);
340343
344 static void OnPlaceDndStart(GVariant *data, gpointer user_data);
345 static void OnPlaceDndFinish(GVariant *data, gpointer user_data);
346
341 static void OnActionDone(GVariant* data, void* val);347 static void OnActionDone(GVariant* data, void* val);
342348
343 void RenderIconToTexture(nux::GraphicsEngine& GfxContext, LauncherIcon* icon, nux::IntrusiveSP<nux::IOpenGLBaseTexture> texture);349 void RenderIconToTexture(nux::GraphicsEngine& GfxContext, LauncherIcon* icon, nux::IntrusiveSP<nux::IOpenGLBaseTexture> texture);
@@ -484,7 +490,7 @@
484 GSettings* _settings;490 GSettings* _settings;
485 guint32 _settings_changed_id;491 guint32 _settings_changed_id;
486492
487 guint _ubus_handles[6];493 guint _ubus_handles[8];
488494
489 nux::Color _background_color;495 nux::Color _background_color;
490 bool _dash_is_open;496 bool _dash_is_open;
491497
=== modified file 'plugins/unityshell/src/PlacesController.cpp'
--- plugins/unityshell/src/PlacesController.cpp 2011-07-21 14:59:25 +0000
+++ plugins/unityshell/src/PlacesController.cpp 2011-08-02 06:24:40 +0000
@@ -60,6 +60,10 @@
60 UBUS_PLACE_VIEW_CLOSE_REQUEST,60 UBUS_PLACE_VIEW_CLOSE_REQUEST,
61 (UBusCallback) &PlacesController::CloseRequest,61 (UBusCallback) &PlacesController::CloseRequest,
62 this);62 this);
63 _ubus_handles[2] = ubus_server_register_interest(ubus,
64 UBUS_PLACES_APP_DND_FINISHED,
65 (UBusCallback) &PlacesController::DndFinished,
66 this);
6367
64 _factory = PlaceFactory::GetDefault();68 _factory = PlaceFactory::GetDefault();
6569
@@ -353,6 +357,32 @@
353}357}
354358
355void359void
360PlacesController::OnDndFinished()
361{
362 if (_visible)
363 {
364 //
365 // We might think we own the pointer grab, but if we just finished DnD
366 // then we probably lost the grab.
367 // That might be a bug in Nux, but it's cleaner to put a workaround here
368 // right now...
369 //
370 if (_window->OwnsPointerGrab())
371 {
372 _window->UnGrabPointer();
373 _window->GrabPointer();
374 }
375 }
376}
377
378void
379PlacesController::DndFinished(GVariant *data, void *val)
380{
381 PlacesController *self = (PlacesController*)val;
382 self->OnDndFinished();
383}
384
385void
356PlacesController::RecvMouseDownOutsideOfView(int x, int y, unsigned long button_flags, unsigned long key_flags)386PlacesController::RecvMouseDownOutsideOfView(int x, int y, unsigned long button_flags, unsigned long key_flags)
357{387{
358 if (IsActivationValid())388 if (IsActivationValid())
359389
=== modified file 'plugins/unityshell/src/PlacesController.h'
--- plugins/unityshell/src/PlacesController.h 2011-07-21 14:59:25 +0000
+++ plugins/unityshell/src/PlacesController.h 2011-08-02 06:24:40 +0000
@@ -59,9 +59,11 @@
59private:59private:
60 static void ExternalActivation(GVariant* data, void* val);60 static void ExternalActivation(GVariant* data, void* val);
61 static void CloseRequest(GVariant* data, void* val);61 static void CloseRequest(GVariant* data, void* val);
62 static void DndFinished(GVariant *data, void *val);
62 static void WindowConfigureCallback(int WindowWidth, int WindowHeight,63 static void WindowConfigureCallback(int WindowWidth, int WindowHeight,
63 nux::Geometry& geo, void* user_data);64 nux::Geometry& geo, void* user_data);
6465
66 void OnDndFinished();
65 void RecvMouseDownOutsideOfView(int x, int y, unsigned long button_flags, unsigned long key_flags);67 void RecvMouseDownOutsideOfView(int x, int y, unsigned long button_flags, unsigned long key_flags);
66 void OnActivePlaceEntryChanged(PlaceEntry* entry);68 void OnActivePlaceEntryChanged(PlaceEntry* entry);
67 void OnSettingsChanged(PlacesSettings* settings);69 void OnSettingsChanged(PlacesSettings* settings);
@@ -92,7 +94,7 @@
9294
93 bool _need_show;95 bool _need_show;
9496
95 guint _ubus_handles[2];97 guint _ubus_handles[3];
96};98};
9799
98#endif // PLACES_CONTROLLER_H100#endif // PLACES_CONTROLLER_H
99101
=== modified file 'plugins/unityshell/src/PlacesSimpleTile.cpp'
--- plugins/unityshell/src/PlacesSimpleTile.cpp 2011-07-26 03:49:30 +0000
+++ plugins/unityshell/src/PlacesSimpleTile.cpp 2011-08-02 06:24:40 +0000
@@ -83,9 +83,12 @@
83PlacesSimpleTile::DndSourceDragBegin()83PlacesSimpleTile::DndSourceDragBegin()
84{84{
85 Reference();85 Reference();
86 ubus_server_send_message(ubus_server_get_default(),86 const gchar *message;
87 UBUS_PLACE_VIEW_CLOSE_REQUEST,87 if (_uri && g_str_has_prefix(_uri, "application://"))
88 NULL);88 message = UBUS_PLACES_APP_DND_STARTED;
89 else
90 message = UBUS_PLACE_VIEW_CLOSE_REQUEST;
91 ubus_server_send_message(ubus_server_get_default(), message, NULL);
89}92}
9093
91nux::NBitmapData*94nux::NBitmapData*
@@ -177,6 +180,12 @@
177void180void
178PlacesSimpleTile::DndSourceDragFinished(nux::DndAction result)181PlacesSimpleTile::DndSourceDragFinished(nux::DndAction result)
179{182{
183 if (_uri && g_str_has_prefix(_uri, "application://"))
184 {
185 ubus_server_send_message(ubus_server_get_default(),
186 UBUS_PLACES_APP_DND_FINISHED,
187 NULL);
188 }
180 UnReference();189 UnReference();
181}190}
182191
183192
=== modified file 'plugins/unityshell/src/UBusMessages.h'
--- plugins/unityshell/src/UBusMessages.h 2011-07-29 07:15:54 +0000
+++ plugins/unityshell/src/UBusMessages.h 2011-08-02 06:24:40 +0000
@@ -27,6 +27,10 @@
2727
28#define UBUS_HOME_BUTTON_ACTIVATED "PANEL_HOME_ACTIVATED"28#define UBUS_HOME_BUTTON_ACTIVATED "PANEL_HOME_ACTIVATED"
2929
30// When an app is being dragged (from the Dash)
31#define UBUS_PLACES_APP_DND_STARTED "PLACES_APP_DND_STARTED"
32#define UBUS_PLACES_APP_DND_FINISHED "PLACES_APP_DND_FINISHED"
33
30#define UBUS_DASH_EXTERNAL_ACTIVATION "DASH_EXTERNAL_ACTIVATION"34#define UBUS_DASH_EXTERNAL_ACTIVATION "DASH_EXTERNAL_ACTIVATION"
31#define UBUS_HOME_BUTTON_BFB_UPDATE "PANEL_HOME_BUTTON_BFB_UPDATE"35#define UBUS_HOME_BUTTON_BFB_UPDATE "PANEL_HOME_BUTTON_BFB_UPDATE"
32#define UBUS_HOME_BUTTON_BFB_DND_ENTER "PANEL_HOME_BUTTON_BFB_DND_ENTER"36#define UBUS_HOME_BUTTON_BFB_DND_ENTER "PANEL_HOME_BUTTON_BFB_DND_ENTER"