Bug 1936325 - Miscellaneous windows widget clean-ups. r=win-reviewers,rkraesig
Did these while debugging bug 1936164. No behavior change intended. Differential Revision: https://phabricator.services.mozilla.com/D231706
This commit is contained in:
@@ -306,7 +306,7 @@ class WinUtils {
|
|||||||
* | | TRUE | FALSE |
|
* | | TRUE | FALSE |
|
||||||
+ +-----------------+-------+-----------------------+-----------------------+
|
+ +-----------------+-------+-----------------------+-----------------------+
|
||||||
* | | | * an independent top level window |
|
* | | | * an independent top level window |
|
||||||
* | | TRUE | * a pupup window (WS_POPUP) |
|
* | | TRUE | * a popup window (WS_POPUP) |
|
||||||
* | | | * an owned top level window (like dialog) |
|
* | | | * an owned top level window (like dialog) |
|
||||||
* | aStopIfNotChild +-------+-----------------------+-----------------------+
|
* | aStopIfNotChild +-------+-----------------------+-----------------------+
|
||||||
* | | | * independent window | * only an independent |
|
* | | | * independent window | * only an independent |
|
||||||
|
|||||||
@@ -515,27 +515,24 @@ class TIPMessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MOZ_RAII A11yInstantiationBlocker {
|
class MOZ_RAII A11yInstantiationBlocker{public : A11yInstantiationBlocker(){
|
||||||
public:
|
if (!TIPMessageHandler::sInstance){return;
|
||||||
A11yInstantiationBlocker() {
|
} ++TIPMessageHandler::sInstance->mA11yBlockCount;
|
||||||
if (!TIPMessageHandler::sInstance) {
|
} // namespace mozilla
|
||||||
return;
|
|
||||||
}
|
|
||||||
++TIPMessageHandler::sInstance->mA11yBlockCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
~A11yInstantiationBlocker() {
|
~A11yInstantiationBlocker() {
|
||||||
if (!TIPMessageHandler::sInstance) {
|
if (!TIPMessageHandler::sInstance) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(TIPMessageHandler::sInstance->mA11yBlockCount > 0);
|
MOZ_ASSERT(TIPMessageHandler::sInstance->mA11yBlockCount > 0);
|
||||||
--TIPMessageHandler::sInstance->mA11yBlockCount;
|
--TIPMessageHandler::sInstance->mA11yBlockCount;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
;
|
||||||
|
|
||||||
friend class A11yInstantiationBlocker;
|
friend class A11yInstantiationBlocker;
|
||||||
|
|
||||||
static LRESULT CALLBACK TIPHook(int aCode, WPARAM aWParam, LPARAM aLParam) {
|
static LRESULT CALLBACK TIPHook(int aCode, WPARAM aWParam, LPARAM aLParam) {
|
||||||
if (aCode < 0 || !sInstance) {
|
if (aCode < 0 || !sInstance) {
|
||||||
return ::CallNextHookEx(nullptr, aCode, aWParam, aLParam);
|
return ::CallNextHookEx(nullptr, aCode, aWParam, aLParam);
|
||||||
}
|
}
|
||||||
@@ -551,9 +548,9 @@ class TIPMessageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ::CallNextHookEx(nullptr, aCode, aWParam, aLParam);
|
return ::CallNextHookEx(nullptr, aCode, aWParam, aLParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT WINAPI SendMessageTimeoutWHook(HWND aHwnd, UINT aMsgCode,
|
static LRESULT WINAPI SendMessageTimeoutWHook(HWND aHwnd, UINT aMsgCode,
|
||||||
WPARAM aWParam, LPARAM aLParam,
|
WPARAM aWParam, LPARAM aLParam,
|
||||||
UINT aFlags, UINT aTimeout,
|
UINT aFlags, UINT aTimeout,
|
||||||
PDWORD_PTR aMsgResult) {
|
PDWORD_PTR aMsgResult) {
|
||||||
@@ -574,16 +571,17 @@ class TIPMessageHandler {
|
|||||||
::DefWindowProcW(aHwnd, aMsgCode, aWParam, aLParam));
|
::DefWindowProcW(aHwnd, aMsgCode, aWParam, aLParam));
|
||||||
|
|
||||||
return static_cast<LRESULT>(TRUE);
|
return static_cast<LRESULT>(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
static WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||||
sSendMessageTimeoutWStub;
|
sSendMessageTimeoutWStub;
|
||||||
static StaticAutoPtr<TIPMessageHandler> sInstance;
|
static StaticAutoPtr<TIPMessageHandler> sInstance;
|
||||||
|
|
||||||
HHOOK mHook;
|
HHOOK mHook;
|
||||||
UINT mMessages[7];
|
UINT mMessages[7];
|
||||||
uint32_t mA11yBlockCount;
|
uint32_t mA11yBlockCount;
|
||||||
};
|
}
|
||||||
|
;
|
||||||
|
|
||||||
WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||||
TIPMessageHandler::sSendMessageTimeoutWStub;
|
TIPMessageHandler::sSendMessageTimeoutWStub;
|
||||||
@@ -1202,7 +1200,7 @@ void nsWindow::Destroy() {
|
|||||||
|
|
||||||
// Our windows can be subclassed which may prevent us receiving WM_DESTROY. If
|
// Our windows can be subclassed which may prevent us receiving WM_DESTROY. If
|
||||||
// OnDestroy() didn't get called, call it now.
|
// OnDestroy() didn't get called, call it now.
|
||||||
if (false == mOnDestroyCalled) {
|
if (!mOnDestroyCalled) {
|
||||||
MSGResult msgResult;
|
MSGResult msgResult;
|
||||||
mWindowHook.Notify(mWnd, WM_DESTROY, 0, 0, msgResult);
|
mWindowHook.Notify(mWnd, WM_DESTROY, 0, 0, msgResult);
|
||||||
OnDestroy();
|
OnDestroy();
|
||||||
@@ -2324,7 +2322,9 @@ bool nsWindow::IsEnabled() const {
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
void nsWindow::SetFocus(Raise aRaise, mozilla::dom::CallerType aCallerType) {
|
void nsWindow::SetFocus(Raise aRaise, mozilla::dom::CallerType aCallerType) {
|
||||||
if (mWnd) {
|
if (!mWnd) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef WINSTATE_DEBUG_OUTPUT
|
#ifdef WINSTATE_DEBUG_OUTPUT
|
||||||
if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) {
|
if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) {
|
||||||
MOZ_LOG(gWindowsLog, LogLevel::Info,
|
MOZ_LOG(gWindowsLog, LogLevel::Info,
|
||||||
@@ -2340,7 +2340,6 @@ void nsWindow::SetFocus(Raise aRaise, mozilla::dom::CallerType aCallerType) {
|
|||||||
::ShowWindow(toplevelWnd, SW_RESTORE);
|
::ShowWindow(toplevelWnd, SW_RESTORE);
|
||||||
}
|
}
|
||||||
::SetFocus(mWnd);
|
::SetFocus(mWnd);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
@@ -4631,8 +4630,9 @@ LRESULT CALLBACK nsWindow::WindowProcInternal(HWND hWnd, UINT msg,
|
|||||||
nsAutoRollup autoRollup;
|
nsAutoRollup autoRollup;
|
||||||
|
|
||||||
LRESULT popupHandlingResult;
|
LRESULT popupHandlingResult;
|
||||||
if (DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult))
|
if (DealWithPopups(hWnd, msg, wParam, lParam, &popupHandlingResult)) {
|
||||||
return popupHandlingResult;
|
return popupHandlingResult;
|
||||||
|
}
|
||||||
|
|
||||||
// Call ProcessMessage
|
// Call ProcessMessage
|
||||||
LRESULT retValue;
|
LRESULT retValue;
|
||||||
@@ -5559,7 +5559,9 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
|||||||
// events arrive.
|
// events arrive.
|
||||||
case WM_ACTIVATE: {
|
case WM_ACTIVATE: {
|
||||||
int32_t fActive = LOWORD(wParam);
|
int32_t fActive = LOWORD(wParam);
|
||||||
if (mWidgetListener) {
|
if (!mWidgetListener) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (WA_INACTIVE == fActive) {
|
if (WA_INACTIVE == fActive) {
|
||||||
// when minimizing a window, the deactivation and focus events will
|
// when minimizing a window, the deactivation and focus events will
|
||||||
// be fired in the reverse order. Instead, just deactivate right away.
|
// be fired in the reverse order. Instead, just deactivate right away.
|
||||||
@@ -5586,14 +5588,14 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
|||||||
ModifierKeyState modifierKeyState;
|
ModifierKeyState modifierKeyState;
|
||||||
modifierKeyState.InitInputEvent(event);
|
modifierKeyState.InitInputEvent(event);
|
||||||
DispatchInputEvent(&event);
|
DispatchInputEvent(&event);
|
||||||
if (sSwitchKeyboardLayout && mLastKeyboardLayout)
|
if (sSwitchKeyboardLayout && mLastKeyboardLayout) {
|
||||||
ActivateKeyboardLayout(mLastKeyboardLayout, 0);
|
ActivateKeyboardLayout(mLastKeyboardLayout, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
a11y::LazyInstantiator::ResetUiaDetectionCache();
|
a11y::LazyInstantiator::ResetUiaDetectionCache();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WM_ACTIVATEAPP: {
|
case WM_ACTIVATEAPP: {
|
||||||
|
|||||||
Reference in New Issue
Block a user