Add QXcbScreen platform interface
Task-number: QTBUG-84220 Change-Id: I6c166409fbaf50627dea65a6256764e08ab36a59 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>bb10
parent
6e5694b63b
commit
3a475d48ee
|
|
@ -53,6 +53,8 @@
|
|||
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
|
||||
#include <QtCore/qpointer.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QScreen;
|
||||
|
|
@ -63,6 +65,20 @@ public:
|
|||
QPointer<QScreen> screen;
|
||||
};
|
||||
|
||||
// ----------------- QPlatformInterface -----------------
|
||||
|
||||
namespace QPlatformInterface::Private {
|
||||
|
||||
#if QT_CONFIG(xcb)
|
||||
struct Q_GUI_EXPORT QXcbScreen
|
||||
{
|
||||
QT_DECLARE_PLATFORM_INTERFACE(QXcbScreen)
|
||||
virtual int virtualDesktopNumber() const = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // QPlatformInterface::Private
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QPLATFORMSCREEN_P_H
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#include <qpa/qplatformopenglcontext.h>
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <qpa/qplatformscreen_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -79,6 +80,10 @@ QOpenGLContext *QPlatformInterface::QEGLContext::fromNative(EGLContext context,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if QT_CONFIG(xcb)
|
||||
QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(QXcbScreen);
|
||||
#endif
|
||||
|
||||
#endif // QT_NO_OPENGL
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -7,13 +7,11 @@
|
|||
qt_add_module(PlatformHeaders
|
||||
HEADER_MODULE
|
||||
SOURCES
|
||||
cocoafunctions/qcocoawindowfunctions_p.h
|
||||
eglfsfunctions/qeglfsfunctions_p.h
|
||||
helper/qplatformheaderhelper_p.h
|
||||
linuxfbfunctions/qlinuxfbfunctions_p.h
|
||||
waylandfunctions/qwaylandwindowfunctions_p.h
|
||||
windowsfunctions/qwindowswindowfunctions_p.h
|
||||
xcbfunctions/qxcbscreenfunctions_p.h
|
||||
xcbfunctions/qxcbwindowfunctions_p.h
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::Core
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ qt_add_module(PlatformHeaders
|
|||
HEADER_MODULE
|
||||
# special case begin
|
||||
# SOURCES
|
||||
# cocoafunctions/qcocoawindowfunctions_p.h
|
||||
# eglfsfunctions/qeglfsfunctions_p.h
|
||||
# helper/qplatformheaderhelper_p.h
|
||||
# linuxfbfunctions/qlinuxfbfunctions_p.h
|
||||
# waylandfunctions/qwaylandwindowfunctions_p.h
|
||||
# windowsfunctions/qwindowswindowfunctions_p.h
|
||||
# xcbfunctions/qxcbscreenfunctions_p.h
|
||||
# xcbfunctions/qxcbwindowfunctions_p.h
|
||||
# special case end
|
||||
PUBLIC_LIBRARIES
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QXCBSCREENFUNCTIONS_H
|
||||
#define QXCBSCREENFUNCTIONS_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtPlatformHeaders/private/qplatformheaderhelper_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QScreen;
|
||||
|
||||
class QXcbScreenFunctions
|
||||
{
|
||||
public:
|
||||
typedef bool (*VirtualDesktopNumber)(const QScreen *screen);
|
||||
static const QByteArray virtualDesktopNumberIdentifier() { return QByteArrayLiteral("XcbVirtualDesktopNumber"); }
|
||||
static int virtualDesktopNumber(const QScreen *screen)
|
||||
{
|
||||
return QPlatformHeaderHelper::callPlatformFunction<int, VirtualDesktopNumber, const QScreen *>(virtualDesktopNumberIdentifier(), screen);
|
||||
}
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif /*QXCBSCREENFUNCTIONS_H*/
|
||||
|
|
@ -1,3 +1,2 @@
|
|||
HEADERS += \
|
||||
$$PWD/qxcbwindowfunctions_p.h \
|
||||
$$PWD/qxcbscreenfunctions_p.h
|
||||
$$PWD/qxcbwindowfunctions_p.h
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
#include <QtGui/qscreen.h>
|
||||
|
||||
#include <QtPlatformHeaders/private/qxcbwindowfunctions_p.h>
|
||||
#include <QtPlatformHeaders/private/qxcbscreenfunctions_p.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -329,9 +328,6 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio
|
|||
return QFunctionPointer(QXcbWindowFunctions::VisualId(QXcbWindow::visualIdStatic));
|
||||
}
|
||||
|
||||
if (function == QXcbScreenFunctions::virtualDesktopNumberIdentifier())
|
||||
return QFunctionPointer(QXcbScreenFunctions::VirtualDesktopNumber(reinterpret_cast<void *>(QXcbScreen::virtualDesktopNumberStatic)));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -702,14 +702,6 @@ void QXcbScreen::setOutput(xcb_randr_output_t outputId,
|
|||
// TODO: Send an event to the QScreen instance that the screen changed its name
|
||||
}
|
||||
|
||||
int QXcbScreen::virtualDesktopNumberStatic(const QScreen *screen)
|
||||
{
|
||||
if (screen && screen->handle())
|
||||
return static_cast<const QXcbScreen *>(screen->handle())->screenNumber();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
|
||||
{
|
||||
if (!connection()->hasXRandr())
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#define QXCBSCREEN_H
|
||||
|
||||
#include <qpa/qplatformscreen.h>
|
||||
#include <qpa/qplatformscreen_p.h>
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
|
@ -137,6 +138,7 @@ private:
|
|||
};
|
||||
|
||||
class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen
|
||||
, public QPlatformInterface::Private::QXcbScreen
|
||||
{
|
||||
public:
|
||||
QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop,
|
||||
|
|
@ -171,7 +173,7 @@ public:
|
|||
bool isPrimary() const { return m_primary; }
|
||||
|
||||
int screenNumber() const { return m_virtualDesktop->number(); }
|
||||
static int virtualDesktopNumberStatic(const QScreen *screen);
|
||||
int virtualDesktopNumber() const override { return screenNumber(); }
|
||||
|
||||
xcb_screen_t *screen() const { return m_virtualDesktop->screen(); }
|
||||
xcb_window_t root() const { return screen()->root; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue