Merge lp:~aacid/unity-2d/unity-2d-shell_ignore_super_on_spread into lp:~unity-2d-team/unity-2d/unity-2d-shell

Proposed by Albert Astals Cid
Status: Rejected
Rejected by: Florian Boucault
Proposed branch: lp:~aacid/unity-2d/unity-2d-shell_ignore_super_on_spread
Merge into: lp:~unity-2d-team/unity-2d/unity-2d-shell
Diff against target: 158 lines (+28/-41)
4 files modified
shell/Shell.qml (+9/-9)
shell/app/shell.cpp (+1/-0)
shell/app/shelldeclarativeview.cpp (+14/-31)
shell/app/shelldeclarativeview.h (+4/-1)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d-shell_ignore_super_on_spread
Reviewer Review Type Date Requested Status
Florian Boucault Pending
Review via email: mp+92013@code.launchpad.net

Description of the change

[shell] Ignore Super to show the dash when spread is shown

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

This code means that now the Shell has two SpreadMonitors one instantiated in .cpp and one in .qml. If you want i can remove the one from qml and do
  view.rootContext()->setContextProperty("spreadMonitor", view.spreadMonitor());

985. By Albert Astals Cid

Merge

986. By Albert Astals Cid

Use a single spread monitor

Revision history for this message
Florian Boucault (fboucault) wrote :

Unmerged revisions

986. By Albert Astals Cid

Use a single spread monitor

985. By Albert Astals Cid

Merge

984. By Albert Astals Cid

[shell] Ignore Super to show the dash when spread is shown

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shell/Shell.qml'
2--- shell/Shell.qml 2012-02-08 14:53:49 +0000
3+++ shell/Shell.qml 2012-02-08 16:46:26 +0000
4@@ -65,15 +65,15 @@
5 }
6 }
7
8- SpreadMonitor {
9- id: spread
10- onShownChanged: if (shown) {
11- /* The the spread grabs input and Qt can't properly
12- detect we've lost input, so explicitly hide the menus */
13- launcherLoader.item.hideMenu()
14- launcherLoader.visibilityController.beginForceVisible("spread")
15- }
16- else launcherLoader.visibilityController.endForceVisible("spread")
17+ Connections {
18+ target: spreadMonitor
19+ onShownChanged: if (spreadMonitor.shown) {
20+ /* The the spread grabs input and Qt can't properly
21+ detect we've lost input, so explicitly hide the menus */
22+ launcherLoader.item.hideMenu()
23+ launcherLoader.visibilityController.beginForceVisible("spread")
24+ }
25+ else launcherLoader.visibilityController.endForceVisible("spread")
26 }
27 }
28
29
30=== modified file 'shell/app/shell.cpp'
31--- shell/app/shell.cpp 2012-02-08 11:05:30 +0000
32+++ shell/app/shell.cpp 2012-02-08 16:46:26 +0000
33@@ -87,6 +87,7 @@
34 /* Load the QML UI, focus and show the window */
35 view.setResizeMode(QDeclarativeView::SizeViewToRootObject);
36 view.rootContext()->setContextProperty("declarativeView", &view);
37+ view.rootContext()->setContextProperty("spreadMonitor", view.spreadMonitor());
38 // WARNING This declaration of dashClient used to be in Unity2d/plugin.cpp
39 // but it lead to locks when both the shell and the spread were started
40 // at the same time since SpreadMonitor QDBusServiceWatcher::serviceRegistered
41
42=== modified file 'shell/app/shelldeclarativeview.cpp'
43--- shell/app/shelldeclarativeview.cpp 2012-02-07 11:57:10 +0000
44+++ shell/app/shelldeclarativeview.cpp 2012-02-08 16:46:26 +0000
45@@ -48,11 +48,6 @@
46
47 static const int KEY_HOLD_THRESHOLD = 250;
48
49-static const char* SPREAD_DBUS_SERVICE = "com.canonical.Unity2d.Spread";
50-static const char* SPREAD_DBUS_PATH = "/Spread";
51-static const char* SPREAD_DBUS_INTERFACE = "com.canonical.Unity2d.Spread";
52-static const char* SPREAD_DBUS_METHOD_IS_SHOWN = "IsShown";
53-
54 static const char* COMMANDS_LENS_ID = "commands.lens";
55
56 ShellDeclarativeView::ShellDeclarativeView()
57@@ -164,25 +159,6 @@
58 XA_ATOM, 32, PropModeAppend, (unsigned char *) &propAtom, 1);
59 }
60
61-bool
62-ShellDeclarativeView::isSpreadActive()
63-{
64- /* Check if the spread is present on DBUS first, as we don't want to have DBUS
65- activate it if it's not running yet */
66- QDBusConnectionInterface* sessionBusIFace = QDBusConnection::sessionBus().interface();
67- QDBusReply<bool> reply = sessionBusIFace->isServiceRegistered(SPREAD_DBUS_SERVICE);
68- if (reply.isValid() && reply.value() == true) {
69- QDBusInterface spreadInterface(SPREAD_DBUS_SERVICE, SPREAD_DBUS_PATH,
70- SPREAD_DBUS_INTERFACE);
71-
72- QDBusReply<bool> spreadActiveResult = spreadInterface.call(SPREAD_DBUS_METHOD_IS_SHOWN);
73- if (spreadActiveResult.isValid() && spreadActiveResult.value() == true) {
74- return true;
75- }
76- }
77- return false;
78-}
79-
80 void
81 ShellDeclarativeView::showEvent(QShowEvent *event)
82 {
83@@ -201,7 +177,7 @@
84 We need to do this since the spread can't prevent the launcher from
85 monitoring the super key and therefore getting to this point if
86 it's tapped. */
87- if (isSpreadActive()) {
88+ if (m_spreadMonitor.shown()) {
89 return;
90 }
91
92@@ -272,12 +248,14 @@
93 void
94 ShellDeclarativeView::toggleDash()
95 {
96- if (dashActive()) {
97- setDashActive(false);
98- forceDeactivateWindow();
99- } else {
100- setFocus();
101- Q_EMIT activateHome();
102+ if (!m_spreadMonitor.shown()) {
103+ if (dashActive()) {
104+ setDashActive(false);
105+ forceDeactivateWindow();
106+ } else {
107+ setFocus();
108+ Q_EMIT activateHome();
109+ }
110 }
111 }
112
113@@ -490,3 +468,8 @@
114 {
115 return m_monitoredAreaContainsMouse;
116 }
117+
118+SpreadMonitor *ShellDeclarativeView::spreadMonitor()
119+{
120+ return &m_spreadMonitor;
121+}
122
123=== modified file 'shell/app/shelldeclarativeview.h'
124--- shell/app/shelldeclarativeview.h 2012-02-07 11:57:10 +0000
125+++ shell/app/shelldeclarativeview.h 2012-02-08 16:46:26 +0000
126@@ -18,6 +18,7 @@
127 #define ShellDeclarativeView_H
128
129 // libunity-2d-private
130+#include "spreadmonitor.h"
131 #include "unity2ddeclarativeview.h"
132 #include "unity2dapplication.h"
133
134@@ -65,6 +66,7 @@
135 bool superKeyHeld() const { return m_superKeyHeld; }
136 QRect monitoredArea() const;
137 bool monitoredAreaContainsMouse() const;
138+ SpreadMonitor *spreadMonitor();
139
140 /* setters */
141 Q_SLOT void setDashActive(bool active);
142@@ -117,7 +119,6 @@
143 void focusOutEvent(QFocusEvent* event);
144 void focusInEvent(QFocusEvent* event);
145 void setWMFlags();
146- bool isSpreadActive();
147 void updateInputShape();
148
149 DashMode m_mode;
150@@ -132,6 +133,8 @@
151 QRect m_monitoredArea;
152 bool m_monitoredAreaContainsMouse;
153
154+ SpreadMonitor m_spreadMonitor;
155+
156 friend class DashDBus;
157 friend class LauncherDBus;
158 };

Subscribers

People subscribed via source and target branches