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

Proposed by Manuel Nicetto
Status: Superseded
Proposed branch: lp:~manuel-nicetto/unity/bug-754565
Merge into: lp:unity
Diff against target: 149 lines (+39/-4)
4 files modified
plugins/unityshell/src/Launcher.cpp (+24/-1)
plugins/unityshell/src/Launcher.h (+2/-0)
plugins/unityshell/src/LauncherIcon.cpp (+11/-3)
plugins/unityshell/src/LauncherIcon.h (+2/-0)
To merge this branch: bzr merge lp:~manuel-nicetto/unity/bug-754565
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+65836@code.launchpad.net

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

This proposal has been superseded by a proposal from 2011-06-27.

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

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 :

+ 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;

lp:~manuel-nicetto/unity/bug-754565 updated
1243. By Manuel Nicetto

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

1244. By Manuel Nicetto

-- fixed another identation error

1245. By Manuel Nicetto

Pass shift_pressed on click behavior as suggested by Jason

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-27 10:59:56 +0000
3+++ plugins/unityshell/src/Launcher.cpp 2011-06-27 21:19:34 +0000
4@@ -258,6 +258,7 @@
5 _parent = parent;
6 _screen = screen;
7 _active_quicklist = 0;
8+ _shift_pressed = false;
9
10 _hide_machine = new LauncherHideMachine ();
11 _set_hidden_connection = (sigc::connection) _hide_machine->should_hide_changed.connect (sigc::mem_fun (this, &Launcher::SetHidden));
12@@ -276,6 +277,7 @@
13 OnMouseMove.connect (sigc::mem_fun (this, &Launcher::RecvMouseMove));
14 OnMouseWheel.connect (sigc::mem_fun (this, &Launcher::RecvMouseWheel));
15 OnKeyPressed.connect (sigc::mem_fun (this, &Launcher::RecvKeyPressed));
16+ OnKeyReleased.connect (sigc::mem_fun (this, &Launcher::RecvKeyReleased));
17 OnMouseDownOutsideArea.connect (sigc::mem_fun (this, &Launcher::RecvMouseDownOutsideArea));
18 //OnEndFocus.connect (sigc::mem_fun (this, &Launcher::exitKeyNavMode));
19
20@@ -3050,6 +3052,7 @@
21
22 void Launcher::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
23 {
24+ UnGrabKeyboard ();
25 _last_button_press = nux::GetEventButton (button_flags);
26 SetMousePosition (x, y);
27
28@@ -3142,6 +3145,7 @@
29 {
30 SetMousePosition (x, y);
31 SetStateMouseOverLauncher (true);
32+ GrabKeyboard ();
33
34 // make sure we actually get a chance to get events before turning this off
35 if (x > 0)
36@@ -3156,6 +3160,7 @@
37 SetMousePosition (x, y);
38 SetStateMouseOverLauncher (false);
39 LauncherIcon::SetSkipTooltipDelay (false);
40+ UnGrabKeyboard ();
41
42 EventLogic ();
43 EnsureAnimation ();
44@@ -3277,6 +3282,12 @@
45 {
46
47 LauncherModel::iterator it;
48+
49+ if(key_sym == NUX_VK_SHIFT){
50+ _shift_pressed = true;
51+ } else {
52+ _shift_pressed = false;
53+ }
54
55 /*
56 * all key events below are related to keynavigation. Make an additional
57@@ -3383,6 +3394,16 @@
58 }
59 }
60
61+void
62+Launcher::RecvKeyReleased (unsigned int key_sym,
63+ unsigned long key_code,
64+ unsigned long key_state)
65+{
66+ if(key_sym == NUX_VK_SHIFT){
67+ _shift_pressed = false;
68+ }
69+}
70+
71 void Launcher::RecvQuicklistOpened (QuicklistView *quicklist)
72 {
73 _hide_machine->SetQuirk (LauncherHideMachine::QUICKLIST_OPEN, true);
74@@ -3465,7 +3486,9 @@
75 _icon_mouse_down->MouseUp.emit (nux::GetEventButton (button_flags));
76
77 if (GetActionState () == ACTION_NONE) {
78- _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags));
79+ _icon_mouse_down->_shift_pressed = _shift_pressed;
80+ _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags));
81+ _shift_pressed = false;
82 }
83 }
84
85
86=== modified file 'plugins/unityshell/src/Launcher.h'
87--- plugins/unityshell/src/Launcher.h 2011-06-09 07:23:27 +0000
88+++ plugins/unityshell/src/Launcher.h 2011-06-27 21:19:34 +0000
89@@ -156,6 +156,7 @@
90 virtual void RecvMouseDownOutsideArea (int x, int y, unsigned long button_flags, unsigned long key_flags);
91
92 virtual void RecvKeyPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
93+ virtual void RecvKeyReleased (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
94
95 virtual void RecvQuicklistOpened (QuicklistView *quicklist);
96 virtual void RecvQuicklistClosed (QuicklistView *quicklist);
97@@ -424,6 +425,7 @@
98 bool _shortcuts_shown;
99 bool _super_pressed;
100 bool _keynav_activated;
101+ bool _shift_pressed;
102 guint64 _latest_shortcut;
103
104 BacklightMode _backlight_mode;
105
106=== modified file 'plugins/unityshell/src/LauncherIcon.cpp'
107--- plugins/unityshell/src/LauncherIcon.cpp 2011-06-21 12:10:09 +0000
108+++ plugins/unityshell/src/LauncherIcon.cpp 2011-06-27 21:19:34 +0000
109@@ -60,6 +60,7 @@
110 LauncherIcon::LauncherIcon(Launcher* launcher)
111 {
112 _folding_angle = 0;
113+ _shift_pressed = false;
114 _launcher = launcher;
115 m_TooltipText = "blank";
116
117@@ -608,10 +609,17 @@
118
119 void LauncherIcon::RecvMouseClick (int button)
120 {
121- if (button == 1)
122+ if (button == 1 && !_shift_pressed){
123 Activate ();
124- else if (button == 2)
125- OpenInstance ();
126+ }
127+ else if (button == 1 && _shift_pressed){
128+ OpenInstance ();
129+ }
130+ else if (button == 2){
131+ OpenInstance ();
132+ }
133+
134+ _shift_pressed = false;
135 }
136
137 void LauncherIcon::HideTooltip ()
138
139=== modified file 'plugins/unityshell/src/LauncherIcon.h'
140--- plugins/unityshell/src/LauncherIcon.h 2011-05-27 18:57:49 +0000
141+++ plugins/unityshell/src/LauncherIcon.h 2011-06-27 21:19:34 +0000
142@@ -234,6 +234,8 @@
143 bool _mouse_inside;
144 float _folding_angle;
145
146+ bool _shift_pressed;
147+
148 nux::Tooltip *_tooltip;
149 QuicklistView *_quicklist;
150