Merge lp:~pete-woods/hud/13.10-lp1238420 into lp:hud/13.10

Proposed by Pete Woods
Status: Rejected
Rejected by: Ted Gould
Proposed branch: lp:~pete-woods/hud/13.10-lp1238420
Merge into: lp:hud/13.10
Diff against target: 107 lines (+37/-14)
1 file modified
window-stack-bridge/BamfWindowStack.cpp (+37/-14)
To merge this branch: bzr merge lp:~pete-woods/hud/13.10-lp1238420
Reviewer Review Type Date Requested Status
Ted Gould (community) Disapprove
Charles Kerr (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+208347@code.launchpad.net

Commit message

Backport fixes to window stack bridge

Description of the change

Backport fixes to window stack bridge

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Seems to be killing test-application-list...?

review: Needs Fixing
Revision history for this message
Ted Gould (ted) wrote :

13.10 is no longer a supported release.

review: Disapprove

Unmerged revisions

348. By Pete Woods

Backport fixes to BamfWindowStack

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'window-stack-bridge/BamfWindowStack.cpp'
--- window-stack-bridge/BamfWindowStack.cpp 2013-11-04 17:38:54 +0000
+++ window-stack-bridge/BamfWindowStack.cpp 2014-02-26 12:07:32 +0000
@@ -57,12 +57,13 @@
57 QDBusPendingReply<QString> desktopFileReply(application.DesktopFile());57 QDBusPendingReply<QString> desktopFileReply(application.DesktopFile());
58 desktopFileReply.waitForFinished();58 desktopFileReply.waitForFinished();
59 if (desktopFileReply.isError()) {59 if (desktopFileReply.isError()) {
60 qWarning() << _("Could not get desktop file for") << path;60 qWarning() << _("Could not get desktop file for") << path
61 << desktopFileReply.error();
61 m_error = true;62 m_error = true;
62 return;63 return;
63 } else {64 } else {
64 QFile desktopFile(desktopFileReply);65 QString desktopFile(desktopFileReply);
65 if (desktopFile.exists()) {66 if (!desktopFile.isEmpty()) {
66 m_applicationId = QFileInfo(desktopFile).baseName();67 m_applicationId = QFileInfo(desktopFile).baseName();
67 }68 }
68 }69 }
@@ -160,6 +161,7 @@
160}161}
161162
162QString BamfWindowStack::GetAppIdFromPid(uint pid) {163QString BamfWindowStack::GetAppIdFromPid(uint pid) {
164 Q_UNUSED(pid);
163 // FIXME Not implemented165 // FIXME Not implemented
164 sendErrorReply(QDBusError::NotSupported,166 sendErrorReply(QDBusError::NotSupported,
165 "GetAppIdFromPid method not implemented");167 "GetAppIdFromPid method not implemented");
@@ -169,17 +171,33 @@
169QList<WindowInfo> BamfWindowStack::GetWindowStack() {171QList<WindowInfo> BamfWindowStack::GetWindowStack() {
170 QList<WindowInfo> results;172 QList<WindowInfo> results;
171173
172 QStringList stack(m_matcher.WindowStackForMonitor(-1));174 QDBusPendingReply<QStringList> stackReply(
175 m_matcher.WindowStackForMonitor(-1));
176 stackReply.waitForFinished();
177 if (stackReply.isError()) {
178 qWarning() << "Failed to get BAMF window stack" << stackReply.error();
179 return results;
180 }
181
182 QStringList stack(stackReply);
173 for (const QString &path : stack) {183 for (const QString &path : stack) {
174 const auto window (m_windows[path]);184 const auto window(m_windows[path]);
175 if (window) {185 if (window) {
176 results << WindowInfo(window->windowId(),186 results
177 window->applicationId(),187 << WindowInfo(window->windowId(), window->applicationId(),
178 false);188 false);
179 }189 }
180 }190 }
181191
182 const auto window (m_windows[m_matcher.ActiveWindow()]);192 QDBusPendingReply<QString> activeWindowReply(m_matcher.ActiveWindow());
193 activeWindowReply.waitForFinished();
194 if (activeWindowReply.isError()) {
195 qWarning() << "Failed to get BAMF active window"
196 << activeWindowReply.error();
197 return results;
198 }
199
200 const auto window(m_windows[activeWindowReply]);
183 if (window) {201 if (window) {
184 const uint windowId(window->windowId());202 const uint windowId(window->windowId());
185203
@@ -195,8 +213,9 @@
195213
196QStringList BamfWindowStack::GetWindowProperties(uint windowId,214QStringList BamfWindowStack::GetWindowProperties(uint windowId,
197 const QString &appId, const QStringList &names) {215 const QString &appId, const QStringList &names) {
216 Q_UNUSED(appId);
198 QStringList result;217 QStringList result;
199 auto window = m_windowsById[windowId];218 const auto window = m_windowsById[windowId];
200219
201 if (window == nullptr) {220 if (window == nullptr) {
202 sendErrorReply(QDBusError::InvalidArgs, "Unable to find windowId");221 sendErrorReply(QDBusError::InvalidArgs, "Unable to find windowId");
@@ -204,19 +223,23 @@
204 }223 }
205224
206 for (const QString &name : names) {225 for (const QString &name : names) {
207 result << window->xProp(name);226 if (window) {
227 result << window->xProp(name);
228 } else {
229 result << QString();
230 }
208 }231 }
209 return result;232 return result;
210}233}
211234
212void BamfWindowStack::ActiveWindowChanged(const QString &oldWindowPath,235void BamfWindowStack::ActiveWindowChanged(const QString &oldWindowPath,
213 const QString &newWindowPath) {236 const QString &newWindowPath) {
237 Q_UNUSED(oldWindowPath);
214 if (!newWindowPath.isEmpty()) {238 if (!newWindowPath.isEmpty()) {
215 const auto window(m_windows[newWindowPath]);239 const auto window(m_windows[newWindowPath]);
216 if (window) {240 if (window) {
217 FocusedWindowChanged(window->windowId(),241 FocusedWindowChanged(window->windowId(), window->applicationId(),
218 window->applicationId(),242 WindowInfo::MAIN);
219 WindowInfo::MAIN);
220 }243 }
221 }244 }
222}245}

Subscribers

People subscribed via source and target branches