Merge lp:~fkrull/unity-2d/compiz-integration into lp:unity-2d/3.0

Proposed by Felix Krull
Status: Merged
Merge reported by: Florian Boucault
Merged at revision: not available
Proposed branch: lp:~fkrull/unity-2d/compiz-integration
Merge into: lp:unity-2d/3.0
Diff against target: 168 lines (+76/-34)
3 files modified
launcher/UnityApplications/launcherapplication.cpp (+34/-12)
launcher/UnityApplications/workspaces.cpp (+20/-9)
launcher/app/launcherview.cpp (+22/-13)
To merge this branch: bzr merge lp:~fkrull/unity-2d/compiz-integration
Reviewer Review Type Date Requested Status
Florian Boucault (community) code Approve
Review via email: mp+57896@code.launchpad.net

Description of the change

For the workspaces and window overviews, trigger Compiz's Expo and Scale plugins if Compiz is running. If Compiz isn't running, said plugins aren't enabled or the D-Bus plugin isn't enabled, fall back to using unity-2d-spread.

See also https://bugs.launchpad.net/unity-2d/+bug/760674

How to test:
Log into Unity 2D. Run `compiz --replace`. Using ccsm, make sure that the Expo, Scale and D-Bus plugins for Compiz are enabled. Trigger the workspace or window overview.

To post a comment you must log in.
534. By Felix Krull

Also invoke Expo plugin on Super+S keypress.

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

Although the code looks generally ok, I am unable to test it for a lack of D-Bus service 'org.freedesktop.compiz'. I carefully activated Expo, Scale and D-Bus plugins in ccsm. Any tips?

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

Note there is a conflict with trunk.

review: Needs Fixing
Revision history for this message
Felix Krull (fkrull) wrote :

I can't really reproduce your problem regarding D-Bus. Having just enabled the plugin, I can see that service just fine (in qdbusviewer). Anyway, how would I resolve that conflict with trunk? I tried to rebase, but couldn't push that -- obviously, really. Or would I just pull and merge from trunk?

Revision history for this message
Olivier Tilloy (osomon) wrote :

Felix, you’ll need to merge the latest trunk into your branch and solve the conflict(s) there. Once this is done, commit and push to lp:~fkrull/unity-2d/compiz-integration. Thanks!

535. By Felix Krull

Merged trunk (r557).

536. By Felix Krull

Merged r560 from trunk.

Revision history for this message
Felix Krull (fkrull) wrote :

I've resolved any conflicts, but I noticed another problem with the code: Activating the window overview for an application doesn't work correctly using the Super+<Number> shortcut keys.

a) The overview doesn't appear as soon as you press the number button (and toggles quickly when kept pressed), but only when you release it. Also, one has to keep the keys pressed for a time (half a second, maybe), otherwise nothing happens.
b) It only affects the keyboard shortcuts. Activating the overview by clicking on an icon in the launcher works perfectly. Also, holding Super and then clicking an icon works as well.
c) It only affects the window overview with Compiz's Scale plugin. Switching to the application when it is not focused works, as does activating the unity-2d-spread 2D overview, *as does activating Compiz's Expo plugin*.

I have honestly no idea what this is about. I can only guess that there is some weird quirk or bug with the Scale plugin. I don't think it's a bug in my code, because I can't imagine where that would come from. Anyway, with that in mind, you might or might not want to actually merge this; I think it's OK apart from this one problem.

(Do I need to select resubmit here or anything?)

Revision history for this message
Olivier Tilloy (osomon) wrote :

No need for a resubmit or any additional interaction on your part Felix. Thanks for your work, we’ll make sure to look into it soon.

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

After resolving some new conflicts that arose with the latest trunk I performed some functional testing and I must say that it works really well! Even the Super+<Number> shortcut keys :)

I will finish checking a bit more the code and then it's good to go. Well done Felix!

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

Merge with trunk was done in branch: lp:~fboucault/unity-2d/compiz-integration

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

Felix, I think the code is good. I added one simplification for which I would love to have your feedback on. It's in the last revision of lp:~fboucault/unity-2d/compiz-integration

If that change is ok with you then I suggest we merge the whole thing in trunk.

review: Approve (code)
Revision history for this message
Felix Krull (fkrull) wrote :

Yeah, sure, no problem with that ;) I'm not really familiar with Qt, so I just guessed there; your variant is certainly simpler.

The number shortcuts consistently don't work as I described both on my main system and in a clean Natty VM. If it works for you, did you do anything weird or do you have a different Compiz or something?

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

Thanks Felix, it's now merged in trunk and will be part of tomorrow's daily build.

I don't think I have any strange Compiz version or configuration. In case that was not clear, I am using my laptop's keyboard with no external keyboard connected and pressing the number keys that are above the letters.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/UnityApplications/launcherapplication.cpp'
--- launcher/UnityApplications/launcherapplication.cpp 2011-04-28 13:09:25 +0000
+++ launcher/UnityApplications/launcherapplication.cpp 2011-05-14 15:59:28 +0000
@@ -50,6 +50,7 @@
50#include <debug_p.h>50#include <debug_p.h>
5151
52// Qt52// Qt
53#include <Qt>
53#include <QDebug>54#include <QDebug>
54#include <QAction>55#include <QAction>
55#include <QDBusInterface>56#include <QDBusInterface>
@@ -57,6 +58,7 @@
57#include <QFile>58#include <QFile>
58#include <QFileSystemWatcher>59#include <QFileSystemWatcher>
59#include <QScopedPointer>60#include <QScopedPointer>
61#include <QX11Info>
6062
61extern "C" {63extern "C" {
62#include <libsn/sn.h>64#include <libsn/sn.h>
@@ -767,21 +769,41 @@
767void769void
768LauncherApplication::spread(bool showAllWorkspaces)770LauncherApplication::spread(bool showAllWorkspaces)
769{771{
770 QDBusInterface iface("com.canonical.Unity2d.Spread", "/Spread",772 QDBusInterface compiz("org.freedesktop.compiz",
771 "com.canonical.Unity2d.Spread");773 "/org/freedesktop/compiz/scale/screen0/initiate_all_key",
772 QDBusReply<bool> isShown = iface.call("IsShown");774 "org.freedesktop.compiz");
773 if (isShown.isValid()) {775
774 if (isShown.value() == true) {776 if (compiz.isValid()) {
775 iface.asyncCall("FilterByApplication", m_application->desktop_file());777 Qt::HANDLE root = QX11Info::appRootWindow();
776 } else {778 BamfUintList* xids = m_application->xids();
777 if (showAllWorkspaces) {779 QString match = "";
778 iface.asyncCall("ShowAllWorkspaces", m_application->desktop_file());780 for (int i = 0; i < xids->size(); i++) {
781 uint xid = xids->at(i);
782 match.append("xid=");
783 QVariant tmp(xid);
784 match.append(tmp.toString());
785 if (i < xids->size() - 1) {
786 match.append(" | ");
787 }
788 }
789 compiz.asyncCall("activate", "root", static_cast<int>(root), "match", match);
790 } else {
791 QDBusInterface spread("com.canonical.Unity2d.Spread", "/Spread",
792 "com.canonical.Unity2d.Spread");
793 QDBusReply<bool> isShown = spread.call("IsShown");
794 if (isShown.isValid()) {
795 if (isShown.value() == true) {
796 spread.asyncCall("FilterByApplication", m_application->desktop_file());
779 } else {797 } else {
780 iface.asyncCall("ShowCurrentWorkspace", m_application->desktop_file());798 if (showAllWorkspaces) {
799 spread.asyncCall("ShowAllWorkspaces", m_application->desktop_file());
800 } else {
801 spread.asyncCall("ShowCurrentWorkspace", m_application->desktop_file());
802 }
781 }803 }
804 } else {
805 UQ_WARNING << "Failed to get property IsShown on com.canonical.Unity2d.Spread";
782 }806 }
783 } else {
784 UQ_WARNING << "Failed to get property IsShown on com.canonical.Unity2d.Spread";
785 }807 }
786}808}
787809
788810
=== modified file 'launcher/UnityApplications/workspaces.cpp'
--- launcher/UnityApplications/workspaces.cpp 2011-04-28 13:09:25 +0000
+++ launcher/UnityApplications/workspaces.cpp 2011-05-14 15:59:28 +0000
@@ -23,6 +23,8 @@
2323
24#include <QDBusInterface>24#include <QDBusInterface>
25#include <QDBusReply>25#include <QDBusReply>
26#include <Qt>
27#include <QX11Info>
2628
27// libunity-2d29// libunity-2d
28#include <unity2dtr.h>30#include <unity2dtr.h>
@@ -85,17 +87,26 @@
85void87void
86Workspaces::activate()88Workspaces::activate()
87{89{
88 QDBusInterface iface("com.canonical.Unity2d.Spread", "/Spread",90 QDBusInterface compiz("org.freedesktop.compiz",
89 "com.canonical.Unity2d.Spread");91 "/org/freedesktop/compiz/expo/screen0/expo_key",
90 QDBusReply<bool> isShown = iface.call("IsShown");92 "org.freedesktop.compiz");
91 if (isShown.isValid()) {93
92 if (isShown.value() == true) {94 if (compiz.isValid()) {
93 iface.asyncCall("FilterByApplication", QString());95 Qt::HANDLE root = QX11Info::appRootWindow();
96 compiz.asyncCall("activate", "root", static_cast<int>(root));
97 } else {
98 QDBusInterface spread("com.canonical.Unity2d.Spread", "/Spread",
99 "com.canonical.Unity2d.Spread");
100 QDBusReply<bool> isShown = spread.call("IsShown");
101 if (isShown.isValid()) {
102 if (isShown.value() == true) {
103 spread.asyncCall("FilterByApplication", QString());
104 } else {
105 spread.asyncCall("ShowAllWorkspaces", QString());
106 }
94 } else {107 } else {
95 iface.asyncCall("ShowAllWorkspaces", QString());108 UQ_WARNING << "Failed to get property IsShown on com.canonical.Unity2d.Spread";
96 }109 }
97 } else {
98 UQ_WARNING << "Failed to get property IsShown on com.canonical.Unity2d.Spread";
99 }110 }
100}111}
101112
102113
=== modified file 'launcher/app/launcherview.cpp'
--- launcher/app/launcherview.cpp 2011-05-03 18:34:05 +0000
+++ launcher/app/launcherview.cpp 2011-05-14 15:59:28 +0000
@@ -344,19 +344,28 @@
344void344void
345LauncherView::showWorkspaceSwitcher()345LauncherView::showWorkspaceSwitcher()
346{346{
347 QDBusInterface spreadInterface(SPREAD_DBUS_SERVICE, SPREAD_DBUS_PATH, SPREAD_DBUS_INTERFACE);347 QDBusInterface compiz("org.freedesktop.compiz",
348348 "/org/freedesktop/compiz/expo/screen0/expo_key",
349 /* Here we only show the spread, if it's hidden.349 "org.freedesktop.compiz");
350 However on Super+s the spread should exit if it's already running.350
351 That is done directly in spread/Workspaces.qml because the spread351 if (compiz.isValid()) {
352 fully grabs the keyboard, so it's the only place where Super+s can352 Qt::HANDLE root = QX11Info::appRootWindow();
353 be handled while the spread is active */353 compiz.asyncCall("activate", "root", static_cast<int>(root));
354 QDBusReply<bool> isShown = spreadInterface.call("IsShown");354 } else {
355 if (isShown.isValid()) {355 QDBusInterface spreadInterface(SPREAD_DBUS_SERVICE, SPREAD_DBUS_PATH, SPREAD_DBUS_INTERFACE);
356 if (isShown.value() == false) {356
357 spreadInterface.asyncCall("ShowAllWorkspaces", QString());357 /* Here we only show the spread, if it's hidden.
358 However on Super+s the spread should exit if it's already running.
359 That is done directly in spread/Workspaces.qml because the spread
360 fully grabs the keyboard, so it's the only place where Super+s can
361 be handled while the spread is active */
362 QDBusReply<bool> isShown = spreadInterface.call("IsShown");
363 if (isShown.isValid()) {
364 if (isShown.value() == false) {
365 spreadInterface.asyncCall("ShowAllWorkspaces", QString());
366 }
367 } else {
368 UQ_WARNING << "Failed to get property IsShown on" << SPREAD_DBUS_SERVICE;
358 }369 }
359 } else {
360 UQ_WARNING << "Failed to get property IsShown on" << SPREAD_DBUS_SERVICE;
361 }370 }
362}371}

Subscribers

People subscribed via source and target branches