Merge lp:~mjuhasz/unity/fix-for-754565 into lp:unity

Proposed by Miklos Juhasz on 2012-04-11
Status: Superseded
Proposed branch: lp:~mjuhasz/unity/fix-for-754565
Merge into: lp:unity
Diff against target: 159 lines (+33/-29)
6 files modified
plugins/unityshell/src/AbstractLauncherIcon.h (+3/-3)
plugins/unityshell/src/Launcher.cpp (+4/-4)
plugins/unityshell/src/LauncherIcon.cpp (+9/-5)
plugins/unityshell/src/LauncherIcon.h (+5/-5)
plugins/unityshell/src/SimpleLauncherIcon.cpp (+9/-9)
plugins/unityshell/src/SimpleLauncherIcon.h (+3/-3)
To merge this branch: bzr merge lp:~mjuhasz/unity/fix-for-754565
Reviewer Review Type Date Requested Status
Alex Launi (community) quality 2012-04-11 Needs Fixing on 2012-04-12
Review via email: mp+101635@code.launchpad.net

This proposal has been superseded by a proposal from 2012-05-02.

Description of the Change

Fix for bug #754565 - Shift+Click on a launcher icon should open a new instance of the application.

Also see: https://code.launchpad.net/~yeganeh/unity/fix-for-754565/+merge/77739

To post a comment you must log in.
Alex Launi (alexlauni) wrote :

Please add an autopilot test to ensure that this feature does not regress, and is working properly. A new test should go into tests/autopilot/autopilot/tests/test_launcher.py

review: Needs Fixing (quality)
Miklos Juhasz (mjuhasz) wrote :

@thomir: Is your offer to write the test still valid?

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/AbstractLauncherIcon.h'
2--- plugins/unityshell/src/AbstractLauncherIcon.h 2012-03-30 15:24:34 +0000
3+++ plugins/unityshell/src/AbstractLauncherIcon.h 2012-04-11 19:21:24 +0000
4@@ -207,9 +207,9 @@
5
6 virtual void UnStick() = 0;
7
8- sigc::signal<void, int, int> mouse_down;
9- sigc::signal<void, int, int> mouse_up;
10- sigc::signal<void, int, int> mouse_click;
11+ sigc::signal<void, int, int, unsigned long> mouse_down;
12+ sigc::signal<void, int, int, unsigned long> mouse_up;
13+ sigc::signal<void, int, int, unsigned long> mouse_click;
14 sigc::signal<void, int> mouse_enter;
15 sigc::signal<void, int> mouse_leave;
16
17
18=== modified file 'plugins/unityshell/src/Launcher.cpp'
19--- plugins/unityshell/src/Launcher.cpp 2012-04-10 01:41:16 +0000
20+++ plugins/unityshell/src/Launcher.cpp 2012-04-11 19:21:24 +0000
21@@ -2533,7 +2533,7 @@
22 g_source_remove(_start_dragicon_handle);
23 _start_dragicon_handle = g_timeout_add(START_DRAGICON_DURATION, &Launcher::StartIconDragTimeout, this);
24
25- launcher_icon->mouse_down.emit(nux::GetEventButton(button_flags), monitor);
26+ launcher_icon->mouse_down.emit(nux::GetEventButton(button_flags), monitor, key_flags);
27 }
28 }
29
30@@ -2549,17 +2549,17 @@
31
32 if (_icon_mouse_down && (_icon_mouse_down == launcher_icon))
33 {
34- _icon_mouse_down->mouse_up.emit(nux::GetEventButton(button_flags), monitor);
35+ _icon_mouse_down->mouse_up.emit(nux::GetEventButton(button_flags), monitor, key_flags);
36
37 if (GetActionState() == ACTION_NONE)
38 {
39- _icon_mouse_down->mouse_click.emit(nux::GetEventButton(button_flags), monitor);
40+ _icon_mouse_down->mouse_click.emit(nux::GetEventButton(button_flags), monitor, key_flags);
41 }
42 }
43
44 if (launcher_icon && (_icon_mouse_down != launcher_icon))
45 {
46- launcher_icon->mouse_up.emit(nux::GetEventButton(button_flags), monitor);
47+ launcher_icon->mouse_up.emit(nux::GetEventButton(button_flags), monitor, key_flags);
48 }
49
50 if (GetActionState() == ACTION_DRAG_LAUNCHER)
51
52=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
53--- plugins/unityshell/src/LauncherIcon.cpp 2012-04-10 00:39:14 +0000
54+++ plugins/unityshell/src/LauncherIcon.cpp 2012-04-11 19:21:24 +0000
55@@ -620,13 +620,13 @@
56 return true;
57 }
58
59-void LauncherIcon::RecvMouseDown(int button, int monitor)
60+void LauncherIcon::RecvMouseDown(int button, int monitor, unsigned long key_flags)
61 {
62 if (button == 3)
63 OpenQuicklist();
64 }
65
66-void LauncherIcon::RecvMouseUp(int button, int monitor)
67+void LauncherIcon::RecvMouseUp(int button, int monitor, unsigned long key_flags)
68 {
69 if (button == 3)
70 {
71@@ -635,14 +635,18 @@
72 }
73 }
74
75-void LauncherIcon::RecvMouseClick(int button, int monitor)
76+void LauncherIcon::RecvMouseClick(int button, int monitor, unsigned long key_flags)
77 {
78 ActionArg arg(ActionArg::LAUNCHER, button);
79 arg.monitor = monitor;
80
81- if (button == 1)
82+ bool shift_pressed = nux::GetKeyModifierState(key_flags, nux::NUX_STATE_SHIFT);
83+
84+ // Click without shift
85+ if (button == 1 && !shift_pressed)
86 Activate(arg);
87- else if (button == 2)
88+ // Middle click or click with shift
89+ else if ((button == 2) || (button == 1 && shift_pressed))
90 OpenInstance(arg);
91 }
92
93
94=== modified file 'plugins/unityshell/src/LauncherIcon.h'
95--- plugins/unityshell/src/LauncherIcon.h 2012-04-03 22:18:36 +0000
96+++ plugins/unityshell/src/LauncherIcon.h 2012-04-11 19:21:24 +0000
97@@ -76,11 +76,11 @@
98
99 void RecvMouseLeave(int monitor);
100
101- void RecvMouseDown(int button, int monitor);
102-
103- void RecvMouseUp(int button, int monitor);
104-
105- void RecvMouseClick(int button, int monitor);
106+ void RecvMouseDown(int button, int monitor, unsigned long key_flags = 0);
107+
108+ void RecvMouseUp(int button, int monitor, unsigned long key_flags = 0);
109+
110+ void RecvMouseClick(int button, int monitor, unsigned long key_flags = 0);
111
112 void HideTooltip();
113
114
115=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.cpp'
116--- plugins/unityshell/src/SimpleLauncherIcon.cpp 2012-03-25 22:52:20 +0000
117+++ plugins/unityshell/src/SimpleLauncherIcon.cpp 2012-04-11 19:21:24 +0000
118@@ -69,15 +69,15 @@
119 g_signal_handler_disconnect(gtk_icon_theme_get_default(), theme_changed_id_);
120 }
121
122-void SimpleLauncherIcon::OnMouseDown(int button, int monitor)
123-{
124-}
125-
126-void SimpleLauncherIcon::OnMouseUp(int button, int monitor)
127-{
128-}
129-
130-void SimpleLauncherIcon::OnMouseClick(int button, int monitor)
131+void SimpleLauncherIcon::OnMouseDown(int button, int monitor, unsigned long key_flags)
132+{
133+}
134+
135+void SimpleLauncherIcon::OnMouseUp(int button, int monitor, unsigned long key_flags)
136+{
137+}
138+
139+void SimpleLauncherIcon::OnMouseClick(int button, int monitor, unsigned long key_flags)
140 {
141 }
142
143
144=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.h'
145--- plugins/unityshell/src/SimpleLauncherIcon.h 2012-03-25 22:52:20 +0000
146+++ plugins/unityshell/src/SimpleLauncherIcon.h 2012-04-11 19:21:24 +0000
147@@ -49,9 +49,9 @@
148 std::string GetName() const;
149 void AddProperties(GVariantBuilder* builder);
150
151- virtual void OnMouseDown(int button, int monitor);
152- virtual void OnMouseUp(int button, int monitor);
153- virtual void OnMouseClick(int button, int monitor);
154+ virtual void OnMouseDown(int button, int monitor, unsigned long key_flags = 0);
155+ virtual void OnMouseUp(int button, int monitor, unsigned long key_flags = 0);
156+ virtual void OnMouseClick(int button, int monitor, unsigned long key_flags = 0);
157 virtual void OnMouseEnter(int monitor);
158 virtual void OnMouseLeave(int monitor);
159 virtual void ActivateLauncherIcon(ActionArg arg);