Changeset 432
- Timestamp:
- Dec 18, 2009, 2:36:30 AM (15 years ago)
- Location:
- trunk/src/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qapplication_pm.cpp
r428 r432 110 110 QPointer<QWidget> qt_last_mouse_receiver = 0; 111 111 112 113 114 112 115 static HWND autoCaptureWnd = NULLHANDLE; 113 116 static bool autoCaptureReleased = FALSE; … … 1016 1019 } 1017 1020 1018 case WM_ SETFOCUS: {1021 case WM_: { 1019 1022 HWND hwnd = (HWND)mp1; 1020 1023 bool focus = SHORT1FROMMP(mp2); … … 1023 1026 // we don't get focus, so unset it now 1024 1027 if (QApplication::activePopupWidget()) { 1028 1025 1029 // Another application was activated while our popups are open, 1026 1030 // then close all popups. In case some popup refuses to close, … … 1437 1441 return; 1438 1442 1439 if (QApplicationPrivate::popupWidgets->count() == 1 && !qt_nograb()) { 1440 Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created)); 1441 setAutoCapture(popup->d_func()->frameWinId()); // grab mouse/keyboard 1442 } 1443 if (QApplicationPrivate::popupWidgets->count() == 1) { 1444 if (!qt_nograb()) { 1445 Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created)); 1446 setAutoCapture(popup->d_func()->frameWinId()); // grab mouse/keyboard 1447 } 1448 if (!qWidgetFromHWND(WinQueryActiveWindow(HWND_DESKTOP))) { 1449 // the popup is opened while another application is active. Steal 1450 // the focus (to receive keyboard input and to make sure we get 1451 // WM_FOCUSCHANGE when clicked outside) but not the active state. 1452 ULONG flags = FC_NOSETACTIVE | FC_NOLOSEACTIVE; 1453 WinFocusChange(HWND_DESKTOP, popup->d_func()->frameWinId(), flags); 1454 foreignActiveWnd = WinQueryActiveWindow(HWND_DESKTOP); 1455 } 1456 } 1457 1443 1458 // Popups are not focus-handled by the window system (the first 1444 1459 // popup grabbed the keyboard), so we have to do that manually: A … … 1464 1479 curPos.y = q_func()->desktop()->height() - (curPos.y + 1); 1465 1480 1466 if (QApplicationPrivate::popupWidgets->isEmpty()) { // this was the last popup 1481 if (QApplicationPrivate::popupWidgets->isEmpty()) { 1482 // this was the last popup 1483 if (foreignActiveWnd != NULLHANDLE && foreignFocusWnd != NULLHANDLE) { 1484 // we stole focus from another application so PM won't send it 1485 // WM_ACTIVATE(FALSE). Our duty is to do it for PM. 1486 HWND parent, desktop = WinQueryDesktopWindow(0, NULLHANDLE); 1487 // find the top-level window of the window actually getting focus 1488 while ((parent = WinQueryWindow(foreignFocusWnd, QW_PARENT)) != desktop) 1489 foreignFocusWnd = parent; 1490 // send deactivation to the old active window if it differs 1491 if (foreignFocusWnd != foreignActiveWnd) 1492 WinSendMsg(foreignActiveWnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)foreignActiveWnd); 1493 } 1494 foreignActiveWnd = NULLHANDLE; 1495 foreignFocusWnd = NULLHANDLE; 1496 1467 1497 delete QApplicationPrivate::popupWidgets; 1468 1498 QApplicationPrivate::popupWidgets = 0; … … 2553 2583 HWND hwnd = (HWND)qmsg.mp2; 2554 2584 str += QCStr(" Active(") + QCStr(active ? "TRUE) " : "FALSE)"); 2555 str += QString().sprintf(" hwnd %08lX.", hwnd);2585 str += QString().sprintf(" hwnd %08lX.", hwnd); 2556 2586 str += qWidgetName(qWidgetFromHWND(hwnd)); 2557 2587 break; … … 2562 2592 bool focus = SHORT1FROMMP(qmsg.mp2); 2563 2593 str += QCStr(" Focus(") + QCStr(focus ? "TRUE) " : "FALSE)"); 2564 str += QString().sprintf(" hwnd %08lX.", hwnd);2594 str += QString().sprintf(" hwnd %08lX.", hwnd); 2565 2595 str += qWidgetName(qWidgetFromHWND(hwnd)); 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2566 2614 break; 2567 2615 myCaseEnd() -
trunk/src/gui/util/qsystemtrayicon_pm.cpp
r286 r432 158 158 } 159 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 160 174 bool QSystemTrayIconSys::pmEvent(QMSG *msg, MRESULT *result) 161 175 { … … 165 179 switch (SHORT2FROMMP(msg->mp1)) { 166 180 case XST_IN_MOUSE: { 181 167 182 PXSTMOUSEMSG pMsg = (PXSTMOUSEMSG)msg->mp2; 168 183 switch (pMsg->ulMouseMsg) { … … 182 197 } 183 198 case XST_IN_CONTEXT: { 199 200 201 202 203 204 205 206 207 208 209 210 184 211 PXSTCONTEXTMSG pMsg = (PXSTCONTEXTMSG)msg->mp2; 185 212 if (q->contextMenu()) { … … 196 223 break; 197 224 } 225 226 227 198 228 default: 199 229 break;
Note:
See TracChangeset
for help on using the changeset viewer.