@@ -145,19 +145,23 @@ Rectangle {
145 // destroyed when dragging them outside the list. This needs to be at least
145 // destroyed when dragging them outside the list. This needs to be at least
146 // itemHeight to prevent folded items from disappearing and DragArea limits
146 // itemHeight to prevent folded items from disappearing and DragArea limits
147 // need to be smaller than this size to avoid breakage.
147 // need to be smaller than this size to avoid breakage.
148− property int extensionSize: 0
148+ property int extensionSize: itemHeight * 3
150− // Setting extensionSize after the list has been populated because it has
150+ // Workaround: The snap settings in the launcher, will always try to
151− // the potential to mess up with the intial positioning in combination
151+ // snap to what we told it to do. However, we want the initial position
152− // with snapping to the center of the list. This catches all the cases
152+ // of the launcher to not be centered, but instead start with the topmost
153− // where the item would be outside the list for more than itemHeight / 2.
153+ // item unfolded completely. Lets wait for the ListView to settle after
154− // For the rest, give it a flick to scroll to the beginning. Note that
154+ // creation and then reposition it to 0.
155− // the flicking alone isn't enough because in some cases it's not strong
156− // enough to overcome the snapping.
157 // https://bugreports.qt-project.org/browse/QTBUG-32251
155 // https://bugreports.qt-project.org/browse/QTBUG-32251
158 Component.onCompleted: {
156 Component.onCompleted: {
159− extensionSize = itemHeight * 3
157+ initTimer.start();
160− flick(0, clickFlickSpeed)
158+ }
163+ launcherListView.moveToIndex(0)
163 // The height of the area where icons start getting folded
167 // The height of the area where icons start getting folded
@@ -415,7 +419,18 @@ Rectangle {
415 property int startX
419 property int startX
416 property int startY
420 property int startY
422+ // This is workaround for some issue in the QML ListView:
423+ // When calling moveToItem(0), the listview visually positions itself
424+ // correctly to display the first item expanded. However, some internal
425+ // state seems to not be valid, and the next time the user clicks on it,
426+ // it snaps back to the snap boundries before executing the onClicked handler.
427+ // This can cause the listview getting stuck in a snapped position where you can't
428+ // launch things without first dragging the launcher manually. So lets read the item
429+ // angle before that happens and use that angle instead of the one we get in onClicked.
430+ property real pressedStartAngle: 0
418 onPressed: {
431 onPressed: {
432+ var clickedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
433+ pressedStartAngle = clickedItem.angle;
419 processPress(mouse);
434 processPress(mouse);
@@ -442,9 +457,8 @@ Rectangle {
443 // First/last item do the scrolling at more than 12 degrees
458 // First/last item do the scrolling at more than 12 degrees
444 if (index == 0 || index == launcherListView.count - 1) {
459 if (index == 0 || index == launcherListView.count - 1) {
445− if (clickedItem.angle > 12 || clickedItem.angle < -12) {
446− launcherListView.moveToIndex(index);
460+ launcherListView.moveToIndex(index);
447− } else {
461+ if (pressedStartAngle < 12 && pressedStartAngle > -12) {
448 root.applicationSelected(LauncherModel.get(index).appId);
462 root.applicationSelected(LauncherModel.get(index).appId);