Skip to content
Snippets Groups Projects
Commit fdbe7930 authored by Martin Stransky's avatar Martin Stransky
Browse files

Bug 1826778 [Linux] Lock cursor type set by widget code r=emilio

If we set resize cursor on widget level keep it locked and prevent layout
to switch it back to default (by synthetic mouse events for instance)
until resize is finished.

Differential Revision: https://phabricator.services.mozilla.com/D179049
parent e2831ed7
No related branches found
No related tags found
No related merge requests found
......@@ -415,6 +415,7 @@ nsWindow::nsWindow()
mNoAutoHide(false),
mIsTransparent(false),
mHasReceivedSizeAllocate(false),
mWidgetCursorLocked(false),
mPopupTrackInHierarchy(false),
mPopupTrackInHierarchyConfigured(false),
mHiddenPopupPositioned(false),
......@@ -3328,6 +3329,10 @@ void nsWindow::SetCursor(const Cursor& aCursor) {
return;
}
if (mWidgetCursorLocked) {
return;
}
// Only change cursor if it's actually been changed
if (!mUpdateCursor && mCursor == aCursor) {
return;
......@@ -4433,6 +4438,7 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) {
}
}
mWidgetCursorLocked = false;
const auto refPoint = GetRefPoint(this, aEvent);
if (auto edge = CheckResizerEdge(refPoint)) {
nsCursor cursor = eCursor_none;
......@@ -4455,6 +4461,10 @@ void nsWindow::OnMotionNotifyEvent(GdkEventMotion* aEvent) {
break;
}
SetCursor(Cursor{cursor});
// If we set resize cursor on widget level keep it locked and prevent layout
// to switch it back to default (by synthetic mouse events for instance)
// until resize is finished.
mWidgetCursorLocked = true;
return;
}
......
......@@ -672,6 +672,7 @@ class nsWindow final : public nsBaseWidget {
bool mIsTransparent : 1;
// We can expect at least one size-allocate event after early resizes.
bool mHasReceivedSizeAllocate : 1;
bool mWidgetCursorLocked : 1;
/* Gkt creates popup in two incarnations - wl_subsurface and xdg_popup.
* Kind of popup is choosen before GdkWindow is mapped so we can change
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment