Create Cursor instance through Platform
By default the InputRedirectionCursor is created and only the X11 standalone platform creates the X11 specific cursor. This is a preparation step for moving the X11 specific cursor implementation into the x11standalone platform plugin.icc-effect-5.14.5
parent
ec98f498e8
commit
03700500be
16
cursor.cpp
16
cursor.cpp
|
@ -53,21 +53,6 @@ namespace KWin
|
|||
{
|
||||
Cursor *Cursor::s_self = nullptr;
|
||||
|
||||
Cursor *Cursor::create(QObject *parent)
|
||||
{
|
||||
Q_ASSERT(!s_self);
|
||||
#ifndef KCMRULES
|
||||
if (kwinApp()->operationMode() == Application::OperationModeX11) {
|
||||
s_self = new X11Cursor(parent);
|
||||
} else {
|
||||
s_self = new InputRedirectionCursor(parent);
|
||||
}
|
||||
#else
|
||||
s_self = new X11Cursor(parent);
|
||||
#endif
|
||||
return s_self;
|
||||
}
|
||||
|
||||
Cursor::Cursor(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_mousePollingCounter(0)
|
||||
|
@ -75,6 +60,7 @@ Cursor::Cursor(QObject *parent)
|
|||
, m_themeName("default")
|
||||
, m_themeSize(24)
|
||||
{
|
||||
s_self = this;
|
||||
loadThemeSettings();
|
||||
QDBusConnection::sessionBus().connect(QString(), QStringLiteral("/KGlobalSettings"), QStringLiteral("org.kde.KGlobalSettings"),
|
||||
QStringLiteral("notifyChange"), this, SLOT(slotKGlobalSettingsNotifyChange(int,int)));
|
||||
|
|
6
cursor.h
6
cursor.h
|
@ -222,10 +222,11 @@ private:
|
|||
KWIN_SINGLETON(Cursor)
|
||||
};
|
||||
|
||||
class X11Cursor : public Cursor
|
||||
class KWIN_EXPORT X11Cursor : public Cursor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
X11Cursor(QObject *parent);
|
||||
virtual ~X11Cursor();
|
||||
|
||||
void schedulePoll() {
|
||||
|
@ -252,7 +253,6 @@ private Q_SLOTS:
|
|||
void mousePolled();
|
||||
void aboutToBlock();
|
||||
private:
|
||||
X11Cursor(QObject *parent);
|
||||
void initXInput();
|
||||
xcb_cursor_t createCursor(const QByteArray &name);
|
||||
QHash<QByteArray, xcb_cursor_t > m_cursors;
|
||||
|
@ -279,6 +279,7 @@ class InputRedirectionCursor : public Cursor
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InputRedirectionCursor(QObject *parent);
|
||||
virtual ~InputRedirectionCursor();
|
||||
protected:
|
||||
virtual void doSetPos();
|
||||
|
@ -289,7 +290,6 @@ private Q_SLOTS:
|
|||
void slotPointerButtonChanged();
|
||||
void slotModifiersChanged(Qt::KeyboardModifiers mods, Qt::KeyboardModifiers oldMods);
|
||||
private:
|
||||
explicit InputRedirectionCursor(QObject *parent);
|
||||
Qt::MouseButtons m_currentButtons;
|
||||
friend class Cursor;
|
||||
};
|
||||
|
|
|
@ -173,7 +173,7 @@ void DetectDialog::selectWindow()
|
|||
if (!KWin::Cursor::self()) {
|
||||
qApp->setProperty("x11Connection", QVariant::fromValue<void*>(QX11Info::connection()));
|
||||
qApp->setProperty("x11RootWindow", QVariant::fromValue(QX11Info::appRootWindow()));
|
||||
KWin::Cursor::create(this);
|
||||
new X11Cursor(this);
|
||||
}
|
||||
// use a dialog, so that all user input is blocked
|
||||
// use WX11BypassWM and moving away so that it's not actually visible
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -273,7 +273,7 @@ void Application::createInput()
|
|||
LogindIntegration::create(this);
|
||||
auto input = InputRedirection::create(this);
|
||||
input->init();
|
||||
Cursor::create(this);
|
||||
m_platform->createPlatformCursor(this);
|
||||
}
|
||||
|
||||
void Application::createScreens()
|
||||
|
|
|
@ -75,6 +75,11 @@ Edge *Platform::createScreenEdge(ScreenEdges *edges)
|
|||
return new Edge(edges);
|
||||
}
|
||||
|
||||
void Platform::createPlatformCursor(QObject *parent)
|
||||
{
|
||||
new InputRedirectionCursor(parent);
|
||||
}
|
||||
|
||||
void Platform::configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *config)
|
||||
{
|
||||
Q_UNUSED(config)
|
||||
|
|
|
@ -56,6 +56,11 @@ public:
|
|||
* The default implementation creates a Edge.
|
||||
**/
|
||||
virtual Edge *createScreenEdge(ScreenEdges *parent);
|
||||
/**
|
||||
* Allows the platform to create a platform specific Cursor.
|
||||
* The default implementation creates an InputRedirectionCursor.
|
||||
**/
|
||||
virtual void createPlatformCursor(QObject *parent = nullptr);
|
||||
virtual void warpPointer(const QPointF &globalPos);
|
||||
/**
|
||||
* Whether our Compositing EGL display allows a surface less context
|
||||
|
|
|
@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "x11_platform.h"
|
||||
#include "cursor.h"
|
||||
#include "edge.h"
|
||||
#include <kwinconfig.h>
|
||||
#if HAVE_EPOXY_GLX
|
||||
|
@ -84,6 +85,11 @@ Edge *X11StandalonePlatform::createScreenEdge(ScreenEdges *edges)
|
|||
return new WindowBasedEdge(edges);
|
||||
}
|
||||
|
||||
void X11StandalonePlatform::createPlatformCursor(QObject *parent)
|
||||
{
|
||||
new X11Cursor(parent);
|
||||
}
|
||||
|
||||
bool X11StandalonePlatform::requiresCompositing() const
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
Screens *createScreens(QObject *parent = nullptr) override;
|
||||
OpenGLBackend *createOpenGLBackend() override;
|
||||
Edge *createScreenEdge(ScreenEdges *parent) override;
|
||||
void createPlatformCursor(QObject *parent = nullptr) override;
|
||||
bool requiresCompositing() const override;
|
||||
bool compositingPossible() const override;
|
||||
QString compositingNotPossibleReason() const override;
|
||||
|
|
Loading…
Reference in New Issue