зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1460022: Part 11 - Update Win32 nsWindow to work with revised DLL interceptor interface; r=mhowell
This commit is contained in:
Родитель
c710bd6ee2
Коммит
75d2812072
|
@ -352,9 +352,6 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
|||
// General purpose user32.dll hook object
|
||||
static WindowsDllInterceptor sUser32Intercept;
|
||||
|
||||
// AddHook success checks
|
||||
static mozilla::Maybe<bool> sHookedGetWindowInfo;
|
||||
|
||||
// 2 pixel offset for eTransparencyBorderlessGlass which equals the size of
|
||||
// the default window border Windows paints. Glass will be extended inward
|
||||
// this distance to remove the border.
|
||||
|
@ -461,17 +458,17 @@ private:
|
|||
if (!IsWin10OrLater() && GetModuleHandle(L"tiptsf.dll") &&
|
||||
!sProcessCaretEventsStub) {
|
||||
sTipTsfInterceptor.Init("tiptsf.dll");
|
||||
DebugOnly<bool> ok = sTipTsfInterceptor.AddHook("ProcessCaretEvents",
|
||||
reinterpret_cast<intptr_t>(&ProcessCaretEventsHook),
|
||||
(void**) &sProcessCaretEventsStub);
|
||||
DebugOnly<bool> ok = sProcessCaretEventsStub.Set(sTipTsfInterceptor,
|
||||
"ProcessCaretEvents",
|
||||
&ProcessCaretEventsHook);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
|
||||
if (!sSendMessageTimeoutWStub) {
|
||||
sUser32Intercept.Init("user32.dll");
|
||||
DebugOnly<bool> hooked = sUser32Intercept.AddHook("SendMessageTimeoutW",
|
||||
reinterpret_cast<intptr_t>(&SendMessageTimeoutWHook),
|
||||
(void**) &sSendMessageTimeoutWStub);
|
||||
DebugOnly<bool> hooked = sSendMessageTimeoutWStub.Set(sUser32Intercept,
|
||||
"SendMessageTimeoutW",
|
||||
&SendMessageTimeoutWHook);
|
||||
MOZ_ASSERT(hooked);
|
||||
}
|
||||
}
|
||||
|
@ -556,8 +553,10 @@ private:
|
|||
}
|
||||
|
||||
static WindowsDllInterceptor sTipTsfInterceptor;
|
||||
static WINEVENTPROC sProcessCaretEventsStub;
|
||||
static decltype(&SendMessageTimeoutW) sSendMessageTimeoutWStub;
|
||||
static WindowsDllInterceptor::FuncHookType<WINEVENTPROC>
|
||||
sProcessCaretEventsStub;
|
||||
static WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||
sSendMessageTimeoutWStub;
|
||||
static StaticAutoPtr<TIPMessageHandler> sInstance;
|
||||
|
||||
HHOOK mHook;
|
||||
|
@ -566,8 +565,10 @@ private:
|
|||
};
|
||||
|
||||
WindowsDllInterceptor TIPMessageHandler::sTipTsfInterceptor;
|
||||
WINEVENTPROC TIPMessageHandler::sProcessCaretEventsStub;
|
||||
decltype(&SendMessageTimeoutW) TIPMessageHandler::sSendMessageTimeoutWStub;
|
||||
WindowsDllInterceptor::FuncHookType<WINEVENTPROC>
|
||||
TIPMessageHandler::sProcessCaretEventsStub;
|
||||
WindowsDllInterceptor::FuncHookType<decltype(&SendMessageTimeoutW)>
|
||||
TIPMessageHandler::sSendMessageTimeoutWStub;
|
||||
StaticAutoPtr<TIPMessageHandler> TIPMessageHandler::sInstance;
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -2472,7 +2473,7 @@ nsWindow::ResetLayout()
|
|||
// margins are set.
|
||||
static const wchar_t kManageWindowInfoProperty[] = L"ManageWindowInfoProperty";
|
||||
typedef BOOL (WINAPI *GetWindowInfoPtr)(HWND hwnd, PWINDOWINFO pwi);
|
||||
static GetWindowInfoPtr sGetWindowInfoPtrStub = nullptr;
|
||||
static WindowsDllInterceptor::FuncHookType<GetWindowInfoPtr> sGetWindowInfoPtrStub;
|
||||
|
||||
BOOL WINAPI
|
||||
GetWindowInfoHook(HWND hWnd, PWINDOWINFO pwi)
|
||||
|
@ -2500,18 +2501,15 @@ nsWindow::UpdateGetWindowInfoCaptionStatus(bool aActiveCaption)
|
|||
if (!mWnd)
|
||||
return;
|
||||
|
||||
if (sHookedGetWindowInfo.isNothing()) {
|
||||
sUser32Intercept.Init("user32.dll");
|
||||
sHookedGetWindowInfo =
|
||||
Some(sUser32Intercept.AddHook("GetWindowInfo",
|
||||
reinterpret_cast<intptr_t>(GetWindowInfoHook),
|
||||
(void**) &sGetWindowInfoPtrStub));
|
||||
if (!sHookedGetWindowInfo.value()) {
|
||||
return;
|
||||
}
|
||||
sUser32Intercept.Init("user32.dll");
|
||||
sGetWindowInfoPtrStub.Set(sUser32Intercept, "GetWindowInfo",
|
||||
&GetWindowInfoHook);
|
||||
if (!sGetWindowInfoPtrStub) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update our internally tracked caption status
|
||||
SetPropW(mWnd, kManageWindowInfoProperty,
|
||||
SetPropW(mWnd, kManageWindowInfoProperty,
|
||||
reinterpret_cast<HANDLE>(static_cast<INT_PTR>(aActiveCaption) + 1));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче