Merge lp:~dyams/unity-2d/mm-updates-pips into lp:unity-2d

Proposed by Lohith D Shivamurthy on 2012-02-16
Status: Superseded
Proposed branch: lp:~dyams/unity-2d/mm-updates-pips
Merge into: lp:unity-2d
Diff against target: 1218 lines (+638/-222)
15 files modified
libunity-2d-private/src/launcherapplication.cpp (+88/-0)
libunity-2d-private/src/launcherapplication.h (+5/-0)
libunity-2d-private/src/launcheritem.cpp (+6/-0)
libunity-2d-private/src/launcheritem.h (+2/-0)
libunity-2d-private/src/screeninfo.cpp (+15/-0)
libunity-2d-private/src/screeninfo.h (+2/-0)
shell/Shell.qml (+5/-1)
shell/app/CMakeLists.txt (+2/-0)
shell/app/shell.cpp (+3/-51)
shell/app/shelldeclarativeview.cpp (+52/-147)
shell/app/shelldeclarativeview.h (+16/-20)
shell/app/shellmanager.cpp (+380/-0)
shell/app/shellmanager.h (+58/-0)
shell/launcher/LauncherList.qml (+3/-2)
shell/launcher/LauncherLoader.qml (+1/-1)
To merge this branch: bzr merge lp:~dyams/unity-2d/mm-updates-pips
Reviewer Review Type Date Requested Status
Albert Astals Cid 2012-02-16 Pending
Review via email: mp+93350@code.launchpad.net

Description of the change

[shell][Multimonitor] update pips to show whether application belongs to current screen or not

To post a comment you must log in.
lp:~dyams/unity-2d/mm-updates-pips updated on 2012-02-20
922. By Lohith D Shivamurthy on 2012-02-20

fix comments

Unmerged revisions

922. By Lohith D Shivamurthy on 2012-02-20

fix comments

921. By Lohith D Shivamurthy on 2012-02-16

[shell] update pips to show whether application belongs to current screen or not

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/launcherapplication.cpp'
2--- libunity-2d-private/src/launcherapplication.cpp 2012-02-06 12:07:47 +0000
3+++ libunity-2d-private/src/launcherapplication.cpp 2012-02-16 08:16:20 +0000
4@@ -43,6 +43,7 @@
5 // libunity-2d
6 #include <unity2dtr.h>
7 #include <debug_p.h>
8+#include <screeninfo.h>
9
10 // Qt
11 #include <Qt>
12@@ -62,6 +63,14 @@
13 #include <libsn/sn.h>
14 }
15
16+#define GOBJECT_CALLBACK0(callbackName, slot) \
17+static void \
18+callbackName(GObject* src, QObject* dst) \
19+{ \
20+ QMetaObject::invokeMethod(dst, slot); \
21+}
22+GOBJECT_CALLBACK0(geometryChangedCB, "onWindowGeometryChanged")
23+
24 const char* SHORTCUT_NICK_PROPERTY = "nick";
25
26 LauncherApplication::LauncherApplication()
27@@ -91,6 +100,7 @@
28
29 LauncherApplication::~LauncherApplication()
30 {
31+ disconnectWindowSignals();
32 }
33
34 bool
35@@ -526,6 +536,29 @@
36 WnckWindow* window = wnck_window_get(xids->at(i));
37 g_signal_connect(G_OBJECT(window), "workspace-changed",
38 G_CALLBACK(LauncherApplication::onWindowWorkspaceChanged), this);
39+ g_signal_connect(G_OBJECT(window), "geometry-changed", G_CALLBACK(geometryChangedCB), this);
40+ }
41+}
42+
43+void
44+LauncherApplication::disconnectWindowSignals()
45+{
46+ if (m_application == NULL || m_application->running() == false) {
47+ return;
48+ }
49+
50+ QScopedPointer<BamfUintList> xids(m_application->xids());
51+ int size = xids->size();
52+ if (size < 1) {
53+ return;
54+ }
55+
56+ WnckScreen* screen = wnck_screen_get_default();
57+ wnck_screen_force_update(screen);
58+
59+ for (int i = 0; i < size; ++i) {
60+ WnckWindow* window = wnck_window_get(xids->at(i));
61+ g_signal_handlers_disconnect_by_func(window, gpointer(geometryChangedCB), this);
62 }
63 }
64
65@@ -537,6 +570,7 @@
66 WnckWindow* wnck_window = wnck_window_get(window->xid());
67 g_signal_connect(G_OBJECT(wnck_window), "workspace-changed",
68 G_CALLBACK(LauncherApplication::onWindowWorkspaceChanged), this);
69+ g_signal_connect(G_OBJECT(window), "geometry-changed", G_CALLBACK(geometryChangedCB), this);
70 }
71 }
72
73@@ -665,6 +699,42 @@
74 return windowCount;
75 }
76
77+int
78+LauncherApplication::windowCountOnCurrentScreen(int screen)
79+{
80+ int windowCount = 0;
81+
82+ if (!m_application) {
83+ return windowCount;
84+ }
85+
86+ ScreenInfo screenInfo(screen);
87+ QScopedPointer<BamfUintList> xids(m_application->xids());
88+ for (int i = 0; i < xids->size(); i++) {
89+ /* When geting the wnck window, it's possible we get a NULL
90+ return value because wnck hasn't updated its internal list yet,
91+ so we need to force it once to be sure */
92+ WnckWindow *window = wnck_window_get(xids->at(i));
93+ if (window == NULL) {
94+ wnck_screen_force_update(wnck_screen_get_default());
95+ window = wnck_window_get(xids->at(i));
96+ if (window == NULL) {
97+ continue;
98+ }
99+ }
100+
101+ // Check the window screen
102+ int x, y, width, height;
103+ wnck_window_get_geometry(window, &x, &y, &width, &height);
104+ QRect windowRect(x, y, width, height);
105+ QPoint pos = windowRect.center();
106+ if (ScreenInfo::screenNumber(pos) == screen) {
107+ windowCount++;
108+ }
109+ }
110+ return windowCount;
111+}
112+
113 void
114 LauncherApplication::activate()
115 {
116@@ -986,6 +1056,18 @@
117 return false;
118 }
119
120+bool
121+LauncherApplication::belongsToDifferentScreen(int screen)
122+{
123+ int totalWindows = windowCount();
124+ int windowsInCurrentScreen = windowCountOnCurrentScreen(screen);
125+ if (totalWindows > 0 && windowsInCurrentScreen == 0) {
126+ return true;
127+ }
128+
129+ return false;
130+}
131+
132 void
133 LauncherApplication::onIndicatorMenuUpdated()
134 {
135@@ -1110,6 +1192,12 @@
136 }
137
138 void
139+LauncherApplication::onWindowGeometryChanged()
140+{
141+ windowGeometryChanged();
142+}
143+
144+void
145 LauncherApplication::onDragEnter(DeclarativeDragDropEvent* event)
146 {
147 QList<QUrl> urls = validateUrisForLaunch(event->mimeData());
148
149=== modified file 'libunity-2d-private/src/launcherapplication.h'
150--- libunity-2d-private/src/launcherapplication.h 2012-02-06 12:07:47 +0000
151+++ libunity-2d-private/src/launcherapplication.h 2012-02-16 08:16:20 +0000
152@@ -105,7 +105,9 @@
153
154 Q_INVOKABLE virtual void createMenuActions();
155 Q_INVOKABLE virtual bool belongsToDifferentWorkspace();
156+ Q_INVOKABLE virtual bool belongsToDifferentScreen(int screen);
157 Q_INVOKABLE void connectWindowSignals();
158+ void disconnectWindowSignals();
159
160 void updateOverlaysState(const QString& sender, const QMap<QString, QVariant>& properties);
161
162@@ -151,6 +153,8 @@
163 void onDragEnter(DeclarativeDragDropEvent*);
164 void onDrop(DeclarativeDragDropEvent*);
165
166+ void onWindowGeometryChanged();
167+
168 private:
169 QPointer<BamfApplication> m_application;
170 QFileSystemWatcher *m_desktopFileWatcher;
171@@ -175,6 +179,7 @@
172 void createDynamicMenuActions();
173 void createStaticMenuActions();
174 int windowCountOnCurrentWorkspace();
175+ int windowCountOnCurrentScreen(int);
176 template<typename T>
177 bool updateOverlayState(const QMap<QString, QVariant>& properties,
178 const QString& propertyName, T* member);
179
180=== modified file 'libunity-2d-private/src/launcheritem.cpp'
181--- libunity-2d-private/src/launcheritem.cpp 2012-02-06 12:07:47 +0000
182+++ libunity-2d-private/src/launcheritem.cpp 2012-02-16 08:16:20 +0000
183@@ -93,6 +93,12 @@
184 }
185
186 bool
187+LauncherItem::belongsToDifferentScreen(int)
188+{
189+ return false;
190+}
191+
192+bool
193 LauncherItem::progressBarVisible() const
194 {
195 return false;
196
197=== modified file 'libunity-2d-private/src/launcheritem.h'
198--- libunity-2d-private/src/launcheritem.h 2012-02-06 12:07:47 +0000
199+++ libunity-2d-private/src/launcheritem.h 2012-02-16 08:16:20 +0000
200@@ -80,6 +80,7 @@
201 Q_INVOKABLE virtual void createMenuActions() = 0;
202 Q_INVOKABLE virtual void launchNewInstance();
203 Q_INVOKABLE virtual bool belongsToDifferentWorkspace();
204+ Q_INVOKABLE virtual bool belongsToDifferentScreen(int);
205
206 protected:
207 LauncherContextualMenu* m_menu;
208@@ -102,6 +103,7 @@
209 void emblemVisibleChanged(bool);
210 void emblemChanged(QString);
211 void windowWorkspaceChanged();
212+ void windowGeometryChanged();
213
214 public Q_SLOTS:
215 /* Default implementation of drag’n’drop handling, should be overridden in
216
217=== modified file 'libunity-2d-private/src/screeninfo.cpp'
218--- libunity-2d-private/src/screeninfo.cpp 2012-02-01 16:28:13 +0000
219+++ libunity-2d-private/src/screeninfo.cpp 2012-02-16 08:16:20 +0000
220@@ -198,6 +198,21 @@
221 return m_corner;
222 }
223
224+int
225+ScreenInfo::cursorScreen()
226+{
227+ QDesktopWidget* desktop = QApplication::desktop();
228+ QPoint cursorPos(QCursor::pos());
229+ return desktop->screenNumber(cursorPos);
230+}
231+
232+int
233+ScreenInfo::screenNumber(QPoint point)
234+{
235+ QDesktopWidget* desktop = QApplication::desktop();
236+ return desktop->screenNumber(point);
237+}
238+
239 void
240 ScreenInfo::setCorner(Corner corner)
241 {
242
243=== modified file 'libunity-2d-private/src/screeninfo.h'
244--- libunity-2d-private/src/screeninfo.h 2012-02-01 15:01:21 +0000
245+++ libunity-2d-private/src/screeninfo.h 2012-02-16 08:16:20 +0000
246@@ -39,6 +39,8 @@
247 int screen() const;
248 QWidget* widget() const;
249 Corner corner() const;
250+ static int cursorScreen();
251+ static int screenNumber(QPoint);
252
253 /* Setters */
254 void setScreen(int screen);
255
256=== modified file 'shell/Shell.qml'
257--- shell/Shell.qml 2012-02-13 09:15:03 +0000
258+++ shell/Shell.qml 2012-02-16 08:16:20 +0000
259@@ -106,7 +106,11 @@
260
261 Loader {
262 id: dashLoader
263- source: "dash/Dash.qml"
264+ /* TODO : In case of multi-monitors, there should be only one dash,
265+ which could be moved to any screen.
266+ ATM, we are displaying dash for the leftmost screen only. other screens will not support dash yet.
267+ */
268+ source: (declarativeView.isTopLeftShell ? "dash/Dash.qml" : "")
269 anchors.top: parent.top
270 x: Utils.isLeftToRight() ? launcherLoader.width : shell.width - width - launcherLoader.width
271 onLoaded: item.focus = true
272
273=== modified file 'shell/app/CMakeLists.txt'
274--- shell/app/CMakeLists.txt 2012-02-13 23:46:04 +0000
275+++ shell/app/CMakeLists.txt 2012-02-16 08:16:20 +0000
276@@ -8,12 +8,14 @@
277 dashdbus.cpp
278 launcherdbus.cpp
279 shelldeclarativeview.cpp
280+ shellmanager.cpp
281 )
282
283 set(shell_MOC_HDRS
284 dashdbus.h
285 launcherdbus.h
286 shelldeclarativeview.h
287+ shellmanager.h
288 )
289
290 qt4_wrap_cpp(shell_MOC_SRCS ${shell_MOC_HDRS})
291
292=== modified file 'shell/app/shell.cpp'
293--- shell/app/shell.cpp 2012-02-13 23:46:04 +0000
294+++ shell/app/shell.cpp 2012-02-16 08:16:20 +0000
295@@ -21,30 +21,16 @@
296 // QT
297 #include <QApplication>
298 #include <QDebug>
299-#include <QtDeclarative>
300-#include <QDeclarativeEngine>
301-#include <QDeclarativeView>
302-#include <QDesktopWidget>
303-#include <QDBusConnection>
304-#include <QDBusConnectionInterface>
305-#include <QDeclarativeContext>
306-#include <QAbstractEventDispatcher>
307 #include <QDir>
308-
309-// X11
310-#include <X11/Xlib.h>
311+#include <QUrl>
312
313 // unity-2d
314 #include <gnomesessionclient.h>
315 #include <unity2dapplication.h>
316-#include <unity2ddebug.h>
317
318 // Local
319 #include "config.h"
320-#include "shelldeclarativeview.h"
321-#include "dashclient.h"
322-#include "dashdbus.h"
323-#include "launcherdbus.h"
324+#include "shellmanager.h"
325
326 int main(int argc, char *argv[])
327 {
328@@ -71,32 +57,7 @@
329 GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-shell.desktop");
330 client.connectToSessionManager();
331
332- qmlRegisterType<ShellDeclarativeView>("Unity2d", 1, 0, "ShellDeclarativeView");
333- ShellDeclarativeView view;
334- view.setAccessibleName("Shell");
335- if (arguments.contains("-opengl")) {
336- view.setUseOpenGL(true);
337- }
338-
339- application.installX11EventFilter(&view);
340-
341- view.engine()->addImportPath(unity2dImportPath());
342- view.engine()->setBaseUrl(QUrl::fromLocalFile(unity2dDirectory() + "/shell/"));
343-
344- /* Load the QML UI, focus and show the window */
345- view.setResizeMode(QDeclarativeView::SizeViewToRootObject);
346- view.rootContext()->setContextProperty("declarativeView", &view);
347- // WARNING This declaration of dashClient used to be in Unity2d/plugin.cpp
348- // but it lead to locks when both the shell and the spread were started
349- // at the same time since SpreadMonitor QDBusServiceWatcher::serviceRegistered
350- // and DashClient QDBusServiceWatcher::serviceRegistered
351- // triggered at the same time ending up with both creating QDBusInterface
352- // to eachother in the main thread meaning they would block
353- // In case you need to have a DashClient in the spread the fix for the problem
354- // is moving the QDbusInterface creation to a thread so it does not block
355- // the main thread
356- view.rootContext()->setContextProperty("dashClient", DashClient::instance());
357- view.setSource(rootFileUrl);
358+ ShellManager shells(rootFileUrl);
359
360 /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes (launched
361 applications) to use the same client id.
362@@ -113,14 +74,5 @@
363 (see e.g. https://bugs.launchpad.net/bugs/684471). */
364 QDir::setCurrent(QDir::homePath());
365
366- DashDBus dashDBus(&view);
367- if (!dashDBus.connectToBus()) {
368- qCritical() << "Another instance of the Dash already exists. Quitting.";
369- return -1;
370- }
371-
372- LauncherDBus launcherDBus(&view);
373- launcherDBus.connectToBus();
374-
375 return application.exec();
376 }
377
378=== modified file 'shell/app/shelldeclarativeview.cpp'
379--- shell/app/shelldeclarativeview.cpp 2012-02-13 23:46:04 +0000
380+++ shell/app/shelldeclarativeview.cpp 2012-02-16 08:16:20 +0000
381@@ -22,11 +22,6 @@
382 // libunity-2d-private
383 #include <debug_p.h>
384 #include <hotkey.h>
385-#include <hotkeymonitor.h>
386-#include <keyboardmodifiersmonitor.h>
387-#include <keymonitor.h>
388-#include <dashclient.h>
389-#include <launcherclient.h>
390 #include <screeninfo.h>
391 #include <strutmanager.h>
392
393@@ -47,46 +42,20 @@
394 #include <X11/Xlib.h>
395 #include <X11/Xatom.h>
396
397-static const int KEY_HOLD_THRESHOLD = 250;
398-
399 static const char* COMMANDS_LENS_ID = "commands.lens";
400
401-ShellDeclarativeView::ShellDeclarativeView()
402+ShellDeclarativeView::ShellDeclarativeView(const QUrl &sourceFileUrl, bool isTopLeftShell, int screen)
403 : Unity2DDeclarativeView()
404 , m_mode(DesktopMode)
405 , m_expanded(true)
406 , m_active(false)
407- , m_superKeyPressed(false)
408- , m_superKeyHeld(false)
409+ , m_isTopLeftShell(isTopLeftShell)
410+ , m_sourceFileUrl(sourceFileUrl)
411 {
412 setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);
413 setTransparentBackground(QX11Info::isCompositingManagerRunning());
414
415- m_screenInfo = new ScreenInfo(ScreenInfo::TopLeft, this);
416-
417- m_superKeyHoldTimer.setSingleShot(true);
418- m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD);
419- connect(&m_superKeyHoldTimer, SIGNAL(timeout()), SLOT(updateSuperKeyHoldState()));
420- connect(this, SIGNAL(superKeyTapped()), SLOT(toggleDash()));
421-
422- connect(&launcher2dConfiguration(), SIGNAL(superKeyEnableChanged(bool)), SLOT(updateSuperKeyMonitoring()));
423- updateSuperKeyMonitoring();
424-
425- /* Alt+F1 reveal the launcher and gives the keyboard focus to the Dash Button. */
426- Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier);
427- connect(altF1, SIGNAL(pressed()), SLOT(onAltF1Pressed()));
428-
429- /* Alt+F2 shows the dash with the commands lens activated. */
430- Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier);
431- connect(altF2, SIGNAL(pressed()), SLOT(showCommandsLens()));
432-
433- /* Super+{n} for 0 ≤ n ≤ 9 activates the item with index (n + 9) % 10. */
434- for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) {
435- Hotkey* hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier);
436- connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey()));
437- hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier | Qt::ShiftModifier);
438- connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey()));
439- }
440+ m_screenInfo = new ScreenInfo(screen, this);
441
442 connect(m_screenInfo, SIGNAL(availableGeometryChanged(QRect)), SLOT(updateShellPosition()));
443 updateShellPosition();
444@@ -172,6 +141,9 @@
445 /* Note that this has to be called everytime the window is shown, as the WM
446 will remove the flags when the window is hidden */
447 setWMFlags();
448+ if (source().isEmpty()) {
449+ setSource(m_sourceFileUrl);
450+ }
451 }
452
453 void
454@@ -262,7 +234,7 @@
455 }
456
457 void
458-ShellDeclarativeView::onAltF1Pressed()
459+ShellDeclarativeView::toggleLauncher()
460 {
461 if (!isActiveWindow()) {
462 forceActivateWindow();
463@@ -279,117 +251,27 @@
464 }
465 }
466
467-/* ----------------- super key handling ---------------- */
468-
469-void
470-ShellDeclarativeView::updateSuperKeyHoldState()
471-{
472- /* If the key was released in the meantime, just do nothing, otherwise
473- consider the key being held, unless we're told to ignore it. */
474- if (m_superKeyPressed && !m_superPressIgnored) {
475- m_superKeyHeld = true;
476- Q_EMIT superKeyHeldChanged(m_superKeyHeld);
477- }
478-}
479-
480-void
481-ShellDeclarativeView::updateSuperKeyMonitoring()
482-{
483- KeyboardModifiersMonitor *modifiersMonitor = KeyboardModifiersMonitor::instance();
484- KeyMonitor *keyMonitor = KeyMonitor::instance();
485- HotkeyMonitor& hotkeyMonitor = HotkeyMonitor::instance();
486-
487- QVariant value = launcher2dConfiguration().property("superKeyEnable");
488- if (!value.isValid() || value.toBool() == true) {
489- hotkeyMonitor.enableModifiers(Qt::MetaModifier);
490- QObject::connect(modifiersMonitor,
491- SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)),
492- this, SLOT(setHotkeysForModifiers(Qt::KeyboardModifiers)));
493- /* Ignore Super presses if another key was pressed simultaneously
494- (i.e. a shortcut). https://bugs.launchpad.net/unity-2d/+bug/801073 */
495- QObject::connect(keyMonitor,
496- SIGNAL(keyPressed()),
497- this, SLOT(ignoreSuperPress()));
498- setHotkeysForModifiers(modifiersMonitor->keyboardModifiers());
499- } else {
500- hotkeyMonitor.disableModifiers(Qt::MetaModifier);
501- QObject::disconnect(modifiersMonitor,
502- SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)),
503- this, SLOT(setHotkeysForModifiers(Qt::KeyboardModifiers)));
504- QObject::disconnect(keyMonitor,
505- SIGNAL(keyPressed()),
506- this, SLOT(ignoreSuperPress()));
507- m_superKeyHoldTimer.stop();
508- m_superKeyPressed = false;
509- if (m_superKeyHeld) {
510- m_superKeyHeld = false;
511- Q_EMIT superKeyHeldChanged(false);
512- }
513- }
514-}
515-
516-void
517-ShellDeclarativeView::setHotkeysForModifiers(Qt::KeyboardModifiers modifiers)
518-{
519- /* This is the new new state of the Super key (AKA Meta key), while
520- m_superKeyPressed is the previous state of the key at the last modifiers change. */
521- bool superKeyPressed = modifiers.testFlag(Qt::MetaModifier);
522-
523- if (m_superKeyPressed != superKeyPressed) {
524- m_superKeyPressed = superKeyPressed;
525- if (superKeyPressed) {
526- m_superPressIgnored = false;
527- /* If the key is pressed, start up a timer to monitor if it's being held short
528- enough to qualify as just a "tap" or as a proper hold */
529- m_superKeyHoldTimer.start();
530- } else {
531- m_superKeyHoldTimer.stop();
532-
533- /* If the key is released, and was not being held, it means that the user just
534- performed a "tap". Unless we're told to ignore that tap, that is. */
535- if (!m_superKeyHeld && !m_superPressIgnored) {
536- Q_EMIT superKeyTapped();
537- }
538- /* Otherwise the user just terminated a hold. */
539- else if(m_superKeyHeld){
540- m_superKeyHeld = false;
541- Q_EMIT superKeyHeldChanged(m_superKeyHeld);
542- }
543- }
544- }
545-}
546-
547-void
548-ShellDeclarativeView::ignoreSuperPress()
549-{
550- /* There was a key pressed, ignore current super tap/hold */
551- m_superPressIgnored = true;
552-}
553-
554-void
555-ShellDeclarativeView::forwardNumericHotkey()
556-{
557- Hotkey* hotkey = qobject_cast<Hotkey*>(sender());
558- if (hotkey != NULL) {
559- /* Shortcuts from 1 to 9 should activate the items with index
560- from 1 to 9 (index 0 being the so-called "BFB" or Dash launcher).
561- Shortcut for 0 should activate item with index 10.
562- In other words, the indexes are activated in the same order as
563- the keys appear on a standard keyboard. */
564- Qt::Key key = hotkey->key();
565- if (key >= Qt::Key_1 && key <= Qt::Key_9) {
566- int index = key - Qt::Key_0;
567- if (hotkey->modifiers() & Qt::ShiftModifier) {
568- Q_EMIT newInstanceShortcutPressed(index);
569- } else {
570- Q_EMIT activateShortcutPressed(index);
571- }
572- } else if (key == Qt::Key_0) {
573- if (hotkey->modifiers() & Qt::ShiftModifier) {
574- Q_EMIT newInstanceShortcutPressed(10);
575- } else {
576- Q_EMIT activateShortcutPressed(10);
577- }
578+void
579+ShellDeclarativeView::processNumericHotkey(Hotkey* hotkey)
580+{
581+ /* Shortcuts from 1 to 9 should activate the items with index
582+ from 1 to 9 (index 0 being the so-called "BFB" or Dash launcher).
583+ Shortcut for 0 should activate item with index 10.
584+ In other words, the indexes are activated in the same order as
585+ the keys appear on a standard keyboard. */
586+ Qt::Key key = hotkey->key();
587+ if (key >= Qt::Key_1 && key <= Qt::Key_9) {
588+ int index = key - Qt::Key_0;
589+ if (hotkey->modifiers() & Qt::ShiftModifier) {
590+ Q_EMIT newInstanceShortcutPressed(index);
591+ } else {
592+ Q_EMIT activateShortcutPressed(index);
593+ }
594+ } else if (key == Qt::Key_0) {
595+ if (hotkey->modifiers() & Qt::ShiftModifier) {
596+ Q_EMIT newInstanceShortcutPressed(10);
597+ } else {
598+ Q_EMIT activateShortcutPressed(10);
599 }
600 }
601 }
602@@ -466,3 +348,26 @@
603 {
604 return m_monitoredAreaContainsMouse;
605 }
606+
607+void
608+ShellDeclarativeView::setIsTopLeftShell(bool ashell)
609+{
610+ if (m_isTopLeftShell == ashell) {
611+ return;
612+ }
613+
614+ m_isTopLeftShell = ashell;
615+ Q_EMIT isTopLeftShellChanged(m_isTopLeftShell);
616+}
617+
618+void
619+ShellDeclarativeView::setScreenNumber(int screen)
620+{
621+ m_screenInfo->setScreen(screen);
622+}
623+
624+int
625+ShellDeclarativeView::screenNumber() const
626+{
627+ return m_screenInfo->screen();
628+}
629
630=== modified file 'shell/app/shelldeclarativeview.h'
631--- shell/app/shelldeclarativeview.h 2012-02-13 23:46:04 +0000
632+++ shell/app/shelldeclarativeview.h 2012-02-16 08:16:20 +0000
633@@ -27,6 +27,7 @@
634 class LauncherClient;
635 class DashDBus;
636 class ScreenInfo;
637+class Hotkey;
638
639 class ShellDeclarativeView : public Unity2DDeclarativeView, public AbstractX11EventFilter
640 {
641@@ -38,7 +39,7 @@
642 Q_PROPERTY(DashMode dashMode READ dashMode WRITE setDashMode NOTIFY dashModeChanged)
643 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
644 Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify
645- Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
646+ Q_PROPERTY(bool isTopLeftShell READ isTopLeftShell WRITE setIsTopLeftShell NOTIFY isTopLeftShellChanged)
647 Q_PROPERTY(bool haveCustomHomeShortcuts READ haveCustomHomeShortcuts)
648
649 /* These two properties and mouse movement tracking on the widget are added here only because
650@@ -56,7 +57,7 @@
651 DesktopMode,
652 FullScreenMode
653 };
654- explicit ShellDeclarativeView();
655+ explicit ShellDeclarativeView(const QUrl &sourceFileUrl = QUrl(), bool isTopLeftShell = false, int screen = 0);
656
657 /* getters */
658 bool dashActive() const;
659@@ -64,19 +65,28 @@
660 DashMode dashMode() const;
661 const QString& activeLens() const;
662 bool expanded() const;
663- bool superKeyHeld() const { return m_superKeyHeld; }
664 QRect monitoredArea() const;
665 bool monitoredAreaContainsMouse() const;
666+ bool isTopLeftShell() const { return m_isTopLeftShell; }
667
668 /* setters */
669 Q_SLOT void setDashActive(bool active);
670 Q_INVOKABLE void setDashMode(DashMode);
671 Q_INVOKABLE void setActiveLens(const QString& activeLens);
672 Q_INVOKABLE void setExpanded(bool);
673+ void setScreenNumber(int);
674+ int screenNumber() const;
675 void setMonitoredArea(QRect monitoredArea);
676+ void setIsTopLeftShell(bool);
677
678 virtual bool x11EventFilter(XEvent* event);
679
680+ void toggleDash();
681+ void toggleLauncher();
682+ void showCommandsLens();
683+
684+ void processNumericHotkey(Hotkey*);
685+
686 Q_SIGNALS:
687 void dashActiveChanged(bool);
688 void dashModeChanged(DashMode);
689@@ -89,22 +99,10 @@
690 void monitoredAreaContainsMouseChanged();
691
692 void addWebFavoriteRequested(const QUrl& url);
693- void superKeyHeldChanged(bool superKeyHeld);
694- void superKeyTapped();
695 void activateShortcutPressed(int itemIndex);
696 void newInstanceShortcutPressed(int itemIndex);
697 void launcherFocusRequested();
698-
699-private Q_SLOTS:
700- void updateSuperKeyMonitoring();
701- void updateSuperKeyHoldState();
702- void setHotkeysForModifiers(Qt::KeyboardModifiers modifiers);
703- void forwardNumericHotkey();
704- void ignoreSuperPress();
705-
706- void toggleDash();
707- void showCommandsLens();
708- void onAltF1Pressed();
709+ void isTopLeftShellChanged(bool);
710
711 protected:
712 virtual void showEvent(QShowEvent *event);
713@@ -126,12 +124,10 @@
714 QString m_activeLens; /* Lens id of the active lens */
715 bool m_active;
716
717- bool m_superKeyPressed;
718- bool m_superKeyHeld;
719- bool m_superPressIgnored;
720- QTimer m_superKeyHoldTimer;
721 QRect m_monitoredArea;
722 bool m_monitoredAreaContainsMouse;
723+ bool m_isTopLeftShell;
724+ QUrl m_sourceFileUrl;
725
726 friend class DashDBus;
727 friend class LauncherDBus;
728
729=== added file 'shell/app/shellmanager.cpp'
730--- shell/app/shellmanager.cpp 1970-01-01 00:00:00 +0000
731+++ shell/app/shellmanager.cpp 2012-02-16 08:16:20 +0000
732@@ -0,0 +1,380 @@
733+/*
734+ * This file is part of unity-2d
735+ *
736+ * Copyright 2010 Canonical Ltd.
737+ *
738+ * This program is free software; you can redistribute it and/or modify
739+ * it under the terms of the GNU General Public License as published by
740+ * the Free Software Foundation; version 3.
741+ *
742+ * This program is distributed in the hope that it will be useful,
743+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
744+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
745+ * GNU General Public License for more details.
746+ *
747+ * You should have received a copy of the GNU General Public License
748+ * along with this program. If not, see <http://www.gnu.org/licenses/>
749+ */
750+
751+#include "shellmanager.h"
752+
753+// Qt
754+#include <QApplication>
755+#include <QDebug>
756+#include <QtDeclarative>
757+#include <QDeclarativeEngine>
758+#include <QDeclarativeView>
759+#include <QDesktopWidget>
760+#include <QDBusConnection>
761+#include <QDBusConnectionInterface>
762+#include <QDeclarativeContext>
763+#include <QAbstractEventDispatcher>
764+
765+// libunity-2d-private
766+#include <hotkeymonitor.h>
767+#include <hotkey.h>
768+#include <keyboardmodifiersmonitor.h>
769+#include <keymonitor.h>
770+#include <screeninfo.h>
771+
772+// Local
773+#include "shelldeclarativeview.h"
774+#include "dashclient.h"
775+#include "dashdbus.h"
776+#include "gesturehandler.h"
777+#include "launcherdbus.h"
778+#include "config.h"
779+
780+// unity-2d
781+#include <unity2ddebug.h>
782+#include <unity2dapplication.h>
783+
784+// X11
785+#include <X11/Xlib.h>
786+
787+static const int KEY_HOLD_THRESHOLD = 250;
788+
789+struct ShellManagerPrivate
790+{
791+ ShellManagerPrivate()
792+ : q(0)
793+ , m_dashDBus(0)
794+ , m_launcherDBus(0)
795+ , m_superKeyPressed(false)
796+ , m_superKeyHeld(false)
797+ {}
798+
799+ ShellDeclarativeView* initShell(bool isTopLeft, int screen);
800+ void updateScreenCount(int newCount);
801+ ShellDeclarativeView* activeShell() const;
802+
803+ ShellManager *q;
804+ QList<ShellDeclarativeView *> m_viewList;
805+ DashDBus * m_dashDBus;
806+ LauncherDBus* m_launcherDBus;
807+ QUrl m_sourceFileUrl;
808+
809+ bool m_superKeyPressed;
810+ bool m_superKeyHeld;
811+ bool m_superPressIgnored;
812+ QTimer m_superKeyHoldTimer;
813+};
814+
815+
816+ShellDeclarativeView *
817+ShellManagerPrivate::initShell(bool isTopLeft, int screen)
818+{
819+ const QStringList arguments = qApp->arguments();
820+ ShellDeclarativeView * view = new ShellDeclarativeView(m_sourceFileUrl, isTopLeft, screen);
821+ view->setAccessibleName("Shell");
822+ if (arguments.contains("-opengl")) {
823+ view->setUseOpenGL(true);
824+ }
825+
826+ Unity2dApplication::instance()->installX11EventFilter(view);
827+
828+ view->engine()->addImportPath(unity2dImportPath());
829+ view->engine()->setBaseUrl(QUrl::fromLocalFile(unity2dDirectory() + "/shell/"));
830+
831+ /* Load the QML UI, focus and show the window */
832+ view->setResizeMode(QDeclarativeView::SizeViewToRootObject);
833+ view->rootContext()->setContextProperty("declarativeView", view);
834+ view->rootContext()->setContextProperty("shellManager", q);
835+ // WARNING This declaration of dashClient used to be in Unity2d/plugin.cpp
836+ // but it lead to locks when both the shell and the spread were started
837+ // at the same time since SpreadMonitor QDBusServiceWatcher::serviceRegistered
838+ // and DashClient QDBusServiceWatcher::serviceRegistered
839+ // triggered at the same time ending up with both creating QDBusInterface
840+ // to eachother in the main thread meaning they would block
841+ // In case you need to have a DashClient in the spread the fix for the problem
842+ // is moving the QDbusInterface creation to a thread so it does not block
843+ // the main thread
844+ view->rootContext()->setContextProperty("dashClient", DashClient::instance());
845+
846+ if (!m_dashDBus) {
847+ m_dashDBus = new DashDBus(view);
848+ if (!m_dashDBus->connectToBus()) {
849+ qCritical() << "Another instance of the Dash already exists. Quitting.";
850+ return 0;
851+ }
852+ }
853+
854+ if (!m_launcherDBus) {
855+ m_launcherDBus = new LauncherDBus(view);
856+ m_launcherDBus->connectToBus();
857+ }
858+
859+ view->show();
860+
861+ return view;
862+}
863+
864+ShellDeclarativeView *
865+ShellManagerPrivate::activeShell() const
866+{
867+ int cursorScreen = ScreenInfo::cursorScreen();
868+ Q_FOREACH(ShellDeclarativeView * shell, m_viewList) {
869+ if (shell->screenNumber() == cursorScreen) {
870+ return shell;
871+ }
872+ }
873+ return 0;
874+}
875+
876+void
877+ShellManagerPrivate::updateScreenCount(int newCount)
878+{
879+ if (newCount > 0) {
880+ QDesktopWidget* desktop = QApplication::desktop();
881+ int size = m_viewList.size();
882+ ShellDeclarativeView* shell = 0;
883+
884+ /* The first shell is always the one on the leftmost screen. */
885+ QPoint p;
886+ if (QApplication::isRightToLeft()) {
887+ p = QPoint(desktop->width() - 1, 0);
888+ }
889+ int leftmost = desktop->screenNumber(p);
890+ if (size > 0) {
891+ shell = m_viewList[0];
892+ } else {
893+ shell = initShell(true, leftmost);
894+ m_viewList.append(shell);
895+ }
896+ shell->setScreenNumber(leftmost);
897+
898+ /* Update the position of other existing Shells, and instantiate new
899+ Shells as needed. */
900+ int i = 1;
901+ for (int screen = 0; screen < newCount; ++screen) {
902+ if (screen == leftmost) {
903+ continue;
904+ }
905+ if (i < size) {
906+ shell = m_viewList[i];
907+ } else {
908+ shell = initShell(false, screen);
909+ m_viewList.append(shell);
910+ }
911+ shell->setIsTopLeftShell(false);
912+ shell->setScreenNumber(screen);
913+ ++i;
914+ }
915+ }
916+ /* Remove extra Shells if any. */
917+ while (m_viewList.size() > newCount) {
918+ m_viewList.takeLast()->deleteLater();
919+ }
920+}
921+
922+/* -------------------------- ShellManager -----------------------------*/
923+
924+ShellManager::ShellManager(const QUrl &sourceFileUrl, QObject* parent) :
925+ QObject(parent)
926+ ,d(new ShellManagerPrivate)
927+{
928+ d->q = this;
929+ d->m_sourceFileUrl = sourceFileUrl;
930+
931+ qmlRegisterType<ShellDeclarativeView>("Unity2d", 1, 0, "ShellDeclarativeView");
932+
933+ QDesktopWidget* desktop = QApplication::desktop();
934+
935+ d->updateScreenCount(desktop->screenCount());
936+
937+ connect(desktop, SIGNAL(screenCountChanged(int)), SLOT(onScreenCountChanged(int)));
938+
939+ d->m_superKeyHoldTimer.setSingleShot(true);
940+ d->m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD);
941+ connect(&d->m_superKeyHoldTimer, SIGNAL(timeout()), SLOT(updateSuperKeyHoldState()));
942+
943+ connect(&launcher2dConfiguration(), SIGNAL(superKeyEnableChanged(bool)), SLOT(updateSuperKeyMonitoring()));
944+ updateSuperKeyMonitoring();
945+
946+ /* Alt+F1 reveal the launcher and gives the keyboard focus to the Dash Button. */
947+ Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier);
948+ connect(altF1, SIGNAL(pressed()), SLOT(onAltF1Pressed()));
949+
950+ /* Alt+F2 shows the dash with the commands lens activated. */
951+ Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier);
952+ connect(altF2, SIGNAL(pressed()), SLOT(onAltF2Pressed()));
953+
954+ /* Super+{n} for 0 ≤ n ≤ 9 activates the item with index (n + 9) % 10. */
955+ for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) {
956+ Hotkey* hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier);
957+ connect(hotkey, SIGNAL(pressed()), SLOT(onNumericHotkeyPressed()));
958+ hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier | Qt::ShiftModifier);
959+ connect(hotkey, SIGNAL(pressed()), SLOT(onNumericHotkeyPressed()));
960+ }
961+}
962+
963+ShellManager::~ShellManager()
964+{
965+ qDeleteAll(d->m_viewList);
966+ delete d;
967+}
968+
969+void
970+ShellManager::onScreenCountChanged(int newCount)
971+{
972+ d->updateScreenCount(newCount);
973+}
974+
975+/* ----------------- super key handling ---------------- */
976+
977+void
978+ShellManager::updateSuperKeyHoldState()
979+{
980+ /* If the key was released in the meantime, just do nothing, otherwise
981+ consider the key being held, unless we're told to ignore it. */
982+ if (d->m_superKeyPressed && !d->m_superPressIgnored) {
983+ d->m_superKeyHeld = true;
984+ Q_EMIT superKeyHeldChanged(d->m_superKeyHeld);
985+ }
986+}
987+
988+void
989+ShellManager::updateSuperKeyMonitoring()
990+{
991+ KeyboardModifiersMonitor *modifiersMonitor = KeyboardModifiersMonitor::instance();
992+ KeyMonitor *keyMonitor = KeyMonitor::instance();
993+ HotkeyMonitor& hotkeyMonitor = HotkeyMonitor::instance();
994+
995+ QVariant value = launcher2dConfiguration().property("superKeyEnable");
996+ if (!value.isValid() || value.toBool() == true) {
997+ hotkeyMonitor.enableModifiers(Qt::MetaModifier);
998+ QObject::connect(modifiersMonitor,
999+ SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)),
1000+ this, SLOT(setHotkeysForModifiers(Qt::KeyboardModifiers)));
1001+ /* Ignore Super presses if another key was pressed simultaneously
1002+ (i.e. a shortcut). https://bugs.launchpad.net/unity-2d/+bug/801073 */
1003+ QObject::connect(keyMonitor,
1004+ SIGNAL(keyPressed()),
1005+ this, SLOT(ignoreSuperPress()));
1006+ setHotkeysForModifiers(modifiersMonitor->keyboardModifiers());
1007+ } else {
1008+ hotkeyMonitor.disableModifiers(Qt::MetaModifier);
1009+ QObject::disconnect(modifiersMonitor,
1010+ SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)),
1011+ this, SLOT(setHotkeysForModifiers(Qt::KeyboardModifiers)));
1012+ QObject::disconnect(keyMonitor,
1013+ SIGNAL(keyPressed()),
1014+ this, SLOT(ignoreSuperPress()));
1015+ d->m_superKeyHoldTimer.stop();
1016+ d->m_superKeyPressed = false;
1017+ if (d->m_superKeyHeld) {
1018+ d->m_superKeyHeld = false;
1019+ Q_EMIT superKeyHeldChanged(false);
1020+ }
1021+ }
1022+}
1023+
1024+void
1025+ShellManager::setHotkeysForModifiers(Qt::KeyboardModifiers modifiers)
1026+{
1027+ /* This is the new new state of the Super key (AKA Meta key), while
1028+ d->m_superKeyPressed is the previous state of the key at the last modifiers change. */
1029+ bool superKeyPressed = modifiers.testFlag(Qt::MetaModifier);
1030+
1031+ if (d->m_superKeyPressed != superKeyPressed) {
1032+ d->m_superKeyPressed = superKeyPressed;
1033+ if (superKeyPressed) {
1034+ d->m_superPressIgnored = false;
1035+ /* If the key is pressed, start up a timer to monitor if it's being held short
1036+ enough to qualify as just a "tap" or as a proper hold */
1037+ d->m_superKeyHoldTimer.start();
1038+ } else {
1039+ d->m_superKeyHoldTimer.stop();
1040+
1041+ /* If the key is released, and was not being held, it means that the user just
1042+ performed a "tap". Unless we're told to ignore that tap, that is. */
1043+ if (!d->m_superKeyHeld && !d->m_superPressIgnored) {
1044+ onSuperKeyTapped();
1045+ }
1046+ /* Otherwise the user just terminated a hold. */
1047+ else if(d->m_superKeyHeld){
1048+ d->m_superKeyHeld = false;
1049+ Q_EMIT superKeyHeldChanged(d->m_superKeyHeld);
1050+ }
1051+ }
1052+ }
1053+}
1054+
1055+void
1056+ShellManager::ignoreSuperPress()
1057+{
1058+ /* There was a key pressed, ignore current super tap/hold */
1059+ d->m_superPressIgnored = true;
1060+}
1061+
1062+void
1063+ShellManager::onSuperKeyTapped()
1064+{
1065+ // TODO : In future, All shells should be able to handle the Dash
1066+ // Note: Always, first item in the list is the topLeft shell
1067+ // In any case, just iterate through the list
1068+ Q_FOREACH(ShellDeclarativeView *shell, d->m_viewList) {
1069+ if (shell->isTopLeftShell()) {
1070+ shell->toggleDash();
1071+ break;
1072+ }
1073+ }
1074+}
1075+
1076+bool
1077+ShellManager::superKeyHeld() const
1078+{
1079+ return d->m_superKeyHeld;
1080+}
1081+
1082+/*------------------ Hotkeys Handling -----------------------*/
1083+
1084+void
1085+ShellManager::onAltF1Pressed()
1086+{
1087+ ShellDeclarativeView * activeShell = d->activeShell();
1088+ if (activeShell) {
1089+ activeShell->toggleLauncher();
1090+ }
1091+}
1092+
1093+void
1094+ShellManager::onAltF2Pressed()
1095+{
1096+ ShellDeclarativeView * activeShell = d->activeShell();
1097+ if (activeShell) {
1098+ activeShell->showCommandsLens();
1099+ }
1100+}
1101+
1102+void
1103+ShellManager::onNumericHotkeyPressed()
1104+{
1105+ Hotkey* hotkey = qobject_cast<Hotkey*>(sender());
1106+ if (hotkey) {
1107+ ShellDeclarativeView * activeShell = d->activeShell();
1108+ if (activeShell) {
1109+ activeShell->processNumericHotkey(hotkey);
1110+ }
1111+ }
1112+}
1113
1114=== added file 'shell/app/shellmanager.h'
1115--- shell/app/shellmanager.h 1970-01-01 00:00:00 +0000
1116+++ shell/app/shellmanager.h 2012-02-16 08:16:20 +0000
1117@@ -0,0 +1,58 @@
1118+/*
1119+ * This file is part of unity-2d
1120+ *
1121+ * Copyright 2010 Canonical Ltd.
1122+ *
1123+ * This program is free software; you can redistribute it and/or modify
1124+ * it under the terms of the GNU General Public License as published by
1125+ * the Free Software Foundation; version 3.
1126+ *
1127+ * This program is distributed in the hope that it will be useful,
1128+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1129+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1130+ * GNU General Public License for more details.
1131+ *
1132+ * You should have received a copy of the GNU General Public License
1133+ * along with this program. If not, see <http://www.gnu.org/licenses/>
1134+ */
1135+#ifndef SHELLMANAGER_H
1136+#define SHELLMANAGER_H
1137+
1138+#include <QObject>
1139+struct ShellManagerPrivate;
1140+
1141+class QUrl;
1142+
1143+class ShellManager : public QObject
1144+{
1145+ Q_OBJECT
1146+ Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
1147+
1148+public:
1149+ ShellManager(const QUrl &sourceFileUrl, QObject* parent = 0);
1150+ ~ShellManager();
1151+
1152+ bool superKeyHeld() const;
1153+
1154+Q_SIGNALS:
1155+ void superKeyHeldChanged(bool superKeyHeld);
1156+
1157+private Q_SLOTS:
1158+ void onScreenCountChanged(int);
1159+
1160+ void updateSuperKeyMonitoring();
1161+ void updateSuperKeyHoldState();
1162+ void setHotkeysForModifiers(Qt::KeyboardModifiers modifiers);
1163+ void ignoreSuperPress();
1164+ void onSuperKeyTapped();
1165+
1166+ void onAltF1Pressed();
1167+ void onAltF2Pressed();
1168+ void onNumericHotkeyPressed();
1169+
1170+private:
1171+ Q_DISABLE_COPY(ShellManager)
1172+ ShellManagerPrivate * const d;
1173+};
1174+
1175+#endif // SHELLMANAGER_H
1176
1177=== modified file 'shell/launcher/LauncherList.qml'
1178--- shell/launcher/LauncherList.qml 2012-02-09 11:59:16 +0000
1179+++ shell/launcher/LauncherList.qml 2012-02-16 08:16:20 +0000
1180@@ -93,7 +93,7 @@
1181 }
1182
1183 function updatePips() {
1184- if (item.belongsToDifferentWorkspace()) {
1185+ if (item.belongsToDifferentWorkspace() || item.belongsToDifferentScreen(declarativeView.screen.screen)) {
1186 launcherItem.pips = 1
1187 launcherItem.pipSource = "launcher/artwork/launcher_arrow_outline_ltr.png";
1188 } else {
1189@@ -125,7 +125,7 @@
1190 emblemVisible: item.emblemVisible
1191
1192 /* Launcher of index 0 is the so-called BFB or Dash launcher */
1193- shortcutVisible: declarativeView.superKeyHeld &&
1194+ shortcutVisible: shellManager.superKeyHeld &&
1195 ((item.toString().indexOf("LauncherApplication") == 0 && index > 0 && index <= 10) ||
1196 item.shortcutKey != 0)
1197 shortcutText: {
1198@@ -310,6 +310,7 @@
1199 width, height, xid)
1200 onWindowCountChanged: updatePips()
1201 onWindowWorkspaceChanged: updatePips()
1202+ onWindowGeometryChanged: updatePips()
1203 /* Not all items are applications. */
1204 ignoreUnknownSignals: true
1205 }
1206
1207=== modified file 'shell/launcher/LauncherLoader.qml'
1208--- shell/launcher/LauncherLoader.qml 2012-02-10 11:17:36 +0000
1209+++ shell/launcher/LauncherLoader.qml 2012-02-16 08:16:20 +0000
1210@@ -70,7 +70,7 @@
1211 }
1212
1213 Connections {
1214- target: declarativeView
1215+ target: shellManager
1216 onSuperKeyHeldChanged: {
1217 if (superKeyHeld) visibilityController.beginForceVisible()
1218 else visibilityController.endForceVisible()

Subscribers

People subscribed via source and target branches