Merge lp:~tiagosh/unity-2d/bugfix-897640 into lp:unity-2d

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Lohith D Shivamurthy
Approved revision: 817
Merged at revision: 820
Proposed branch: lp:~tiagosh/unity-2d/bugfix-897640
Merge into: lp:unity-2d
Diff against target: 58 lines (+25/-0)
2 files modified
libunity-2d-private/src/unity2ddeclarativeview.cpp (+22/-0)
libunity-2d-private/src/unity2ddeclarativeview.h (+3/-0)
To merge this branch: bzr merge lp:~tiagosh/unity-2d/bugfix-897640
Reviewer Review Type Date Requested Status
Lohith D Shivamurthy (community) Approve
Review via email: mp+85015@code.launchpad.net

Description of the change

When switching between workspaces we need to invalidade the previous active window, as it belongs
to the previous active workspace.

To post a comment you must log in.
Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

It works good and the code is neat and clean.

Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

Thank you

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
2--- libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-12-07 19:20:54 +0000
3+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2011-12-08 19:46:25 +0000
4@@ -28,6 +28,20 @@
5 #include <debug_p.h>
6 #include <config.h>
7
8+// libwnck
9+extern "C" {
10+#include <libwnck/libwnck.h>
11+}
12+
13+#define GOBJECT_CALLBACK0(callbackName, slot) \
14+static void \
15+callbackName(GObject* src, void* dummy1, QObject* dst) \
16+{ \
17+ QMetaObject::invokeMethod(dst, slot); \
18+}
19+
20+GOBJECT_CALLBACK0(activeWorkspaceChangedCB, "onActiveWorkspaceChanged");
21+
22 Unity2DDeclarativeView::Unity2DDeclarativeView(QWidget *parent) :
23 QDeclarativeView(parent),
24 m_useOpenGL(false),
25@@ -40,6 +54,9 @@
26 m_useOpenGL = unity2dConfiguration().property("useOpengl").toBool();
27 }
28
29+ WnckScreen* screen = wnck_screen_get_default();
30+ g_signal_connect(G_OBJECT(screen), "active_workspace_changed", G_CALLBACK(activeWorkspaceChangedCB), this);
31+
32 setupViewport();
33 }
34
35@@ -243,4 +260,9 @@
36 }
37 }
38
39+void Unity2DDeclarativeView::onActiveWorkspaceChanged()
40+{
41+ m_last_focused_window = None;
42+}
43+
44 #include <unity2ddeclarativeview.moc>
45
46=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.h'
47--- libunity-2d-private/src/unity2ddeclarativeview.h 2011-11-18 10:15:49 +0000
48+++ libunity-2d-private/src/unity2ddeclarativeview.h 2011-12-08 19:46:25 +0000
49@@ -53,6 +53,9 @@
50 void forceActivateWindow();
51 void forceDeactivateWindow();
52
53+private Q_SLOTS:
54+ void onActiveWorkspaceChanged();
55+
56 private:
57 void saveActiveWindow();
58 void forceActivateThisWindow(WId);

Subscribers

People subscribed via source and target branches