[tbb-commits] [tor-browser] 250/311: Bug 1758357 - Don't call SetCursor redundantly on Windows. r=cmartin a=dmeehan

gitolite role git at cupani.torproject.org
Tue Apr 26 15:30:50 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit da0305f982f2c07bb1c8aeab25ea1acb667b3dd8
Author: Emilio Cobos Álvarez <emilio at crisal.io>
AuthorDate: Wed Mar 23 17:17:35 2022 +0000

    Bug 1758357 - Don't call SetCursor redundantly on Windows. r=cmartin a=dmeehan
    
    Bug 1724120 apparently regressed this, which is a bit surprising because
    the redundant ::SetCursor() call is already there. The real fix is the
    one above, however I think this change is still worth it. Make cursor
    updates avoid redundant ::SetCursor() calls the same way other widget
    back-ends do (always except for mUpdateCursor, which is set on scale
    changes and so on).
    
    Differential Revision: https://phabricator.services.mozilla.com/D141864
---
 widget/windows/nsWindow.cpp | 7 ++++---
 widget/windows/nsWindow.h   | 1 -
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index 69abb58ef4f53..6ec40095e3990 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -259,7 +259,6 @@ bool nsWindow::sDropShadowEnabled = true;
 uint32_t nsWindow::sInstanceCount = 0;
 bool nsWindow::sSwitchKeyboardLayout = false;
 BOOL nsWindow::sIsOleInitialized = FALSE;
-HCURSOR nsWindow::sCustomHCursor = nullptr;
 nsIWidget::Cursor nsWindow::sCurrentCursor = {};
 nsWindow* nsWindow::sCurrentWindow = nullptr;
 bool nsWindow::sJustGotDeactivate = false;
@@ -3244,13 +3243,15 @@ static HCURSOR CursorForImage(const nsIWidget::Cursor& aCursor,
 
 // Setting the actual cursor
 void nsWindow::SetCursor(const Cursor& aCursor) {
+  static HCURSOR sCustomHCursor = nullptr;
+
   mCursor = aCursor;
 
-  if (sCurrentCursor == aCursor && sCustomHCursor) {
-    ::SetCursor(sCustomHCursor);
+  if (!mUpdateCursor && sCurrentCursor == aCursor) {
     return;
   }
 
+  mUpdateCursor = false;
   if (sCustomHCursor) {
     ::DestroyIcon(sCustomHCursor);
     sCustomHCursor = nullptr;
diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h
index f757e9c27650a..ffbdaf0fe1f00 100644
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -667,7 +667,6 @@ class nsWindow final : public nsBaseWidget {
   static TriStateBool sCanQuit;
   static nsWindow* sCurrentWindow;
   static BOOL sIsOleInitialized;
-  static HCURSOR sCustomHCursor;
   static Cursor sCurrentCursor;
   static bool sSwitchKeyboardLayout;
   static bool sJustGotDeactivate;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list