Skip to content

Dialogs do not return focus to parent window on Windows and GM LTS #3

@Grix

Description

@Grix

A user reported that after a recent update in my software, in which I updated the DialogModule version, the main window loses focus after a dialog opens, and the focus stays lost after the dialog is closed. This causes problems such as the user having to manually click on the main window again to return the focus so that keyboard keys work again.

I believe the change was introduced while fixing a previous issue in DialogModule, the code history of which has been lost to time due to the git repo being deleted iirc. But the change was related to dialog boxes being centered on the screen to avoid appearing outside the screen boundary due to display scaling settings. When using a dll from before this fix, the focusing works fine.

However, the issue seems to be restricted to certain scenarios. It happens for me on Windows when using GameMaker LTS 2022. It happens even if I use widget_set_owner(window_handle()); or widget_set_owner(string(int64(window_handle()))); . In fact the former seems to occasionally crash the entire program.

But when I use the modern GM version and the example project from this git repo, then by default the focus problem still happens but if I add widget_set_owner(window_handle()); then the problem is resolved as expected.

So there seems to be something different about how modern GM and 2022 LTS GM handles the widget_set_owner function and focus?

Unfortunately I don't think I am ready to try to port my whole project to a modern GM version yet. I tried once and nothing worked, it would be a huge endeavor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions