Preliminary QWindow event delivery.
(cherry picked from commit 28a09e668a8125cff680ab9f1e7256e7e4e34158)
This commit is contained in:
parent
290573425c
commit
bbee0db8f9
@ -78,13 +78,7 @@ QString QApplicationPrivate::appName() const
|
|||||||
|
|
||||||
void QApplicationPrivate::createEventDispatcher()
|
void QApplicationPrivate::createEventDispatcher()
|
||||||
{
|
{
|
||||||
Q_Q(QApplication);
|
QGuiApplicationPrivate::createEventDispatcher();
|
||||||
#if !defined(QT_NO_GLIB)
|
|
||||||
if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported())
|
|
||||||
eventDispatcher = new QPAEventDispatcherGlib(q);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
eventDispatcher = new QEventDispatcherQPA(q);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool qt_try_modal(QWidget *widget, QEvent::Type type)
|
static bool qt_try_modal(QWidget *widget, QEvent::Type type)
|
||||||
|
@ -45,6 +45,12 @@
|
|||||||
#include "private/qplatformintegrationfactory_qpa_p.h"
|
#include "private/qplatformintegrationfactory_qpa_p.h"
|
||||||
#include "private/qevent_p.h"
|
#include "private/qevent_p.h"
|
||||||
|
|
||||||
|
#if !defined(QT_NO_GLIB)
|
||||||
|
#include "qeventdispatcher_glib_qpa_p.h"
|
||||||
|
#endif
|
||||||
|
#include "qeventdispatcher_qpa_p.h"
|
||||||
|
|
||||||
|
#include <QtCore/QAbstractEventDispatcher>
|
||||||
#include <QtCore/private/qcoreapplication_p.h>
|
#include <QtCore/private/qcoreapplication_p.h>
|
||||||
#include <QtCore/private/qabstracteventdispatcher_p.h>
|
#include <QtCore/private/qabstracteventdispatcher_p.h>
|
||||||
#include <QtCore/qmutex.h>
|
#include <QtCore/qmutex.h>
|
||||||
@ -100,6 +106,8 @@ QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
|
|||||||
: QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags))
|
: QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags))
|
||||||
{
|
{
|
||||||
d_func()->init();
|
d_func()->init();
|
||||||
|
|
||||||
|
QCoreApplicationPrivate::eventDispatcher->startingUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
|
QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
|
||||||
@ -162,6 +170,16 @@ static void init_plugins(const QList<QByteArray> pluginList)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QGuiApplicationPrivate::createEventDispatcher()
|
||||||
|
{
|
||||||
|
Q_Q(QGuiApplication);
|
||||||
|
#if !defined(QT_NO_GLIB)
|
||||||
|
if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported())
|
||||||
|
eventDispatcher = new QPAEventDispatcherGlib(q);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
eventDispatcher = new QEventDispatcherQPA(q);
|
||||||
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::init()
|
void QGuiApplicationPrivate::init()
|
||||||
{
|
{
|
||||||
@ -213,6 +231,8 @@ void QGuiApplicationPrivate::init()
|
|||||||
init_plugins(pluginList);
|
init_plugins(pluginList);
|
||||||
|
|
||||||
QFont::initialize();
|
QFont::initialize();
|
||||||
|
|
||||||
|
is_app_running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGuiApplicationPrivate::~QGuiApplicationPrivate()
|
QGuiApplicationPrivate::~QGuiApplicationPrivate()
|
||||||
@ -220,6 +240,9 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
|
|||||||
delete platform_integration;
|
delete platform_integration;
|
||||||
platform_integration = 0;
|
platform_integration = 0;
|
||||||
|
|
||||||
|
is_app_closing = true;
|
||||||
|
is_app_running = false;
|
||||||
|
|
||||||
QFont::cleanup();
|
QFont::cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +385,9 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
|||||||
stateChange = Qt::NoButton;
|
stateChange = Qt::NoButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget * tlw = e->window.data() ? e->window.data()->widget() : 0;
|
QWindow *window = e->window.data();
|
||||||
|
|
||||||
|
QWidget * tlw = window ? window->widget() : 0;
|
||||||
|
|
||||||
QPoint localPoint = e->localPos;
|
QPoint localPoint = e->localPos;
|
||||||
QPoint globalPoint = e->globalPos;
|
QPoint globalPoint = e->globalPos;
|
||||||
@ -370,7 +395,6 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
|||||||
|
|
||||||
Qt::MouseButton button = Qt::NoButton;
|
Qt::MouseButton button = Qt::NoButton;
|
||||||
|
|
||||||
|
|
||||||
if (qt_last_x != globalPoint.x() || qt_last_y != globalPoint.y()) {
|
if (qt_last_x != globalPoint.x() || qt_last_y != globalPoint.y()) {
|
||||||
type = QEvent::MouseMove;
|
type = QEvent::MouseMove;
|
||||||
qt_last_x = globalPoint.x();
|
qt_last_x = globalPoint.x();
|
||||||
@ -410,6 +434,13 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
|
|||||||
type = QEvent::MouseButtonRelease;
|
type = QEvent::MouseButtonRelease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (window && !tlw) {
|
||||||
|
QMouseEvent ev(type, localPoint, globalPoint, button, buttons, QGuiApplication::keyboardModifiers());
|
||||||
|
QGuiApplication::sendSpontaneousEvent(window, &ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (self->inPopupMode()) {
|
if (self->inPopupMode()) {
|
||||||
//popup mouse handling is magical...
|
//popup mouse handling is magical...
|
||||||
@ -606,7 +637,7 @@ void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::En
|
|||||||
qt_last_mouse_receiver = e->enter.data() ? e->enter.data()->widget() : 0;
|
qt_last_mouse_receiver = e->enter.data() ? e->enter.data()->widget() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e)
|
void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *)
|
||||||
{
|
{
|
||||||
// QGuiApplicationPrivate::dispatchEnterLeave(0,qt_last_mouse_receiver);
|
// QGuiApplicationPrivate::dispatchEnterLeave(0,qt_last_mouse_receiver);
|
||||||
|
|
||||||
@ -618,7 +649,7 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e)
|
void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *)
|
||||||
{
|
{
|
||||||
// QGuiApplication::setActiveWindow(e->activated.data());
|
// QGuiApplication::setActiveWindow(e->activated.data());
|
||||||
}
|
}
|
||||||
@ -628,7 +659,7 @@ void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePr
|
|||||||
if (e->tlw.isNull())
|
if (e->tlw.isNull())
|
||||||
return;
|
return;
|
||||||
QWidget *tlw = e->tlw.data() ? e->tlw.data()->widget() : 0;
|
QWidget *tlw = e->tlw.data() ? e->tlw.data()->widget() : 0;
|
||||||
if (!tlw->isWindow())
|
if (!tlw || !tlw->isWindow())
|
||||||
return; //geo of native child widgets is controlled by lighthouse
|
return; //geo of native child widgets is controlled by lighthouse
|
||||||
//so we already have sent the events; besides this new rect
|
//so we already have sent the events; besides this new rect
|
||||||
//is not mapped to parent
|
//is not mapped to parent
|
||||||
@ -660,12 +691,12 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
|
|||||||
// e->topLevel.data()->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
|
// e->topLevel.data()->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
|
void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *)
|
||||||
{
|
{
|
||||||
// translateRawTouchEvent(e->widget.data(), e->devType, e->points);
|
// translateRawTouchEvent(e->widget.data(), e->devType, e->points);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e)
|
void QGuiApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *)
|
||||||
{
|
{
|
||||||
// This operation only makes sense after the QGuiApplication constructor runs
|
// This operation only makes sense after the QGuiApplication constructor runs
|
||||||
if (QCoreApplication::startingUp())
|
if (QCoreApplication::startingUp())
|
||||||
@ -677,7 +708,7 @@ void QGuiApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::Sc
|
|||||||
//emit desktop->screenCountChanged(e->count);
|
//emit desktop->screenCountChanged(e->count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e)
|
void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *)
|
||||||
{
|
{
|
||||||
// This operation only makes sense after the QGuiApplication constructor runs
|
// This operation only makes sense after the QGuiApplication constructor runs
|
||||||
if (QCoreApplication::startingUp())
|
if (QCoreApplication::startingUp())
|
||||||
@ -703,7 +734,7 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::reportAvailableGeometryChange(
|
void QGuiApplicationPrivate::reportAvailableGeometryChange(
|
||||||
QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e)
|
QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *)
|
||||||
{
|
{
|
||||||
// This operation only makes sense after the QGuiApplication constructor runs
|
// This operation only makes sense after the QGuiApplication constructor runs
|
||||||
if (QCoreApplication::startingUp())
|
if (QCoreApplication::startingUp())
|
||||||
|
@ -67,6 +67,8 @@ public:
|
|||||||
QGuiApplicationPrivate(int &argc, char **argv, int flags);
|
QGuiApplicationPrivate(int &argc, char **argv, int flags);
|
||||||
~QGuiApplicationPrivate();
|
~QGuiApplicationPrivate();
|
||||||
|
|
||||||
|
void createEventDispatcher();
|
||||||
|
|
||||||
static int keyboard_input_time;
|
static int keyboard_input_time;
|
||||||
static int mouse_double_click_time;
|
static int mouse_double_click_time;
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
|
|||||||
QWindow *win = topData()->window;
|
QWindow *win = topData()->window;
|
||||||
|
|
||||||
win->setWindowFlags(data.window_flags);
|
win->setWindowFlags(data.window_flags);
|
||||||
|
win->setGeometry(q->geometry());
|
||||||
win->create();
|
win->create();
|
||||||
|
|
||||||
data.window_flags = win->windowFlags();
|
data.window_flags = win->windowFlags();
|
||||||
|
@ -410,10 +410,29 @@ void QWindow::hideEvent(QHideEvent *)
|
|||||||
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
|
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWindow::event(QEvent *)
|
bool QWindow::event(QEvent *event)
|
||||||
{
|
{
|
||||||
qDebug() << "unimplemented:" << __FILE__ << __LINE__;
|
switch (event->type()) {
|
||||||
return false;
|
case QEvent::MouseMove:
|
||||||
|
mouseMoveEvent((QMouseEvent*)event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QEvent::MouseButtonPress:
|
||||||
|
mousePressEvent((QMouseEvent*)event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QEvent::MouseButtonRelease:
|
||||||
|
mouseReleaseEvent((QMouseEvent*)event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QEvent::MouseButtonDblClick:
|
||||||
|
mouseDoubleClickEvent((QMouseEvent*)event);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return QObject::event(event);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWindow::keyPressEvent(QKeyEvent *)
|
void QWindow::keyPressEvent(QKeyEvent *)
|
||||||
|
@ -143,23 +143,26 @@ QXcbConnection::~QXcbConnection()
|
|||||||
delete m_keyboard;
|
delete m_keyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
QXcbWindow *platformWindowFromId(xcb_window_t id)
|
void QXcbConnection::addWindow(xcb_window_t id, QXcbWindow *window)
|
||||||
{
|
{
|
||||||
QWidget *widget = QWidget::find(id);
|
m_mapper.insert(id, window);
|
||||||
if (widget)
|
}
|
||||||
return static_cast<QXcbWindow *>(widget->windowHandle()->handle());
|
|
||||||
return 0;
|
void QXcbConnection::removeWindow(xcb_window_t id)
|
||||||
|
{
|
||||||
|
m_mapper.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id)
|
||||||
|
{
|
||||||
|
return m_mapper.value(id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \
|
#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \
|
||||||
{ \
|
{ \
|
||||||
event_t *e = (event_t *)event; \
|
event_t *e = (event_t *)event; \
|
||||||
if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) { \
|
if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) \
|
||||||
QWindow *windowHandle = platformWindow->window(); \
|
|
||||||
QObjectPrivate *d = QObjectPrivate::get(windowHandle->widget()); \
|
|
||||||
if (!d->wasDeleted) \
|
|
||||||
platformWindow->handler(e); \
|
platformWindow->handler(e); \
|
||||||
} \
|
|
||||||
} \
|
} \
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
@ -51,6 +52,9 @@
|
|||||||
#define Q_XCB_DEBUG
|
#define Q_XCB_DEBUG
|
||||||
|
|
||||||
class QXcbScreen;
|
class QXcbScreen;
|
||||||
|
class QXcbWindow;
|
||||||
|
|
||||||
|
typedef QHash<xcb_window_t, QXcbWindow *> WindowMapper;
|
||||||
|
|
||||||
namespace QXcbAtom {
|
namespace QXcbAtom {
|
||||||
enum Atom {
|
enum Atom {
|
||||||
@ -255,6 +259,9 @@ public:
|
|||||||
void sync();
|
void sync();
|
||||||
void handleXcbError(xcb_generic_error_t *error);
|
void handleXcbError(xcb_generic_error_t *error);
|
||||||
|
|
||||||
|
void addWindow(xcb_window_t id, QXcbWindow *window);
|
||||||
|
void removeWindow(xcb_window_t id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void processXcbEvents();
|
void processXcbEvents();
|
||||||
|
|
||||||
@ -264,6 +271,7 @@ private:
|
|||||||
#ifdef XCB_USE_DRI2
|
#ifdef XCB_USE_DRI2
|
||||||
void initializeDri2();
|
void initializeDri2();
|
||||||
#endif
|
#endif
|
||||||
|
QXcbWindow *platformWindowFromId(xcb_window_t id);
|
||||||
|
|
||||||
xcb_connection_t *m_connection;
|
xcb_connection_t *m_connection;
|
||||||
const xcb_setup_t *m_setup;
|
const xcb_setup_t *m_setup;
|
||||||
@ -303,6 +311,8 @@ private:
|
|||||||
template <typename cookie_t>
|
template <typename cookie_t>
|
||||||
friend cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file, int line);
|
friend cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file, int line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
WindowMapper m_mapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display()))
|
#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display()))
|
||||||
|
@ -90,7 +90,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
|
|||||||
, m_context(0)
|
, m_context(0)
|
||||||
{
|
{
|
||||||
QWidget *tlw = window->widget();
|
QWidget *tlw = window->widget();
|
||||||
m_screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(tlw));
|
m_screen = static_cast<QXcbScreen *>(QGuiApplicationPrivate::platformIntegration()->screens().at(0));
|
||||||
|
|
||||||
setConnection(m_screen->connection());
|
setConnection(m_screen->connection());
|
||||||
|
|
||||||
@ -112,9 +112,11 @@ QXcbWindow::QXcbWindow(QWindow *window)
|
|||||||
| XCB_EVENT_MASK_FOCUS_CHANGE
|
| XCB_EVENT_MASK_FOCUS_CHANGE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QRect rect = window->geometry();
|
||||||
|
|
||||||
#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL)
|
#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL)
|
||||||
if (window->surfaceType() == QWindow::OpenGLSurface
|
if (window->surfaceType() == QWindow::OpenGLSurface
|
||||||
&& QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
|
&& QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
|
||||||
{
|
{
|
||||||
#if defined(XCB_USE_GLX)
|
#if defined(XCB_USE_GLX)
|
||||||
XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window->requestedWindowFormat());
|
XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window->requestedWindowFormat());
|
||||||
@ -136,7 +138,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
|
|||||||
|
|
||||||
XSetWindowAttributes a;
|
XSetWindowAttributes a;
|
||||||
a.colormap = cmap;
|
a.colormap = cmap;
|
||||||
m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), tlw->x(), tlw->y(), tlw->width(), tlw->height(),
|
m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), rect.x(), rect.y(), rect.width(), rect.height(),
|
||||||
0, visualInfo->depth, InputOutput, visualInfo->visual,
|
0, visualInfo->depth, InputOutput, visualInfo->visual,
|
||||||
CWColormap, &a);
|
CWColormap, &a);
|
||||||
|
|
||||||
@ -153,10 +155,10 @@ QXcbWindow::QXcbWindow(QWindow *window)
|
|||||||
XCB_COPY_FROM_PARENT, // depth -- same as root
|
XCB_COPY_FROM_PARENT, // depth -- same as root
|
||||||
m_window, // window id
|
m_window, // window id
|
||||||
m_screen->root(), // parent window id
|
m_screen->root(), // parent window id
|
||||||
tlw->x(),
|
rect.x(),
|
||||||
tlw->y(),
|
rect.y(),
|
||||||
tlw->width(),
|
rect.width(),
|
||||||
tlw->height(),
|
rect.height(),
|
||||||
0, // border width
|
0, // border width
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
|
XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class
|
||||||
m_screen->screen()->root_visual, // visual
|
m_screen->screen()->root_visual, // visual
|
||||||
@ -166,6 +168,8 @@ QXcbWindow::QXcbWindow(QWindow *window)
|
|||||||
printf("created regular window: %d\n", m_window);
|
printf("created regular window: %d\n", m_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connection()->addWindow(m_window, this);
|
||||||
|
|
||||||
Q_XCB_CALL(xcb_change_window_attributes(xcb_connection(), m_window, mask, values));
|
Q_XCB_CALL(xcb_change_window_attributes(xcb_connection(), m_window, mask, values));
|
||||||
|
|
||||||
xcb_atom_t properties[4];
|
xcb_atom_t properties[4];
|
||||||
@ -177,7 +181,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
|
|||||||
if (m_screen->syncRequestSupported())
|
if (m_screen->syncRequestSupported())
|
||||||
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
|
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
|
||||||
|
|
||||||
if (tlw->windowFlags() & Qt::WindowContextHelpButtonHint)
|
if (window->windowFlags() & Qt::WindowContextHelpButtonHint)
|
||||||
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP);
|
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP);
|
||||||
|
|
||||||
Q_XCB_CALL(xcb_change_property(xcb_connection(),
|
Q_XCB_CALL(xcb_change_property(xcb_connection(),
|
||||||
@ -205,7 +209,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
|
|||||||
&m_syncCounter));
|
&m_syncCounter));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTransient(tlw) && tlw->parentWidget()) {
|
if (tlw && isTransient(tlw) && tlw->parentWidget()) {
|
||||||
// ICCCM 4.1.2.6
|
// ICCCM 4.1.2.6
|
||||||
QWidget *p = tlw->parentWidget()->window();
|
QWidget *p = tlw->parentWidget()->window();
|
||||||
xcb_window_t parentWindow = p->winId();
|
xcb_window_t parentWindow = p->winId();
|
||||||
@ -227,6 +231,7 @@ QXcbWindow::~QXcbWindow()
|
|||||||
delete m_context;
|
delete m_context;
|
||||||
if (m_screen->syncRequestSupported())
|
if (m_screen->syncRequestSupported())
|
||||||
Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter));
|
Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter));
|
||||||
|
connection()->removeWindow(m_window);
|
||||||
Q_XCB_CALL(xcb_destroy_window(xcb_connection(), m_window));
|
Q_XCB_CALL(xcb_destroy_window(xcb_connection(), m_window));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +250,7 @@ void QXcbWindow::setVisible(bool visible)
|
|||||||
xcb_wm_hints_t hints;
|
xcb_wm_hints_t hints;
|
||||||
if (visible) {
|
if (visible) {
|
||||||
// TODO: QWindow::isMinimized() or similar
|
// TODO: QWindow::isMinimized() or similar
|
||||||
if (window()->widget()->isMinimized())
|
if (window()->windowState() & Qt::WindowMinimized)
|
||||||
xcb_wm_hints_set_iconic(&hints);
|
xcb_wm_hints_set_iconic(&hints);
|
||||||
else
|
else
|
||||||
xcb_wm_hints_set_normal(&hints);
|
xcb_wm_hints_set_normal(&hints);
|
||||||
@ -522,11 +527,15 @@ QPlatformGLContext *QXcbWindow::glContext() const
|
|||||||
|
|
||||||
void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event)
|
void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event)
|
||||||
{
|
{
|
||||||
QWindowSurface *surface = window()->widget()->windowSurface();
|
QWidget *widget = window()->widget();
|
||||||
|
if (!widget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QWindowSurface *surface = widget->windowSurface();
|
||||||
if (surface) {
|
if (surface) {
|
||||||
QRect rect(event->x, event->y, event->width, event->height);
|
QRect rect(event->x, event->y, event->width, event->height);
|
||||||
|
|
||||||
surface->flush(window()->widget(), rect, QPoint());
|
surface->flush(widget, rect, QPoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user