forward cursorshape changes to effectshandler
CCBUG: 322088 REVIEW: 122468
This commit is contained in:
parent
40a06a23a9
commit
31cfd02756
3 changed files with 35 additions and 0 deletions
26
effects.cpp
26
effects.cpp
|
@ -198,6 +198,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
|
|||
, m_desktopRendering(false)
|
||||
, m_currentRenderedDesktop(0)
|
||||
, m_effectLoader(new EffectLoader(this))
|
||||
, m_trackingCursorChanges(0)
|
||||
{
|
||||
connect(m_effectLoader, &AbstractEffectLoader::effectLoaded, this,
|
||||
[this](Effect *effect, const QString &name) {
|
||||
|
@ -1225,6 +1226,31 @@ bool EffectsHandlerImpl::checkInputWindowEvent(QMouseEvent *e)
|
|||
return true;
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::connectNotify(const QMetaMethod &signal)
|
||||
{
|
||||
if (signal == QMetaMethod::fromSignal(&EffectsHandler::cursorShapeChanged)) {
|
||||
if (!m_trackingCursorChanges) {
|
||||
connect(Cursor::self(), &Cursor::cursorChanged, this, &EffectsHandler::cursorShapeChanged);
|
||||
Cursor::self()->startCursorTracking();
|
||||
}
|
||||
++m_trackingCursorChanges;
|
||||
}
|
||||
EffectsHandler::connectNotify(signal);
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::disconnectNotify(const QMetaMethod &signal)
|
||||
{
|
||||
if (signal == QMetaMethod::fromSignal(&EffectsHandler::cursorShapeChanged)) {
|
||||
Q_ASSERT(m_trackingCursorChanges > 0);
|
||||
if (!--m_trackingCursorChanges) {
|
||||
Cursor::self()->stopCursorTracking();
|
||||
disconnect(Cursor::self(), &Cursor::cursorChanged, this, &EffectsHandler::cursorShapeChanged);
|
||||
}
|
||||
}
|
||||
EffectsHandler::disconnectNotify(signal);
|
||||
}
|
||||
|
||||
|
||||
void EffectsHandlerImpl::checkInputWindowStacking()
|
||||
{
|
||||
if (m_grabbedMouseEffects.isEmpty()) {
|
||||
|
|
|
@ -245,6 +245,8 @@ protected Q_SLOTS:
|
|||
void slotPropertyNotify(KWin::Toplevel *t, long atom);
|
||||
|
||||
protected:
|
||||
void connectNotify(const QMetaMethod &signal) override;
|
||||
void disconnectNotify(const QMetaMethod &signal) override;
|
||||
void effectsChanged();
|
||||
void setupClientConnections(KWin::Client *c);
|
||||
void setupUnmanagedConnections(KWin::Unmanaged *u);
|
||||
|
@ -276,6 +278,7 @@ private:
|
|||
Xcb::Window m_mouseInterceptionWindow;
|
||||
QList<Effect*> m_grabbedMouseEffects;
|
||||
EffectLoader *m_effectLoader;
|
||||
int m_trackingCursorChanges;
|
||||
};
|
||||
|
||||
class EffectWindowImpl : public EffectWindow
|
||||
|
|
|
@ -1322,6 +1322,12 @@ Q_SIGNALS:
|
|||
void mouseChanged(const QPoint& pos, const QPoint& oldpos,
|
||||
Qt::MouseButtons buttons, Qt::MouseButtons oldbuttons,
|
||||
Qt::KeyboardModifiers modifiers, Qt::KeyboardModifiers oldmodifiers);
|
||||
/**
|
||||
* Signal emitted when the cursor shape changed.
|
||||
* You'll likely want to query the current cursor as reaction: xcb_xfixes_get_cursor_image_unchecked
|
||||
* Connection to this signal is tracked, so if you don't need it anymore, disconnect from it to stop cursor event filtering
|
||||
*/
|
||||
void cursorShapeChanged();
|
||||
/**
|
||||
* Receives events registered for using @link registerPropertyType.
|
||||
* Use readProperty() to get the property data.
|
||||
|
|
Loading…
Reference in a new issue