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

DolphinQt: Disable keyboard navigation in tab widget on MappingWindow #7830

Open
wants to merge 2 commits into
base: master
from

Conversation

2 participants
@RMcTn
Copy link

RMcTn commented Feb 28, 2019

Fixes issue https://bugs.dolphin-emu.org/issues/11563

Completely disables use of keys whilst the tab widget (where keys are rebound) on the Mapping Window is selected.

This allows spacebar to be bound without going through the more options menu.
It also means the arrow keys and tab cannot be used to navigate through the buttons.

@@ -107,7 +107,7 @@ void MappingButton::Detect()
if (m_parent->GetDevice() == nullptr || !m_reference->IsInput())
return;

installEventFilter(BlockUserInputFilter::Instance());
installEventFilter(this);

This comment has been minimized.

@jordan-woyak

jordan-woyak Feb 28, 2019

Member

It looks like mouse events aren't going to be ignored during detection if you do this.

This comment has been minimized.

@RMcTn

RMcTn Feb 28, 2019

Author

Mouse events don't seem to be ignored when using BlockUserInputFilter, as in mouse movements will be detected and bound, and so will right and left click. Are mouse events intended to be ignored?

Using middle click with BlockUserInputFilter actually detects the event, binds the action (Click 2) and then unbinds it as the detected middle click clears it.

By checking for MouseButtonRelease in MappingButton's eventFilter, it fixes the issue with middle click unbinding itself. One issue with this is that using left click on the button whilst a key is waiting to be bound will not bind left click, it will instead appear to do nothing, but left click can be bound if the user left clicks outside the button.

Checking for MouseButtonPress as well in MappingButton's eventFilter causes single clicks after binding that click to be ignored, meaning if the user were to bind left click, then try single left click another button, nothing would happen. A double click would be required to get the button into 'bind' mode.

bool MappingButton::eventFilter(QObject* object, QEvent* event)
{
const QEvent::Type event_type = event->type();
return event_type == QEvent::KeyPress || event_type == QEvent::KeyRelease;

This comment has been minimized.

@jordan-woyak

jordan-woyak Feb 28, 2019

Member

If this does work (untested) the button in the advanced mapping window needs the same treatment.

@jordan-woyak

This comment has been minimized.

Copy link
Member

jordan-woyak commented Feb 28, 2019

After thinking about this, I think a proper fix would be to make a filter that blocks one "release" event for any button/key that has been just "pressed" during a detection period. (The filter should run even after the input detection is done.)

Edit: Turns out that doesn't work because ControllerInterface detects input before the "press" event.
Perhaps we should block all keyboard input for 100ish ms after input detection?

@RMcTn

This comment has been minimized.

Copy link
Author

RMcTn commented Mar 1, 2019

Using a timer to block further input for a while works well in the hotkey settings window, but in the controller configuration window, all columns except the first column give an access violation when trying to bind any input.

Happens when checking if (!expr.isEmpty()) after the timer is started, any ideas?

@jordan-woyak

This comment has been minimized.

Copy link
Member

jordan-woyak commented Mar 1, 2019

@RMcTn I can't see what you've done but I'm guessing the access violation is related to the already unsafe thread usage. I've removed the threading in my PR #7829. You might want to base your changes on that or wait til it gets merged.

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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.