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
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2011-06-30 15:21:07 +0000
+++ plugins/unityshell/src/Launcher.cpp 2011-06-30 22:35:53 +0000
@@ -261,7 +261,12 @@
261 _parent = parent;261 _parent = parent;
262 _screen = screen;262 _screen = screen;
263 _active_quicklist = 0;263 _active_quicklist = 0;
264<<<<<<< TREE
264265
266=======
267 _shift_pressed = false;
268
269>>>>>>> MERGE-SOURCE
265 _hide_machine = new LauncherHideMachine ();270 _hide_machine = new LauncherHideMachine ();
266 _set_hidden_connection = (sigc::connection) _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden));271 _set_hidden_connection = (sigc::connection) _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden));
267 _hover_machine = new LauncherHoverMachine ();272 _hover_machine = new LauncherHoverMachine ();
@@ -279,6 +284,7 @@
279 OnMouseMove.connect (sigc::mem_fun (this, &Launcher::RecvMouseMove));284 OnMouseMove.connect (sigc::mem_fun (this, &Launcher::RecvMouseMove));
280 OnMouseWheel.connect (sigc::mem_fun (this, &Launcher::RecvMouseWheel));285 OnMouseWheel.connect (sigc::mem_fun (this, &Launcher::RecvMouseWheel));
281 OnKeyPressed.connect (sigc::mem_fun (this, &Launcher::RecvKeyPressed));286 OnKeyPressed.connect (sigc::mem_fun (this, &Launcher::RecvKeyPressed));
287 OnKeyReleased.connect (sigc::mem_fun (this, &Launcher::RecvKeyReleased));
282 OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &Launcher::RecvMouseDownOutsideArea));288 OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &Launcher::RecvMouseDownOutsideArea));
283 //OnEndFocus.connect (sigc::mem_fun (this, &Launcher::exitKeyNavMode));289 //OnEndFocus.connect (sigc::mem_fun (this, &Launcher::exitKeyNavMode));
284290
@@ -3039,6 +3045,7 @@
30393045
3040void Launcher::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)3046void Launcher::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
3041{3047{
3048 UnGrabKeyboard ();
3042 _last_button_press = nux::GetEventButton (button_flags);3049 _last_button_press = nux::GetEventButton (button_flags);
3043 SetMousePosition (x, y);3050 SetMousePosition (x, y);
30443051
@@ -3131,7 +3138,12 @@
3131{3138{
3132 SetMousePosition (x, y);3139 SetMousePosition (x, y);
3133 SetStateMouseOverLauncher (true);3140 SetStateMouseOverLauncher (true);
3141<<<<<<< TREE
31343142
3143=======
3144 GrabKeyboard ();
3145
3146>>>>>>> MERGE-SOURCE
3135 // make sure we actually get a chance to get events before turning this off3147 // make sure we actually get a chance to get events before turning this off
3136 if (x > 0)3148 if (x > 0)
3137 _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE, false);3149 _hide_machine->SetQuirk (LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE, false);
@@ -3145,6 +3157,7 @@
3145 SetMousePosition (x, y);3157 SetMousePosition (x, y);
3146 SetStateMouseOverLauncher (false);3158 SetStateMouseOverLauncher (false);
3147 LauncherIcon::SetSkipTooltipDelay (false);3159 LauncherIcon::SetSkipTooltipDelay (false);
3160 UnGrabKeyboard ();
31483161
3149 EventLogic ();3162 EventLogic ();
3150 EnsureAnimation ();3163 EnsureAnimation ();
@@ -3266,6 +3279,12 @@
3266{3279{
32673280
3268 LauncherModel::iterator it;3281 LauncherModel::iterator it;
3282
3283 if(key_sym == NUX_VK_SHIFT){
3284 _shift_pressed = true;
3285 } else {
3286 _shift_pressed = false;
3287 }
32693288
3270 /*3289 /*
3271 * all key events below are related to keynavigation. Make an additional3290 * all key events below are related to keynavigation. Make an additional
@@ -3372,6 +3391,16 @@
3372 }3391 }
3373}3392}
33743393
3394void
3395Launcher::RecvKeyReleased (unsigned int key_sym,
3396 unsigned long key_code,
3397 unsigned long key_state)
3398{
3399 if(key_sym == NUX_VK_SHIFT){
3400 _shift_pressed = false;
3401 }
3402}
3403
3375void Launcher::RecvQuicklistOpened (QuicklistView *quicklist)3404void Launcher::RecvQuicklistOpened (QuicklistView *quicklist)
3376{3405{
3377 _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true);3406 _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true);
@@ -3454,7 +3483,8 @@
3454 _icon_mouse_down->MouseUp.emit (nux::GetEventButton (button_flags));3483 _icon_mouse_down->MouseUp.emit (nux::GetEventButton (button_flags));
34553484
3456 if (GetActionState () == ACTION_NONE) {3485 if (GetActionState () == ACTION_NONE) {
3457 _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags));3486 _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags), _shift_pressed);
3487 _shift_pressed = false;
3458 }3488 }
3459 }3489 }
34603490
34613491
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2011-06-28 11:49:06 +0000
+++ plugins/unityshell/src/Launcher.h 2011-06-30 22:35:53 +0000
@@ -152,6 +152,7 @@
152 virtual void RecvMouseDownOutsideArea (int x, int y, unsigned long button_flags, unsigned long key_flags);152 virtual void RecvMouseDownOutsideArea (int x, int y, unsigned long button_flags, unsigned long key_flags);
153153
154 virtual void RecvKeyPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state);154 virtual void RecvKeyPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
155 virtual void RecvKeyReleased (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
155156
156 virtual void RecvQuicklistOpened (QuicklistView *quicklist);157 virtual void RecvQuicklistOpened (QuicklistView *quicklist);
157 virtual void RecvQuicklistClosed (QuicklistView *quicklist);158 virtual void RecvQuicklistClosed (QuicklistView *quicklist);
@@ -418,6 +419,7 @@
418 bool _shortcuts_shown; 419 bool _shortcuts_shown;
419 bool _super_pressed;420 bool _super_pressed;
420 bool _keynav_activated;421 bool _keynav_activated;
422 bool _shift_pressed;
421 guint64 _latest_shortcut;423 guint64 _latest_shortcut;
422 424
423 BacklightMode _backlight_mode;425 BacklightMode _backlight_mode;
424426
=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
--- plugins/unityshell/src/LauncherIcon.cpp 2011-06-21 12:10:09 +0000
+++ plugins/unityshell/src/LauncherIcon.cpp 2011-06-30 22:35:53 +0000
@@ -606,12 +606,17 @@
606 }606 }
607}607}
608608
609void LauncherIcon::RecvMouseClick (int button)609void LauncherIcon::RecvMouseClick (int button, bool shift_pressed)
610{610{
611 if (button == 1)611 if (button == 1 && !shift_pressed){
612 Activate ();612 Activate ();
613 else if (button == 2)613 }
614 OpenInstance ();614 else if (button == 1 && shift_pressed){
615 OpenInstance ();
616 }
617 else if (button == 2){
618 OpenInstance ();
619 }
615}620}
616621
617void LauncherIcon::HideTooltip ()622void LauncherIcon::HideTooltip ()
618623
=== modified file 'plugins/unityshell/src/LauncherIcon.h'
--- plugins/unityshell/src/LauncherIcon.h 2011-06-04 15:15:56 +0000
+++ plugins/unityshell/src/LauncherIcon.h 2011-06-30 22:35:53 +0000
@@ -95,7 +95,7 @@
95 void RecvMouseLeave ();95 void RecvMouseLeave ();
96 void RecvMouseDown (int button);96 void RecvMouseDown (int button);
97 void RecvMouseUp (int button);97 void RecvMouseUp (int button);
98 void RecvMouseClick (int button);98 void RecvMouseClick (int button, bool shift_pressed = false);
99 99
100 void HideTooltip ();100 void HideTooltip ();
101 gboolean OpenQuicklist (bool default_to_first_item = false);101 gboolean OpenQuicklist (bool default_to_first_item = false);
@@ -155,7 +155,7 @@
155 sigc::signal<void, int> MouseUp;155 sigc::signal<void, int> MouseUp;
156 sigc::signal<void> MouseEnter;156 sigc::signal<void> MouseEnter;
157 sigc::signal<void> MouseLeave;157 sigc::signal<void> MouseLeave;
158 sigc::signal<void, int> MouseClick;158 sigc::signal<void, int, bool> MouseClick;
159 159
160 sigc::signal<void, LauncherIcon *> show;160 sigc::signal<void, LauncherIcon *> show;
161 sigc::signal<void, LauncherIcon *> hide;161 sigc::signal<void, LauncherIcon *> hide;
162162
=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.cpp'
--- plugins/unityshell/src/SimpleLauncherIcon.cpp 2011-04-20 09:40:45 +0000
+++ plugins/unityshell/src/SimpleLauncherIcon.cpp 2011-06-30 22:35:53 +0000
@@ -67,7 +67,7 @@
67}67}
6868
69void69void
70SimpleLauncherIcon::OnMouseClick (int button)70SimpleLauncherIcon::OnMouseClick (int button, bool shift_pressed)
71{71{
72}72}
7373
7474
=== modified file 'plugins/unityshell/src/SimpleLauncherIcon.h'
--- plugins/unityshell/src/SimpleLauncherIcon.h 2011-03-29 17:32:19 +0000
+++ plugins/unityshell/src/SimpleLauncherIcon.h 2011-06-30 22:35:53 +0000
@@ -40,7 +40,7 @@
40protected:40protected:
41 virtual void OnMouseDown (int button);41 virtual void OnMouseDown (int button);
42 virtual void OnMouseUp (int button);42 virtual void OnMouseUp (int button);
43 virtual void OnMouseClick (int button);43 virtual void OnMouseClick (int button, bool shift_pressed = false);
44 virtual void OnMouseEnter ();44 virtual void OnMouseEnter ();
45 virtual void OnMouseLeave ();45 virtual void OnMouseLeave ();
4646