on xenial help sign in
don't allow autorepeat to wrap around the spread
89ee18dMichael Zanetti
qml/Components/PhysicalKeysMapper.qml+6−6
@@ -41,8 +41,8 @@ Item {
41 signal volumeUpTriggered;
41 signal volumeUpTriggered;
42 signal screenshotTriggered;
42 signal screenshotTriggered;
43
43
44− signal altTabNext();
44+ signal altTabNext(bool isAutoRepeat);
45− signal altTabPrevious();
45+ signal altTabPrevious(bool isAutoRepeat);
46 readonly property bool altTabPressed: d.altTabPressed
46 readonly property bool altTabPressed: d.altTabPressed
47
47
48 property int powerKeyLongPressTime: 2000
48 property int powerKeyLongPressTime: 2000
@@ -109,21 +109,21 @@ Item {
109 d.altTabPressed = true;
109 d.altTabPressed = true;
110 } else if (d.altTabPressed) {
110 } else if (d.altTabPressed) {
111 print("alttabnext")
111 print("alttabnext")
112− root.altTabNext();
112+ root.altTabNext(event.isAutoRepeat);
113 }
113 }
114 } else if (event.key == Qt.Key_Backtab) {
114 } else if (event.key == Qt.Key_Backtab) {
115 if (d.altTabPressed) {
115 if (d.altTabPressed) {
116− root.altTabPrevious();
116+ root.altTabPrevious(event.isAutoRepeat);
117 }
117 }
118 } else if (event.key == Qt.Key_Left) {
118 } else if (event.key == Qt.Key_Left) {
119 if (d.altTabPressed) {
119 if (d.altTabPressed) {
120 print("alttabprevious")
120 print("alttabprevious")
121− root.altTabPrevious();
121+ root.altTabPrevious(event.isAutoRepeat);
122 event.accpeted = true;
122 event.accpeted = true;
123 }
123 }
124 } else if (event.key == Qt.Key_Right) {
124 } else if (event.key == Qt.Key_Right) {
125 if (d.altTabPressed) {
125 if (d.altTabPressed) {
126− root.altTabNext();
126+ root.altTabNext(event.isAutoRepeat);
127 event.accepted = true;
127 event.accepted = true;
128 }
128 }
129 }
129 }
qml/Shell.qml+2−2
@@ -159,8 +159,8 @@ Item {
159 onVolumeDownTriggered: volumeControl.volumeDown();
159 onVolumeDownTriggered: volumeControl.volumeDown();
160 onVolumeUpTriggered: volumeControl.volumeUp();
160 onVolumeUpTriggered: volumeControl.volumeUp();
161 onScreenshotTriggered: screenGrabber.capture();
161 onScreenshotTriggered: screenGrabber.capture();
162− onAltTabNext: applicationsDisplayLoader.item.altTabNext()
162+ onAltTabNext: applicationsDisplayLoader.item.altTabNext(isAutoRepeat)
163− onAltTabPrevious: applicationsDisplayLoader.item.altTabPrevious();
163+ onAltTabPrevious: applicationsDisplayLoader.item.altTabPrevious(isAutoRepeat);
164 }
164 }
165
165
166 ScreenGrabber {
166 ScreenGrabber {
qml/Stages/DesktopStage.qml+10−2
@@ -44,9 +44,13 @@ Rectangle {
44 }
44 }
45 }
45 }
46
46
47− function altTabNext() {
47+ function altTabNext(isAutoRepeat) {
48 if (root.altTabPressed) {
48 if (root.altTabPressed) {
49 print("should tab next")
49 print("should tab next")
50+ if (isAutoRepeat && appRepeater.highlightedIndex >= ApplicationManager.count -1) {
51+ return; // AutoRepeat is not allowed to wrap around
52+ }
53+
50 appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count;
54 appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count;
51 var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 3));
55 var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 3));
52 if (spreadFlickable.contentX < newContentX || appRepeater.highlightedIndex == 0) {
56 if (spreadFlickable.contentX < newContentX || appRepeater.highlightedIndex == 0) {
@@ -55,9 +59,13 @@ Rectangle {
55 }
59 }
56 }
60 }
57
61
58− function altTabPrevious() {
62+ function altTabPrevious(isAutoRepeat) {
59 print("alttabprevious pressed")
63 print("alttabprevious pressed")
60 if (root.altTabPressed) {
64 if (root.altTabPressed) {
65+ if (isAutoRepeat && appRepeater.highlightedIndex == 0) {
66+ return; // AutoRepeat is not allowed to wrap around
67+ }
68+
61 var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
69 var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
62 appRepeater.highlightedIndex = newIndex;
70 appRepeater.highlightedIndex = newIndex;
63 var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 1));
71 var newContentX = ((spreadFlickable.contentWidth) / (ApplicationManager.count + 1)) * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 1));