Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow interacting with the render window while configuring controllers #8088

Merged
merged 1 commit into from May 11, 2019

Conversation

3 participants
@Pokechu22
Copy link
Contributor

commented May 9, 2019

This change enables interacting with the render window while configuring controllers. This is useful for e.g. trying out different configurations without having to close and reopen the configuration window (note that the parent controller settings window is not modal). Note that as-is it does not allow interacting when "render to main window" is enabled.

I've done this by making the controller configuration window WindowModal, which allows alt+tabing to the render window, but prohibits interaction with parent windows (controller settings window and the main dolphin window). exec acts the same as if ApplicationModal were used and makes it impossible to switch to any window, including the render window. (It also blocks until the window is closed, which I assume is why a temporary variable could be used).

The main reason to even make it modal in the first place is that it prevents opening a second window by going to the configuration dialog and clicking the button again. An alternative approach would be to do the same thing that is done for the hotkey window:

void MainWindow::ShowHotkeyDialog()
{
if (!m_hotkey_window)
{
m_hotkey_window = new MappingWindow(this, MappingWindow::Type::MAPPING_HOTKEYS, 0);
InstallHotkeyFilter(m_hotkey_window);
}
m_hotkey_window->show();
m_hotkey_window->raise();
m_hotkey_window->activateWindow();
}

This requires an array here, though, and I think it would get complicated. Additionally, though it allows interacting with the parent windows (i.e. the game when "render to main window" is enabled), the actual dialog is still always on top. But if that's preferable behavior, I can change to it.

Allow interacting with the render window while configuring controllers
WindowModal allows alt+tabing to the render window, but prohibits interaction
with parent windows (controller settings window and the main dolphin window).

@Pokechu22 Pokechu22 force-pushed the Pokechu22:modal-control-mapping branch from f3be8ef to 7c80fcd May 10, 2019

@leoetlino
Copy link
Member

left a comment

LGTM. Let's wait for the Windows builder to be fixed before building this though.

@jordan-woyak

This comment has been minimized.

Copy link
Member

commented May 10, 2019

You don't need to set Qt::WA_DeleteOnClose. Giving the dialog a parent is enough for it to be deleted on close.

@Pokechu22

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2019

While that's true, the ControllersWindow is constructed once in MainWindow and then not deleted until the main app closes (at least as far as I can tell). To my understanding, without WA_DeleteOnClose, the newly created dialog will be deleted when the parent dialog is deleted - which for dolphin doesn't happen until dolphin fully closes. (This is based on what happened when I tested with char data[10000000]; in MappingWindow)

@jordan-woyak

This comment has been minimized.

Copy link
Member

commented May 10, 2019

Well that's dumb of Qt.. :P

@leoetlino leoetlino merged commit 5774363 into dolphin-emu:master May 11, 2019

10 checks passed

default Very basic checks passed, handed off to Buildbot.
Details
lint Build succeeded on builder lint
Details
pr-android Build succeeded on builder pr-android
Details
pr-deb-dbg-x64 Build succeeded on builder pr-deb-dbg-x64
Details
pr-deb-x64 Build succeeded on builder pr-deb-x64
Details
pr-freebsd-x64 Build succeeded on builder pr-freebsd-x64
Details
pr-osx-x64 Build succeeded on builder pr-osx-x64
Details
pr-ubu-x64 Build succeeded on builder pr-ubu-x64
Details
pr-win-dbg-x64 Build succeeded on builder pr-win-dbg-x64
Details
pr-win-x64 Build succeeded on builder pr-win-x64
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.