Ignore:
Timestamp:
Dec 18, 2009, 2:36:30 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Fixed: Popups shown when another application is active were not controllable with keyboard and didn't close on an outside mouse click (closes #113).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/util/qsystemtrayicon_pm.cpp

    r286 r432  
    158158}
    159159
     160static void closeNormalPopups()
     161{
     162    if (QApplication::activePopupWidget()) {
     163        // The system tray area is actually another application so we close all
     164        // normal popups for consistency (see qapplication_pm.cpp). In case some
     165        // popup refuses to close, we give up after 1024 attempts (to avoid an
     166        // infinite loop).
     167        int maxiter = 1024;
     168        QWidget *popup;
     169        while ((popup = QApplication::activePopupWidget()) && maxiter--)
     170            popup->close();
     171    }
     172}
     173
    160174bool QSystemTrayIconSys::pmEvent(QMSG *msg, MRESULT *result)
    161175{
     
    165179            switch (SHORT2FROMMP(msg->mp1)) {
    166180                case XST_IN_MOUSE: {
     181                    closeNormalPopups();
    167182                    PXSTMOUSEMSG pMsg = (PXSTMOUSEMSG)msg->mp2;
    168183                    switch (pMsg->ulMouseMsg) {
     
    182197                }
    183198                case XST_IN_CONTEXT: {
     199                    closeNormalPopups();
     200                    if (QApplication::activePopupWidget()) {
     201                        // The system tray area is actually another application
     202                        // so we close all normal popups for consistency (see
     203                        // qapplication_pm.cpp). In case some popup refuses to
     204                        // close, we give up after 1024 attempts (to avoid an
     205                        // infinite loop).
     206                        int maxiter = 1024;
     207                        QWidget *popup;
     208                        while ((popup=QApplication::activePopupWidget()) && maxiter--)
     209                            popup->close();
     210                    }
    184211                    PXSTCONTEXTMSG pMsg = (PXSTCONTEXTMSG)msg->mp2;
    185212                    if (q->contextMenu()) {
     
    196223                    break;
    197224                }
     225                case XST_IN_WHEEL: {
     226                    closeNormalPopups();
     227                }
    198228                default:
    199229                    break;
Note: See TracChangeset for help on using the changeset viewer.