on xenial help sign in
add left/right and backtab
commit535d849cc213c6dbb767c1b042470e960d95918d authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 16 Mar 2015, 17:09 (12 years ago) parent6c53347
3 files changed+31−1
qml/Components/PhysicalKeysMapper.qml+21−1 qml/Shell.qml+1 qml/Stages/DesktopStage.qml+9
qml/Components/PhysicalKeysMapper.qml+21−1
@@ -42,6 +42,7 @@ Item {
4242 signal screenshotTriggered;
4343
4444 signal altTabNext();
45+ signal altTabPrevious();
4546 readonly property bool altTabPressed: d.altTabPressed
4647
4748 QtObject {
@@ -103,12 +104,28 @@ Item {
103104 print("controll pressed");
104105 d.altPressed = true;
105106 } else if (event.key == Qt.Key_Tab) {
107+ print("tab pressed")
106108 if (d.altPressed && !d.altTabPressed) {
107109 d.altTabPressed = true;
108110 } else if (d.altTabPressed) {
109111 print("alttabnext")
110112 root.altTabNext();
111113 }
114+ } else if (event.key == Qt.Key_Backtab) {
115+ if (d.altTabPressed) {
116+ root.altTabPrevious();
117+ }
118+ } else if (event.key == Qt.Key_Left) {
119+ if (d.altTabPressed) {
120+ print("alttabprevious")
121+ root.altTabPrevious();
122+ event.accpeted = true;
123+ }
124+ } else if (event.key == Qt.Key_Right) {
125+ if (d.altTabPressed) {
126+ root.altTabNext();
127+ event.accepted = true;
128+ }
112129 }
113130 }
114131
@@ -125,8 +142,11 @@ Item {
125142 d.volumeUpKeyPressed = false;
126143 if (!d.volumeDownKeyPressed) d.ignoreVolumeEvents = false;
127144 } else if (event.key == Qt.Key_Control) {
128− d.altTabPressed = false;
129145 d.altPressed = false;
146+ if (d.altTabPressed) {
147+ d.altTabPressed = false;
148+ event.accepted = true;
149+ }
130150 }
131151 }
132152}
qml/Shell.qml+1
@@ -158,6 +158,7 @@ Item {
158158 onScreenshotTriggered: screenGrabber.capture();
159159
160160 onAltTabNext: applicationsDisplayLoader.item.altTabNext()
161+ onAltTabPrevious: applicationsDisplayLoader.item.altTabPrevious();
161162 }
162163
163164 ScreenGrabber {
qml/Stages/DesktopStage.qml+9
@@ -48,6 +48,15 @@ Item {
4848 }
4949 }
5050
51+ function altTabPrevious() {
52+ print("alttabprevious pressed")
53+ if (root.altTabPressed) {
54+ var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
55+ appRepeater.highlightedIndex = newIndex;
56+ spreadFlickable.snapTo(spreadFlickable.width / 5 * Math.max(0, appRepeater.highlightedIndex - 3))
57+ }
58+ }
59+
5160 CrossFadeImage {
5261 id: wallpaper
5362 anchors.fill: parent