Fix #66722: Blender doesn't open file if isn't focused #106769

Closed
Ankit Meel wants to merge 4 commits from ankitm:66722 into main

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

After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen. So fetch any
window instead of relying on active one.

--

This fixes the bug, but need to investigate if there is any better
window to choose.
: Scenarios tested:

  • Fresh launch from double click file
  • Already open blend file and different file double click
  • Already open blend file with multiple windows open and different file
    double click.

In some other PR, would like to remove other behaviour dependent
on active window and not put Blender at the front even if
some other app has focus. Similar to Firefox.

After double clicking a file, user can click on a different app and Blender will lose focus. Then it stays on splash screen. So fetch any window instead of relying on active one. -- ~~This fixes the bug, but need to investigate if there is any better window to choose.~~: Scenarios tested: - Fresh launch from double click file - Already open blend file and different file double click - Already open blend file with multiple windows open and different file double click. In some other PR, would like to remove other behaviour dependent on active window and not put Blender at the front even if some other app has focus. Similar to Firefox.
Ankit Meel added 1 commit 2023-04-10 18:48:08 +02:00
After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen.
This fixes the bug, but need to investigate if there is any better
window to choose.
Ankit Meel changed title from 66722 to Fix #66722: Blender doesn't open file if isn't focused 2023-04-10 18:48:29 +02:00
Member

Just mentioning that on the Windows platform we steal focus a few different times during startup so it is basically impossible for a different app to remain in focus between launching Blender and having it fully loaded. I remember one bug report that complained about this behavior, but otherwise it feels fairly normal compared to other programs.

Just mentioning that on the Windows platform we steal focus a few different times during startup so it is basically impossible for a different app to remain in focus between launching Blender and having it fully loaded. I remember one bug report that complained about this behavior, but otherwise it feels fairly normal compared to other programs.
Author
Member
On mac, on lower end machines like mine, starting blender and then switching desktop is common for me. But instead of staying on older desktop, Blender shows up on the new one. I can pin it to one desktop, but then at launch even the desktop changes to Blender's. https://apple.stackexchange.com/questions/394603/how-do-you-prevent-launched-apps-from-taking-focus https://apple.stackexchange.com/questions/428522/prevent-all-apps-in-macos-from-stealing-focus https://superuser.com/questions/56589/is-there-a-way-in-mac-os-x-to-stop-applications-from-stealing-focus-especially https://apple.stackexchange.com/questions/355431/avoid-apps-from-stealing-focus-in-macos https://apple.stackexchange.com/questions/123448/os-x-how-to-have-starting-applications-optionally-not-take-the-focus Will discuss it later in detail
Ankit Meel changed title from Fix #66722: Blender doesn't open file if isn't focused to WIP: Fix #66722: Blender doesn't open file if isn't focused 2023-04-10 21:13:14 +02:00
Ankit Meel added the
Module
User Interface
Platform
macOS
labels 2023-04-11 19:58:46 +02:00
Ankit Meel added this to the Module: User Interface project 2023-04-11 19:59:09 +02:00
Ankit Meel requested review from Brecht Van Lommel 2023-04-11 19:59:27 +02:00
Ankit Meel requested review from Julian Eisel 2023-04-11 19:59:28 +02:00
Ankit Meel changed title from WIP: Fix #66722: Blender doesn't open file if isn't focused to Fix #66722: Blender doesn't open file if isn't focused 2023-04-11 20:03:01 +02:00
Ankit Meel added 1 commit 2023-04-12 14:00:35 +02:00
Member

We should avoid stealing focus, and indeed, for file opening that shouldn't be needed. File loading should work with any window.

Haven't tested this but makes sense to me.

We should avoid stealing focus, and indeed, for file opening that shouldn't be needed. File loading should work with any window. Haven't tested this but makes sense to me.
Julian Eisel approved these changes 2023-04-12 16:04:20 +02:00
@ -1403,1 +1403,3 @@
GHOST_Window *window = (GHOST_Window *)m_windowManager->getActiveWindow();
GHOST_Window *window = m_windowManager->getWindows().empty() ?
NULL :
(GHOST_Window *)m_windowManager->getWindows().back();
Member

It shouldn't matter much, but I would use the first, not the last window here. Just because that would always be a main window I think, not a child window, and this makes more sense to me conceptually.

It shouldn't matter much, but I would use the first, not the last window here. Just because that would always be a main window I think, not a child window, and this makes more sense to me conceptually.
ankitm marked this conversation as resolved
Ankit Meel added 2 commits 2023-04-12 17:08:04 +02:00
Ankit Meel closed this pull request 2023-04-13 07:19:17 +02:00

Pull request closed

Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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 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#106769
No description provided.