Merge lp:~dyams/unity-2d/altf1-toggle-launcher-focus into lp:unity-2d

Proposed by Lohith D Shivamurthy
Status: Merged
Approved by: Gerry Boland
Approved revision: 788
Merged at revision: 795
Proposed branch: lp:~dyams/unity-2d/altf1-toggle-launcher-focus
Merge into: lp:unity-2d
Diff against target: 83 lines (+18/-11)
3 files modified
launcher/Launcher.qml (+6/-2)
launcher/app/launcherview.cpp (+11/-6)
launcher/app/launcherview.h (+1/-3)
To merge this branch: bzr merge lp:~dyams/unity-2d/altf1-toggle-launcher-focus
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+82184@code.launchpad.net

Commit message

[launcher] Force the launcher to reposition to the beginning when Alt-F1 is hit

Description of the change

[launcher] Force the launcher to reposition to the beginning when Alt-F1 is hit

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

Bug:
1. Have Launcher scrollable, i.e. has more icons than it can display at one time
2. With mouse, reveal launcher and scroll down to the bottom
3. Press Alt+F1

Expected Result:
Launcher repositions listview to top, highlights BFB button

Actual Result:
Launcher does not reposition, but BFB still highlighted.

Revision history for this message
Gerry Boland (gerboland) wrote :

Please separate the Super-key fix from this MR and submit separately.

review: Needs Fixing
Revision history for this message
Gerry Boland (gerboland) wrote :

I see no need to add /* lp:885304 */ as a note in the source code. The function name makes it obvious what it's doing

Some style corrections: instead of

  if (!main.activeFocus)
      main.focus = true

please use either

  if (!main.activeFocus) main.focus = true

or

  if (!main.activeFocus) {
      main.focus = true
  }

Also please consult the CODING document for the use of braces with if/else blocks in C++, this is wrong:

  }
  else {

Would you have any comment on why Alt+F1 isn't working while you are in the Spread?

review: Needs Fixing
Revision history for this message
Gerry Boland (gerboland) wrote :

In the absence of automated testing, please add test-cases to https://wiki.ubuntu.com/Unity2DRegressionTest

Revision history for this message
Gerry Boland (gerboland) wrote :
Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

> I see no need to add /* lp:885304 */ as a note in the source code. The
> function name makes it obvious what it's doing
>
> Some style corrections: instead of
>
> if (!main.activeFocus)
> main.focus = true
>
> please use either
>
> if (!main.activeFocus) main.focus = true
>
> or
>
> if (!main.activeFocus) {
> main.focus = true
> }
>
>
> Also please consult the CODING document for the use of braces with if/else
> blocks in C++, this is wrong:
>
> }
> else {

Sorry.

I have updated the branch with above changes now.

>
>
> Would you have any comment on why Alt+F1 isn't working while you are in the
> Spread?

Yes, I have. Currently, when Spread is will eat all mouse and keyboard events while it is open.
IMO, We need a separate discussion for this.

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

> >
> > Would you have any comment on why Alt+F1 isn't working while you are in the
> > Spread?
>
> Yes, I have. Currently, when Spread is will eat all mouse and keyboard events
> while it is open.
> IMO, We need a separate discussion for this.

 Yes, I have.
 Currently, Spread will eat all mouse and keyboard events while it is open.
 IMO, We need a separate discussion for this.

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

> typo in URL above, make it: https://wiki.ubuntu.com/Unity2DRegressionTests

Yes, updated.

Revision history for this message
Gerry Boland (gerboland) wrote :

Ok, all looks good. Thank you!

review: Approve
Revision history for this message
Bob The Builder (bobthebuilder-deactivatedaccount) wrote :

Attempt to merge into lp:unity-2d failed due to conflicts:

text conflict in launcher/Launcher.qml
text conflict in launcher/app/launcherview.cpp

787. By Lohith D Shivamurthy

Resolved merge conflicts

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

> Attempt to merge into lp:unity-2d failed due to conflicts:
>
> text conflict in launcher/Launcher.qml
> text conflict in launcher/app/launcherview.cpp

Merge conflicts resolved

788. By Lohith D Shivamurthy

cleaned the code to remove few lines related to another bug

Revision history for this message
Gerry Boland (gerboland) wrote :

Looks good, merging.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/Launcher.qml'
--- launcher/Launcher.qml 2011-11-23 12:14:44 +0000
+++ launcher/Launcher.qml 2011-11-25 12:35:26 +0000
@@ -37,9 +37,13 @@
37 }37 }
38 }38 }
3939
40 function positionAtBeginning() {40 function focusBFB() {
41 if (!main.activeFocus) {
42 main.focus = true
43 }
44
45 main.currentIndex = 0
41 main.positionViewAtBeginning()46 main.positionViewAtBeginning()
42 hideMenu()
43 }47 }
4448
45 GnomeBackground {49 GnomeBackground {
4650
=== modified file 'launcher/app/launcherview.cpp'
--- launcher/app/launcherview.cpp 2011-11-23 12:14:44 +0000
+++ launcher/app/launcherview.cpp 2011-11-25 12:35:26 +0000
@@ -72,9 +72,9 @@
72 connect(&launcher2dConfiguration(), SIGNAL(superKeyEnableChanged(bool)), SLOT(updateSuperKeyMonitoring()));72 connect(&launcher2dConfiguration(), SIGNAL(superKeyEnableChanged(bool)), SLOT(updateSuperKeyMonitoring()));
73 updateSuperKeyMonitoring();73 updateSuperKeyMonitoring();
7474
75 /* Alt+F1 reveal the launcher and gives the keyboard focus to the Dash Button. */75 /* Alt+F1 toggle the keyboard focus between laucher and other(previous) application. */
76 Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier);76 Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier);
77 connect(altF1, SIGNAL(pressed()), SLOT(forceActivateWindow()));77 connect(altF1, SIGNAL(pressed()), SLOT(onAltF1Pressed()));
7878
79 /* Alt+F2 shows the dash with the commands lens activated. */79 /* Alt+F2 shows the dash with the commands lens activated. */
80 Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier);80 Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier);
@@ -263,7 +263,6 @@
263 }263 }
264264
265 dashInterface.asyncCall(DASH_DBUS_METHOD_ACTIVATE_HOME);265 dashInterface.asyncCall(DASH_DBUS_METHOD_ACTIVATE_HOME);
266 positionAtBeginning();
267 }266 }
268}267}
269268
@@ -283,9 +282,15 @@
283}282}
284283
285void284void
286LauncherView::positionAtBeginning()285LauncherView::onAltF1Pressed()
287{286{
288 QGraphicsObject* launcher = rootObject();287 QGraphicsObject* launcher = rootObject();
289 QMetaObject::invokeMethod(launcher, "positionAtBeginning", Qt::AutoConnection);288
289 if (hasFocus()) {
290 QMetaObject::invokeMethod(launcher, "hideMenu", Qt::AutoConnection);
291 forceDeactivateWindow();
292 } else {
293 forceActivateWindow();
294 QMetaObject::invokeMethod(launcher, "focusBFB", Qt::AutoConnection);
295 }
290}296}
291
292297
=== modified file 'launcher/app/launcherview.h'
--- launcher/app/launcherview.h 2011-11-23 12:14:44 +0000
+++ launcher/app/launcherview.h 2011-11-25 12:35:26 +0000
@@ -60,15 +60,13 @@
60 void toggleDash();60 void toggleDash();
61 void showCommandsLens();61 void showCommandsLens();
62 void onSuperSPressed();62 void onSuperSPressed();
63 void onAltF1Pressed();
6364
64protected:65protected:
65 void focusInEvent(QFocusEvent* event);66 void focusInEvent(QFocusEvent* event);
66 void focusOutEvent(QFocusEvent* event);67 void focusOutEvent(QFocusEvent* event);
6768
68private:69private:
69 void positionAtBeginning();
70
71private:
72 bool m_superKeyPressed;70 bool m_superKeyPressed;
73 bool m_superKeyHeld;71 bool m_superKeyHeld;
74 bool m_superPressIgnored;72 bool m_superPressIgnored;

Subscribers

People subscribed via source and target branches