Win32: Auto-Raise and -Focus Windows on Hover #104681

Closed
Harley Acheson wants to merge 1 commits from Harley:AutoFocus into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

On the Windows platform, raise windows and give them focus as the mouse
hovers over them. This allows keyboard shortcuts for the area under the
mouse without having to click the window caption to make them active.


This patch makes it so that as you move your mouse between different Blender windows the window under the mouse automatically becomes active - raises and gets focus. And does so all the time and without any user configuration.

Note that this is only when hovering over the client portion of the window, not non-client areas like the caption (title bar). And this is ONLY between separate windows within a single Blender instance, and NOT between Blender and other applications.

Even between Blender windows, not everything is auto-focused. But most things. Specifically:

  • Child to parent
  • Parent to child
  • Between siblings of the same parent
  • Between main windows that do not overlap.

The situations where windows are NOT auto-focused are primarily:

  • main parent windows that overlap each other
  • between child windows of different parents
On the Windows platform, raise windows and give them focus as the mouse hovers over them. This allows keyboard shortcuts for the area under the mouse without having to click the window caption to make them active. --- This patch makes it so that as you move your mouse between different Blender windows the window under the mouse automatically becomes active - raises and gets focus. And does so all the time and without any user configuration. Note that this is only when hovering over the client portion of the window, not non-client areas like the caption (title bar). And this is ONLY between separate windows within a single Blender instance, and NOT between Blender and other applications. Even between Blender windows, not everything is auto-focused. But most things. Specifically: * Child to parent * Parent to child * Between siblings of the same parent * Between main windows that do not overlap. The situations where windows are NOT auto-focused are primarily: * main parent windows that overlap each other * between child windows of different parents
Harley Acheson added 1 commit 2023-02-13 03:28:53 +01:00
4d336038ce Win32: Auto-Raise and -Focus Windows on Hover
On the Windows platform, raise windows and give them focus as the mouse
hovers over them. This allows keyboard shortcuts for the area under the
mouse without having to click the window caption to make them active.

I haven't tested the latest version of the patch on Windows, but I'm doubtful about child to parent focusing.

If I remember correctly preferences and file browser are child windows, while the render window is not. Regardless, I can't think of a case where I would want any of those windows to automatically go behind the parent window.

Personally at least I can imagine letting the cursor rest outside the child window, to get an unobstructed view of the contents of the child window, and then it suddenly disappearing.

Previous discussion for reference:
https://archive.blender.org/developer/D13951

I haven't tested the latest version of the patch on Windows, but I'm doubtful about child to parent focusing. If I remember correctly preferences and file browser are child windows, while the render window is not. Regardless, I can't think of a case where I would want any of those windows to automatically go behind the parent window. Personally at least I can imagine letting the cursor rest outside the child window, to get an unobstructed view of the contents of the child window, and then it suddenly disappearing. Previous discussion for reference: https://archive.blender.org/developer/D13951
Brecht Van Lommel requested changes 2023-02-13 09:05:26 +01:00
Brecht Van Lommel left a comment
Owner

Marking as request change due to question.

Marking as request change due to question.
Brecht Van Lommel added this to the User Interface project 2023-02-13 09:06:29 +01:00
Author
Member

If I remember correctly preferences and file browser are child windows, while the render window is not. Regardless, I can't think of a case where I would want any of those windows to automatically go behind the parent window.

They don't. On Windows if it is a child then it always remains in front of its parent. So for these focus can change from parent to child and back and nothing changes in z-order.

Render window is not a child. But this patch does not automatically change focus for windows like this that have any overlap. It will do so if they don't overlap, in which case there is no z-order change.

Personally at least I can imagine letting the cursor rest outside the child window, to get an unobstructed view of the contents of the child window, and then it suddenly disappearing.

For sure and for child windows all that would happen is the parent would get focus (so the titlebar would change) but otherwise everything would remain the same.

Previous discussion for reference:
https://archive.blender.org/developer/D13951

You did try it early on and raised similar issues as above that were addressed with the change to having it not change focus on overlapping peer windows.

I subsequently made builds available and asked for feedback here: https://devtalk.blender.org/t/please-test-windows-auto-focus-patch-build/26965

Got a "brings tears to my eyes". LOL

> If I remember correctly preferences and file browser are child windows, while the render window is not. Regardless, I can't think of a case where I would want any of those windows to automatically go behind the parent window. They don't. On Windows if it is a child then it always remains in front of its parent. So for these focus can change from parent to child and back and nothing changes in z-order. Render window is not a child. But this patch does not automatically change focus for windows like this that **have any overlap**. It will do so if they don't overlap, in which case there is no z-order change. > Personally at least I can imagine letting the cursor rest outside the child window, to get an unobstructed view of the contents of the child window, and then it suddenly disappearing. For sure and for child windows all that would happen is the parent would get focus (so the titlebar would change) but otherwise everything would remain the same. > Previous discussion for reference: > https://archive.blender.org/developer/D13951 You did try it early on and raised similar issues as above that were addressed with the change to having it not change focus on overlapping peer windows. I subsequently made builds available and asked for feedback here: https://devtalk.blender.org/t/please-test-windows-auto-focus-patch-build/26965 Got a "brings tears to my eyes". LOL
Brecht Van Lommel approved these changes 2023-02-13 18:55:53 +01:00
Brecht Van Lommel left a comment
Owner

Thanks, given the explanation and user feedback this looks good to me.

Thanks, given the explanation and user feedback this looks good to me.
Author
Member

Closing with manual commit: defd95afcd

Closing with manual commit: https://projects.blender.org/blender/blender/commit/defd95afcd44a17a82c54134a9762290b384e664
Harley Acheson closed this pull request 2023-02-22 19:40:38 +01:00
Harley Acheson deleted branch AutoFocus 2023-02-22 19:41:22 +01:00
Member

While this patch sounds really helpful, it caused a lot of confusion while testing nightlies, I believe this patch is the main reason for it. I used to be able to type file names when saving a file using file save window and not worry about where my mouse pointer was. Now pressing a wrong button can messes up your scene, change frames etc if the mouse pointer is not exactly within the borders of the save window, which happened to me a lot lately.

If this patch is in the main, maybe the file save window should be blocking other windows, because I feel like this is really dangerous and the user might not realize that she is messing up with the scene just prior to saving the file.

While this patch sounds really helpful, it caused a lot of confusion while testing nightlies, I believe this patch is the main reason for it. I used to be able to type file names when saving a file using file save window and not worry about where my mouse pointer was. Now pressing a wrong button can messes up your scene, change frames etc if the mouse pointer is not exactly within the borders of the save window, which happened to me a lot lately. If this patch is in the main, maybe the file save window should be blocking other windows, because I feel like this is really dangerous and the user might not realize that she is messing up with the scene just prior to saving the file.
Author
Member

I used to be able to type file names when saving a file using file save window and not worry about where my mouse pointer was...

Thanks for this comment, that does sound annoying.

If this patch is in the main, maybe the file save window should be blocking other windows...

I don't think that making the File Browser window blocking could be a possible solution as there are many people who rely on using it non-modally, like opening for one purpose but then dragging an image into the 3DViewport instead.

I'd hate to give up on this change though as it offers such nice utility when working with multiple windows. We get so many reports from people saying it is a pain to have to select a window just to use hotkeys.

Do you mind continuing to evaluate this impact, while considering possible solutions and the tradeoff with not having to activate child windows manually? One possible solution is to just make this feature an opt-in preference, but I'd much rather avoid this if possible.

> I used to be able to type file names when saving a file using file save window and not worry about where my mouse pointer was... Thanks for this comment, that does sound annoying. > If this patch is in the main, maybe the file save window should be blocking other windows... I don't _think_ that making the File Browser window blocking could be a possible solution as there are many people who rely on using it non-modally, like opening for one purpose but then dragging an image into the 3DViewport instead. I'd hate to give up on this change though as it offers such nice utility when working with multiple windows. We get so many reports from people saying it is a pain to have to select a window just to use hotkeys. Do you mind continuing to evaluate this impact, while considering possible solutions and the tradeoff with not having to activate child windows manually? One possible solution is to just make this feature an opt-in preference, but I'd much rather avoid this if possible.

If the focus is on a text field or a modal operator is running, it probably should not change the window focus automatically?

Maybe the information is already at the GHOST level through cursor grabbing and IME, not sure if it's enough.

If the focus is on a text field or a modal operator is running, it probably should not change the window focus automatically? Maybe the information is already at the GHOST level through cursor grabbing and IME, not sure if it's enough.
Author
Member

If the focus is on a text field or a modal operator is running, it probably should not change the window focus automatically?
Maybe the information is already at the GHOST level through cursor grabbing and IME, not sure if it's enough.

We would have more options if this wasn't just an isolated change to GHOST_SystemWin32.cpp. This could be exposed higher up, so a wmWindow could have some "don't change focus automatically" that could be set/unset at times. Not sure that that would look like, but maybe "allow_hoverfocus" or similar

But... simpler I could use the "is_dialog" argument that is sent during window creation. On Windows we aren't doing anything with it because we generally don't want different look or behavior with our windows, or even (yet) have code that could make them actually modal (disallowing events to the parent for example). But this might be a bit of "is_dialog" that makes sense. AFAIK File Browser is the only window that is created with is_dialog true (it has changed behavior on Mac). I don't think it is misusing the idea since a true modal dialog would not allow hover focus either.

But the first idea feels better.

> If the focus is on a text field or a modal operator is running, it probably should not change the window focus automatically? > Maybe the information is already at the GHOST level through cursor grabbing and IME, not sure if it's enough. We would have more options if this wasn't just an isolated change to GHOST_SystemWin32.cpp. This could be exposed higher up, so a wmWindow could have some "don't change focus automatically" that could be set/unset at times. Not sure that that would look like, but maybe "allow_hoverfocus" or similar But... simpler I _could_ use the "is_dialog" argument that is sent during window creation. On Windows we aren't doing anything with it because we generally don't want different look or behavior with our windows, or even (yet) have code that could make them actually modal (disallowing events to the parent for example). But this might be a bit of "is_dialog" that makes sense. AFAIK File Browser is the only window that is created with is_dialog true (it has changed behavior on Mac). I don't think it is misusing the idea since a true modal dialog would not allow hover focus either. But the first idea feels better.
Member

Do you mind continuing to evaluate this impact, while considering possible solutions and the tradeoff with not having to activate child windows manually? One possible solution is to just make this feature an opt-in preference, but I'd much rather avoid this if possible.

I think this is a great feature just that it has a some bad side effects when trying to save a file. I actually deleted objects while saving, instead of deleting a character or moved to wrong frames etc.

I will keep testing it. I feel like this could be optional like you mentioned.

> Do you mind continuing to evaluate this impact, while considering possible solutions and the tradeoff with not having to activate child windows manually? One possible solution is to just make this feature an opt-in preference, but I'd much rather avoid this if possible. > > > I think this is a great feature just that it has a some bad side effects when trying to save a file. I actually deleted objects while saving, instead of deleting a character or moved to wrong frames etc. I will keep testing it. I feel like this could be optional like you mentioned.
Author
Member

@kursadk - I'm hoping you can test the following build:

https://builder.blender.org/download/patch/PR105446/

@kursadk - I'm hoping you can test the following build: https://builder.blender.org/download/patch/PR105446/

Pull request closed

Sign in to join this conversation.
No reviewers
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
3 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#104681
No description provided.