xcb: make QXcbWindow inherit QObject
Pick-to: 6.5 Change-Id: I418305f1e66bdf90b8bda724976916e320012961 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 5896314ff3e46849b6ff7e1069f2273cc6508cf7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2ee11d3e01
commit
42338ad4b9
@ -1231,7 +1231,7 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event
|
||||
|
||||
bool QXcbDrag::dndEnable(QXcbWindow *w, bool on)
|
||||
{
|
||||
qCDebug(lcQpaXDnd) << "dndEnable" << w << on;
|
||||
qCDebug(lcQpaXDnd) << "dndEnable" << static_cast<QPlatformWindow *>(w) << on;
|
||||
// Windows announce that they support the XDND protocol by creating a window property XdndAware.
|
||||
if (on) {
|
||||
QXcbWindow *window = nullptr;
|
||||
|
@ -95,7 +95,7 @@ const quint32 XEMBED_VERSION = 0;
|
||||
|
||||
QXcbScreen *QXcbWindow::parentScreen()
|
||||
{
|
||||
return parent() ? static_cast<QXcbWindow*>(parent())->parentScreen() : xcbScreen();
|
||||
return QPlatformWindow::parent() ? static_cast<QXcbWindow*>(QPlatformWindow::parent())->parentScreen() : xcbScreen();
|
||||
}
|
||||
|
||||
QXcbScreen *QXcbWindow::initialScreen() const
|
||||
@ -232,8 +232,8 @@ void QXcbWindow::create()
|
||||
Qt::WindowType type = window()->type();
|
||||
|
||||
QXcbScreen *currentScreen = xcbScreen();
|
||||
QXcbScreen *platformScreen = parent() ? parentScreen() : initialScreen();
|
||||
QRect rect = parent()
|
||||
QXcbScreen *platformScreen = QPlatformWindow::parent() ? parentScreen() : initialScreen();
|
||||
QRect rect = QPlatformWindow::parent()
|
||||
? QHighDpi::toNativeLocalPosition(window()->geometry(), platformScreen)
|
||||
: QHighDpi::toNativePixels(window()->geometry(), platformScreen);
|
||||
|
||||
@ -273,11 +273,11 @@ void QXcbWindow::create()
|
||||
QWindowSystemInterface::handleWindowScreenChanged(window(), platformScreen->QPlatformScreen::screen());
|
||||
|
||||
xcb_window_t xcb_parent_id = platformScreen->root();
|
||||
if (parent()) {
|
||||
xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window();
|
||||
m_embedded = parent()->isForeignWindow();
|
||||
if (QPlatformWindow::parent()) {
|
||||
xcb_parent_id = static_cast<QXcbWindow *>(QPlatformWindow::parent())->xcb_window();
|
||||
m_embedded = QPlatformWindow::parent()->isForeignWindow();
|
||||
|
||||
QSurfaceFormat parentFormat = parent()->window()->requestedFormat();
|
||||
QSurfaceFormat parentFormat = QPlatformWindow::parent()->window()->requestedFormat();
|
||||
if (window()->surfaceType() != QSurface::OpenGLSurface && parentFormat.hasAlpha()) {
|
||||
window()->setFormat(parentFormat);
|
||||
}
|
||||
@ -295,16 +295,16 @@ void QXcbWindow::create()
|
||||
qWarning() << "Failed to use requested visual id.";
|
||||
}
|
||||
|
||||
if (parent()) {
|
||||
if (QPlatformWindow::parent()) {
|
||||
// When using a Vulkan QWindow via QWidget::createWindowContainer() we
|
||||
// must make sure the visuals are compatible. Now, the parent will be
|
||||
// of RasterGLSurface which typically chooses a GLX/EGL compatible
|
||||
// visual which may not be what the Vulkan window would choose.
|
||||
// Therefore, take the parent's visual.
|
||||
if (window()->surfaceType() == QSurface::VulkanSurface
|
||||
&& parent()->window()->surfaceType() != QSurface::VulkanSurface)
|
||||
&& QPlatformWindow::parent()->window()->surfaceType() != QSurface::VulkanSurface)
|
||||
{
|
||||
visual = platformScreen->visualForId(static_cast<QXcbWindow *>(parent())->visualId());
|
||||
visual = platformScreen->visualForId(static_cast<QXcbWindow *>(QPlatformWindow::parent())->visualId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ void QXcbWindow::setGeometry(const QRect &rect)
|
||||
propagateSizeHints();
|
||||
|
||||
QXcbScreen *currentScreen = xcbScreen();
|
||||
QXcbScreen *newScreen = parent() ? parentScreen() : static_cast<QXcbScreen*>(screenForGeometry(rect));
|
||||
QXcbScreen *newScreen = QPlatformWindow::parent() ? parentScreen() : static_cast<QXcbScreen*>(screenForGeometry(rect));
|
||||
|
||||
if (!newScreen)
|
||||
newScreen = xcbScreen();
|
||||
@ -1751,7 +1751,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
|
||||
{
|
||||
bool fromSendEvent = (event->response_type & 0x80);
|
||||
QPoint pos(event->x, event->y);
|
||||
if (!parent() && !fromSendEvent) {
|
||||
if (!QPlatformWindow::parent() && !fromSendEvent) {
|
||||
// Do not trust the position, query it instead.
|
||||
auto reply = Q_XCB_REPLY(xcb_translate_coordinates, xcb_connection(),
|
||||
xcb_window(), xcbScreen()->root(), 0, 0);
|
||||
@ -1762,7 +1762,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
|
||||
}
|
||||
|
||||
const QRect actualGeometry = QRect(pos, QSize(event->width, event->height));
|
||||
QPlatformScreen *newScreen = parent() ? parent()->screen() : screenForGeometry(actualGeometry);
|
||||
QPlatformScreen *newScreen = QPlatformWindow::parent() ? QPlatformWindow::parent()->screen() : screenForGeometry(actualGeometry);
|
||||
if (!newScreen)
|
||||
return;
|
||||
|
||||
@ -1872,7 +1872,7 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in
|
||||
|
||||
if (m_embedded && !m_trayIconWindow) {
|
||||
if (window() != QGuiApplication::focusWindow()) {
|
||||
const QXcbWindow *container = static_cast<const QXcbWindow *>(parent());
|
||||
const QXcbWindow *container = static_cast<const QXcbWindow *>(QPlatformWindow::parent());
|
||||
Q_ASSERT(container != nullptr);
|
||||
|
||||
sendXEmbedMessage(container->xcb_window(), XEMBED_REQUEST_FOCUS);
|
||||
@ -2321,7 +2321,7 @@ bool QXcbWindow::windowEvent(QEvent *event)
|
||||
case Qt::BacktabFocusReason:
|
||||
{
|
||||
const QXcbWindow *container =
|
||||
static_cast<const QXcbWindow *>(parent());
|
||||
static_cast<const QXcbWindow *>(QPlatformWindow::parent());
|
||||
sendXEmbedMessage(container->xcb_window(),
|
||||
focusEvent->reason() == Qt::TabFocusReason ?
|
||||
XEMBED_FOCUS_NEXT : XEMBED_FOCUS_PREV);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <qpa/qplatformwindow_p.h>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QSurfaceFormat>
|
||||
#include <QtGui/QImage>
|
||||
|
||||
@ -20,9 +21,10 @@ class QXcbScreen;
|
||||
class QXcbSyncWindowRequest;
|
||||
class QIcon;
|
||||
|
||||
class Q_XCB_EXPORT QXcbWindow : public QXcbObject, public QXcbWindowEventListener, public QPlatformWindow
|
||||
class Q_XCB_EXPORT QXcbWindow : public QObject, public QXcbObject, public QXcbWindowEventListener, public QPlatformWindow
|
||||
, public QNativeInterface::Private::QXcbWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum NetWmState {
|
||||
NetWmStateAbove = 0x1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user