on xenial help sign in
don't allow autorepeat to wrap around the spread
commit89ee18d839a22414b59bd3a0354dde5bf877c92d authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 22 May 2015, 14:15 (11 years ago) parent9636bc0
3 files changed+18−10
qml/Components/PhysicalKeysMapper.qml+6−6 qml/Shell.qml+2−2 qml/Stages/DesktopStage.qml+10−2
qml/Components/PhysicalKeysMapper.qml+6−6
@@ -41,8 +41,8 @@ Item {
4141 signal volumeUpTriggered;
4242 signal screenshotTriggered;
4343
44− signal altTabNext();
45− signal altTabPrevious();
44+ signal altTabNext(bool isAutoRepeat);
45+ signal altTabPrevious(bool isAutoRepeat);
4646 readonly property bool altTabPressed: d.altTabPressed
4747
4848 property int powerKeyLongPressTime: 2000
@@ -109,21 +109,21 @@ Item {
109109 d.altTabPressed = true;
110110 } else if (d.altTabPressed) {
111111 print("alttabnext")
112− root.altTabNext();
112+ root.altTabNext(event.isAutoRepeat);
113113 }
114114 } else if (event.key == Qt.Key_Backtab) {
115115 if (d.altTabPressed) {
116− root.altTabPrevious();
116+ root.altTabPrevious(event.isAutoRepeat);
117117 }
118118 } else if (event.key == Qt.Key_Left) {
119119 if (d.altTabPressed) {
120120 print("alttabprevious")
121− root.altTabPrevious();
121+ root.altTabPrevious(event.isAutoRepeat);
122122 event.accpeted = true;
123123 }
124124 } else if (event.key == Qt.Key_Right) {
125125 if (d.altTabPressed) {
126− root.altTabNext();
126+ root.altTabNext(event.isAutoRepeat);
127127 event.accepted = true;
128128 }
129129 }
qml/Shell.qml+2−2
@@ -159,8 +159,8 @@ Item {
159159 onVolumeDownTriggered: volumeControl.volumeDown();
160160 onVolumeUpTriggered: volumeControl.volumeUp();
161161 onScreenshotTriggered: screenGrabber.capture();
162− onAltTabNext: applicationsDisplayLoader.item.altTabNext()
163− onAltTabPrevious: applicationsDisplayLoader.item.altTabPrevious();
162+ onAltTabNext: applicationsDisplayLoader.item.altTabNext(isAutoRepeat)
163+ onAltTabPrevious: applicationsDisplayLoader.item.altTabPrevious(isAutoRepeat);
164164 }
165165
166166 ScreenGrabber {
qml/Stages/DesktopStage.qml+10−2
@@ -44,9 +44,13 @@ Rectangle {
4444 }
4545 }
4646
47− function altTabNext() {
47+ function altTabNext(isAutoRepeat) {
4848 if (root.altTabPressed) {
4949 print("should tab next")
50+ if (isAutoRepeat && appRepeater.highlightedIndex >= ApplicationManager.count -1) {
51+ return; // AutoRepeat is not allowed to wrap around
52+ }
53+
5054 appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count;
5155 var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 3));
5256 if (spreadFlickable.contentX < newContentX || appRepeater.highlightedIndex == 0) {
@@ -55,9 +59,13 @@ Rectangle {
5559 }
5660 }
5761
58− function altTabPrevious() {
62+ function altTabPrevious(isAutoRepeat) {
5963 print("alttabprevious pressed")
6064 if (root.altTabPressed) {
65+ if (isAutoRepeat && appRepeater.highlightedIndex == 0) {
66+ return; // AutoRepeat is not allowed to wrap around
67+ }
68+
6169 var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
6270 appRepeater.highlightedIndex = newIndex;
6371 var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 1));