Merge lp:~manuel-nicetto/unity/bug-754565 into lp:unity

Proposed by Manuel Nicetto
Status: Rejected
Rejected by: Neil J. Patel
Proposed branch: lp:~manuel-nicetto/unity/bug-754565
Merge into: lp:unity
Diff against target: 186 lines (+46/-9) (has conflicts)
6 files modified
plugins/unityshell/src/Launcher.cpp (+31/-1)
plugins/unityshell/src/Launcher.h (+2/-0)
plugins/unityshell/src/LauncherIcon.cpp (+9/-4)
plugins/unityshell/src/LauncherIcon.h (+2/-2)
plugins/unityshell/src/SimpleLauncherIcon.cpp (+1/-1)
plugins/unityshell/src/SimpleLauncherIcon.h (+1/-1)
Text conflict in plugins/unityshell/src/Launcher.cpp
To merge this branch: bzr merge lp:~manuel-nicetto/unity/bug-754565
Reviewer Review Type Date Requested Status
Jason Smith Pending
Review via email: mp+66527@code.launchpad.net

This proposal supersedes a proposal from 2011-06-27.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote : Posted in a previous version of this proposal

On Sat, 25 Jun 2011 08:44:55 you wrote:
> +void
> +Launcher::RecvKeyReleased (unsigned int key_sym,
> + unsigned long key_code,
> + unsigned long key_state)
> +{
> + _shift_pressed=false;
> +}
> +

This looks wrong. What if the user held shift, then alt, then released alt,
but shift still down. This would incorrectly clear the shift pressed. We
should check the key code.

Tim

Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote : Posted in a previous version of this proposal

+ bool _shift_pressed;

You are using tab here. Please, use spaces instead.

+ _shift_pressed=false;
+ _icon_mouse_down->_shift_pressed=_shift_pressed;

Use spaces before and after the assignment operator. Something like:
_shift_pressed = false;
_icon_mouse_down->_shift_pressed = _shift_pressed;

Revision history for this message
Jason Smith (jassmith) wrote : Posted in a previous version of this proposal

please dont use public variables to signify information to a method on LauncherIcon, pass shift_pressed as an argument to the click behavior.

review: Needs Fixing

Unmerged revisions

1245. By Manuel Nicetto

Pass shift_pressed on click behavior as suggested by Jason

1244. By Manuel Nicetto

-- fixed another identation error

1243. By Manuel Nicetto

-- Fixed key release checking the correct shift pressed event reported by Tim Penhey
-- Fixed identation errors reported from Marco Biscaro

1242. By Manuel Nicetto

fixed _shift_pressed assigned twice in LauncherIcon.cpp

1241. By Manuel Nicetto

* Regression: shift+click on a launcher icon to open a new application instance gone

-- Manuel Nicetto <email address hidden> Thu 16 Jun 2011 23:31

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-06-30 15:21:07 +0000
3+++ plugins/unityshell/src/Launcher.cpp 2011-06-30 22:35:53 +0000
4@@ -261,7 +261,12 @@
5 _parent = parent;
6 _screen = screen;
7 _active_quicklist = 0;
8+<<<<<<< TREE
9
10+=======
11+ _shift_pressed = false;
12+
13+>>>>>>> MERGE-SOURCE
14 _hide_machine = new LauncherHideMachine ();
15 _set_hidden_connection = (sigc::connection) _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden));
16 _hover_machine = new LauncherHoverMachine ();
17@@ -279,6 +284,7 @@
18 OnMouseMove.connect (sigc::mem_fun (this, &Launcher::RecvMouseMove));
19 OnMouseWheel.connect (sigc::mem_fun (this, &Launcher::RecvMouseWheel));
20 OnKeyPressed.connect (sigc::mem_fun (this, &Launcher::RecvKeyPressed));
21+ OnKeyReleased.connect (sigc::mem_fun (this, &Launcher::RecvKeyReleased));
22 OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &Launcher::RecvMouseDownOutsideArea));
23 //OnEndFocus.connect (sigc::mem_fun (this, &Launcher::exitKeyNavMode));
24
25@@ -3039,6 +3045,7 @@
26
27 void Launcher::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
28 {
29+ UnGrabKeyboard ();
30 _last_button_press = nux::GetEventButton (button_flags);
31 SetMousePosition (x, y);
32
33@@ -3131,7 +3138,12 @@
34 {
35 SetMousePosition (x, y);
36 SetStateMouseOverLauncher (true);
37+<<<<<<< TREE
38
39+=======
40+ GrabKeyboard ();
41+
42+>>>>>>> MERGE-SOURCE
43 // make sure we actually get a chance to get events before turning this off
44 if (x > 0)
45 _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE, false);
46@@ -3145,6 +3157,7 @@
47 SetMousePosition (x, y);
48 SetStateMouseOverLauncher (false);
49 LauncherIcon::SetSkipTooltipDelay (false);
50+ UnGrabKeyboard ();
51
52 EventLogic ();
53 EnsureAnimation ();
54@@ -3266,6 +3279,12 @@
55 {
56
57 LauncherModel::iterator it;
58+
59+ if(key_sym == NUX_VK_SHIFT){
60+ _shift_pressed = true;
61+ } else {
62+ _shift_pressed = false;
63+ }
64
65 /*
66 * all key events below are related to keynavigation. Make an additional
67@@ -3372,6 +3391,16 @@
68 }
69 }
70
71+void
72+Launcher::RecvKeyReleased (unsigned int key_sym,
73+ unsigned long key_code,
74+ unsigned long key_state)
75+{
76+ if(key_sym == NUX_VK_SHIFT){
77+ _shift_pressed = false;
78+ }
79+}
80+
81 void Launcher::RecvQuicklistOpened (QuicklistView *quicklist)
82 {
83 _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true);
84@@ -3454,7 +3483,8 @@
85 _icon_mouse_down->MouseUp.emit (nux::GetEventButton (button_flags));
86
87 if (GetActionState () == ACTION_NONE) {
88- _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags));
89+ _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags), _shift_pressed);
90+ _shift_pressed = false;
91 }
92 }
93
94
95=== modified file 'plugins/unityshell/src/Launcher.h'
96--- plugins/unityshell/src/Launcher.h 2011-06-28 11:49:06 +0000
97+++ plugins/unityshell/src/Launcher.h 2011-06-30 22:35:53 +0000
98@@ -152,6 +152,7 @@
99 virtual void RecvMouseDownOutsideArea (int x, int y, unsigned long button_flags, unsigned long key_flags);
100
101 virtual void RecvKeyPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
102+ virtual void RecvKeyReleased (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
103
104 virtual void RecvQuicklistOpened (QuicklistView *quicklist);
105 virtual void RecvQuicklistClosed (QuicklistView *quicklist);
106@@ -418,6 +419,7 @@
107 bool _shortcuts_shown;
108 bool _super_pressed;
109 bool _keynav_activated;
110+ bool _shift_pressed;
111 guint64 _latest_shortcut;
112
113 BacklightMode _backlight_mode;
114
115=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
116--- plugins/unityshell/src/LauncherIcon.cpp 2011-06-21 12:10:09 +0000
117+++ plugins/unityshell/src/LauncherIcon.cpp 2011-06-30 22:35:53 +0000
118@@ -606,12 +606,17 @@
119 }
120 }
121
122-void LauncherIcon::RecvMouseClick (int button)
123+void LauncherIcon::RecvMouseClick (int button, bool shift_pressed)
124 {
125- if (button == 1)
126+ if (button == 1 && !shift_pressed){
127 Activate ();
128- else if (button == 2)
129- OpenInstance ();
130+ }
131+ else if (button == 1 && shift_pressed){
132+ OpenInstance ();
133+ }
134+ else if (button == 2){
135+ OpenInstance ();
136+ }
137 }
138
139 void LauncherIcon::HideTooltip ()
140
141=== modified file 'plugins/unityshell/src/LauncherIcon.h'
142--- plugins/unityshell/src/LauncherIcon.h 2011-06-04 15:15:56 +0000
143+++ plugins/unityshell/src/LauncherIcon.h 2011-06-30 22:35:53 +0000
144@@ -95,7 +95,7 @@
145 void RecvMouseLeave ();
146 void RecvMouseDown (int button);
147 void RecvMouseUp (int button);
148- void RecvMouseClick (int button);
149+ void RecvMouseClick (int button, bool shift_pressed = false);
150
151 void HideTooltip ();
152 gboolean OpenQuicklist (bool default_to_first_item = false);
153@@ -155,7 +155,7 @@
154 sigc::signal<void, int> MouseUp;
155 sigc::signal<void> MouseEnter;
156 sigc::signal<void> MouseLeave;
157- sigc::signal<void, int> MouseClick;
158+ sigc::signal<void, int, bool> MouseClick;
159
160 sigc::signal<void, LauncherIcon *> show;
161 sigc::signal<void, LauncherIcon *> hide;
162
163=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.cpp'
164--- plugins/unityshell/src/SimpleLauncherIcon.cpp 2011-04-20 09:40:45 +0000
165+++ plugins/unityshell/src/SimpleLauncherIcon.cpp 2011-06-30 22:35:53 +0000
166@@ -67,7 +67,7 @@
167 }
168
169 void
170-SimpleLauncherIcon::OnMouseClick (int button)
171+SimpleLauncherIcon::OnMouseClick (int button, bool shift_pressed)
172 {
173 }
174
175
176=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.h'
177--- plugins/unityshell/src/SimpleLauncherIcon.h 2011-03-29 17:32:19 +0000
178+++ plugins/unityshell/src/SimpleLauncherIcon.h 2011-06-30 22:35:53 +0000
179@@ -40,7 +40,7 @@
180 protected:
181 virtual void OnMouseDown (int button);
182 virtual void OnMouseUp (int button);
183- virtual void OnMouseClick (int button);
184+ virtual void OnMouseClick (int button, bool shift_pressed = false);
185 virtual void OnMouseEnter ();
186 virtual void OnMouseLeave ();
187