~jbicha/unity-2d/fix-launcher-quicklist-naming-lp949636

« back to all changes in this revision

Viewing changes to shell/launcher/LauncherList.qml

  • Committer: Tarmac
  • Author(s): Albert Astals, LDS, Lohith D Shivamurthy, Ugo Riboni
  • Date: 2012-03-15 10:33:11 UTC
  • mfrom: (915.5.120 Shell-MultiMonitor)
  • Revision ID: tarmac-20120315103311-8ujg3ct3q7fmy5cj
[all] implement multimonitor support in the shell

* allow launcher-per-screen configuration
* HUD and Dash follow mouse cursor
* panel per-screen, also on non-top screens
* spread per-screen
* support the switch to a single launcher on primary monitor. Fixes: https://bugs.launchpad.net/bugs/780204, https://bugs.launchpad.net/bugs/844798, https://bugs.launchpad.net/bugs/844809, https://bugs.launchpad.net/bugs/947145, https://bugs.launchpad.net/bugs/954175. Approved by Michał Sawicz.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        }
94
94
 
95
95
        function updatePips() {
96
 
            if (item.belongsToDifferentWorkspace()) {
 
96
            var windowCount = item.windowsOnCurrentWorkspaceScreen(launcher2dConfiguration.onlyOneLauncher ? -1 : declarativeView.screen.screen);
 
97
            if (windowCount == 0 && item.windowCount != 0) {
97
98
                launcherItem.pips = 1
98
99
                launcherItem.pipSource = "launcher/artwork/launcher_arrow_outline_ltr.png";
99
100
            } else {
100
 
                launcherItem.pips = Math.min(item.windowCount, 3)
 
101
                launcherItem.pips = Math.min(windowCount, 3)
101
102
                launcherItem.pipSource = ("launcher/artwork/launcher_" + ((pips <= 1) ? "arrow" : "pip") + "_ltr.png")
102
103
            }
103
104
        }
113
114
        icon: item.icon != "" ? "image://icons/" + item.icon : "image://icons/unknown"
114
115
        running: item.running
115
116
        active: item.active
 
117
        activeOnThisScreen: item.activeScreen == declarativeView.screen.screen
116
118
        urgent: item.urgent
117
119
        launching: item.launching
118
 
        pips: Math.min(item.windowCount, 3)
119
120
 
120
121
        counter: item.counter
121
122
        counterVisible: item.counterVisible
125
126
        emblemVisible: item.emblemVisible
126
127
 
127
128
        /* Launcher of index 0 is the so-called BFB or Dash launcher */
128
 
        shortcutVisible: declarativeView.superKeyHeld &&
 
129
        shortcutVisible: shellManager.superKeyHeld &&
129
130
                         ((item.toString().indexOf("Application") == 0 && index > 0 && index <= 10) ||
130
131
                          item.shortcutKey != 0)
131
132
        shortcutText: {
157
158
                list.visibleMenu.hide()
158
159
            }
159
160
            list.visibleMenu = item.menu
160
 
            item.menu.show(width - 5, declarativeView.globalPosition.y + list.y - list.contentY +
 
161
            item.menu.show(declarativeView.globalPosition.x + width - 5, declarativeView.globalPosition.y + list.y - list.contentY +
161
162
                                  y + height - selectionOutlineSize / 2)
162
163
        }
163
164
 
262
263
 
263
264
        function setIconGeometry() {
264
265
            if (running) {
 
266
                var screen = launcher2dConfiguration.onlyOneLauncher ? -1 : declarativeView.screen.screen
265
267
                item.setIconGeometry(x + declarativeView.globalPosition.x,
266
268
                                     y + declarativeView.globalPosition.y,
267
 
                                     width, height)
 
269
                                     width, height, screen)
268
270
            }
269
271
        }
270
272
 
304
306
 
305
307
        Connections {
306
308
            target: item
307
 
            onWindowAdded: item.setIconGeometry(x + declarativeView.globalPosition.x,
308
 
                                                y + declarativeView.globalPosition.y,
309
 
                                                width, height, xid)
 
309
            onWindowAdded: {
 
310
                var screen = launcher2dConfiguration.onlyOneLauncher ? -1 : declarativeView.screen.screen
 
311
                item.setIconGeometry(x + declarativeView.globalPosition.x,
 
312
                                     y + declarativeView.globalPosition.y,
 
313
                                     width, height, screen, xid)
 
314
            }
310
315
            onWindowCountChanged: updatePips()
311
316
            onWindowWorkspaceChanged: updatePips()
 
317
            onWindowGeometryChanged: {
 
318
                updatePips()
 
319
                setIconGeometry()
 
320
            }
312
321
            /* Not all items are applications. */
313
322
            ignoreUnknownSignals: true
314
323
        }
353
362
        }
354
363
 
355
364
        Connections {
356
 
            target: declarativeView
 
365
            target: shellManager
357
366
            onActiveWorkspaceChanged: updatePips()
358
367
        }
359
368
        Component.onCompleted: updatePips()