From b7b8a6c4665cf39334635e7b44a538572dc53a34 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 2 Sep 2009 13:16:57 -0700 Subject: Create windows with the appropriate geometry Since DirectFB allows for providing position and size on creation of windows we might as well use these fields rather than first create the surface and then resize it. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 16 +++++++++++----- src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 7abba81..9e0691d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -119,7 +119,7 @@ void QDirectFBWindowSurface::raise() } } -void QDirectFBWindowSurface::createWindow() +void QDirectFBWindowSurface::createWindow(const QRect &rect) { IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); if (!layer) @@ -127,8 +127,12 @@ void QDirectFBWindowSurface::createWindow() DFBWindowDescription description; description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; - description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT; + description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY; + description.posx = rect.x(); + description.posy = rect.y(); + description.width = rect.width(); + description.height = rect.height(); description.surface_caps = DSCAPS_NONE; if (screen->directFBFlags() & QDirectFBScreen::VideoOnly) description.surface_caps |= DSCAPS_VIDEOONLY; @@ -204,9 +208,11 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) DFBResult result = DFB_OK; // If we're in a resize, the surface shouldn't be locked #ifdef QT_DIRECTFB_WM - if (!dfbWindow) - createWindow(); - setWindowGeometry(dfbWindow, oldRect, rect); + if (!dfbWindow) { + createWindow(rect); + } else { + setWindowGeometry(dfbWindow, oldRect, rect); + } #else if (mode == Primary) { if (dfbSurface && dfbSurface != primarySurface) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index edecb14..7ae9bfe 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -99,7 +99,7 @@ private: QDirectFBWindowSurface *sibling; #ifdef QT_DIRECTFB_WM - void createWindow(); + void createWindow(const QRect &rect); IDirectFBWindow *dfbWindow; #else enum Mode { -- cgit v0.12