summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-09-01 08:25:54 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-09-01 08:25:54 (GMT)
commit1051e9d0dc5cbad27b89756839f3619cae2d44fe (patch)
treecd25969458735e14c0b5de365760c3fd7747659d /src
parent0d411622521a89c04a416e2aaf3da44b6015b183 (diff)
parent8f1596ae9b64870c54958611552c71b0b390038f (diff)
downloadQt-1051e9d0dc5cbad27b89756839f3619cae2d44fe.zip
Qt-1051e9d0dc5cbad27b89756839f3619cae2d44fe.tar.gz
Qt-1051e9d0dc5cbad27b89756839f3619cae2d44fe.tar.bz2
Merge branch '4.6' of git:qt/qt into 4.6
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp11
-rw-r--r--src/corelib/tools/qmargins.cpp8
-rw-r--r--src/corelib/tools/qmargins.h5
-rw-r--r--src/gui/itemviews/qheaderview.cpp4
-rw-r--r--src/gui/kernel/qapplication_x11.cpp111
-rw-r--r--src/network/ssl/qsslcertificate.cpp8
-rw-r--r--src/network/ssl/qsslerror.cpp15
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h1
-rw-r--r--src/opengl/qglextensions.cpp4
-rw-r--r--src/opengl/qglshaderprogram.cpp33
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp8
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp7
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.h11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp9
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h10
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h8
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp11
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h10
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp83
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h18
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp3
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp31
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h13
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp12
27 files changed, 293 insertions, 165 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 30f1cc8..c311465 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -943,7 +943,7 @@ QByteArray QMetaObject::normalizedType(const char *type)
if (!type || !*type)
return result;
- QVarLengthArray<char> stackbuf((int)strlen(type));
+ QVarLengthArray<char> stackbuf(int(strlen(type)) + 1);
qRemoveWhitespace(type, stackbuf.data());
int templdepth = 0;
qNormalizeType(stackbuf.data(), templdepth, result);
@@ -968,10 +968,9 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
if (!method || !*method)
return result;
int len = int(strlen(method));
- char stackbuf[64];
- char *buf = (len >= 64 ? new char[len+1] : stackbuf);
- qRemoveWhitespace(method, buf);
- char *d = buf;
+ QVarLengthArray<char> stackbuf(len + 1);
+ char *d = stackbuf.data();
+ qRemoveWhitespace(method, d);
result.reserve(len);
@@ -987,8 +986,6 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
result += *d++;
}
- if (buf != stackbuf)
- delete [] buf;
return result;
}
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index df08da1..747ea5e 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
\class QMargins
\ingroup painting
- \brief The QMargins
+ \brief The QMargins class defines the four margins of a rectangle.
QMargin defines a set of four margins; left, top, right and bottom,
that describe the size of the borders surrounding a rectangle.
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
Constructs a margins object with all margins set to 0.
- \sa isValid()
+ \sa isNull()
*/
/*!
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
Constructs margins with the given \a left, \a top, \a right, \a bottom
- \sa setWidth(), setHeight()
+ \sa setLeft(), setRight(), setTop(), setBottom()
*/
/*!
@@ -86,8 +86,6 @@ QT_BEGIN_NAMESPACE
Returns true if all margins are is 0; otherwise returns
false.
-
- \sa isValid(), isEmpty()
*/
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index be918cc..2691c62 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -68,11 +68,6 @@ public:
void setRight(int right);
void setBottom(int bottom);
- int &rleft();
- int &rtop();
- int &rright();
- int &rbottom();
-
private:
int m_left;
int m_top;
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index a1c3e4e..4dbd6dc 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1047,7 +1047,9 @@ int QHeaderView::visualIndex(int logicalIndex) const
/*!
Returns the logicalIndex for the section at the given \a visualIndex
- position, or -1 otherwise.
+ position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count().
+
+ Note that the visualIndex is not affected by hidden sections.
\sa visualIndex(), sectionPosition()
*/
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 69dba40..0056b9e 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -4510,7 +4510,9 @@ void fetchWacomToolId(int &deviceType, qint64 &serialId)
struct qt_tablet_motion_data
{
- Time timestamp;
+ bool filterByWidget;
+ const QWidget *widget;
+ const QWidget *etWidget;
int tabletMotionType;
bool error; // found a reason to stop searching
};
@@ -4533,15 +4535,20 @@ static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg)
qt_tablet_motion_data *data = (qt_tablet_motion_data *) arg;
if (data->error)
return false;
-
if (event->type == data->tabletMotionType) {
- if (data->timestamp > 0) {
- if ((reinterpret_cast<const XDeviceMotionEvent*>(event))->time > data->timestamp) {
- data->error = true;
- return false;
+ const XDeviceMotionEvent *const motion = reinterpret_cast<const XDeviceMotionEvent*>(event);
+ if (data->filterByWidget) {
+ const QPoint curr(motion->x, motion->y);
+ const QWidget *w = data->etWidget;
+ const QWidget *const child = w->childAt(curr);
+ if (child) {
+ w = child;
}
+ if (w == data->widget)
+ return true;
+ } else {
+ return true;
}
- return true;
}
data->error = event->type != MotionNotify; // we stop compression when another event gets in between.
@@ -4574,57 +4581,17 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
qreal rotation = 0;
int deviceType = QTabletEvent::NoDevice;
int pointerType = QTabletEvent::UnknownPointer;
- XEvent mouseMotionEvent;
- XEvent dummy;
const XDeviceMotionEvent *motion = 0;
XDeviceButtonEvent *button = 0;
const XProximityNotifyEvent *proximity = 0;
QEvent::Type t;
Qt::KeyboardModifiers modifiers = 0;
- bool reinsertMouseEvent = false;
- XEvent mouseMotionEventSave;
#if !defined (Q_OS_IRIX)
XID device_id;
#endif
if (ev->type == tablet->xinput_motion) {
motion = reinterpret_cast<const XDeviceMotionEvent*>(ev);
-
- // Do event compression. Skip over tablet+mouse move events if there are newer ones.
- qt_tablet_motion_data tabletMotionData;
- tabletMotionData.tabletMotionType = tablet->xinput_motion;
- while (true) {
- // Find first mouse event since we expect them in pairs inside Qt
- tabletMotionData.error =false;
- tabletMotionData.timestamp = 0;
- if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) {
- mouseMotionEventSave = mouseMotionEvent;
- reinsertMouseEvent = true;
- } else {
- break;
- }
-
- // Now discard any duplicate tablet events.
- tabletMotionData.error = false;
- tabletMotionData.timestamp = mouseMotionEvent.xmotion.time;
- while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
- motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy);
- }
-
- // now check if there are more recent tablet motion events since we'll compress the current one with
- // newer ones in that case
- tabletMotionData.error = false;
- tabletMotionData.timestamp = 0;
- if (! XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
- break; // done with compression
- }
- motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy);
- }
-
- if (reinsertMouseEvent) {
- XPutBackEvent(X11->display, &mouseMotionEventSave);
- }
-
t = QEvent::TabletMove;
global = QPoint(motion->x_root, motion->y_root);
curr = QPoint(motion->x, motion->y);
@@ -4777,11 +4744,14 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
}
#endif
- QWidget *child = w->childAt(curr);
- if (child) {
- w = child;
- curr = w->mapFromGlobal(global);
+ if (tablet->widgetToGetPress) {
+ w = tablet->widgetToGetPress;
+ } else {
+ QWidget *child = w->childAt(curr);
+ if (child)
+ w = child;
}
+ curr = w->mapFromGlobal(global);
if (t == QEvent::TabletPress) {
tablet->widgetToGetPress = w;
@@ -4795,10 +4765,45 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
deviceType, pointerType,
qreal(pressure / qreal(tablet->maxPressure - tablet->minPressure)),
xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid);
- if (proximity)
+ if (proximity) {
QApplication::sendSpontaneousEvent(qApp, &e);
- else
+ } else {
QApplication::sendSpontaneousEvent(w, &e);
+ const bool accepted = e.isAccepted();
+ if (!accepted && ev->type == tablet->xinput_motion) {
+ // If the widget does not accept tablet events, we drop the next ones from the event queue
+ // for this widget so it is not overloaded with the numerous tablet events.
+ qt_tablet_motion_data tabletMotionData;
+ tabletMotionData.tabletMotionType = tablet->xinput_motion;
+ tabletMotionData.widget = w;
+ tabletMotionData.etWidget = this;
+ // if nothing is pressed, the events are filtered by position
+ tabletMotionData.filterByWidget = (tablet->widgetToGetPress == 0);
+
+ bool reinsertMouseEvent = false;
+ XEvent mouseMotionEvent;
+ while (true) {
+ // Find first mouse event since we expect them in pairs inside Qt
+ tabletMotionData.error =false;
+ if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) {
+ reinsertMouseEvent = true;
+ } else {
+ break;
+ }
+
+ // Now discard any duplicate tablet events.
+ tabletMotionData.error = false;
+ XEvent dummy;
+ while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
+ // just discard the event
+ }
+ }
+
+ if (reinsertMouseEvent) {
+ XPutBackEvent(X11->display, &mouseMotionEvent);
+ }
+ }
+ }
return true;
}
#endif
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 666770d..c128da9 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -250,6 +250,10 @@ void QSslCertificate::clear()
*/
QByteArray QSslCertificate::version() const
{
+ if (d->versionString.isEmpty() && d->x509)
+ d->versionString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)));
+
return d->versionString;
}
@@ -258,6 +262,10 @@ QByteArray QSslCertificate::version() const
*/
QByteArray QSslCertificate::serialNumber() const
{
+ if (d->serialNumberString.isEmpty() && d->x509)
+ d->serialNumberString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber)) + 1);
+
return d->serialNumberString;
}
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index 69d2ccd..d47c91d 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -105,10 +105,8 @@ public:
};
/*!
- Constructs a QSslError object. The two optional arguments specify the \a
- error that occurred, and which \a certificate the error relates to.
+ Constructs a QSslError object with no error and default certificate.
- \sa QSslCertificate
*/
// RVCT compiler in debug build does not like about default values in const-
@@ -120,6 +118,11 @@ QSslError::QSslError()
d->certificate = QSslCertificate();
}
+/*!
+ Constructs a QSslError object. The argument specifies the \a
+ error that occurred.
+
+*/
QSslError::QSslError(SslError error)
: d(new QSslErrorPrivate)
{
@@ -127,6 +130,12 @@ QSslError::QSslError(SslError error)
d->certificate = QSslCertificate();
}
+/*!
+ Constructs a QSslError object. The two arguments specify the \a
+ error that occurred, and which \a certificate the error relates to.
+
+ \sa QSslCertificate
+*/
QSslError::QSslError(SslError error, const QSslCertificate &certificate)
: d(new QSslErrorPrivate)
{
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 5b04a57..d3dcd51 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -94,6 +94,7 @@ QT_BEGIN_NAMESPACE
#ifdef SSLEAY_MACROS
DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return)
#endif
+DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return)
DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return)
@@ -608,6 +609,7 @@ bool q_resolveOpenSslSymbols()
#ifdef SSLEAY_MACROS
RESOLVEFUNC(ASN1_dup)
#endif
+ RESOLVEFUNC(ASN1_INTEGER_get)
RESOLVEFUNC(ASN1_STRING_data)
RESOLVEFUNC(ASN1_STRING_length)
RESOLVEFUNC(BIO_ctrl)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index f9c92e5..30762ca 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -201,6 +201,7 @@ QT_BEGIN_NAMESPACE
#endif // !defined QT_LINKED_OPENSSL
bool q_resolveOpenSslSymbols();
+long q_ASN1_INTEGER_get(ASN1_INTEGER *a);
unsigned char * q_ASN1_STRING_data(ASN1_STRING *a);
int q_ASN1_STRING_length(ASN1_STRING *a);
long q_BIO_ctrl(BIO *a, int b, long c, void *d);
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index e1ab6a4..a883c42 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -175,10 +175,10 @@ bool qt_resolve_glsl_extensions(QGLContext *ctx)
#if defined(QT_OPENGL_ES_2)
// The GLSL shader functions are always present in OpenGL/ES 2.0.
// The only exceptions are glGetProgramBinaryOES and glProgramBinaryOES.
- if (!QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved) {
+ if (!QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved) {
glGetProgramBinaryOES = (_glGetProgramBinaryOES) ctx->getProcAddress(QLatin1String("glGetProgramBinaryOES"));
glProgramBinaryOES = (_glProgramBinaryOES) ctx->getProcAddress(QLatin1String("glProgramBinaryOES"));
- QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved = true;
+ QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved = true;
}
return true;
#else
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 61d8b10..56b55d0 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -501,6 +501,25 @@ bool QGLShader::compile(const char *source)
return d->compile(this);
} else if (d->shader) {
QVarLengthArray<const char *> src;
+ int headerLen = 0;
+ while (source && source[headerLen] == '#') {
+ // Skip #version and #extension directives at the start of
+ // the shader code. We need to insert the qualifierDefines
+ // and redefineHighp just after them.
+ if (qstrncmp(source + headerLen, "#version", 8) != 0 &&
+ qstrncmp(source + headerLen, "#extension", 10) != 0) {
+ break;
+ }
+ while (source[headerLen] != '\0' && source[headerLen] != '\n')
+ ++headerLen;
+ if (source[headerLen] == '\n')
+ ++headerLen;
+ }
+ QByteArray header;
+ if (headerLen > 0) {
+ header = QByteArray(source, headerLen);
+ src.append(header.constData());
+ }
#ifdef QGL_DEFINE_QUALIFIERS
src.append(qualifierDefines);
#endif
@@ -509,7 +528,7 @@ bool QGLShader::compile(const char *source)
d->shaderType == PartialFragmentShader)
src.append(redefineHighp);
#endif
- src.append(source);
+ src.append(source + headerLen);
QGLContextGroup *ctx = d->ctx;
glShaderSource(d->shader, src.size(), src.data(), 0);
return d->compile(this);
@@ -1094,6 +1113,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const
if (!isLinked())
return QByteArray();
+ QGLContextGroup *ctx = d->ctx;
+#ifndef QT_NO_DEBUG
+ if (!qt_check_sharing_with_current_context(ctx))
+ qWarning("QGLShaderProgram::programBinary: Program is not associated with current context.");
+#endif
+
// Get the length of the binary data, bailing out if there is none.
GLint length = 0;
glGetProgramiv(d->program, GL_PROGRAM_BINARY_LENGTH_OES, &length);
@@ -1124,6 +1149,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const
bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary)
{
#if defined(QT_OPENGL_ES_2)
+ QGLContextGroup *ctx = d->ctx;
+#ifndef QT_NO_DEBUG
+ if (!qt_check_sharing_with_current_context(ctx))
+ qWarning("QGLShaderProgram::setProgramBinary: Program is not associated with current context.");
+#endif
+
// Load the binary and check that it was linked correctly.
glProgramBinaryOES(d->program, (GLenum)format,
binary.constData(), binary.size());
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
index fe77fd1..f207ebc 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
@@ -41,7 +41,7 @@
#include "qdirectfbkeyboard.h"
-#ifndef QT_NO_DIRECTFB
+#ifndef QT_NO_QWS_DIRECTFB
#include "qdirectfbscreen.h"
#include <qobject.h>
@@ -53,6 +53,8 @@
#include <fcntl.h>
#include <errno.h>
+QT_BEGIN_NAMESPACE
+
class KeyMap : public QHash<DFBInputDeviceKeySymbol, Qt::Key>
{
public:
@@ -429,6 +431,6 @@ KeyMap::KeyMap()
insert(DIKS_TILDE , Qt::Key_AsciiTilde);
}
+QT_END_NAMESPACE
#include "qdirectfbkeyboard.moc"
-
-#endif // QT_NO_DIRECTFB
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
index 756892f..96d73ac 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h
@@ -42,13 +42,16 @@
#ifndef QDIRECTFBKEYBOARD_H
#define QDIRECTFBKEYBOARD_H
+#include <qglobal.h>
#include <QtGui/qkbd_qws.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
-QT_MODULE(Gui)
+QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DIRECTFB
+QT_MODULE(Gui)
class QDirectFBKeyboardHandlerPrivate;
@@ -62,7 +65,9 @@ private:
QDirectFBKeyboardHandlerPrivate *d;
};
-#endif // QT_NO_DIRECTFB
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
QT_END_HEADER
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
index 1f2b363..2fb1520 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
@@ -41,6 +41,8 @@
#include "qdirectfbmouse.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
#include "qdirectfbscreen.h"
#include <qsocketnotifier.h>
@@ -49,6 +51,8 @@
#include <fcntl.h>
#include <errno.h>
+QT_BEGIN_NAMESPACE
+
class QDirectFBMouseHandlerPrivate : public QObject
{
Q_OBJECT
@@ -269,5 +273,8 @@ void QDirectFBMouseHandler::resume()
d->setEnabled(true);
}
+QT_END_NAMESPACE
#include "qdirectfbmouse.moc"
+#endif // QT_NO_QWS_DIRECTFB
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
index 14026ee..5ef229c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
@@ -42,13 +42,16 @@
#ifndef QDIRECTFBMOUSE_H
#define QDIRECTFBMOUSE_H
+#include <qglobal.h>
#include <QtGui/qmouse_qws.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
-QT_MODULE(Gui)
+QT_BEGIN_NAMESPACE
-#ifndef QT_NO_DIRECTFB
+QT_MODULE(Gui)
class QDirectFBMouseHandlerPrivate;
@@ -65,8 +68,8 @@ protected:
QDirectFBMouseHandlerPrivate *d;
};
-#endif // QT_NO_DIRECTFB
+QT_END_NAMESPACE
QT_END_HEADER
-
+#endif // QT_NO_QWS_DIRECTFB
#endif // QDIRECTFBMOUSE_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index dec4bdd..106de0d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -39,12 +39,14 @@
**
****************************************************************************/
-#ifndef QT_NO_DIRECTFB
-
#include "qdirectfbscreen.h"
#include "qdirectfbpaintdevice.h"
#include "qdirectfbpaintengine.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
+QT_BEGIN_NAMESPACE
+
QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr)
: QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0),
@@ -169,5 +171,6 @@ QPaintEngine *QDirectFBPaintDevice::paintEngine() const
return engine;
}
-#endif
+QT_END_NAMESPACE
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index ca958c8..f5de44b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -43,11 +43,14 @@
#define QDIRECTFBPAINTDEVICE_H
#include <private/qpaintengine_raster_p.h>
-#include <directfb.h>
#include "qdirectfbscreen.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
// Inherited by both window surface and pixmap
@@ -57,7 +60,7 @@ class QDirectFBPaintDevice : public QCustomRasterPaintDevice
public:
~QDirectFBPaintDevice();
- IDirectFBSurface *directFBSurface() const;
+ virtual IDirectFBSurface *directFBSurface() const;
void lockDirectFB(DFBSurfaceLockFlags lock);
void unlockDirectFB();
@@ -94,6 +97,9 @@ private:
Q_DISABLE_COPY(QDirectFBPaintDevice);
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
#endif //QDIRECTFBPAINTDEVICE_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 337e75a..9a9553e 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -41,7 +41,7 @@
#include "qdirectfbpaintengine.h"
-#ifndef QT_NO_DIRECTFB
+#ifndef QT_NO_QWS_DIRECTFB
#include "qdirectfbwindowsurface.h"
#include "qdirectfbscreen.h"
@@ -55,6 +55,8 @@
#include <private/qpixmap_raster_p.h>
#include <private/qimagepixmapcleanuphooks_p.h>
+QT_BEGIN_NAMESPACE
+
class SurfaceCache;
class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
{
@@ -145,7 +147,9 @@ private:
#ifdef QT_DIRECTFB_IMAGECACHE
+QT_BEGIN_INCLUDE_NAMESPACE
#include <private/qimage_p.h>
+QT_END_INCLUDE_NAMESPACE
struct CachedImage
{
IDirectFBSurface *surface;
@@ -1246,4 +1250,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
}
#endif // QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
-#endif // QT_NO_DIRECTFB
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
index 51468ad..b4f0b5d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h
@@ -45,8 +45,12 @@
#include <QtGui/qpaintengine.h>
#include <private/qpaintengine_raster_p.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
class QDirectFBPaintEnginePrivate;
@@ -107,6 +111,10 @@ public:
static void initImageCache(int size);
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
+
#endif // QPAINTENGINE_DIRECTFB_P_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 2e3d32d..0717020 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -41,6 +41,8 @@
#include "qdirectfbpixmap.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
#include "qdirectfbscreen.h"
#include "qdirectfbpaintengine.h"
@@ -48,6 +50,9 @@
#include <QtCore/qfile.h>
#include <directfb.h>
+
+QT_BEGIN_NAMESPACE
+
static int global_ser_no = 0;
QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType)
@@ -574,3 +579,9 @@ void QDirectFBPixmapData::invalidate()
imageFormat = QImage::Format_Invalid;
}
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
+
+
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index 8bf1e73..7b4ae47 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -42,6 +42,10 @@
#ifndef QDIRECTFBPIXMAP_H
#define QDIRECTFBPIXMAP_H
+#include <qglobal.h>
+
+#ifndef QT_NO_QWS_DIRECTFB
+
#include <QtGui/private/qpixmapdata_p.h>
#include <QtGui/private/qpaintengine_raster_p.h>
#include "qdirectfbpaintdevice.h"
@@ -49,6 +53,8 @@
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
class QDirectFBPaintEngine;
@@ -91,6 +97,10 @@ private:
bool alpha;
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
+
#endif // QDIRECTFBPIXMAP_H
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 8be0355..59fa191 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -54,6 +54,10 @@
#include <QtCore/qvector.h>
#include <QtCore/qrect.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
+QT_BEGIN_NAMESPACE
+
class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem
{
Q_OBJECT
@@ -94,8 +98,6 @@ public:
QDirectFBScreen *q;
};
-#include "qdirectfbscreen.moc"
-
QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
: QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE),
directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid),
@@ -494,14 +496,6 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface,
#endif // QT_NO_DIRECTFB_PALETTE
-#ifndef QT_NO_QWS_CURSOR
-#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR
-#define QT_DIRECTFB_CURSOR
-#elif defined QT_DIRECTFB_LAYER
-#define QT_DIRECTFB_CURSOR
-#endif
-#endif
-
#if defined QT_DIRECTFB_CURSOR
class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor
{
@@ -1015,7 +1009,7 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value)
{
Q_ASSERT(value);
- QRegExp rx(QString("%1=?(\\d+)").arg(variable));
+ QRegExp rx(QString::fromLatin1("%1=?(\\d+)").arg(variable));
rx.setCaseSensitivity(Qt::CaseInsensitive);
if (arguments.indexOf(rx) != -1) {
*value = rx.cap(1).toInt();
@@ -1024,36 +1018,6 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var
return false;
}
-static inline int depth(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- return 1;
- case QImage::Format_Indexed8:
- return 8;
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- return 32;
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_RGB888:
- return 24;
- case QImage::Format_RGB555:
- case QImage::Format_RGB444:
- case QImage::Format_RGB16:
- case QImage::Format_ARGB4444_Premultiplied:
- return 16;
- case QImage::Format_Invalid:
- case QImage::NImageFormats:
- break;
- }
- return -1;
-}
-
bool QDirectFBScreen::connect(const QString &displaySpec)
{
DFBResult result = DFB_OK;
@@ -1199,7 +1163,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
break;
}
setPixelFormat(pixelFormat);
- QScreen::d = ::depth(pixelFormat);
+ QScreen::d = QDirectFBScreen::depth(pixelFormat);
data = 0;
lstep = 0;
size = 0;
@@ -1227,6 +1191,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
"Unable to get screen size!", result);
return false;
}
+ ::setIntOption(displayArgs, QLatin1String("width"), &w);
+ ::setIntOption(displayArgs, QLatin1String("height"), &h);
dw = w;
dh = h;
@@ -1252,7 +1218,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
surface->Release(surface);
#endif
- QRegExp backgroundColorRegExp("bgcolor=?(.+)");
+ QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)"));
backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive);
if (displayArgs.indexOf(backgroundColorRegExp) != -1) {
d_ptr->backgroundColor.setNamedColor(backgroundColorRegExp.cap(1));
@@ -1305,12 +1271,10 @@ bool QDirectFBScreen::initDevice()
}
#endif
-#ifndef QT_NO_QWS_CURSOR
-#if defined QT_NO_DIRECTFB_WM || defined QT_NO_DIRECTFB_LAYER
- QScreenCursor::initSoftwareCursor();
-#else
+#ifdef QT_DIRECTFB_CURSOR
qt_screencursor = new QDirectFBScreenCursor;
-#endif
+#elif !defined QT_NO_QWS_CURSOR
+ QScreenCursor::initSoftwareCursor();
#endif
return true;
}
@@ -1370,17 +1334,18 @@ QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const
// window surfaces. Normal, directFB surfaces are handled by DirectFB.
void QDirectFBScreen::exposeRegion(QRegion r, int changing)
{
-#ifdef QT_NO_DIRECTFB_WM
+#if defined QT_NO_DIRECTFB_WM
const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows();
- if (changing < 0 || changing >= windows.size())
+ if (changing < 0 || changing >= windows.size()) {
return;
-
+ }
QWSWindow *win = windows.at(changing);
QWSWindowSurface *s = win->windowSurface();
r &= region();
- if (r.isEmpty())
+ if (r.isEmpty()) {
return;
+ }
const QRect brect = r.boundingRect();
@@ -1398,15 +1363,18 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
? static_cast<QDirectFBWindowSurface*>(s) : 0;
if (dfbWindowSurface) {
IDirectFBSurface *surface = dfbWindowSurface->directFBSurface();
+ Q_ASSERT(surface);
const int n = insideWindow.numRects();
if (n == 1 || d_ptr->directFBFlags & BoundingRectFlip) {
const QRect source = (insideWindow.boundingRect().intersected(windowGeometry)).translated(-windowGeometry.topLeft());
const DFBRectangle rect = {
source.x(), source.y(), source.width(), source.height()
};
+
d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, &rect,
windowGeometry.x() + source.x(),
windowGeometry.y() + source.y());
+
} else {
const QVector<QRect> rects = insideWindow.rects();
QVarLengthArray<DFBRectangle, 16> dfbRectangles(n);
@@ -1429,6 +1397,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
}
}
+#ifdef QT_NO_DIRECTFB_CURSOR
if (QScreenCursor *cursor = QScreenCursor::instance()) {
const QRect cursorRectangle = cursor->boundingRect();
if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) {
@@ -1442,6 +1411,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
#endif
}
}
+#endif
flipSurface(d_ptr->primarySurface, d_ptr->flipFlags, r, QPoint());
#else
Q_UNUSED(r);
@@ -1459,8 +1429,8 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion &region)
return;
d_ptr->primarySurface->SetColor(d_ptr->primarySurface,
- color.red(), color.green(), color.blue(),
- color.alpha());
+ color.red(), color.green(), color.blue(),
+ color.alpha());
const int n = region.numRects();
if (n > 1) {
const QRect r = region.boundingRect();
@@ -1590,3 +1560,8 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
return subSurface;
}
+QT_END_NAMESPACE
+
+#include "qdirectfbscreen.moc"
+#endif // QT_NO_QWS_DIRECTFB
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index df0eea4..e74adb1 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -42,12 +42,16 @@
#ifndef QDIRECTFBSCREEN_H
#define QDIRECTFBSCREEN_H
+#include <qglobal.h>
+#ifndef QT_NO_QWS_DIRECTFB
#include <QtGui/qscreen_qws.h>
#include <directfb.h>
#include <directfb_version.h>
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
#if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER
@@ -83,6 +87,16 @@ QT_MODULE(Gui)
#if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION
#define QT_DIRECTFB_OPAQUE_DETECTION
#endif
+#ifndef QT_NO_QWS_CURSOR
+#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR
+#define QT_DIRECTFB_CURSOR
+#elif defined QT_DIRECTFB_LAYER
+#define QT_DIRECTFB_CURSOR
+#endif
+#endif
+#ifndef QT_DIRECTFB_CURSOR
+#define QT_NO_DIRECTFB_CURSOR
+#endif
#if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM
#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM
#endif
@@ -269,6 +283,10 @@ inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface)
return QDirectFBScreen::hasAlphaChannel(format);
}
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
#endif // QDIRECTFBSCREEN_H
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
index 4caee414..05fe70f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp
@@ -43,6 +43,7 @@
#include <QtGui/qscreendriverplugin_qws.h>
#include <QtCore/qstringlist.h>
+#ifndef QT_NO_QWS_DIRECTFB
class DirectFBScreenDriverPlugin : public QScreenDriverPlugin
{
@@ -73,3 +74,5 @@ QScreen* DirectFBScreenDriverPlugin::create(const QString& driver,
}
Q_EXPORT_PLUGIN2(qdirectfbscreen, DirectFBScreenDriverPlugin)
+
+#endif
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index a05ad21..73a6dd7 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -48,11 +48,15 @@
#include <qpaintdevice.h>
#include <qvarlengtharray.h>
+#ifndef QT_NO_QWS_DIRECTFB
+
+QT_BEGIN_NAMESPACE
+
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr)
: QDirectFBPaintDevice(scr)
+ , sibling(0)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
- , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -69,9 +73,9 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget)
: QWSWindowSurface(widget), QDirectFBPaintDevice(scr)
+ , sibling(0)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
- , sibling(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
@@ -243,23 +247,16 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect)
QByteArray QDirectFBWindowSurface::permanentState() const
{
-#ifdef QT_DIRECTFB_WM
QByteArray state(sizeof(this), 0);
*reinterpret_cast<const QDirectFBWindowSurface**>(state.data()) = this;
return state;
-#endif
- return QByteArray();
}
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
-#ifdef QT_DIRECTFB_WM
if (state.size() == sizeof(this)) {
sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData());
}
-#else
- Q_UNUSED(state);
-#endif
}
static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy)
@@ -381,6 +378,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
}
}
+#ifdef QT_NO_DIRECTFB_CURSOR
if (QScreenCursor *cursor = QScreenCursor::instance()) {
const QRect cursorRectangle = cursor->boundingRect();
if (cursor->isVisible() && !cursor->isAccelerated()
@@ -396,6 +394,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
#endif
}
}
+#endif
if (mode == Offscreen) {
screen->flipSurface(primarySurface, flipFlags, region, offset + windowGeometry.topLeft());
} else
@@ -424,6 +423,14 @@ void QDirectFBWindowSurface::endPaint(const QRegion &)
unlockDirectFB();
}
+IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const
+{
+ if (!dfbSurface && sibling && sibling->dfbSurface)
+ return sibling->dfbSurface;
+ return dfbSurface;
+}
+
+
IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const
{
Q_ASSERT(widget);
@@ -449,3 +456,9 @@ void QDirectFBWindowSurface::updateFormat()
{
imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_QWS_DIRECTFB
+
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index a2861e5..ca76613 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -46,9 +46,10 @@
#include "qdirectfbpaintdevice.h"
#include "qdirectfbscreen.h"
+#ifndef QT_NO_QWS_DIRECTFB
+
#include <private/qpaintengine_raster_p.h>
#include <private/qwindowsurface_qws_p.h>
-#include <directfb.h>
#ifdef QT_DIRECTFB_TIMING
#include <qdatetime.h>
@@ -56,6 +57,8 @@
QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
QT_MODULE(Gui)
class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice
@@ -89,12 +92,14 @@ public:
void endPaint(const QRegion &);
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
+ IDirectFBSurface *directFBSurface() const;
private:
void updateFormat();
+ QDirectFBWindowSurface *sibling;
+
#ifdef QT_DIRECTFB_WM
void createWindow();
IDirectFBWindow *dfbWindow;
- QDirectFBWindowSurface *sibling;
#else
enum Mode {
Primary,
@@ -110,6 +115,10 @@ private:
#endif
};
+QT_END_NAMESPACE
+
QT_END_HEADER
+#endif // QT_NO_QWS_DIRECTFB
+
#endif // QDIRECFBWINDOWSURFACE_H
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 742d596..2692c96 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -323,12 +323,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call
}
}
- char* buf = new char[colSize];
+ QVarLengthArray<char> buf(colSize);
while (true) {
r = SQLGetData(hStmt,
column+1,
unicode ? SQL_C_WCHAR : SQL_C_CHAR,
- (SQLPOINTER)buf,
+ (SQLPOINTER)buf.data(),
colSize,
&lengthIndicator);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
@@ -343,11 +343,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// colSize-1: remove 0 termination when there is more data to fetch
int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator;
if (unicode) {
- fieldVal += QString((QChar*) buf, rSize / 2);
+ fieldVal += QString((const QChar*) buf.constData(), rSize / 2);
} else {
- fieldVal += QString::fromAscii(buf, rSize);
+ fieldVal += QString::fromAscii(buf.constData(), rSize);
}
- if (lengthIndicator - fieldVal.size() <= 0) {
+ memset(buf.data(), 0, colSize);
+ if (lengthIndicator < colSize) {
// workaround for Drivermanagers that don't return SQL_NO_DATA
break;
}
@@ -359,7 +360,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
break;
}
}
- delete[] buf;
return fieldVal;
}