src/gui/kernel/qapplication_win.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 19 fcece45ef507
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   926     int type = flags & Qt::WindowType_Mask;
   926     int type = flags & Qt::WindowType_Mask;
   927 
   927 
   928     uint style;
   928     uint style;
   929     bool icon;
   929     bool icon;
   930     QString cname;
   930     QString cname;
   931     if (flags & Qt::MSWindowsOwnDC) {
   931     if (qt_widget_private(w)->isGLWidget) {
       
   932         cname = QLatin1String("QGLWidget");
       
   933         style = CS_DBLCLKS;
       
   934         icon  = true;
       
   935     } else if (flags & Qt::MSWindowsOwnDC) {
   932         cname = QLatin1String("QWidgetOwnDC");
   936         cname = QLatin1String("QWidgetOwnDC");
   933         style = CS_DBLCLKS;
   937         style = CS_DBLCLKS;
   934 #ifndef Q_WS_WINCE
   938 #ifndef Q_WS_WINCE
   935         style |= CS_OWNDC;
   939         style |= CS_OWNDC;
   936 #endif
   940 #endif
  1019     } else {
  1023     } else {
  1020         wc.hIcon    = 0;
  1024         wc.hIcon    = 0;
  1021     }
  1025     }
  1022     wc.hCursor      = 0;
  1026     wc.hCursor      = 0;
  1023 #ifndef Q_WS_WINCE
  1027 #ifndef Q_WS_WINCE
  1024     wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
  1028     wc.hbrBackground = qt_widget_private(w)->isGLWidget ? 0 : (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
  1025 #else
  1029 #else
  1026     wc.hbrBackground = 0;
  1030     wc.hbrBackground = 0;
  1027 #endif
  1031 #endif
  1028     wc.lpszMenuName  = 0;
  1032     wc.lpszMenuName  = 0;
  1029     wc.lpszClassName = (wchar_t*)cname.utf16();
  1033     wc.lpszClassName = (wchar_t*)cname.utf16();
  1899         case WM_SETTINGCHANGE:
  1903         case WM_SETTINGCHANGE:
  1900             if ( QApplication::type() == QApplication::Tty )
  1904             if ( QApplication::type() == QApplication::Tty )
  1901                 break;
  1905                 break;
  1902 
  1906 
  1903             if (!msg.wParam) {
  1907             if (!msg.wParam) {
       
  1908 #ifdef Q_WS_WINCE
       
  1909                 // On Windows CE, lParam parameter is a constant, not a char pointer.
       
  1910                 if (msg.lParam == INI_INTL) {
       
  1911 #else
  1904                 QString area = QString::fromWCharArray((wchar_t*)msg.lParam);
  1912                 QString area = QString::fromWCharArray((wchar_t*)msg.lParam);
  1905                 if (area == QLatin1String("intl")) {
  1913                 if (area == QLatin1String("intl")) {
       
  1914 #endif
  1906                     QLocalePrivate::updateSystemPrivate();
  1915                     QLocalePrivate::updateSystemPrivate();
  1907                     if (!widget->testAttribute(Qt::WA_SetLocale))
  1916                     if (!widget->testAttribute(Qt::WA_SetLocale))
  1908                         widget->dptr()->setLocale_helper(QLocale(), true);
  1917                         widget->dptr()->setLocale_helper(QLocale(), true);
  1909                 }
  1918                 }
  1910             }
  1919             }
  3614 
  3623 
  3615     if (msg.message == WM_ERASEBKGND)
  3624     if (msg.message == WM_ERASEBKGND)
  3616         return true;
  3625         return true;
  3617 
  3626 
  3618     setAttribute(Qt::WA_PendingUpdate, false);
  3627     setAttribute(Qt::WA_PendingUpdate, false);
  3619     const QRegion dirtyInBackingStore(qt_dirtyRegion(this));
  3628 
  3620     // Make sure the invalidated region contains the region we're about to repaint.
  3629     if (d_func()->isGLWidget) {
  3621     // BeginPaint will set the clip to the invalidated region and it is impossible
  3630         if (d_func()->usesDoubleBufferedGLContext)
  3622     // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient
  3631             InvalidateRect(internalWinId(), 0, false);
  3623     // as it may return an invalid context (especially on Windows Vista).
  3632     } else {
  3624     if (!dirtyInBackingStore.isEmpty())
  3633         const QRegion dirtyInBackingStore(qt_dirtyRegion(this));
  3625         InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false);
  3634         // Make sure the invalidated region contains the region we're about to repaint.
       
  3635         // BeginPaint will set the clip to the invalidated region and it is impossible
       
  3636         // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient
       
  3637         // as it may return an invalid context (especially on Windows Vista).
       
  3638         if (!dirtyInBackingStore.isEmpty())
       
  3639             InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false);
       
  3640     }
  3626     PAINTSTRUCT ps;
  3641     PAINTSTRUCT ps;
  3627     d_func()->hd = BeginPaint(internalWinId(), &ps);
  3642     d_func()->hd = BeginPaint(internalWinId(), &ps);
  3628 
  3643 
  3629     const QRect updateRect(QPoint(ps.rcPaint.left, ps.rcPaint.top),
  3644     const QRect updateRect(QPoint(ps.rcPaint.left, ps.rcPaint.top),
  3630                            QPoint(ps.rcPaint.right, ps.rcPaint.bottom));
  3645                            QPoint(ps.rcPaint.right, ps.rcPaint.bottom));