noc_file_dialog: Specify timestamp to focus dialog for GTK #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GNOME has a "focus stealing prevention" feature that will open new windows in the background to prevent the keyboard focus from being stolen from a user, and show an "<Application> is ready" notification.
This feature currently impacts file dialog creation resulting in the dialog being confusingly spawned in the background on every creation after the first with the GTK implementation.
This patch adds a call to
gtk_window_present_with_time()
with the current time, enforcing that the dialog always makes it to the top of the window stacking order and receives focus.I believe this is the simplest/best way to handle this for my application of responding to a button click without convenient access to this necessary event token/timestamp, but I welcome someone with more experience with GTK to weigh in here with a better solution. Note that I've not tested with Wayland.
Some information about the issue/feature:
Tagging other, similar projects I came across while searching for solutions which might be interested in this: