- Timestamp:
- Aug 29, 2009, 12:06:08 AM (16 years ago)
- Location:
- trunk/src/gui/kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qapplication.h
r2 r138 239 239 void winFocus(QWidget *, bool); 240 240 static void winMouseButtonUp(); 241 #endif 242 243 #if defined(Q_WS_PM) 244 void pmFocus(QWidget *, bool); 241 245 #endif 242 246 -
trunk/src/gui/kernel/qapplication_pm.cpp
r136 r138 469 469 #define SV_WORKAREA_XLEFT 54 470 470 471 /*! 472 \internal 473 \since 4.1 474 475 If \a gotFocus is true, \a widget will become the active window. 476 Otherwise the active window is reset to 0. 477 */ 478 void QApplication::pmFocus(QWidget *widget, bool gotFocus) 479 { 480 if (gotFocus) { 481 setActiveWindow(widget); 482 if (QApplicationPrivate::active_window 483 && (QApplicationPrivate::active_window->windowType() == Qt::Dialog)) { 484 // raise the entire application, not just the dialog 485 QWidget* mw = QApplicationPrivate::active_window; 486 while(mw->parentWidget() && (mw->windowType() == Qt::Dialog)) 487 mw = mw->parentWidget()->window(); 488 if (mw->testAttribute(Qt::WA_WState_Created) && mw != QApplicationPrivate::active_window) 489 WinSetWindowPos(mw->d_func()->frameWinId(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 490 } 491 } else { 492 setActiveWindow(0); 493 } 494 } 495 471 496 // QtWndProc() receives all messages from the main event loop 472 497 … … 659 684 if (widget->translateConfigEvent(qmsg)) 660 685 return (MRESULT)TRUE; 686 break; 687 } 688 689 case WM_ACTIVATE: { 690 qApp->pmFocus(widget, SHORT1FROMMP(mp1)); 691 break; 692 } 693 694 case WM_SETFOCUS: { 695 HWND hwnd = (HWND)mp1; 696 bool focus = SHORT1FROMMP(mp2); 697 if (!focus) { 698 if (!QWidget::find(hwnd)) { 699 // we don't get focus, so unset it now 700 if (QApplication::activePopupWidget()) { 701 // Another application was activated while our popups are open, 702 // then close all popups. In case some popup refuses to close, 703 // we give up after 1024 attempts (to avoid an infinite loop). 704 int maxiter = 1024; 705 QWidget *popup; 706 while ( (popup=QApplication::activePopupWidget()) && maxiter-- ) 707 popup->close(); 708 } 709 // non-Qt ownees of our WC_FRAME window (such as 710 // FID_SYSMENU) should not cause the focus to be lost. 711 if (WinQueryWindow(hwnd, QW_OWNER) == 712 ((QETWidget*)widget->window())->dptr()->frameWinId()) 713 break; 714 if (!widget->isWindow()) 715 qApp->pmFocus(widget, focus); 716 } 717 } 661 718 break; 662 719 } … … 2011 2068 myCaseEnd() 2012 2069 2070 myCaseBegin(WM_ACTIVATE) 2071 bool active = SHORT1FROMMP(qmsg.mp1); 2072 HWND hwnd = (HWND)qmsg.mp2; 2073 str += QCStr(" Active(") + QCStr(active ? "TRUE) " : "FALSE)"); 2074 str += QString().sprintf(" hwnd %08lX.", hwnd); 2075 str += qWidgetName(qWidgetFromHWND(hwnd)); 2076 break; 2077 myCaseEnd() 2078 2079 myCaseBegin(WM_SETFOCUS) 2080 HWND hwnd = (HWND)qmsg.mp1; 2081 bool focus = SHORT1FROMMP(qmsg.mp2); 2082 str += QCStr(" Focus(") + QCStr(focus ? "TRUE) " : "FALSE)"); 2083 str += QString().sprintf(" hwnd %08lX.", hwnd); 2084 str += qWidgetName(qWidgetFromHWND(hwnd)); 2085 break; 2086 myCaseEnd() 2087 2013 2088 default: 2014 2089 break; … … 2030 2105 { 2031 2106 QString fl; 2107 myDefFlagEx(swp.fl, SWP_SIZE, fl, "SIZE"); 2108 myDefFlagEx(swp.fl, SWP_MOVE, fl, "MOVE"); 2109 myDefFlagEx(swp.fl, SWP_ZORDER, fl, "ZORD"); 2032 2110 myDefFlagEx(swp.fl, SWP_SHOW, fl, "SHOW"); 2033 2111 myDefFlagEx(swp.fl, SWP_HIDE, fl, "HIDE"); 2112 myDefFlagEx(swp.fl, SWP_NOREDRAW, fl, "NORDR"); 2113 myDefFlagEx(swp.fl, SWP_NOADJUST, fl, "NOADJ"); 2034 2114 myDefFlagEx(swp.fl, SWP_ACTIVATE, fl, "ACT"); 2035 2115 myDefFlagEx(swp.fl, SWP_DEACTIVATE, fl, "DEACT"); 2116 myDefFlagEx(swp.fl, SWP_EXTSTATECHANGE, fl, "EXTST"); 2117 myDefFlagEx(swp.fl, SWP_MINIMIZE, fl, "MIN"); 2036 2118 myDefFlagEx(swp.fl, SWP_MAXIMIZE, fl, "MAX"); 2037 myDefFlagEx(swp.fl, SWP_MINIMIZE, fl, "MIN");2038 2119 myDefFlagEx(swp.fl, SWP_RESTORE, fl, "REST"); 2039 myDefFlagEx(swp.fl, SWP_ MOVE, fl, "MOVE");2040 myDefFlagEx(swp.fl, SWP_ SIZE, fl, "SIZE");2041 myDefFlagEx(swp.fl, SWP_ ZORDER, fl, "ZORD");2120 myDefFlagEx(swp.fl, SWP_FOCUSACTIVATE, fl, "FCSACT"); 2121 myDefFlagEx(swp.fl, SWP_FOCUSDEACTIVATE, fl, "FCSDEACT"); 2122 myDefFlagEx(swp.fl, SWP_NOAUTOCLOSE, fl, "NOACLOSE"); 2042 2123 2043 2124 return QString().sprintf("SWP(%ld,%ld %ldx%ld %08lX ",
Note:
See TracChangeset
for help on using the changeset viewer.