зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1724120 - Tweak Windows' nsWindow::SetCursor. r=mhowell
This is simpler and more correct, the previous code could get sHCursor and sCurrentCursor out of sync, which caused this issue. Differential Revision: https://phabricator.services.mozilla.com/D122966
This commit is contained in:
Родитель
8a7ca74965
Коммит
68a095e065
|
@ -252,7 +252,7 @@ bool nsWindow::sDropShadowEnabled = true;
|
|||
uint32_t nsWindow::sInstanceCount = 0;
|
||||
bool nsWindow::sSwitchKeyboardLayout = false;
|
||||
BOOL nsWindow::sIsOleInitialized = FALSE;
|
||||
HCURSOR nsWindow::sHCursor = nullptr;
|
||||
HCURSOR nsWindow::sCustomHCursor = nullptr;
|
||||
nsIWidget::Cursor nsWindow::sCurrentCursor = {};
|
||||
nsWindow* nsWindow::sCurrentWindow = nullptr;
|
||||
bool nsWindow::sJustGotDeactivate = false;
|
||||
|
@ -3244,38 +3244,31 @@ static HCURSOR CursorForImage(const nsIWidget::Cursor& aCursor,
|
|||
|
||||
// Setting the actual cursor
|
||||
void nsWindow::SetCursor(const Cursor& aCursor) {
|
||||
if (sCurrentCursor == aCursor && sHCursor) {
|
||||
::SetCursor(sHCursor);
|
||||
return;
|
||||
}
|
||||
|
||||
mCursor = aCursor;
|
||||
|
||||
HCURSOR cursor = CursorForImage(aCursor, GetDefaultScale());
|
||||
if (cursor) {
|
||||
::SetCursor(cursor);
|
||||
sCurrentCursor = aCursor;
|
||||
if (sHCursor) {
|
||||
::DestroyIcon(sHCursor);
|
||||
}
|
||||
sHCursor = cursor;
|
||||
if (sCurrentCursor == aCursor && sCustomHCursor) {
|
||||
::SetCursor(sCustomHCursor);
|
||||
return;
|
||||
}
|
||||
|
||||
cursor = CursorFor(aCursor.mDefaultCursor);
|
||||
if (sCustomHCursor) {
|
||||
::DestroyIcon(sCustomHCursor);
|
||||
sCustomHCursor = nullptr;
|
||||
}
|
||||
|
||||
sCurrentCursor = aCursor;
|
||||
HCURSOR cursor = CursorForImage(aCursor, GetDefaultScale());
|
||||
if (cursor) {
|
||||
sCustomHCursor = cursor;
|
||||
} else {
|
||||
cursor = CursorFor(aCursor.mDefaultCursor);
|
||||
}
|
||||
|
||||
if (!cursor) {
|
||||
return;
|
||||
}
|
||||
|
||||
HCURSOR oldCursor = ::SetCursor(cursor);
|
||||
sCurrentCursor = aCursor;
|
||||
|
||||
if (sHCursor == oldCursor) {
|
||||
if (sHCursor) {
|
||||
::DestroyIcon(sHCursor);
|
||||
}
|
||||
sHCursor = nullptr;
|
||||
}
|
||||
::SetCursor(cursor);
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
|
|
|
@ -617,7 +617,7 @@ class nsWindow final : public nsWindowBase {
|
|||
static TriStateBool sCanQuit;
|
||||
static nsWindow* sCurrentWindow;
|
||||
static BOOL sIsOleInitialized;
|
||||
static HCURSOR sHCursor;
|
||||
static HCURSOR sCustomHCursor;
|
||||
static Cursor sCurrentCursor;
|
||||
static bool sSwitchKeyboardLayout;
|
||||
static bool sJustGotDeactivate;
|
||||
|
|
Загрузка…
Ссылка в новой задаче