don't RE-claim CM selection

stealing it from ourself is reported to be able
to confuse KWindowSystem about the state.
Also it causes minor but unnecessary overhead.

REVIEW: 110231
CCBUG: 179042
icc-effect-5.14.5
Thomas Lübking 2013-04-26 17:11:37 +02:00
parent f668277b1b
commit dc1a489f91
2 changed files with 33 additions and 6 deletions

View File

@ -63,6 +63,16 @@ namespace KWin
extern int currentRefreshRate();
CompositorSelectionOwner::CompositorSelectionOwner(const char *selection) : KSelectionOwner(selection), owning(false)
{
connect (this, SIGNAL(lostOwnership()), SLOT(looseOwnership()));
}
void CompositorSelectionOwner::looseOwnership()
{
owning = false;
}
KWIN_SINGLETON_FACTORY_VARIABLE(Compositor, s_compositor)
Compositor::Compositor(QObject* workspace)
@ -148,11 +158,13 @@ void Compositor::slotCompositingOptionsInitialized()
char selection_name[ 100 ];
sprintf(selection_name, "_NET_WM_CM_S%d", DefaultScreen(display()));
if (!cm_selection) {
cm_selection = new KSelectionOwner(selection_name);
cm_selection = new CompositorSelectionOwner(selection_name);
connect(cm_selection, SIGNAL(lostOwnership()), SLOT(finish()));
}
cm_selection->claim(true); // force claiming
if (!cm_selection->owning) {
cm_selection->claim(true); // force claiming
cm_selection->owning = true;
}
switch(options->compositingMode()) {
case OpenGLCompositing: {
kDebug(1212) << "Initializing OpenGL compositing";
@ -199,6 +211,7 @@ void Compositor::slotCompositingOptionsInitialized()
default:
kDebug(1212) << "No compositing enabled";
m_starting = false;
cm_selection->owning = false;
cm_selection->release();
return;
}
@ -208,6 +221,7 @@ void Compositor::slotCompositingOptionsInitialized()
delete m_scene;
m_scene = NULL;
m_starting = false;
cm_selection->owning = false;
cm_selection->release();
return;
}
@ -316,6 +330,7 @@ void Compositor::releaseCompositorSelection()
return;
}
kDebug(1212) << "Releasing compositor selection";
cm_selection->owning = false;
cm_selection->release();
}

View File

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_COMPOSITE_H
// KWin
#include <kwinglobals.h>
// KDE
#include <KDE/KSelectionOwner>
// Qt
#include <QObject>
#include <QElapsedTimer>
@ -30,13 +32,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QBasicTimer>
#include <QRegion>
class KSelectionOwner;
namespace KWin {
class Client;
class Scene;
class CompositorSelectionOwner : public KSelectionOwner
{
Q_OBJECT
public:
CompositorSelectionOwner(const char *selection);
private:
friend class Compositor;
bool owning;
private slots:
void looseOwnership();
};
class Compositor : public QObject {
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.Compositing")
@ -275,7 +287,7 @@ private:
SuspendReasons m_suspended;
QBasicTimer compositeTimer;
KSelectionOwner* cm_selection;
CompositorSelectionOwner* cm_selection;
QTimer m_releaseSelectionTimer;
uint vBlankInterval, fpsInterval;
int m_xrrRefreshRate;