Rename AbstractBackend to Platform

icc-effect-5.14.5
Martin Gräßlin 2016-04-07 09:18:10 +02:00
parent 1d4cd55b9d
commit 10632f09ca
22 changed files with 86 additions and 87 deletions

View File

@ -30,61 +30,61 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
AbstractBackend::AbstractBackend(QObject *parent)
Platform::Platform(QObject *parent)
: QObject(parent)
{
}
AbstractBackend::~AbstractBackend()
Platform::~Platform()
{
}
QImage AbstractBackend::softwareCursor() const
QImage Platform::softwareCursor() const
{
return input()->pointer()->cursorImage();
}
QPoint AbstractBackend::softwareCursorHotspot() const
QPoint Platform::softwareCursorHotspot() const
{
return input()->pointer()->cursorHotSpot();
}
Screens *AbstractBackend::createScreens(QObject *parent)
Screens *Platform::createScreens(QObject *parent)
{
Q_UNUSED(parent)
return nullptr;
}
OpenGLBackend *AbstractBackend::createOpenGLBackend()
OpenGLBackend *Platform::createOpenGLBackend()
{
return nullptr;
}
QPainterBackend *AbstractBackend::createQPainterBackend()
QPainterBackend *Platform::createQPainterBackend()
{
return nullptr;
}
void AbstractBackend::configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *config)
void Platform::configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *config)
{
Q_UNUSED(config)
qCWarning(KWIN_CORE) << "This backend does not support configuration changes.";
}
void AbstractBackend::setSoftWareCursor(bool set)
void Platform::setSoftWareCursor(bool set)
{
if (m_softWareCursor == set) {
return;
}
m_softWareCursor = set;
if (m_softWareCursor) {
connect(Cursor::self(), &Cursor::posChanged, this, &AbstractBackend::triggerCursorRepaint);
connect(Cursor::self(), &Cursor::posChanged, this, &Platform::triggerCursorRepaint);
} else {
disconnect(Cursor::self(), &Cursor::posChanged, this, &AbstractBackend::triggerCursorRepaint);
disconnect(Cursor::self(), &Cursor::posChanged, this, &Platform::triggerCursorRepaint);
}
}
void AbstractBackend::triggerCursorRepaint()
void Platform::triggerCursorRepaint()
{
if (!Compositor::self()) {
return;
@ -96,7 +96,7 @@ void AbstractBackend::triggerCursorRepaint()
size.width(), size.height());
}
void AbstractBackend::markCursorAsRendered()
void Platform::markCursorAsRendered()
{
if (m_softWareCursor) {
m_cursor.lastRenderedPosition = Cursor::pos();
@ -106,7 +106,7 @@ void AbstractBackend::markCursorAsRendered()
}
}
void AbstractBackend::keyboardKeyPressed(quint32 key, quint32 time)
void Platform::keyboardKeyPressed(quint32 key, quint32 time)
{
if (!input()) {
return;
@ -114,7 +114,7 @@ void AbstractBackend::keyboardKeyPressed(quint32 key, quint32 time)
input()->processKeyboardKey(key, InputRedirection::KeyboardKeyPressed, time);
}
void AbstractBackend::keyboardKeyReleased(quint32 key, quint32 time)
void Platform::keyboardKeyReleased(quint32 key, quint32 time)
{
if (!input()) {
return;
@ -122,7 +122,7 @@ void AbstractBackend::keyboardKeyReleased(quint32 key, quint32 time)
input()->processKeyboardKey(key, InputRedirection::KeyboardKeyReleased, time);
}
void AbstractBackend::keyboardModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group)
void Platform::keyboardModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group)
{
if (!input()) {
return;
@ -130,7 +130,7 @@ void AbstractBackend::keyboardModifiers(uint32_t modsDepressed, uint32_t modsLat
input()->processKeyboardModifiers(modsDepressed, modsLatched, modsLocked, group);
}
void AbstractBackend::keymapChange(int fd, uint32_t size)
void Platform::keymapChange(int fd, uint32_t size)
{
if (!input()) {
return;
@ -138,7 +138,7 @@ void AbstractBackend::keymapChange(int fd, uint32_t size)
input()->processKeymapChange(fd, size);
}
void AbstractBackend::pointerAxisHorizontal(qreal delta, quint32 time)
void Platform::pointerAxisHorizontal(qreal delta, quint32 time)
{
if (!input()) {
return;
@ -146,7 +146,7 @@ void AbstractBackend::pointerAxisHorizontal(qreal delta, quint32 time)
input()->processPointerAxis(InputRedirection::PointerAxisHorizontal, delta, time);
}
void AbstractBackend::pointerAxisVertical(qreal delta, quint32 time)
void Platform::pointerAxisVertical(qreal delta, quint32 time)
{
if (!input()) {
return;
@ -154,7 +154,7 @@ void AbstractBackend::pointerAxisVertical(qreal delta, quint32 time)
input()->processPointerAxis(InputRedirection::PointerAxisVertical, delta, time);
}
void AbstractBackend::pointerButtonPressed(quint32 button, quint32 time)
void Platform::pointerButtonPressed(quint32 button, quint32 time)
{
if (!input()) {
return;
@ -162,7 +162,7 @@ void AbstractBackend::pointerButtonPressed(quint32 button, quint32 time)
input()->processPointerButton(button, InputRedirection::PointerButtonPressed, time);
}
void AbstractBackend::pointerButtonReleased(quint32 button, quint32 time)
void Platform::pointerButtonReleased(quint32 button, quint32 time)
{
if (!input()) {
return;
@ -170,7 +170,7 @@ void AbstractBackend::pointerButtonReleased(quint32 button, quint32 time)
input()->processPointerButton(button, InputRedirection::PointerButtonReleased, time);
}
void AbstractBackend::pointerMotion(const QPointF &position, quint32 time)
void Platform::pointerMotion(const QPointF &position, quint32 time)
{
if (!input()) {
return;
@ -178,7 +178,7 @@ void AbstractBackend::pointerMotion(const QPointF &position, quint32 time)
input()->processPointerMotion(position, time);
}
void AbstractBackend::touchCancel()
void Platform::touchCancel()
{
if (!input()) {
return;
@ -186,7 +186,7 @@ void AbstractBackend::touchCancel()
input()->cancelTouch();
}
void AbstractBackend::touchDown(qint32 id, const QPointF &pos, quint32 time)
void Platform::touchDown(qint32 id, const QPointF &pos, quint32 time)
{
if (!input()) {
return;
@ -194,7 +194,7 @@ void AbstractBackend::touchDown(qint32 id, const QPointF &pos, quint32 time)
input()->processTouchDown(id, pos, time);
}
void AbstractBackend::touchFrame()
void Platform::touchFrame()
{
if (!input()) {
return;
@ -202,7 +202,7 @@ void AbstractBackend::touchFrame()
input()->touchFrame();
}
void AbstractBackend::touchMotion(qint32 id, const QPointF &pos, quint32 time)
void Platform::touchMotion(qint32 id, const QPointF &pos, quint32 time)
{
if (!input()) {
return;
@ -210,7 +210,7 @@ void AbstractBackend::touchMotion(qint32 id, const QPointF &pos, quint32 time)
input()->processTouchMotion(id, pos, time);
}
void AbstractBackend::touchUp(qint32 id, quint32 time)
void Platform::touchUp(qint32 id, quint32 time)
{
if (!input()) {
return;
@ -218,7 +218,7 @@ void AbstractBackend::touchUp(qint32 id, quint32 time)
input()->processTouchUp(id, time);
}
void AbstractBackend::repaint(const QRect &rect)
void Platform::repaint(const QRect &rect)
{
if (!Compositor::self()) {
return;
@ -226,7 +226,7 @@ void AbstractBackend::repaint(const QRect &rect)
Compositor::self()->addRepaint(rect);
}
void AbstractBackend::setReady(bool ready)
void Platform::setReady(bool ready)
{
if (m_ready == ready) {
return;
@ -235,17 +235,17 @@ void AbstractBackend::setReady(bool ready)
emit readyChanged(m_ready);
}
void AbstractBackend::warpPointer(const QPointF &globalPos)
void Platform::warpPointer(const QPointF &globalPos)
{
Q_UNUSED(globalPos)
}
bool AbstractBackend::supportsQpaContext() const
bool Platform::supportsQpaContext() const
{
return hasGLExtension(QByteArrayLiteral("EGL_KHR_surfaceless_context"));
}
EGLDisplay AbstractBackend::sceneEglDisplay() const
EGLDisplay Platform::sceneEglDisplay() const
{
if (Compositor *c = Compositor::self()) {
if (SceneOpenGL *s = dynamic_cast<SceneOpenGL*>(c->scene())) {
@ -255,7 +255,7 @@ EGLDisplay AbstractBackend::sceneEglDisplay() const
return EGL_NO_DISPLAY;
}
EGLContext AbstractBackend::sceneEglContext() const
EGLContext Platform::sceneEglContext() const
{
if (Compositor *c = Compositor::self()) {
if (SceneOpenGL *s = dynamic_cast<SceneOpenGL*>(c->scene())) {
@ -265,12 +265,12 @@ EGLContext AbstractBackend::sceneEglContext() const
return EGL_NO_CONTEXT;
}
QSize AbstractBackend::screenSize() const
QSize Platform::screenSize() const
{
return QSize();
}
QVector<QRect> AbstractBackend::screenGeometries() const
QVector<QRect> Platform::screenGeometries() const
{
return QVector<QRect>({QRect(QPoint(0, 0), screenSize())});
}

View File

@ -39,11 +39,11 @@ class QPainterBackend;
class Screens;
class WaylandCursorTheme;
class KWIN_EXPORT AbstractBackend : public QObject
class KWIN_EXPORT Platform : public QObject
{
Q_OBJECT
public:
virtual ~AbstractBackend();
virtual ~Platform();
virtual void init() = 0;
virtual Screens *createScreens(QObject *parent = nullptr);
@ -149,7 +149,7 @@ Q_SIGNALS:
void screenSizeChanged();
protected:
explicit AbstractBackend(QObject *parent = nullptr);
explicit Platform(QObject *parent = nullptr);
void setSoftWareCursor(bool set);
void handleOutputs() {
m_handlesOutputs = true;
@ -183,6 +183,6 @@ private:
}
Q_DECLARE_INTERFACE(KWin::AbstractBackend, "org.kde.kwin.AbstractBackend")
Q_DECLARE_INTERFACE(KWin::Platform, "org.kde.kwin.Platform")
#endif

View File

@ -94,20 +94,20 @@ void WaylandTestApplication::performStartup()
void WaylandTestApplication::createBackend()
{
AbstractBackend *backend = kwinApp()->platform();
connect(backend, &AbstractBackend::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens);
connect(backend, &AbstractBackend::initFailed, this,
Platform *platform = kwinApp()->platform();
connect(platform, &Platform::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens);
connect(platform, &Platform::initFailed, this,
[] () {
std::cerr << "FATAL ERROR: backend failed to initialize, exiting now" << std::endl;
::exit(1);
}
);
backend->init();
platform->init();
}
void WaylandTestApplication::continueStartupWithScreens()
{
disconnect(kwinApp()->platform(), &AbstractBackend::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens);
disconnect(kwinApp()->platform(), &Platform::screensQueried, this, &WaylandTestApplication::continueStartupWithScreens);
createScreens();
waylandServer()->initOutputs();

View File

@ -60,7 +60,7 @@ namespace KWin
{
DrmBackend::DrmBackend(QObject *parent)
: AbstractBackend(parent)
: Platform(parent)
, m_udev(new Udev)
, m_udevMonitor(m_udev->monitor())
, m_dpmsFilter()
@ -559,7 +559,7 @@ OpenGLBackend *DrmBackend::createOpenGLBackend()
#if HAVE_GBM
return new EglGbmBackend(this);
#else
return AbstractBackend::createOpenGLBackend();
return Platform::createOpenGLBackend();
#endif
}

View File

@ -55,11 +55,11 @@ class UdevMonitor;
class DrmOutput;
class KWIN_EXPORT DrmBackend : public AbstractBackend
class KWIN_EXPORT DrmBackend : public Platform
{
Q_OBJECT
Q_INTERFACES(KWin::AbstractBackend)
Q_PLUGIN_METADATA(IID "org.kde.kwin.AbstractBackend" FILE "drm.json")
Q_INTERFACES(KWin::Platform)
Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "drm.json")
public:
explicit DrmBackend(QObject *parent = nullptr);
virtual ~DrmBackend();

View File

@ -36,7 +36,7 @@ namespace KWin
{
FramebufferBackend::FramebufferBackend(QObject *parent)
: AbstractBackend(parent)
: Platform(parent)
{
setSoftWareCursor(true);
}

View File

@ -27,11 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
class KWIN_EXPORT FramebufferBackend : public AbstractBackend
class KWIN_EXPORT FramebufferBackend : public Platform
{
Q_OBJECT
Q_INTERFACES(KWin::AbstractBackend)
Q_PLUGIN_METADATA(IID "org.kde.kwin.AbstractBackend" FILE "fbdev.json")
Q_INTERFACES(KWin::Platform)
Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "fbdev.json")
public:
explicit FramebufferBackend(QObject *parent = nullptr);
virtual ~FramebufferBackend();

View File

@ -142,7 +142,7 @@ void BacklightInputEventFilter::toggleBacklight()
}
HwcomposerBackend::HwcomposerBackend(QObject *parent)
: AbstractBackend(parent)
: Platform(parent)
{
handleOutputs();
}

View File

@ -44,11 +44,11 @@ namespace KWin
class HwcomposerWindow;
class BacklightInputEventFilter;
class HwcomposerBackend : public AbstractBackend
class HwcomposerBackend : public Platform
{
Q_OBJECT
Q_INTERFACES(KWin::AbstractBackend)
Q_PLUGIN_METADATA(IID "org.kde.kwin.AbstractBackend" FILE "hwcomposer.json")
Q_INTERFACES(KWin::Platform)
Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "hwcomposer.json")
public:
explicit HwcomposerBackend(QObject *parent = nullptr);
virtual ~HwcomposerBackend();

View File

@ -31,7 +31,7 @@ namespace KWin
{
VirtualBackend::VirtualBackend(QObject *parent)
: AbstractBackend(parent)
: Platform(parent)
{
if (qEnvironmentVariableIsSet("KWIN_WAYLAND_VIRTUAL_SCREENSHOTS")) {
m_screenshotDir.reset(new QTemporaryDir);

View File

@ -31,11 +31,11 @@ class QTemporaryDir;
namespace KWin
{
class KWIN_EXPORT VirtualBackend : public AbstractBackend
class KWIN_EXPORT VirtualBackend : public Platform
{
Q_OBJECT
Q_INTERFACES(KWin::AbstractBackend)
Q_PLUGIN_METADATA(IID "org.kde.kwin.AbstractBackend" FILE "virtual.json")
Q_INTERFACES(KWin::Platform)
Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "virtual.json")
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
public:
VirtualBackend(QObject *parent = nullptr);

View File

@ -162,8 +162,8 @@ WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend)
[this] (bool hasTouch) {
if (hasTouch && !m_touch) {
m_touch = m_seat->createTouch(this);
connect(m_touch, &Touch::sequenceCanceled, m_backend, &AbstractBackend::touchCancel);
connect(m_touch, &Touch::frameEnded, m_backend, &AbstractBackend::touchFrame);
connect(m_touch, &Touch::sequenceCanceled, m_backend, &Platform::touchCancel);
connect(m_touch, &Touch::frameEnded, m_backend, &Platform::touchFrame);
connect(m_touch, &Touch::sequenceStarted, this,
[this] (TouchPoint *tp) {
m_backend->touchDown(tp->id(), tp->position(), tp->time());
@ -262,7 +262,7 @@ void WaylandSeat::setInstallCursor(bool install)
}
WaylandBackend::WaylandBackend(QObject *parent)
: AbstractBackend(parent)
: Platform(parent)
, m_display(nullptr)
, m_eventQueue(new EventQueue(this))
, m_registry(new Registry(this))

View File

@ -99,11 +99,11 @@ private:
* It creates the connection to the Wayland Compositor, sets up the registry and creates
* the Wayland surface and its shell mapping.
*/
class KWIN_EXPORT WaylandBackend : public AbstractBackend
class KWIN_EXPORT WaylandBackend : public Platform
{
Q_OBJECT
Q_INTERFACES(KWin::AbstractBackend)
Q_PLUGIN_METADATA(IID "org.kde.kwin.AbstractBackend" FILE "wayland.json")
Q_INTERFACES(KWin::Platform)
Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "wayland.json")
public:
explicit WaylandBackend(QObject *parent = nullptr);
virtual ~WaylandBackend();

View File

@ -45,7 +45,7 @@ namespace KWin
{
X11WindowedBackend::X11WindowedBackend(QObject *parent)
: AbstractBackend(parent)
: Platform(parent)
{
setSupportsPointerWarping(true);
connect(this, &X11WindowedBackend::sizeChanged, this, &X11WindowedBackend::screenSizeChanged);

View File

@ -36,11 +36,11 @@ class NETWinInfo;
namespace KWin
{
class KWIN_EXPORT X11WindowedBackend : public AbstractBackend
class KWIN_EXPORT X11WindowedBackend : public Platform
{
Q_OBJECT
Q_INTERFACES(KWin::AbstractBackend)
Q_PLUGIN_METADATA(IID "org.kde.kwin.AbstractBackend" FILE "x11.json")
Q_INTERFACES(KWin::Platform)
Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "x11.json")
Q_PROPERTY(QSize size READ screenSize NOTIFY sizeChanged)
public:
X11WindowedBackend(QObject *parent = nullptr);

View File

@ -119,7 +119,7 @@ Compositor::Compositor(QObject* workspace)
if (kwinApp()->platform()->isReady()) {
QMetaObject::invokeMethod(this, "setup", Qt::QueuedConnection);
}
connect(kwinApp()->platform(), &AbstractBackend::readyChanged, this,
connect(kwinApp()->platform(), &Platform::readyChanged, this,
[this] (bool ready) {
if (ready) {
setup();

View File

@ -533,7 +533,7 @@ QProcessEnvironment Application::processStartupEnvironment() const
void Application::initPlatform(const KPluginMetaData &plugin)
{
Q_ASSERT(!m_platform);
m_platform = qobject_cast<AbstractBackend*>(plugin.instantiate());
m_platform = qobject_cast<Platform *>(plugin.instantiate());
if (m_platform) {
m_platform->setParent(this);
#if HAVE_INPUT

6
main.h
View File

@ -39,7 +39,7 @@ class QCommandLineParser;
namespace KWin
{
class AbstractBackend;
class Platform;
class XcbEventFilter : public QAbstractNativeEventFilter
{
@ -165,7 +165,7 @@ public:
virtual QProcessEnvironment processStartupEnvironment() const;
void initPlatform(const KPluginMetaData &plugin);
AbstractBackend *platform() const {
Platform *platform() const {
return m_platform;
}
@ -233,7 +233,7 @@ private:
#ifdef KWIN_BUILD_ACTIVITIES
bool m_useKActivities = true;
#endif
AbstractBackend *m_platform = nullptr;
Platform *m_platform = nullptr;
static int crashes;
};

View File

@ -130,20 +130,19 @@ void ApplicationWayland::setupCrashHandler()
void ApplicationWayland::createBackend()
{
AbstractBackend *backend = kwinApp()->platform();
connect(backend, &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
connect(backend, &AbstractBackend::initFailed, this,
connect(platform(), &Platform::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
connect(platform(), &Platform::initFailed, this,
[] () {
std::cerr << "FATAL ERROR: backend failed to initialize, exiting now" << std::endl;
::exit(1);
}
);
backend->init();
platform()->init();
}
void ApplicationWayland::continueStartupWithScreens()
{
disconnect(kwinApp()->platform(), &AbstractBackend::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
disconnect(kwinApp()->platform(), &Platform::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
createScreens();
waylandServer()->initOutputs();

View File

@ -122,7 +122,7 @@ void PointerInputRedirection::init()
Q_ASSERT(!m_inited);
m_cursor = new CursorImage(this);
m_inited = true;
connect(m_cursor, &CursorImage::changed, kwinApp()->platform(), &AbstractBackend::cursorChanged);
connect(m_cursor, &CursorImage::changed, kwinApp()->platform(), &Platform::cursorChanged);
emit m_cursor->changed();
connect(workspace(), &Workspace::stackingOrderChanged, this, &PointerInputRedirection::update);
connect(screens(), &Screens::changed, this, &PointerInputRedirection::updateAfterScreenChange);

View File

@ -184,7 +184,7 @@ int Screens::intersecting(const QRect &r) const
return cnt;
}
BasicScreens::BasicScreens(AbstractBackend *backend, QObject *parent)
BasicScreens::BasicScreens(Platform *backend, QObject *parent)
: Screens(parent)
, m_backend(backend)
{
@ -196,7 +196,7 @@ void BasicScreens::init()
{
KWin::Screens::init();
#ifndef KWIN_UNIT_TEST
connect(m_backend, &AbstractBackend::screenSizeChanged,
connect(m_backend, &Platform::screenSizeChanged,
this, &BasicScreens::startChangedTimer);
#endif
updateCount();

View File

@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
class AbstractClient;
class AbstractBackend;
class Platform;
class KWIN_EXPORT Screens : public QObject
{
@ -157,7 +157,7 @@ class KWIN_EXPORT BasicScreens : public Screens
{
Q_OBJECT
public:
BasicScreens(AbstractBackend *backend, QObject *parent = nullptr);
BasicScreens(Platform *backend, QObject *parent = nullptr);
virtual ~BasicScreens();
void init() override;
@ -167,7 +167,7 @@ public:
void updateCount() override;
private:
AbstractBackend *m_backend;
Platform *m_backend;
QVector<QRect> m_geometries;
};