Continuous grab is broken 2.92.0 Alpha macOS #82870

Closed
opened 2020-11-20 15:26:14 +01:00 by Yevgeny Makarov · 15 comments

System Information
Operating system: Darwin-19.6.0-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro 455 OpenGL Engine ATI Technologies Inc. 4.1 ATI-3.10.18

Blender Version
Broken: version: 2.92.0 Alpha, Fri, Nov 20, 14:41, 96995b2343.
Worked: ~

Short description of error
When the cursor crosses the editor border, the value jumps/doubles.
It doesn't matter if it's a tablet, mouse, or trackpad.

This problem is also present in previous versions (at least in 2.83 it definitely is)
but after 96200110eb it began to happen all the time.

Actually there is a report for Windows #59836, but it's set to just todo.

continuous-grab-issue.mov

Here's what I see, this is a normal case:

GHOST x_mouse 558
GHOST x_accum 0 
GHOST warped_x_mouse 558 
WM    event.x 1116

GHOST x_mouse 559
GHOST x_accum 0 
GHOST warped_x_mouse 1 
WM    event.x 1118

GHOST x_mouse 1
GHOST x_accum 558 
GHOST warped_x_mouse 1 
WM    event.x 1118

And this is the wrong one:

GHOST x_mouse 558
GHOST x_accum 0 
GHOST warped_x_mouse 558 

WM    event.x 1116

GHOST x_mouse 559
GHOST x_accum 0 
GHOST warped_x_mouse 1 

GHOST x_mouse 559
GHOST x_accum 558 <--- !!!
GHOST warped_x_mouse 1 

WM    event.x 1118
WM    event.x 2234

CC @brecht

**System Information** Operating system: Darwin-19.6.0-x86_64-i386-64bit 64 Bits Graphics card: AMD Radeon Pro 455 OpenGL Engine ATI Technologies Inc. 4.1 ATI-3.10.18 **Blender Version** Broken: version: 2.92.0 Alpha, Fri, Nov 20, 14:41, `96995b2343`. Worked: ~ **Short description of error** When the cursor crosses the editor border, the value jumps/doubles. It doesn't matter if it's a tablet, mouse, or trackpad. This problem is also present in previous versions (at least in 2.83 it definitely is) but after 96200110eb it began to happen all the time. Actually there is a report for Windows #59836, but it's set to just todo. [continuous-grab-issue.mov](https://archive.blender.org/developer/F9337447/continuous-grab-issue.mov) Here's what I see, this is a normal case: ``` GHOST x_mouse 558 GHOST x_accum 0 GHOST warped_x_mouse 558 WM event.x 1116 GHOST x_mouse 559 GHOST x_accum 0 GHOST warped_x_mouse 1 WM event.x 1118 GHOST x_mouse 1 GHOST x_accum 558 GHOST warped_x_mouse 1 WM event.x 1118 ``` And this is the wrong one: ``` GHOST x_mouse 558 GHOST x_accum 0 GHOST warped_x_mouse 558 WM event.x 1116 GHOST x_mouse 559 GHOST x_accum 0 GHOST warped_x_mouse 1 GHOST x_mouse 559 GHOST x_accum 558 <--- !!! GHOST warped_x_mouse 1 WM event.x 1118 WM event.x 2234 ``` CC @brecht
Author
Member

Added subscribers: @brecht, @jenkm

Added subscribers: @brecht, @jenkm
Author
Member

I mean, it seems that the value accumulates but the cursor position is not updated,
and at the next event, the previous cursor position is used and the position is again accumulated.

I mean, it seems that the value accumulates but the cursor position is not updated, and at the next event, the previous cursor position is used and the position is again accumulated.

Added subscriber: @mano-wii

Added subscriber: @mano-wii

It seems to be a high priority issue.
I can't reproduce the problem on windows, in fact it seems to be MacOS specific.

It seems to be a high priority issue. I can't reproduce the problem on windows, in fact it seems to be MacOS specific.

Added subscriber: @PrototypeNM1

Added subscriber: @PrototypeNM1

I don't have time to look into this. @PrototypeNM1 or @jenkm worked on this and they would be the ones to look into a fix. If there is no quick fix, it's best to revert the patch until this issue is fixed.

Also @jenkm, as a developer you can triage the bug immediately and set appropriate tags, confirmation status and priority.

I don't have time to look into this. @PrototypeNM1 or @jenkm worked on this and they would be the ones to look into a fix. If there is no quick fix, it's best to revert the patch until this issue is fixed. Also @jenkm, as a developer you can triage the bug immediately and set appropriate tags, confirmation status and priority.

The equivalent Windows Ghost code tells the OS to update the mouse cursor position, then skips issuing a Ghost event as the OS will issue a new cursor move event with corrected position.

I think what's happening is that after wrapping/accumulating there remains stale mouse events in the OS event queue that previously would have been overwritten before the next event is issued. The only reason this hasn't surfaced on Windows is because inbetween mouse events aren't handled, only tablets.

The equivalent Windows Ghost code tells the OS to update the mouse cursor position, then skips issuing a Ghost event as the OS will issue a new cursor move event with corrected position. I think what's happening is that after wrapping/accumulating there remains stale mouse events in the OS event queue that previously would have been overwritten before the next event is issued. The only reason this hasn't surfaced on Windows is because inbetween mouse events aren't handled, only tablets.
Author
Member

@brecht It was much better with these, (note 2.91 also has a similar regression, but less noticeable).

--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1590,7 +1590,7 @@ - (void)windowWillClose:(NSNotification *)notification
         }
         case GHOST_kGrabWrap:  // Wrap cursor at area/window boundaries
         {
-          NSPoint mousePos = [event locationInWindow];
+          NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
           GHOST_TInt32 x_mouse = mousePos.x;
           GHOST_TInt32 y_mouse = mousePos.y;
           GHOST_Rect bounds, windowBounds, correctedBounds;

9e85812acc


Also I think the navigation gizmos needs to use GHOST_kGrabHide not GHOST_kGrabWrap, this will completely fix the problem for them.

@brecht It was much better with these, (note 2.91 also has a similar regression, but less noticeable). ``` --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1590,7 +1590,7 @@ - (void)windowWillClose:(NSNotification *)notification } case GHOST_kGrabWrap: // Wrap cursor at area/window boundaries { - NSPoint mousePos = [event locationInWindow]; + NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream]; GHOST_TInt32 x_mouse = mousePos.x; GHOST_TInt32 y_mouse = mousePos.y; GHOST_Rect bounds, windowBounds, correctedBounds; ``` 9e85812acc *** Also I think the navigation gizmos needs to use GHOST_kGrabHide not GHOST_kGrabWrap, this will completely fix the problem for them.
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

OK, I found a third similar report #74918 and there was a fix for Linux d6fd03616e.
I will try to do the similar thing (use a time stamp and delay) for Mac.

And the fourth #75528.
And probably these, too #67362 #39144.

OK, I found a third similar report #74918 and there was a fix for Linux d6fd03616e. I will try to do the similar thing (use a time stamp and delay) for Mac. And the fourth #75528. And probably these, too #67362 #39144.

This issue was referenced by 9306e01b10

This issue was referenced by 9306e01b10cd0cad50179f68fe8c8fed1c86e4a1

Added subscriber: @seanr

Added subscriber: @seanr

I can confirm that @jenkm's fix in D9662 works well. 2.92 was utterly unusable without it, but it now appears to be performing even better than it did previously with the fix.

I can confirm that @jenkm's fix in [D9662](https://archive.blender.org/developer/D9662) works well. 2.92 was utterly unusable without it, but it now appears to be performing even better than it did previously with the fix.

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Brecht Van Lommel self-assigned this 2020-11-30 13:44:34 +01:00

Added subscriber: @AgentSam-2

Added subscriber: @AgentSam-2
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#82870
No description provided.