Fix #93685: Allow Outliner Drag to Other Windows #105196

Merged
Harley Acheson merged 5 commits from Harley/blender:EdgePanDrag into main 2023-08-17 00:48:40 +02:00
Member

Allow dragging items from Outliner to other windows. Disables EdgePan
operator when entering new window. Canceling the drop redraws target
area and resets all modal cursors. But this does not fix incorrect
mouse cursor during operations on the remote target window.


This PR cancels the EdgePan operator (view2d_ops.cc) when your mouse enters a new window. This is the main cause of drag and drop not working between windows: not allowing it when another modifier is running (wm_event_cursor_other_windows) and EdgePan runs continuously once started.

This also makes changes to the code executed when a drag finishes (wm_drags_exit). It fixes two things. One is that nothing is redrawn if the drag is canceled (any_active is false) so the 3DView widget remains drawn, when on a different window than it starts from. The second issue is that our modal cursors are per-window, so you can imagine moving from one window to another and back again will leave the modal state set on the middle one. This code clears modal cursors across all windows.

This also makes other changes in wm_dragdrop.cc so that all operations work on the window under the cursor, not just the active window. This means that you can drag an Object from Outliner in one window and drop it into the 3DView of another window. And you can can also drop the name into text input boxes, etc.

HOWEVER, this does not fix the fact that the mouse cursor is not updated and can be shown correctly within the remote target window. So the feedback from the mouse cursor will quite often be wrong, even though the process otherwise works. This seems to be a larger problem within our wm_event_system.cc where we deal with each window in turn, only dealing with events with cursor positions relative to it, but not in other windows relative to the active one. This means that that while one window is active, but you are in an operation over another window that one does not get ED_screen_set_active_region called on it.

I'm not seeing any easy fixes or workarounds for this, so it might have to remain a known limitation and "to do", that dragging to another window does not correctly update the mouse cursor. But at least this PR would allow the operation to work.

The following shows a drag and drop operation from one window to another. It works for all regions, but the cursor shown is always the one that it enters the window with, in this case the default pointer:

Drop1.gif

Following shows the same (successful) operation, but the mouse leaves the source window at a no-drop zone, which is why the "stop sign" cursor is shown while in the target window:

Drop2.gif

Allow dragging items from Outliner to other windows. Disables EdgePan operator when entering new window. Canceling the drop redraws target area and resets all modal cursors. But this does not fix incorrect mouse cursor during operations on the remote target window. --- This PR cancels the EdgePan operator (view2d_ops.cc) when your mouse enters a new window. This is the main cause of drag and drop not working between windows: not allowing it when another modifier is running (wm_event_cursor_other_windows) and EdgePan runs continuously once started. This also makes changes to the code executed when a drag finishes (wm_drags_exit). It fixes two things. One is that nothing is redrawn if the drag is canceled (any_active is false) so the 3DView widget remains drawn, when on a different window than it starts from. The second issue is that our modal cursors are per-window, so you can imagine moving from one window to another and back again will leave the modal state set on the middle one. This code clears modal cursors across all windows. This also makes other changes in `wm_dragdrop.cc` so that all operations work on the window under the cursor, not just the active window. This means that you can drag an Object from Outliner in one window and drop it into the 3DView of another window. And you can can also drop the name into text input boxes, etc. HOWEVER, this does not fix the fact that the mouse cursor is not updated and can be shown correctly within the remote target window. So the feedback from the mouse cursor will quite often be wrong, even though the process otherwise works. This seems to be a larger problem within our wm_event_system.cc where we deal with each window in turn, only dealing with events with cursor positions relative to it, but not in other windows relative to the active one. This means that that while one window is active, but you are in an operation over another window that one does not get `ED_screen_set_active_region` called on it. I'm not seeing any easy fixes or workarounds for this, so it might have to remain a known limitation and "to do", that dragging to another window does not correctly update the mouse cursor. But at least this PR would allow the operation to work. The following shows a drag and drop operation from one window to another. It works for all regions, but the cursor shown is always the one that it enters the window with, in this case the default pointer: ![Drop1.gif](/attachments/ef0b8f10-0655-4a2c-81ab-2e6d74ce3c5a) Following shows the same (successful) operation, but the mouse leaves the source window at a no-drop zone, which is why the "stop sign" cursor is shown while in the target window: ![Drop2.gif](/attachments/e5740407-c0e5-45c3-ad43-67058546c9a9)
426 KiB
327 KiB
Harley Acheson changed title from Fix 93685: Allow Outliner Drag to Other Windows to Fix #93685: Allow Outliner Drag to Other Windows 2023-02-25 02:24:40 +01:00

The 3rd change looks like it could be in another Pull Request.
I'm having a hard time listing the advantages and disadvantages of that change.

But is possible to overlap two windows in such a way that you can drag directly from a "no drop" zone on the source window to a "drop" zone on the target window

I feel that the GHOST_IWindow *GHOST_System::getWindowUnderCursor(int32_t x, int32_t y) could be edited to test the windows in "Z-order" (or else test the active window first). So that wouldn't be a problem anymore?

The 3rd change looks like it could be in another Pull Request. I'm having a hard time listing the advantages and disadvantages of that change. > But is possible to overlap two windows in such a way that you can drag directly from a "no drop" zone on the source window to a "drop" zone on the target window I feel that the `GHOST_IWindow *GHOST_System::getWindowUnderCursor(int32_t x, int32_t y)` could be edited to test the windows in "Z-order" (or else test the active window first). So that wouldn't be a problem anymore?
Author
Member

The 3rd change looks like it could be in another Pull Request.
I'm having a hard time listing the advantages and disadvantages of that change.

Me, too. I really only added that because I just hate the idea of working on something like this and not leaving it perfect, but

But is possible to overlap two windows in such a way that you can drag directly from a "no drop" zone on the source window to a "drop" zone on the target window

I feel that the GHOST_IWindow *GHOST_System::getWindowUnderCursor(int32_t x, int32_t y) could be edited to test the windows in "Z-order" (or else test the active window first). So that wouldn't be a problem anymore?

I'm no expert there so might have some of this wrong, but without doing #3...

When you generally move the mouse around the interface we are looking for areas under the cursor and if there are none we then look for the gaps between areas, and if there isn't anything at all we show a default pointer for outside of the window.

While doing a drag and drop operation though it is setting a modal cursor. While this is set the setting of pointer outside of the window just continues to show the last one, rather than set it to default pointer.

When the mouse moves completely to another window then our calculation of which area we are in starts screwing up. In this drag operation the source window is still active and so the location of the mouse is relative to that window and we can't tell that what area is which. So it looks like we are just outside of the source window and not actually in one of our windows. It tries to show the default arrow but just continues to show the last one because of the modal status.

This means that without #3 things sort of look okay in simple situations. Your mouse is in Outliner or 3DView, looks like an arrow and you drag it out of the window. The arrow continues to be an arrow between windows and does so the entire time you are in that target window (even whether a drop target or not)

But if you instead drag from Outliner over Properties you get a "no-drop" cursor, drag off the window and it continues to show that (because modal) and will keep showing that in the target window. #3 just resets that cursor correctly between windows and as you enter the new one. But even with #3 it does not show "no-drop" over the target window Properties area.

> The 3rd change looks like it could be in another Pull Request. > I'm having a hard time listing the advantages and disadvantages of that change. Me, too. I really only added that because I just hate the idea of working on something like this and not leaving it perfect, but > > But is possible to overlap two windows in such a way that you can drag directly from a "no drop" zone on the source window to a "drop" zone on the target window > > I feel that the `GHOST_IWindow *GHOST_System::getWindowUnderCursor(int32_t x, int32_t y)` could be edited to test the windows in "Z-order" (or else test the active window first). So that wouldn't be a problem anymore? I'm no expert there so might have some of this wrong, but without doing #3... When you generally move the mouse around the interface we are looking for areas under the cursor and if there are none we then look for the gaps between areas, and if there isn't anything at all we show a default pointer for outside of the window. While doing a drag and drop operation though it is setting a **modal** cursor. While this is set the setting of pointer outside of the window just continues to show the last one, rather than set it to default pointer. When the mouse moves completely to another window then our calculation of which area we are in starts screwing up. In this drag operation the source window is still active and so the location of the mouse is relative to that window and we can't tell that what area is which. So it looks like we are just outside of the source window and not actually in one of our windows. It tries to show the default arrow but just continues to show the last one because of the modal status. This means that without #3 things sort of look okay in simple situations. Your mouse is in Outliner or 3DView, looks like an arrow and you drag it out of the window. The arrow continues to be an arrow between windows and does so the entire time you are in that target window (even whether a drop target or not) But if you instead drag from Outliner over Properties you get a "no-drop" cursor, drag off the window and it continues to show that (because modal) and will keep showing that in the target window. #3 just resets that cursor correctly between windows and as you enter the new one. But even with #3 it does not show "no-drop" over the target window Properties area.
Harley Acheson requested review from Julian Eisel 2023-03-06 00:48:31 +01:00
Harley Acheson changed title from Fix #93685: Allow Outliner Drag to Other Windows to WIP: Fix #93685: Allow Outliner Drag to Other Windows 2023-03-10 17:05:47 +01:00
Harley Acheson force-pushed EdgePanDrag from 0408bd7fa8 to b5a931305f 2023-03-10 19:36:22 +01:00 Compare
Harley Acheson changed title from WIP: Fix #93685: Allow Outliner Drag to Other Windows to Fix #93685: Allow Outliner Drag to Other Windows 2023-03-10 19:51:44 +01:00
Author
Member

I removed the changes to ED_screen_set_active_region. Although that earlier change, along with what is in this PR now, correctly shows the mouse cursor at all times it was a very incorrect change. It caused that function to ONLY work on the one window under the cursor and not for all of them, which is the intention when it is called in ED_screens_init. It fixed the cursor for this problem when called from wm_event_do_handlers.

I removed the changes to `ED_screen_set_active_region`. Although that earlier change, along with what is in this PR now, correctly shows the mouse cursor at all times it was a very incorrect change. It caused that function to ONLY work on the one window under the cursor and not for all of them, which is the intention when it is called in `ED_screens_init`. It fixed the cursor for this problem when called from wm_event_do_handlers.
Harley Acheson changed title from Fix #93685: Allow Outliner Drag to Other Windows to WIP: Fix #93685: Allow Outliner Drag to Other Windows 2023-03-11 19:20:29 +01:00
Harley Acheson force-pushed EdgePanDrag from b5a931305f to 5611b109e4 2023-03-11 20:49:25 +01:00 Compare
Harley Acheson changed title from WIP: Fix #93685: Allow Outliner Drag to Other Windows to Fix #93685: Allow Outliner Drag to Other Windows 2023-03-12 19:24:10 +01:00

@JulianEisel Hey, can you please take a look at this PR? It fixes a high priority report. Thanks.

@JulianEisel Hey, can you please take a look at this PR? It fixes a high priority report. Thanks.
Harley Acheson added this to the User Interface project 2023-04-07 19:23:28 +02:00
Harley Acheson added 2 commits 2023-07-21 01:05:49 +02:00
Dalai Felinto requested review from Brecht Van Lommel 2023-08-15 17:52:05 +02:00
Brecht Van Lommel approved these changes 2023-08-15 19:46:48 +02:00
Harley Acheson added 2 commits 2023-08-17 00:14:11 +02:00
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit d102536b1a into main 2023-08-17 00:48:40 +02:00
Harley Acheson deleted branch EdgePanDrag 2023-08-17 00:48:41 +02:00
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
4 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#105196
No description provided.