Skip to content

Conversation

Dentomologist
Copy link
Contributor

Add a new Dolphin input focus option for each of hotkeys, controller input, and Free Look. This option behaves like background input, but only accepts input from most Dolphin windows. This PR is built on top of #13990 to better reflect the intended user experience, so the input suppression when text fields are focused applies here too (and the first actual commit of this PR is 002544c).

The Hotkeys Require Window Focus: and Background Input: checkboxes have been replaced with Accept [Input/Hotkeys] From: comboboxes with the options Render Window or TAS Input, Any Application, and Dolphin.

For controller input and Free Look the default value is Render Window or TAS Input and the current config value will seamlessly be applied.

For hotkeys I've opted to make the default value Dolphin, because it seems to me like a number of hotkeys are more useful if you can use them from places other than the render/TAS windows and I suspect most users would prefer to have the new behavior. For the same reason I've made the config value for Hotkeys Require Window Focus = True correspond to the config value for Dolphin, so configs with that value set will automatically be converted to the new behavior.

Some questions for discussion:

  • Should hotkeys default to Render Window or TAS Input instead?
  • Conversely, should controller input and/or Free Look default to Dolphin instead?
  • Perhaps people with Background Input/Hotkeys Require Window Focus would mostly prefer to have Dolphin instead of Any Application?

Remove input suppression from the Settings and Free Look Settings
windows.

In an upcoming commit input suppression will be added to individual
text fields, so there won't be a need to suppress inputs for the whole
time those windows are open. Removing the suppression from these windows
now reduces commit noise as various refactorings happen.

Keep input suppression for the mapping windows, since users should be
able to check their mappings via the indicator lights without causing
other inputs.

The removed call to install a WindowActivationEventFilter on
MainWindow::m_hotkey_window was redundant with the filter installed in
MappingWindow's constructor.
Use an atomic integer to track the hotkey suppression count instead of a
boolean. This allows for nested suppressions without having to worry
about the order of window activations and deactivations, and making it
atomic fixes a potential data race between the Host and Hotkey Scheduler
threads.

Previously if you had a window that disabled hotkeys focused (such as the
Controllers pane in the Settings window) then opened another such window
(such as a controller mapping window), the focus-in event for the new
window would disable hotkeys again, followed by the focus-out event for
the first window enabling them.
Include InputCommon/InputConfig.h directly in MainWindow.cpp instead of
indirectly via Core/HotkeyManager.h.
In an upcoming commit input suppression will be added for Free Look and
controller inputs. Use an independent class instead of having those
input channels call HotkeyManagerEmu::IsSuppressed.
Adjust #includes and forward declarations and use the DolphinFileDialog
namespace in the .cpp file instead of prefixing each function.
Add filters to automatically add a suppression on hotkey, Free Look, and
controller inputs when a widget with meaningful text input gains focus,
then remove the suppression when that widget loses focus.

Specifically this applies to QLineEdits, QTextEdits, QAbstractSpinBoxes,
and QComboBoxes, as well as any class deriving from one of those.
Accept "True" and "False" in INI files as their corresponding values for
other types.

The purpose of this is to enable backward compatibility when adding a
new value to a formerly boolean type.
Add functions to let DolphinQt notify Core when Dolphin becomes or stops
being the active application.
This will be used by controller/hotkey/Free Look inputs in future
commits.
Replace "Hotkeys Require Window Focus" checkbox with "Accept Hotkeys
From" combobox.

The "Any Application" option has the same behavior as "Hotkeys Require
Window Focus" = False, and will be used by configs with that value.

The "Render Window or TAS Input" option has the same behavior as
"Hotkeys Require Window Focus" = True.

The default "Dolphin" option behaves similarly to the "Any Application"
option, but limited to (most) Dolphin windows. It will be used by
configs with "Hotkeys Require Window Focus" = True, under the theory
that a majority of users would prefer hotkeys to have always behaved
that way.
Replace "Background Input" checkbox with "Accept Input From" combobox.

The default "Render Window or TAS Input" option has the same behavior as
"Background Input" = False, and will be used by configs with that value
set.

The "Any Application" option has the same behavior as "Background Input"
= True, and will be used by configs with that value set.

The "Dolphin" option behaves similarly to the "Any Application" option,
but limited to (most) Dolphin windows.
Replace "Background Input" checkbox with "Accept Input From" combobox.

The default "Render Window or TAS Input" option has the same behavior as
"Background Input" = False, and will be used by configs with that value
set.

The "Any Application" option has the same behavior as "Background Input"
= True, and will be used by configs with that value set.

The "Dolphin" option behaves similarly to the "Any Application" option,
but limited to (most) Dolphin windows.
All of the callers of UpdateInputGate now use the InputFocusPolicy
version so we can get rid of the bool version.
Fix a bug where changing the cursor's focus policy wouldn't update
RenderWidget's cursor icon until either RenderWidget gained/lost focus,
or the cursor visibility setting changed. This would cause the cursor to
be shown or hidden using the wrong focus policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant