~saviq/+junk/shell-refactor-screeninfo

« back to all changes in this revision

Viewing changes to spread/Windows.qml

merge conflicts resolved

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    id: windows
39
39
 
40
40
    signal clicked
 
41
    signal entered
41
42
    signal windowActivated(variant window)
42
43
 
 
44
    keyNavigationWraps: state == "zoomed"
 
45
 
43
46
    MouseArea {
44
47
        anchors.fill: parent
45
48
        onClicked: windows.clicked()
46
49
        /* Eating all mouse events so that they are not passed beneath the workspace */
47
50
        hoverEnabled: true
 
51
        onEntered: windows.entered()
48
52
    }
49
53
 
50
54
    /* This proxy model takes care of removing all windows that are not on
76
80
    cellWidth: Math.floor(width / columns)
77
81
    cellHeight: height / rows
78
82
 
79
 
    model: filteredByApplication
 
83
    /* Set the model only when the component is ready; otherwise, the
 
84
     * initialization gets somehow messed up and the "columns" and "rows"
 
85
     * variables are set to those of the first workspace. */
 
86
    Component.onCompleted: {
 
87
        model = filteredByApplication
 
88
    }
80
89
 
81
90
    delegate:
82
91
        Item {
90
99
                itemHeight: window.size.height
91
100
                parent: windows
92
101
            }
 
102
            /* We are not using GridView.isCurrentItem because it mysteriously
 
103
             * returns "false" the first time the spread is activated. Couldn't
 
104
             * reproduce the same behaviour with simpler test cases.
 
105
             */
 
106
            focus: GridView.view.currentIndex == index
93
107
 
94
108
            /* Workaround http://bugreports.qt.nokia.com/browse/QTBUG-15642 where onAdd is not called for the first item */
95
109
            //GridView.onAdd:
103
117
                switch (event.key) {
104
118
                    case Qt.Key_Enter:
105
119
                    case Qt.Key_Return:
 
120
                    {
106
121
                        windows.windowActivated(spreadWindow)
107
122
                        event.accepted = true
 
123
                    }
108
124
                }
109
125
            }
110
126
 
118
134
 
119
135
                onEntered: {
120
136
                    windows.currentIndex = index
121
 
                    cell.forceActiveFocus()
 
137
                    /* Make sure the workspace is notified as well */
 
138
                    windows.entered()
122
139
                }
123
140
 
124
141
                onClicked: windows.windowActivated(spreadWindow)
138
155
                Behavior on height { enabled: spreadWindow.animateFollow; NumberAnimation { duration: Utils.transitionDuration; easing.type: Easing.InOutQuad } }
139
156
 
140
157
                windowInfo: window
141
 
                state: windows.state
 
158
                state: windows.state == "screen" ? "screen" : "spread"
142
159
                states: [
143
160
                    State {
144
161
                        name: "screen"