Merge lp:~brandontschaefer/unity/fix.918753 into lp:unity

Proposed by Brandon Schaefer on 2012-03-20
Status: Merged
Approved by: Tim Penhey on 2012-03-21
Approved revision: 2131
Merged at revision: 2142
Proposed branch: lp:~brandontschaefer/unity/fix.918753
Merge into: lp:unity
Diff against target: 88 lines (+35/-11)
3 files modified
manual-tests/Launcher.txt (+14/-0)
plugins/unityshell/src/Launcher.cpp (+19/-11)
plugins/unityshell/src/Launcher.h (+2/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/fix.918753
Reviewer Review Type Date Requested Status
Tim Penhey (community) 2012-03-20 Approve on 2012-03-21
Review via email: mp+98323@code.launchpad.net

Commit Message

* Fixes the icon getting frozen and producing a duplicate icon.

Description of the Change

= Problem description =

When a user executed a program from the launcher then draged an icon it the icon would freeze where its at and a duplicate would be put back at its original position.

= The fix =

When a WindowMapped signal gets emitted we check if the the drag icon or drag launcher needs to get reset, if it does then reset it.

= Test coverage =

There is a manual test for this.

To post a comment you must log in.
2131. By Brandon Schaefer on 2012-03-20

* DRY - Dont Repeat Yourself

Tim Penhey (thumper) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Launcher.txt'
2--- manual-tests/Launcher.txt 2012-03-05 02:59:03 +0000
3+++ manual-tests/Launcher.txt 2012-03-20 23:28:20 +0000
4@@ -155,3 +155,17 @@
5 icons.
6 * When released, the icon "flies" back into the launcher, a spaces opens for
7 it, and the any pips for running apps show again.
8+
9+
10+Dragging icon while program is starting
11+---------------------------------------
12+This test that when a program is executed from the launcher and the icon is
13+getting dragged that the icon doesn't get frozen on the launcher.
14+
15+#. Click on Ubuntu Software Center from the launcher.
16+#. While it's starting drag the Ubuntu Software Center icon.
17+#. Drag the icon half over the launcher and desktop.
18+#. Wait for the program to start.
19+
20+Outcome:
21+ * The icon should go back to its correct position in the launcher.
22
23=== modified file 'plugins/unityshell/src/Launcher.cpp'
24--- plugins/unityshell/src/Launcher.cpp 2012-03-20 10:27:41 +0000
25+++ plugins/unityshell/src/Launcher.cpp 2012-03-20 23:28:20 +0000
26@@ -1471,6 +1471,9 @@
27 if (!_dnd_check_handle)
28 _dnd_check_handle = g_timeout_add(200, &Launcher::OnUpdateDragManagerTimeout, this);
29 //}
30+
31+ if (GetActionState() != ACTION_NONE)
32+ ResetMouseDragState();
33 }
34
35 void
36@@ -2183,6 +2186,21 @@
37 }
38 }
39
40+void Launcher::ResetMouseDragState()
41+{
42+ if (GetActionState() == ACTION_DRAG_ICON)
43+ EndIconDrag();
44+
45+ if (GetActionState() == ACTION_DRAG_LAUNCHER)
46+ _hide_machine->SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, false);
47+
48+ SetActionState(ACTION_NONE);
49+ _dnd_delta_x = 0;
50+ _dnd_delta_y = 0;
51+ _last_button_press = 0;
52+ EnsureAnimation();
53+}
54+
55 void Launcher::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
56 {
57 _last_button_press = nux::GetEventButton(button_flags);
58@@ -2198,17 +2216,7 @@
59 nux::Geometry geo = GetGeometry();
60
61 MouseUpLogic(x, y, button_flags, key_flags);
62-
63- if (GetActionState() == ACTION_DRAG_ICON)
64- EndIconDrag();
65-
66- if (GetActionState() == ACTION_DRAG_LAUNCHER)
67- _hide_machine->SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, false);
68- SetActionState(ACTION_NONE);
69- _dnd_delta_x = 0;
70- _dnd_delta_y = 0;
71- _last_button_press = 0;
72- EnsureAnimation();
73+ ResetMouseDragState();
74 }
75
76 void Launcher::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
77
78=== modified file 'plugins/unityshell/src/Launcher.h'
79--- plugins/unityshell/src/Launcher.h 2012-03-13 02:07:54 +0000
80+++ plugins/unityshell/src/Launcher.h 2012-03-20 23:28:20 +0000
81@@ -290,6 +290,8 @@
82 void EndIconDrag();
83 void UpdateDragWindowPosition(int x, int y);
84
85+ void ResetMouseDragState();
86+
87 float GetAutohidePositionMin() const;
88 float GetAutohidePositionMax() const;
89