Bug 1165303 - avoid hiding and reshowing the window in response to our own settext messages because it makes Windows 10 unhappy, r=jimm

This commit is contained in:
Gijs Kruitbosch 2015-06-09 20:18:36 +01:00
parent 6ece7b666b
commit 9439948487
2 changed files with 10 additions and 2 deletions

View File

@ -369,6 +369,7 @@ nsWindow::nsWindow() : nsWindowBase()
#endif
DWORD background = ::GetSysColor(COLOR_BTNFACE);
mBrush = ::CreateSolidBrush(NSRGB_2_COLOREF(background));
mSendingSetText = false;
mTaskbarPreview = nullptr;
@ -2996,6 +2997,8 @@ void nsWindow::FreeNativeData(void * data, uint32_t aDataType)
NS_METHOD nsWindow::SetTitle(const nsAString& aTitle)
{
const nsString& strTitle = PromiseFlatString(aTitle);
AutoRestore<bool> sendingText(mSendingSetText);
mSendingSetText = true;
::SendMessageW(mWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCWSTR)strTitle.get());
return NS_OK;
}
@ -4685,10 +4688,12 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
case WM_SETTEXT:
/*
* WM_SETTEXT paints the titlebar area. Avoid this if we have a
* custom titlebar we paint ourselves.
* custom titlebar we paint ourselves, or if we're the ones
* sending the message with an updated title
*/
if (!mCustomNonClient || mNonClientMargins.top == -1)
if ((mSendingSetText && nsUXThemeData::CheckForCompositor()) ||
!mCustomNonClient || mNonClientMargins.top == -1)
break;
{

View File

@ -575,6 +575,9 @@ protected:
// window below. This is currently only used for popups.
bool mMouseTransparent;
// Whether we're in the process of sending a WM_SETTEXT ourselves
bool mSendingSetText;
// The point in time at which the last paint completed. We use this to avoid
// painting too rapidly in response to frequent input events.
TimeStamp mLastPaintEndTime;