Skip to content

NEEDS WINDOWS TESTING - #21829 darktable steals focus when export progress messages update - #21843

Draft
Arecsu wants to merge 2 commits into
darktable-org:masterfrom
Arecsu:fix/windows-focus-steal-export-21829
Draft

NEEDS WINDOWS TESTING - #21829 darktable steals focus when export progress messages update#21843
Arecsu wants to merge 2 commits into
darktable-org:masterfrom
Arecsu:fix/windows-focus-steal-export-21829

Conversation

@Arecsu

@Arecsu Arecsu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

NEEDS WINDOWS TESTING

This PR is a diagnosis build for #21829 — on Windows, darktable steals the input focus (and can switch the active virtual desktop) each time an export progress message updates while you're working in another window.

Please help reproduce it — a macOS/Linux developer can't trigger this. Any Windows tester is welcome to run the steps below and paste the terminal output.

Why this build

Static analysis of the export path found no explicit focus-grabbing call (gtk_window_present / grab_focus / SetForegroundWindow) — GTK3 on Windows can only steal focus via gdk_window_focus (from gtk_window_present/grab_focus) and transient-window restore, none of which fire during a progress update. The only WM interaction is dt_ui_notify_user()gtk_window_set_urgency_hint(TRUE)FlashWindowEx(FLASHW_ALL|FLASHW_TIMER) at the end of a job.

So we need real data. This branch logs the whole export lifecycle plus window focus changes. Every line already has a timestamp (seconds since darktable started) and is prefixed [21829]:

[21829] EXPORT STARTED (N images)
[21829] _lib_backgroundjobs_message_updated 'exporting x / N to …'   (per image)
[21829] main window focus-OUT                                         (you switch to another app)
[21829] main window focus-IN                                          (darktable steals focus back)
[21829] EXPORT ENDED
[21829] dt_ui_notify_user setting urgency hint (window inactive)
[21829] dt_gui_cursor_set_busy gtk_grab_add on progress widget

How to test (Windows)

  1. Build this branch, then run it from a terminal (a GUI app launched without a console has no stdout):
    darktable -d dev
    
  2. Select several images and start a batch export.
  3. While it runs, switch to another window / another virtual desktop and keep typing there, as normal.
  4. When the export finishes, quit darktable and paste the whole terminal output here — we'll correlate it ourselves.

That's it — no need to time anything manually. The focus-IN lines mark exactly when darktable grabs focus, and their timestamps let us match them to the export/progress/notify lines.

What we're checking

  • Do focus steals line up with per-image _lib_backgroundjobs_message_updated, or with dt_ui_notify_user (once at job end)?
  • Does dt_gui_cursor_set_busy / gtk_grab_add fire during export at all?
  • Are focus steals happening even with no progress bar visible (i.e. not a "pops-up" visual)?

Not for merge — temporary diagnostics, will be removed once the cause is pinned down.

Arecsu added 2 commits August 14, 2026 18:23
…ring export

Temporary logging (DT_DEBUG_ALWAYS) to correlate the Windows focus-steal
during batch export with progress/notify/grab events. Remove once a Windows
tester reproduces it.
…diagnosis

Add EXPORT STARTED/ENDED markers in the export job, and main-window
focus-IN/focus-OUT events, so a Windows tester can paste the terminal
output and we can correlate each focus steal with progress messages.
@Arecsu

Arecsu commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@lintujuh would you be able to compile this branch and collect logs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant