Changeset 936 for trunk/src


Ignore:
Timestamp:
Aug 4, 2011, 12:42:23 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

OS/2: Fixed: Modal widgets could go to behind blocked ones.

This in particular affected parent-less modal widgets (e.g. the
Session Manager dialog in Qt Creator).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qapplication_pm.cpp

    r786 r936  
    143143    QWidgetPrivate *dptr() { return d_func(); }
    144144    QRect frameStrut() const { return d_func()->frameStrut(); }
     145    HWND frameWinId() const { return d_func()->frameWinId(); }
    145146    bool        pmEvent(QMSG *m, MRESULT *r) { return QWidget::pmEvent(m, r); }
    146147//  void        markFrameStrutDirty() { data->fstrut_dirty = 1; }
     
    11021103                        // FID_SYSMENU) should not cause the focus to be lost.
    11031104                        if (WinQueryWindow(hwnd, QW_OWNER) ==
    1104                                 ((QETWidget*)widget->window())->dptr()->frameWinId())
     1105                                ((QETWidget*)widget->window())->frameWinId())
    11051106                            break;
    11061107                        if (!widget->isWindow())
     
    13111312        }
    13121313
     1314        case WM_ADJUSTWINDOWPOS: {
     1315            // If PM tries to activate a modally blocked window, pass activation
     1316            // over to the top modal window instead of letting it activate the
     1317            // blocked one. Z-order changes are simply ignored for now.
     1318            // @todo Blocked widgets should keep Z-order WRT their modal
     1319            // blockers whenever they move (e.g. bringing the modal one to top
     1320            // should also put the one it blocks right under it instead of
     1321            // possibly leaving it somewhere behind other windows).
     1322            PSWP pswp =(PSWP)qmsg.mp1;
     1323            if (app_do_modal &&
     1324                ((pswp->fl & SWP_ACTIVATE) || (pswp->fl & SWP_ZORDER))) {
     1325                QWidget *top = 0;
     1326                if (!QApplicationPrivate::tryModalHelper(widget, &top) && top && widget != top) {
     1327                    if (pswp->fl & SWP_ACTIVATE) {
     1328                        if (top->isVisible()) {
     1329                            top->activateWindow();
     1330                        } else {
     1331                            // This is the case when native file dialogs are shown
     1332                            QWidget *p = (top->parentWidget() ? top->parentWidget()->window() : 0);
     1333                            if (p && p->isVisible()) {
     1334                                p->activateWindow();
     1335                            }
     1336                        }
     1337                        pswp->fl &= ~SWP_ACTIVATE;
     1338                    }
     1339                    if (pswp->fl & SWP_ZORDER) {
     1340                        pswp->fl &= ~SWP_ZORDER;
     1341                    }
     1342                }
     1343            }
     1344            break;
     1345        }
     1346
    13131347        case WM_QUERYTRACKINFO: {
    13141348            QWExtra *x = widget->xtra();
     
    14391473    ignoreNextMouseReleaseEvent = false;
    14401474
    1441     // go through all top-level widgets and disable those that should be
    1442     // blocked by the modality (this in particular will disable activation
    1443     // through clicking on the title bar and also state change throuhg titlebar
    1444     // buttons)
     1475    // go through all top-level widgets and disable those that should be blocked
     1476    // by the modality (this will effectively disable frame controls and make
     1477    // it impossible to manipulate the window state, position and size, even
     1478    // programmatically, e.g. from the Window List)
    14451479    QWidgetList list = QApplication::topLevelWidgets();
    14461480    foreach(QWidget *w, list) {
    1447         if (QApplicationPrivate::isBlockedByModal(w))
     1481        if (w != widget && QApplicationPrivate::isBlockedByModal(w)) {
    14481482            WinEnableWindow(w->d_func()->frameWinId(), FALSE);
     1483        }
    14491484    }
    14501485}
     
    14531488{
    14541489    if (qt_modal_stack) {
    1455         // go through all affected top-level widgets and re-enable them
    1456         QWidgetList list = QApplication::topLevelWidgets();
    1457         foreach(QWidget *w, list) {
    1458             if (QApplicationPrivate::isBlockedByModal(w))
    1459                 WinEnableWindow(w->d_func()->frameWinId(), TRUE);
    1460         }
    14611490        if (qt_modal_stack->removeAll(widget)) {
    14621491            if (qt_modal_stack->isEmpty()) {
     
    14801509        }
    14811510        ignoreNextMouseReleaseEvent = true;
     1511
     1512        // go through all top-level widgets and re-enable those that are not
     1513        // blocked any more
     1514        QWidgetList list = QApplication::topLevelWidgets();
     1515        foreach(QWidget *w, list) {
     1516            if (w != widget && !QApplicationPrivate::isBlockedByModal(w)) {
     1517                WinEnableWindow(w->d_func()->frameWinId(), TRUE);
     1518            }
     1519        }
    14821520    }
    14831521    app_do_modal = qt_modal_stack != 0;
     
    27322770    myCaseEnd()
    27332771
     2772    myCaseBegin(WM_ADJUSTWINDOWPOS)
     2773        debug << *((PSWP) qmsg.mp1);
     2774        debug.space();
     2775        break;
     2776    myCaseEnd()
     2777
    27342778    myCaseBegin(WM_WINDOWPOSCHANGED)
    27352779        debug << *((PSWP) qmsg.mp1);
     
    27852829    myCaseEnd()
    27862830
    2787     myCaseBegin(WM_ADJUSTWINDOWPOS)
    2788         break;
    2789     myCaseEnd()
    2790 
    27912831    myCaseBegin(WM_VRNDISABLED)
    27922832        break;
     
    27972837
    27982838    myCaseBegin(WM_SHOW)
     2839        break;
     2840    myCaseEnd()
     2841
     2842    myCaseBegin(WM_HITTEST)
     2843        PPOINTS pt = (PPOINTS)&qmsg.mp1;
     2844        debug.nospace() << "Point(" << pt->x << "," << pt->y << ")";
     2845        debug.space();
    27992846        break;
    28002847    myCaseEnd()
Note: See TracChangeset for help on using the changeset viewer.