make it possible to disable XINERAMA X11 extension at runtime

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-10-12 11:28:08 +03:00
parent 10026b7ba5
commit b7e4bae65f
3 changed files with 39 additions and 30 deletions

View file

@ -1023,7 +1023,6 @@ void qt_init(QApplicationPrivate *priv, int,
qt_x11Data->use_xrandr = false; qt_x11Data->use_xrandr = false;
qt_x11Data->xrandr_major = 0; qt_x11Data->xrandr_major = 0;
qt_x11Data->xrandr_eventbase = 0; qt_x11Data->xrandr_eventbase = 0;
qt_x11Data->xrandr_errorbase = 0;
// RENDER // RENDER
qt_x11Data->use_xrender = false; qt_x11Data->use_xrender = false;
@ -1032,15 +1031,15 @@ void qt_init(QApplicationPrivate *priv, int,
// XFIXES // XFIXES
qt_x11Data->use_xfixes = false; qt_x11Data->use_xfixes = false;
qt_x11Data->xfixes_major = 0;
qt_x11Data->xfixes_eventbase = 0; qt_x11Data->xfixes_eventbase = 0;
qt_x11Data->xfixes_errorbase = 0;
// MIT-SHM // MIT-SHM
qt_x11Data->use_mitshm = false; qt_x11Data->use_mitshm = false;
qt_x11Data->use_mitshm_pixmaps = false;
qt_x11Data->mitshm_major = 0; qt_x11Data->mitshm_major = 0;
// XINERAMA
qt_x11Data->use_xinerama = false;
qt_x11Data->sip_serial = 0; qt_x11Data->sip_serial = 0;
qt_x11Data->net_supported_list = 0; qt_x11Data->net_supported_list = 0;
qt_x11Data->net_virtual_root_list = 0; qt_x11Data->net_virtual_root_list = 0;
@ -1271,7 +1270,7 @@ void qt_init(QApplicationPrivate *priv, int,
int mitshm_pixmaps; int mitshm_pixmaps;
if (qgetenv("QT_X11_NO_MITSHM").isNull() if (qgetenv("QT_X11_NO_MITSHM").isNull()
&& XQueryExtension(qt_x11Data->display, "MIT-SHM", &qt_x11Data->mitshm_major, && XQueryExtension(qt_x11Data->display, "MIT-SHM", &qt_x11Data->mitshm_major,
&mitshm_eventbase, &mitshm_errorbase) &mitshm_eventbase, &mitshm_errorbase)
&& XShmQueryVersion(qt_x11Data->display, &mitshm_major, &mitshm_minor, && XShmQueryVersion(qt_x11Data->display, &mitshm_major, &mitshm_minor,
&mitshm_pixmaps)) &mitshm_pixmaps))
{ {
@ -1289,11 +1288,20 @@ void qt_init(QApplicationPrivate *priv, int,
|| defaultVisual->green_mask == 0x7e0) || defaultVisual->green_mask == 0x7e0)
&& (defaultVisual->blue_mask == 0xff && (defaultVisual->blue_mask == 0xff
|| defaultVisual->blue_mask == 0x1f)); || defaultVisual->blue_mask == 0x1f));
qt_x11Data->use_mitshm_pixmaps = qt_x11Data->use_mitshm && mitshm_pixmaps;
} }
} }
#endif // QT_NO_XSHM #endif // QT_NO_XSHM
#ifndef QT_NO_XINERAMA
int xinerama_eventbase;
int xinerama_errorbase;
if (qgetenv("QT_X11_NO_XINERAMA").isNull()) {
qt_x11Data->use_xinerama = (XineramaQueryExtension(qt_x11Data->display,
&xinerama_eventbase, &xinerama_errorbase)
&& XineramaIsActive(qt_x11Data->display));
}
#endif
// initialize the graphics system - order is imporant here - it must be done before // initialize the graphics system - order is imporant here - it must be done before
// the QColormap::initialize() call // the QColormap::initialize() call
QApplicationPrivate::graphics_system = QGraphicsSystemFactory::create(QApplicationPrivate::graphics_system_name); QApplicationPrivate::graphics_system = QGraphicsSystemFactory::create(QApplicationPrivate::graphics_system_name);
@ -1311,11 +1319,12 @@ void qt_init(QApplicationPrivate *priv, int,
#ifndef QT_NO_XRANDR #ifndef QT_NO_XRANDR
// See if XRandR is supported on the connected display // See if XRandR is supported on the connected display
int xrandr_errorbase;
if (qgetenv("QT_X11_NO_XRANDR").isNull() if (qgetenv("QT_X11_NO_XRANDR").isNull()
&& XQueryExtension(qt_x11Data->display, "RANDR", &qt_x11Data->xrandr_major, && XQueryExtension(qt_x11Data->display, "RANDR", &qt_x11Data->xrandr_major,
&qt_x11Data->xrandr_eventbase, &qt_x11Data->xrandr_errorbase)) { &qt_x11Data->xrandr_eventbase, &xrandr_errorbase)) {
if (XRRQueryExtension(qt_x11Data->display, &qt_x11Data->xrandr_eventbase, &qt_x11Data->xrandr_errorbase)) { if (XRRQueryExtension(qt_x11Data->display, &qt_x11Data->xrandr_eventbase, &xrandr_errorbase)) {
// XRandR is supported // XRandR is supported
qt_x11Data->use_xrandr = true; qt_x11Data->use_xrandr = true;
} }
@ -1338,11 +1347,13 @@ void qt_init(QApplicationPrivate *priv, int,
#ifndef QT_NO_XFIXES #ifndef QT_NO_XFIXES
// See if Xfixes is supported on the connected display // See if Xfixes is supported on the connected display
int xfixes_major;
int xfixes_errorbase;
if (qgetenv("QT_X11_NO_XFIXES").isNull() if (qgetenv("QT_X11_NO_XFIXES").isNull()
&& XQueryExtension(qt_x11Data->display, "XFIXES", &qt_x11Data->xfixes_major, && XQueryExtension(qt_x11Data->display, "XFIXES", &xfixes_major,
&qt_x11Data->xfixes_eventbase, &qt_x11Data->xfixes_errorbase)) { &qt_x11Data->xfixes_eventbase, &xfixes_errorbase)) {
if(XFixesQueryExtension(qt_x11Data->display, &qt_x11Data->xfixes_eventbase, if(XFixesQueryExtension(qt_x11Data->display, &qt_x11Data->xfixes_eventbase,
&qt_x11Data->xfixes_errorbase)) { &xfixes_errorbase)) {
// Xfixes is supported. // Xfixes is supported.
// Note: the XFixes protocol version is negotiated using QueryVersion. // Note: the XFixes protocol version is negotiated using QueryVersion.
// We supply the highest version we support, the X server replies with // We supply the highest version we support, the X server replies with
@ -1350,20 +1361,21 @@ void qt_init(QApplicationPrivate *priv, int,
// asked for. The version sent back is the protocol version the X server // asked for. The version sent back is the protocol version the X server
// will use to talk us. If this call is removed, the behavior of the // will use to talk us. If this call is removed, the behavior of the
// X server when it receives an XFixes request is undefined. // X server when it receives an XFixes request is undefined.
int major = 3; int xfixes_major = 3;
int minor = 0; int xfixes_minor = 0;
XFixesQueryVersion(qt_x11Data->display, &major, &minor); XFixesQueryVersion(qt_x11Data->display, &xfixes_major, &xfixes_minor);
qt_x11Data->use_xfixes = (major >= 1); qt_x11Data->use_xfixes = (xfixes_major >= 1);
qt_x11Data->xfixes_major = major;
} }
} }
#endif // QT_NO_XFIXES #endif // QT_NO_XFIXES
#ifndef QT_NO_XSYNC #ifndef QT_NO_XSYNC
int xsync_evbase, xsync_errbase; int xsync_evbase;
int major, minor; int xsync_errbase;
int xsync_major;
int xsync_minor;
if (XSyncQueryExtension(qt_x11Data->display, &xsync_evbase, &xsync_errbase)) if (XSyncQueryExtension(qt_x11Data->display, &xsync_evbase, &xsync_errbase))
XSyncInitialize(qt_x11Data->display, &major, &minor); XSyncInitialize(qt_x11Data->display, &xsync_major, &xsync_minor);
#endif // QT_NO_XSYNC #endif // QT_NO_XSYNC
#if !defined(QT_NO_FONTCONFIG) #if !defined(QT_NO_FONTCONFIG)

View file

@ -125,9 +125,7 @@ void QDesktopWidgetPrivate::init()
// we ignore the Xinerama extension when using the display is // we ignore the Xinerama extension when using the display is
// using traditional multi-screen (with multiple root windows) // using traditional multi-screen (with multiple root windows)
if (newScreenCount == 1) { if (newScreenCount == 1) {
int unused; use_xinerama = qt_x11Data->use_xinerama;
use_xinerama = (XineramaQueryExtension(qt_x11Data->display, &unused, &unused)
&& XineramaIsActive(qt_x11Data->display));
} }
if (use_xinerama) { if (use_xinerama) {

View file

@ -197,28 +197,27 @@ struct QX11Data
}; };
FocusModel focus_model; FocusModel focus_model;
// true if Qt is compiled w/ RANDR support and RANDR is supported on the connected Display // true if compiled w/ RANDR support and RANDR is supported on the connected Display
bool use_xrandr; bool use_xrandr;
int xrandr_major; int xrandr_major;
int xrandr_eventbase; int xrandr_eventbase;
int xrandr_errorbase;
// true if Qt is compiled w/ RENDER support and RENDER is supported on the connected Display // true if compiled w/ RENDER support and RENDER is supported on the connected Display
bool use_xrender; bool use_xrender;
int xrender_major; int xrender_major;
int xrender_minor; int xrender_minor;
// true if Qt is compiled w/ XFIXES support and XFIXES is supported on the connected Display // true if compiled w/ XFIXES support and XFIXES is supported on the connected Display
bool use_xfixes; bool use_xfixes;
int xfixes_major;
int xfixes_eventbase; int xfixes_eventbase;
int xfixes_errorbase;
// true if Qt is compiled w/ MIT-SHM support and MIT-SHM is supported on the connected Display // true if compiled w/ MIT-SHM support and MIT-SHM is supported on the connected Display
bool use_mitshm; bool use_mitshm;
bool use_mitshm_pixmaps;
int mitshm_major; int mitshm_major;
// true if compiled w/ XINERAMA support and XINERAMA is supported on the connected Display
bool use_xinerama;
QList<QWidget *> deferred_map; QList<QWidget *> deferred_map;
struct ScrollInProgress { struct ScrollInProgress {
long id; long id;