From 3b47ace59075c11705069f1e5b1b346a0341457a Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 2 Sep 2009 13:53:59 -0700 Subject: Support Windowed mode for DFB < 1.0 DirectFB doesn't let you query the size of the Display in versions prior to 1.0. In this version require people to specify the size using QWS_SIZE, QWS_DISPLAY or print a warning and exit. Reviewed-by: Donald Carr --- .../gfxdrivers/directfb/qdirectfbscreen.cpp | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 15d982d..e9278ec 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1192,18 +1192,6 @@ bool QDirectFBScreen::connect(const QString &displaySpec) lstep = 0; size = 0; -#ifndef QT_NO_DIRECTFB_LAYER - result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY, - &d_ptr->dfbLayer); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::connect: " - "Unable to get primary display layer!", result); - return false; - } - result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen); -#else - result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen); -#endif if (result != DFB_OK) { DirectFBError("QDirectFBScreen::connect: " "Unable to get screen!", result); @@ -1231,11 +1219,30 @@ bool QDirectFBScreen::connect(const QString &displaySpec) setIntOption(displayArgs, QLatin1String("width"), &w); setIntOption(displayArgs, QLatin1String("height"), &h); +#ifndef QT_NO_DIRECTFB_LAYER + result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY, + &d_ptr->dfbLayer); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen::connect: " + "Unable to get primary display layer!", result); + return false; + } + result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen); +#else + result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen); +#endif + if (w <= 0 || h <= 0) { #ifdef QT_NO_DIRECTFB_WM result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h); -#else +#elif (Q_DIRECTFB_VERSION >= 0x010000) result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h); +#else + qWarning("QDirectFBScreen::connect: DirectFB versions prior to 1.0 do not offer a way\n" + "query the size of the primary surface in windowed mode. You have to specify\n" + "the size of the display using QWS_SIZE=[0-9]x[0-9] or\n" + "QWS_DISPLAY=directfb:width=[0-9]:height=[0-9]"); + return false; #endif if (result != DFB_OK) { DirectFBError("QDirectFBScreen::connect: " -- cgit v0.12