Basic QDesktopWidget support.

Makes it possible to use grabWindow on the desktop widget with the xcb
plugin, which gives us a few more passing tests in tst_QWidget.
This commit is contained in:
Samuel Rødal 2011-06-03 14:35:09 +02:00
parent a9910abac9
commit 7e4116cc8a
2 changed files with 11 additions and 2 deletions

View File

@ -113,6 +113,14 @@ void QXcbWindow::create()
Qt::WindowType type = window()->windowType(); Qt::WindowType type = window()->windowType();
if (type == Qt::Desktop) {
m_window = m_screen->root();
m_depth = m_screen->screen()->root_depth;
m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
connection()->addWindow(m_window, this);
return;
}
const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK; const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK;
const quint32 values[] = { const quint32 values[] = {
// XCB_CW_BACK_PIXMAP // XCB_CW_BACK_PIXMAP
@ -149,6 +157,7 @@ void QXcbWindow::create()
{ {
#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());
#elif defined(XCB_USE_EGL) #elif defined(XCB_USE_EGL)
EGLDisplay eglDisplay = connection()->egl_display(); EGLDisplay eglDisplay = connection()->egl_display();
EGLConfig eglConfig = q_configFromQWindowFormat(eglDisplay,window()->requestedWindowFormat(),true); EGLConfig eglConfig = q_configFromQWindowFormat(eglDisplay,window()->requestedWindowFormat(),true);

View File

@ -90,7 +90,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
Qt::WindowFlags flags = data.window_flags; Qt::WindowFlags flags = data.window_flags;
if ((!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow()) || q->windowType() == Qt::Desktop ) if (!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow())
return; // we only care about real toplevels return; // we only care about real toplevels
QWindowSurface *surface = q->windowSurface(); QWindowSurface *surface = q->windowSurface();
@ -776,7 +776,7 @@ void QWidgetPrivate::createTLSysExtra()
Q_Q(QWidget); Q_Q(QWidget);
extra->topextra->screenIndex = 0; extra->topextra->screenIndex = 0;
extra->topextra->window = 0; extra->topextra->window = 0;
if ((q->testAttribute(Qt::WA_NativeWindow) || q->isWindow()) && q->windowType() != Qt::Desktop) if (q->testAttribute(Qt::WA_NativeWindow) || q->isWindow())
extra->topextra->window = new QWidgetWindow(q); extra->topextra->window = new QWidgetWindow(q);
} }