summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-02-03 13:27:43 +0100
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-02-04 15:26:43 +0100
commit392123ef5432643d1047d1e1dd71512ec39d382d (patch)
treea41d4c5b6957a14c4b52f9eda063814100b45899
parent10ca680e00fe514c32eb6364c4cca3ce46814076 (diff)
downloadqt4-tools-392123ef5432643d1047d1e1dd71512ec39d382d.tar.gz
Fixed bug where GL widget was not fully updated on Vista.
There were cases where the QGLWidget would not be fully updated on screen on Windows Vista and Windows 7 with Aero disabled. Task-number: QTBUG-7865 Reviewed-by: Prasanth
-rw-r--r--src/gui/kernel/qapplication_win.cpp28
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/kernel/qwidget_p.h2
-rw-r--r--src/opengl/qgl_mac.mm2
-rw-r--r--src/opengl/qgl_p.h4
5 files changed, 24 insertions, 14 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 5a4f4e63e2..d0c986d55f 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -927,7 +927,11 @@ const QString qt_reg_winclass(QWidget *w) // register window class
uint style;
bool icon;
QString cname;
- if (flags & Qt::MSWindowsOwnDC) {
+ if (qt_widget_private(w)->isGLWidget) {
+ cname = QLatin1String("QGLWidget");
+ style = CS_DBLCLKS;
+ icon = true;
+ } else if (flags & Qt::MSWindowsOwnDC) {
cname = QLatin1String("QWidgetOwnDC");
style = CS_DBLCLKS;
#ifndef Q_OS_WINCE
@@ -1011,7 +1015,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class
ATOM atom;
#ifndef Q_OS_WINCE
- HBRUSH bgBrush = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
+ HBRUSH bgBrush = qt_widget_private(w)->isGLWidget ? 0 : (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
QT_WA({
WNDCLASS wc;
wc.style = style;
@@ -3626,13 +3630,19 @@ bool QETWidget::translatePaintEvent(const MSG &msg)
return true;
setAttribute(Qt::WA_PendingUpdate, false);
- const QRegion dirtyInBackingStore(qt_dirtyRegion(this));
- // Make sure the invalidated region contains the region we're about to repaint.
- // BeginPaint will set the clip to the invalidated region and it is impossible
- // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient
- // as it may return an invalid context (especially on Windows Vista).
- if (!dirtyInBackingStore.isEmpty())
- InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false);
+
+ if (d_func()->isGLWidget) {
+ if (d_func()->usesDoubleBufferedGLContext)
+ InvalidateRect(internalWinId(), 0, false);
+ } else {
+ const QRegion dirtyInBackingStore(qt_dirtyRegion(this));
+ // Make sure the invalidated region contains the region we're about to repaint.
+ // BeginPaint will set the clip to the invalidated region and it is impossible
+ // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient
+ // as it may return an invalid context (especially on Windows Vista).
+ if (!dirtyInBackingStore.isEmpty())
+ InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false);
+ }
PAINTSTRUCT ps;
d_func()->hd = BeginPaint(internalWinId(), &ps);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 91e43cef2f..e8ec3a5732 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -183,6 +183,7 @@ QWidgetPrivate::QWidgetPrivate(int version) :
,inDirtyList(0)
,isScrolled(0)
,isMoved(0)
+ , isGLWidget(0)
,usesDoubleBufferedGLContext(0)
#ifdef Q_WS_WIN
,noPaintOnScreen(0)
@@ -194,7 +195,6 @@ QWidgetPrivate::QWidgetPrivate(int version) :
#endif
#ifdef Q_WS_MAC
,needWindowChange(0)
- ,isGLWidget(0)
#endif
,polished(0)
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 2b092201f3..ee56bb2abf 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -537,6 +537,7 @@ public:
uint inDirtyList : 1;
uint isScrolled : 1;
uint isMoved : 1;
+ uint isGLWidget : 1;
uint usesDoubleBufferedGLContext : 1;
#ifdef Q_WS_WIN
@@ -593,7 +594,6 @@ public:
// This is new stuff
uint needWindowChange : 1;
- uint isGLWidget : 1;
#endif
#if defined(Q_WS_X11) || defined (Q_WS_WIN) || defined(Q_WS_MAC)
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm
index dd9d9ff60a..3329ff9e67 100644
--- a/src/opengl/qgl_mac.mm
+++ b/src/opengl/qgl_mac.mm
@@ -882,8 +882,6 @@ void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget)
break;
current = current->parentWidget();
}
-
- isGLWidget = 1;
}
bool QGLWidgetPrivate::renderCxPm(QPixmap*)
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 793c4d7137..56fe11f551 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -160,7 +160,9 @@ public:
#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
, eglSurfaceWindowId(0)
#endif
- {}
+ {
+ isGLWidget = 1;
+ }
~QGLWidgetPrivate() {}