Ignore:
Timestamp:
Nov 5, 2009, 3:26:47 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Improved widget modality (widgets blocked by modality cannot be activated and moved using the mouse and the title bar anymore).

File:
1 edited

Legend:

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

    r239 r288  
    12031203    qt_last_mouse_receiver = 0;
    12041204    ignoreNextMouseReleaseEvent = false;
     1205
     1206
     1207
     1208
     1209
     1210
     1211
     1212
     1213
     1214
    12051215}
    12061216
    12071217void QApplicationPrivate::leaveModal_sys(QWidget *widget)
    12081218{
    1209     if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
    1210         if (qt_modal_stack->isEmpty()) {
    1211             delete qt_modal_stack;
    1212             qt_modal_stack = 0;
    1213             QPoint p(QCursor::pos());
    1214             app_do_modal = false; // necessary, we may get recursively into qt_try_modal below
    1215             QWidget* w = QApplication::widgetAt(p.x(), p.y());
    1216             QWidget *leave = qt_last_mouse_receiver;
    1217             if (!leave)
    1218                 leave = QWidget::find(curWin);
    1219             if (QWidget *grabber = QWidget::mouseGrabber()) {
    1220                 w = grabber;
    1221                 if (leave == w)
    1222                     leave = 0;
    1223             }
    1224             QApplicationPrivate::dispatchEnterLeave(w, leave); // send synthetic enter event
    1225             curWin = w ? w->effectiveWinId() : 0;
    1226             qt_last_mouse_receiver = w;
     1219    if (qt_modal_stack) {
     1220        // go through all affected top-level widgets and re-enable them
     1221        QWidgetList list = QApplication::topLevelWidgets();
     1222        foreach(QWidget *w, list) {
     1223            if (QApplicationPrivate::isBlockedByModal(w))
     1224                WinEnableWindow(w->d_func()->frameWinId(), TRUE);
     1225        }
     1226        if (qt_modal_stack->removeAll(widget)) {
     1227            if (qt_modal_stack->isEmpty()) {
     1228                delete qt_modal_stack;
     1229                qt_modal_stack = 0;
     1230                QPoint p(QCursor::pos());
     1231                app_do_modal = false; // necessary, we may get recursively into qt_try_modal below
     1232                QWidget* w = QApplication::widgetAt(p.x(), p.y());
     1233                QWidget *leave = qt_last_mouse_receiver;
     1234                if (!leave)
     1235                    leave = QWidget::find(curWin);
     1236                if (QWidget *grabber = QWidget::mouseGrabber()) {
     1237                    w = grabber;
     1238                    if (leave == w)
     1239                        leave = 0;
     1240                }
     1241                QApplicationPrivate::dispatchEnterLeave(w, leave); // send synthetic enter event
     1242                curWin = w ? w->effectiveWinId() : 0;
     1243                qt_last_mouse_receiver = w;
     1244            }
    12271245        }
    12281246        ignoreNextMouseReleaseEvent = true;
Note: See TracChangeset for help on using the changeset viewer.