Remove KWin::display from kwinglobals
Summary: And finally nothing inside libkwineffects, libkwinglutils, libkwinxrenderutils and kwineffect and kwin core uses KWin::display. We are finally XLib free! This change drops KWin::display and removes the include to QX11Info from kwinglobals.h. And the libraries no longer need to link X11Extras. Due to that removal a few seeming unrelated changes are required to add the include where needed and linkage to X11Extras. The biggest change is to x11 platform plugin which still needs the display and caches it in the Platform and passes it to various places in a way that the code doesn't need to be adjusted. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D3337
This commit is contained in:
parent
d7fa827644
commit
346619aa36
21 changed files with 43 additions and 24 deletions
|
@ -134,6 +134,7 @@ add_executable( testBuiltInEffectLoader ${testBuiltInEffectLoader_SRCS})
|
|||
target_link_libraries(testBuiltInEffectLoader
|
||||
Qt5::Concurrent
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
KF5::Package
|
||||
kwineffects
|
||||
kwin4_effect_builtins
|
||||
|
@ -160,6 +161,7 @@ target_link_libraries(testScriptedEffectLoader
|
|||
Qt5::Concurrent
|
||||
Qt5::Script
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
KF5::ConfigGui
|
||||
KF5::GlobalAccel
|
||||
KF5::I18n
|
||||
|
@ -184,6 +186,7 @@ add_executable( testPluginEffectLoader ${testPluginEffectLoader_SRCS})
|
|||
target_link_libraries(testPluginEffectLoader
|
||||
Qt5::Concurrent
|
||||
Qt5::Test
|
||||
Qt5::X11Extras
|
||||
KF5::Package
|
||||
kwineffects
|
||||
kwin4_effect_builtins
|
||||
|
|
|
@ -21,6 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define MOCK_EFFECTS_HANDLER_H
|
||||
|
||||
#include <kwineffects.h>
|
||||
#include <QX11Info>
|
||||
|
||||
class MockEffectsHandler : public KWin::EffectsHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Qt
|
||||
#include <QApplication>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QX11Info>
|
||||
// xcb
|
||||
#include <xcb/xcb.h>
|
||||
// system
|
||||
|
|
|
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KConfigGroup>
|
||||
// Qt
|
||||
#include <QtTest/QtTest>
|
||||
#include <QX11Info>
|
||||
// xcb
|
||||
#include <xcb/xcb.h>
|
||||
Q_DECLARE_METATYPE(KWin::ElectricBorder)
|
||||
|
|
|
@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Qt
|
||||
#include <QApplication>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QX11Info>
|
||||
#include <netwm.h>
|
||||
// xcb
|
||||
#include <xcb/xcb.h>
|
||||
|
|
|
@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Qt
|
||||
#include <QApplication>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QX11Info>
|
||||
// xcb
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Qt
|
||||
#include <QApplication>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QX11Info>
|
||||
#include <netwm.h>
|
||||
// xcb
|
||||
#include <xcb/xcb.h>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <KLocalizedString>
|
||||
#include <kwindowsystem.h>
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
#include <fixx11h.h>
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ set(kwin_EFFECTSLIB_SRCS
|
|||
set(kwineffects_QT_LIBS
|
||||
Qt5::DBus
|
||||
Qt5::Widgets
|
||||
Qt5::X11Extras
|
||||
)
|
||||
|
||||
set(kwineffects_KDE_LIBS
|
||||
|
@ -91,7 +90,7 @@ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
|
|||
include_directories(${glinclude})
|
||||
add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
|
||||
generate_export_header(${name} BASE_NAME kwinglutils EXPORT_FILE_NAME kwinglutils_export.h)
|
||||
target_link_libraries(${name} PUBLIC Qt5::DBus Qt5::X11Extras XCB::XCB KF5::CoreAddons KF5::WindowSystem)
|
||||
target_link_libraries(${name} PUBLIC Qt5::DBus XCB::XCB KF5::CoreAddons KF5::WindowSystem)
|
||||
set_target_properties(${name} PROPERTIES
|
||||
VERSION ${KWINEFFECTS_VERSION_STRING}
|
||||
SOVERSION ${KWINEFFECTS_SOVERSION}
|
||||
|
|
|
@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QImage>
|
||||
#include <QPoint>
|
||||
#include <QVariant>
|
||||
#include <QtX11Extras/QX11Info>
|
||||
#include <QCoreApplication>
|
||||
#include <QVariant>
|
||||
|
||||
|
@ -130,16 +129,6 @@ enum PointerAxisDirection {
|
|||
PointerAxisRight
|
||||
};
|
||||
|
||||
inline
|
||||
KWIN_EXPORT Display* display()
|
||||
{
|
||||
static Display *s_display = nullptr;
|
||||
if (!s_display && QX11Info::isPlatformX11()) {
|
||||
s_display = QX11Info::display();
|
||||
}
|
||||
return s_display;
|
||||
}
|
||||
|
||||
inline
|
||||
KWIN_EXPORT xcb_connection_t *connection()
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QX11Info>
|
||||
|
||||
// system
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -439,7 +440,7 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
|
|||
argv[0], qPrintable(a.platformName()));
|
||||
exit(1);
|
||||
}
|
||||
if (!KWin::display()) {
|
||||
if (!QX11Info::display()) {
|
||||
fprintf(stderr, "%s: FATAL ERROR KWin requires Xlib support in the xcb plugin. Do not configure Qt with -no-xcb-xlib\n",
|
||||
argv[0]);
|
||||
exit(1);
|
||||
|
|
|
@ -38,14 +38,14 @@ Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtCriticalMsg)
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
EglOnXBackend::EglOnXBackend()
|
||||
EglOnXBackend::EglOnXBackend(Display *display)
|
||||
: AbstractEglBackend()
|
||||
, m_overlayWindow(new OverlayWindow())
|
||||
, surfaceHasSubPost(0)
|
||||
, m_bufferAge(0)
|
||||
, m_usesOverlayWindow(true)
|
||||
, m_connection(connection())
|
||||
, m_x11Display(display())
|
||||
, m_x11Display(display)
|
||||
, m_rootWindow(rootWindow())
|
||||
, m_x11ScreenNumber(kwinApp()->x11ScreenNumber())
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace KWin
|
|||
class KWIN_EXPORT EglOnXBackend : public AbstractEglBackend
|
||||
{
|
||||
public:
|
||||
EglOnXBackend();
|
||||
EglOnXBackend(Display *display);
|
||||
explicit EglOnXBackend(xcb_connection_t *connection, Display *display, xcb_window_t rootWindow, int screenNumber, xcb_window_t renderingWindow);
|
||||
virtual ~EglOnXBackend();
|
||||
virtual void screenGeometryChanged(const QSize &size);
|
||||
|
|
|
@ -37,6 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Qt
|
||||
#include <QDebug>
|
||||
#include <QOpenGLContext>
|
||||
#include <QX11Info>
|
||||
// system
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -105,7 +106,7 @@ bool SwapEventFilter::event(xcb_generic_event_t *event)
|
|||
|
||||
|
||||
|
||||
GlxBackend::GlxBackend()
|
||||
GlxBackend::GlxBackend(Display *display)
|
||||
: OpenGLBackend()
|
||||
, m_overlayWindow(new OverlayWindow())
|
||||
, window(None)
|
||||
|
@ -114,6 +115,7 @@ GlxBackend::GlxBackend()
|
|||
, ctx(nullptr)
|
||||
, m_bufferAge(0)
|
||||
, haveSwapInterval(false)
|
||||
, m_x11Display(display)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ private:
|
|||
class GlxBackend : public OpenGLBackend
|
||||
{
|
||||
public:
|
||||
GlxBackend();
|
||||
GlxBackend(Display *display);
|
||||
virtual ~GlxBackend();
|
||||
virtual void screenGeometryChanged(const QSize &size);
|
||||
virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture);
|
||||
|
@ -89,6 +89,9 @@ private:
|
|||
bool initFbConfig();
|
||||
void initVisualDepthHashTable();
|
||||
void setSwapInterval(int interval);
|
||||
Display *display() const {
|
||||
return m_x11Display;
|
||||
}
|
||||
|
||||
int visualDepth(xcb_visualid_t visual) const;
|
||||
FBConfigInfo *infoForVisual(xcb_visualid_t visual);
|
||||
|
@ -112,6 +115,7 @@ private:
|
|||
bool m_haveINTELSwapEvent = false;
|
||||
bool haveSwapInterval = false;
|
||||
bool haveWaitSync = false;
|
||||
Display *m_x11Display;
|
||||
friend class GlxTexture;
|
||||
};
|
||||
|
||||
|
@ -130,6 +134,9 @@ private:
|
|||
friend class GlxBackend;
|
||||
GlxTexture(SceneOpenGL::Texture *texture, GlxBackend *backend);
|
||||
bool loadTexture(xcb_pixmap_t pix, const QSize &size, xcb_visualid_t visual);
|
||||
Display *display() const {
|
||||
return m_backend->m_x11Display;
|
||||
}
|
||||
SceneOpenGL::Texture *q;
|
||||
GlxBackend *m_backend;
|
||||
GLXPixmap m_glxpixmap; // the glx pixmap the texture is bound to
|
||||
|
|
|
@ -46,10 +46,11 @@ namespace KWin
|
|||
|
||||
X11StandalonePlatform::X11StandalonePlatform(QObject *parent)
|
||||
: Platform(parent)
|
||||
, m_x11Display(QX11Info::display())
|
||||
{
|
||||
#if HAVE_X11_XINPUT
|
||||
if (!qEnvironmentVariableIsSet("KWIN_NO_XI2")) {
|
||||
m_xinputIntegration = new XInputIntegration(this);
|
||||
m_xinputIntegration = new XInputIntegration(m_x11Display, this);
|
||||
m_xinputIntegration->init();
|
||||
if (!m_xinputIntegration->hasXinput()) {
|
||||
delete m_xinputIntegration;
|
||||
|
@ -84,14 +85,14 @@ OpenGLBackend *X11StandalonePlatform::createOpenGLBackend()
|
|||
#if HAVE_EPOXY_GLX
|
||||
case GlxPlatformInterface:
|
||||
if (hasGlx()) {
|
||||
return new GlxBackend();
|
||||
return new GlxBackend(m_x11Display);
|
||||
} else {
|
||||
qCWarning(KWIN_X11STANDALONE) << "Glx not available, trying EGL instead.";
|
||||
// no break, needs fall-through
|
||||
}
|
||||
#endif
|
||||
case EglPlatformInterface:
|
||||
return new EglOnXBackend();
|
||||
return new EglOnXBackend(m_x11Display);
|
||||
default:
|
||||
// no backend available
|
||||
return nullptr;
|
||||
|
|
|
@ -70,6 +70,7 @@ private:
|
|||
XInputIntegration *m_xinputIntegration = nullptr;
|
||||
QThread *m_openGLFreezeProtectionThread = nullptr;
|
||||
QTimer *m_openGLFreezeProtection = nullptr;
|
||||
Display *m_x11Display;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -162,8 +162,9 @@ private:
|
|||
Xkb *m_xkb = nullptr;
|
||||
};
|
||||
|
||||
XInputIntegration::XInputIntegration(QObject *parent)
|
||||
XInputIntegration::XInputIntegration(Display *display, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_x11Display(display)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <QScopedPointer>
|
||||
typedef struct _XDisplay Display;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -36,7 +37,7 @@ class XInputIntegration : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit XInputIntegration(QObject *parent);
|
||||
explicit XInputIntegration(Display *display, QObject *parent);
|
||||
virtual ~XInputIntegration();
|
||||
|
||||
void init();
|
||||
|
@ -49,6 +50,9 @@ public:
|
|||
void setXkb(Xkb *xkb);
|
||||
|
||||
private:
|
||||
Display *display() const {
|
||||
return m_x11Display;
|
||||
}
|
||||
|
||||
bool m_hasXInput = false;
|
||||
int m_xiOpcode = 0;
|
||||
|
@ -57,6 +61,7 @@ private:
|
|||
QPointer<X11Cursor> m_x11Cursor;
|
||||
// TODO: QPointer
|
||||
Xkb *m_xkb = nullptr;
|
||||
Display *m_x11Display;
|
||||
|
||||
QScopedPointer<XInputEventFilter> m_xiEventFilter;
|
||||
QScopedPointer<XKeyPressReleaseEventFilter> m_keyPressFilter;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <QWindow>
|
||||
#include <QWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QX11Info>
|
||||
#include "../xcbutils.h"
|
||||
|
||||
#include <KWindowSystem>
|
||||
|
|
|
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
#include <QX11Info>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
Loading…
Reference in a new issue