summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-09-02 20:44:05 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-09-02 21:49:50 (GMT)
commit9c244f6cf29dba9e6b3283cbd5dec2174a20907c (patch)
tree7cc87119440d02b113dcc2ddea5bcb62c7ab19f4 /src/plugins/gfxdrivers
parent5edd63fa65da0853a379a404f9406420a63e2830 (diff)
downloadQt-9c244f6cf29dba9e6b3283cbd5dec2174a20907c.zip
Qt-9c244f6cf29dba9e6b3283cbd5dec2174a20907c.tar.gz
Qt-9c244f6cf29dba9e6b3283cbd5dec2174a20907c.tar.bz2
Make size specification more robust in dfb
Support exporting QWS_SIZE=100x100 to set size Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src/plugins/gfxdrivers')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 179936d..15d982d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -1209,18 +1209,41 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
"Unable to get screen!", result);
return false;
}
+ const QString qws_size = qgetenv("QWS_SIZE");
+ if (!qws_size.isEmpty()) {
+ QRegExp rx(QLatin1String("(\\d+)x(\\d+)"));
+ if (!rx.exactMatch(qws_size)) {
+ qWarning("QDirectFBScreen::connect: Can't parse QWS_SIZE=\"%s\"", qPrintable(qws_size));
+ } else {
+ int *ints[2] = { &w, &h };
+ for (int i=0; i<2; ++i) {
+ *ints[i] = rx.cap(i + 1).toInt();
+ if (*ints[i] <= 0) {
+ qWarning("QDirectFBScreen::connect: %s is not a positive integer",
+ qPrintable(rx.cap(i + 1)));
+ w = h = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ setIntOption(displayArgs, QLatin1String("width"), &w);
+ setIntOption(displayArgs, QLatin1String("height"), &h);
+
+ if (w <= 0 || h <= 0) {
#ifdef QT_NO_DIRECTFB_WM
- result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h);
+ result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h);
#else
- result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
+ result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h);
#endif
- if (result != DFB_OK) {
- DirectFBError("QDirectFBScreen::connect: "
- "Unable to get screen size!", result);
- return false;
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreen::connect: "
+ "Unable to get screen size!", result);
+ return false;
+ }
}
- setIntOption(displayArgs, QLatin1String("width"), &w);
- setIntOption(displayArgs, QLatin1String("height"), &h);
+
dw = w;
dh = h;