Changeset 1035 for trunk/src


Ignore:
Timestamp:
Aug 29, 2011, 2:08:51 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

OS/2: Add proper processing of WM_VRNENABLED for child widgets.

This became possible after r1034 and fixes some repainting issues
in applications (like video players) that paint on Qt widgets externally
using native window IDs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/painting/qwindowsurface_pm.cpp

    r1034 r1035  
    338338    ULONG bufNum;
    339339    bool posDirty;
    340     bool vrnDisabled;
    341340    bool inDrag;
    342341    SETUP_BLITTER setup;
     
    353352    {
    354353        int widgetHeight;
    355         bool vrnDirty;
     354        bool vrnDirty : 1;
     355        bool vrnDisabled : 1;
    356356        size_t rclCount;
    357357        QVector<RECTL> rcls;
     
    393393    wd->rclCount = 0;
    394394
    395     if (widget == that->window()) {
    396         // receive visible region change messages (note that we don't do this
    397         // for sub-widgets as it causes some strange PM freezes if these widgets
    398         // are embedded windows manipulated by other processes). We also want
    399         // to handle other PM messages
    400         widget->addPmEventFilter(this);
    401         WinSetVisibleRegionNotify(widget->internalWinId(), TRUE);
    402     } else {
    403         // receive various PM messages
    404         widget->addPmEventFilter(this);
     395    // receive visible region change messages and other PM messages
     396    widget->addPmEventFilter(this);
     397    WinSetVisibleRegionNotify(widget->internalWinId(), TRUE);
     398
     399    if (widget != that->window()) {
    405400        // receive reparent messages from children to cleanup the map
    406401        widget->installEventFilter(this);
     
    410405void QPMDiveWindowSurfacePrivate::removeWidget(QWidget *widget)
    411406{
    412     if (widget == that->window()) {
    413         WinSetVisibleRegionNotify(widget->internalWinId(), FALSE);
    414         widget->removePmEventFilter(this);
    415     } else {
     407    if (widget != that->window()) {
    416408        widget->removeEventFilter(this);
    417         widget->removePmEventFilter(this);
    418409        subWidgets->remove(widget);
    419410    }
     411
     412
     413
    420414}
    421415
     
    435429    switch (msg->msg) {
    436430        case WM_VRNDISABLED: {
    437             if (!useFB)
    438                 DiveSetupBlitter(hDive, NULL);
    439             vrnDisabled = true;
     431            if (msg->hwnd == that->window()->internalWinId()) {
     432                if (!useFB)
     433                    DiveSetupBlitter(hDive, NULL);
     434                data.vrnDisabled = true;
     435            } else {
     436                WidgetData *wd = widgetData(QWidget::find(msg->hwnd));
     437                Q_ASSERT(wd);
     438                if (wd)
     439                    wd->vrnDisabled = true;
     440            }
    440441            *result = 0;
    441442            return true;
     
    451452        }
    452453        case WM_VRNENABLED: {
    453             vrnDisabled = false;
     454            QWidget *widget = msg->hwnd == that->window()->internalWinId() ?
     455                              that->window() : QWidget::find(msg->hwnd);
     456            WidgetData *wd = widgetData(widget);
     457            Q_ASSERT(wd);
     458            wd->vrnDisabled = false;
    454459            // Note that when an overlapping window of *other* process is moved
    455460            // over this window, PM still sends WM_VRNENABLED to it but with
     
    461466            if (LONGFROMMP(msg->mp1)) // window's visible region changed
    462467#endif
    463             {
    464                 // mark all widgets' visible regions as dirty
    465                 data.vrnDirty = true;
    466                 if (subWidgets) {
    467                     foreach(QWidget *w, subWidgets->keys())
    468                         (*subWidgets)[w].vrnDirty = true;
     468                wd->vrnDirty = true;
     469
     470            if (widget == that->window())
     471                posDirty = true;
     472
     473            // process pending flush events for this widget
     474            for (QList<QPMDiveWindowSurfacePrivate::FlushArgs>::iterator
     475                 it = pending.begin(); it != pending.end();) {
     476                if (it->widget == widget) {
     477                    that->doFlush(it->widget, it->from, it->to);
     478                    it = pending.erase(it);
     479                } else {
     480                    ++it;
    469481                }
    470482            }
    471             posDirty = true;
    472 
    473             // process pending flush events
    474             foreach(const QPMDiveWindowSurfacePrivate::FlushArgs &args, pending)
    475                 that->doFlush(args.widget, args.from, args.to);
    476             pending.clear();
    477483
    478484            *result = 0;
    479485            return true;
    480         }
    481         case WM_SIZE: {
    482             if (msg->hwnd != that->window()->internalWinId()) {
    483                 // sometimes PM doesn't send WM_VRNENABLED to the main widget
    484                 // when the sub-widget (its descendant) gets resized within it;
    485                 // fix it here by invalidating all visible regions
    486                 data.vrnDirty = true;
    487                 if (subWidgets) {
    488                     foreach(QWidget *w, subWidgets->keys())
    489                         (*subWidgets)[w].vrnDirty = true;
    490                 }
    491             }
    492             break;
    493486        }
    494487        default:
     
    508501    d->bufNum = 0;
    509502    d->posDirty = true;
    510     d->vrnDisabled = false;
    511503    d->inDrag = false;
    512504    d->subWidgets = 0;
     
    651643    QRect wbr = br.translated(-wOffset);
    652644
    653     if (d->vrnDisabled) {
     645    QPMDiveWindowSurfacePrivate::WidgetData *wd = d->widgetData(widget);
     646    Q_ASSERT(wd);
     647
     648    if (wd->vrnDisabled) {
    654649        // defer the flush
    655650        QPMDiveWindowSurfacePrivate::FlushArgs args = { widget,
Note: See TracChangeset for help on using the changeset viewer.