mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1157784. Avoid compositing at the same time as WM_SETTEXT. f=jimm
The innards of Windows don't always recheck that the window is visible and it will forget to redraw if we Present at the same time that the window is invisible.
This commit is contained in:
parent
ff387c13a1
commit
99385c4734
@ -404,6 +404,8 @@ nsWindow::nsWindow() : nsWindowBase()
|
||||
|
||||
mIdleService = nullptr;
|
||||
|
||||
::InitializeCriticalSection(&mPresentLock);
|
||||
|
||||
sInstanceCount++;
|
||||
}
|
||||
|
||||
@ -4701,12 +4703,19 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
||||
{
|
||||
// From msdn, the way around this is to disable the visible state
|
||||
// temporarily. We need the text to be set but we don't want the
|
||||
// redraw to occur.
|
||||
// redraw to occur. However, we need to make sure that we don't
|
||||
// do this at the same time that a Present is happening.
|
||||
//
|
||||
// To do this we take mPresentLock in nsWindow::PreRender and
|
||||
// if that lock is taken we wait before doing WM_SETTEXT
|
||||
EnterCriticalSection(&mPresentLock);
|
||||
DWORD style = GetWindowLong(mWnd, GWL_STYLE);
|
||||
SetWindowLong(mWnd, GWL_STYLE, style & ~WS_VISIBLE);
|
||||
*aRetValue = CallWindowProcW(GetPrevWindowProc(), mWnd,
|
||||
msg, wParam, lParam);
|
||||
SetWindowLong(mWnd, GWL_STYLE, style);
|
||||
LeaveCriticalSection(&mPresentLock);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -7556,6 +7565,21 @@ void nsWindow::PickerClosed()
|
||||
}
|
||||
}
|
||||
|
||||
bool nsWindow::PreRender(LayerManagerComposite*)
|
||||
{
|
||||
// This can block waiting for WM_SETTEXT to finish
|
||||
// Using PreRender is unnecessarily pessimistic because
|
||||
// we technically only need to block during the present call
|
||||
// not all of compositor rendering
|
||||
EnterCriticalSection(&mPresentLock);
|
||||
return true;
|
||||
}
|
||||
|
||||
void nsWindow::PostRender(LayerManagerComposite*)
|
||||
{
|
||||
LeaveCriticalSection(&mPresentLock);
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
**************************************************************
|
||||
**
|
||||
|
@ -451,6 +451,8 @@ protected:
|
||||
void ClearCachedResources();
|
||||
nsIWidgetListener* GetPaintListener();
|
||||
static bool IsRenderMode(gfxWindowsPlatform::RenderMode aMode);
|
||||
virtual bool PreRender(LayerManagerComposite*) override;
|
||||
virtual void PostRender(LayerManagerComposite*) override;
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIWidget> mParent;
|
||||
@ -587,6 +589,8 @@ protected:
|
||||
|
||||
static bool sNeedsToInitMouseWheelSettings;
|
||||
static void InitMouseWheelScrollData();
|
||||
|
||||
CRITICAL_SECTION mPresentLock;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user