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

UI: Disable hotkeys when typing or in modal dialog #7924

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cg2121
Copy link
Contributor

@cg2121 cg2121 commented Dec 13, 2022

Description

This disables hotkeys when an user is typing in a editable widget or a modal dialog is open.

Motivation and Context

Simpler version of #3072 (was reverted) and it automatically works with all widgets.

Fixes #7824

How Has This Been Tested?

Focused a editable widget and made sure the hotkeys didn't trigger. Also unfocused the same widget and made sure the hotkeys worked again. Also made sure hotkeys didn't trigger when opening a modal dialog.

Tested on Ubuntu 22.04 and Windows 10.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@cg2121 cg2121 added Bug Fix Non-breaking change which fixes an issue UI/UX Anything to do with changes or additions to UI/UX elements. labels Dec 13, 2022
@RytoEX
Copy link
Member

RytoEX commented Dec 20, 2022

How did you test this? What operating systems did you test on? IIRC, focus events don't work the same on each OS, so it would be good to confirm that this behaves as intended on each.

@cg2121
Copy link
Contributor Author

cg2121 commented Jan 15, 2023

This has now been tested on Linux and Windows without any problems. It just needs testing on macOS.

@cg2121 cg2121 force-pushed the disable-hotkeys branch 2 times, most recently from 0e26379 to 67d4d38 Compare July 24, 2023 19:48
UI/obs-app.cpp Outdated Show resolved Hide resolved
UI/obs-app.cpp Outdated Show resolved Hide resolved
@cg2121 cg2121 changed the title UI: Disable hotkeys when typing UI: Disable hotkeys when typing or in modal dialog Aug 20, 2024
@cg2121
Copy link
Contributor Author

cg2121 commented Aug 20, 2024

Updated PR to also disable hotkeys when a modal dialog is open.

@cg2121 cg2121 mentioned this pull request Aug 20, 2024
6 tasks
@PatTheMav
Copy link
Member

PatTheMav commented Aug 20, 2024

So what is the underlying root cause of the issue? Because it doesn't seem like this was documented/explained anywhere (neither in this PR nor the original one).

When OBS is in focus, hotkey management should be handled by Qt's own event loop and keyboard event handling, so are the key events not consumed by the editable widget? Are we intercepting the event before that and trigger the hotkey action before it's consumed? Wouldn't it be easier to only consume key events that have not been consumed by a widget ("leftover" events) and pass those to the hotkey system then?

@cg2121
Copy link
Contributor Author

cg2121 commented Aug 21, 2024

The main issue is that a user doesn't want a hotkey to trigger when they are typing in a editable widget.

This PR, in my opinion, is simpler than using the event filter because it works for every widget. We would need to install an event filter to every single dialog and wouldn't work for plugins that have their own dialogs. At least that is my understanding of how the event filter works.

This disables hotkeys when an user is typing in an editable widget
or a modal dialog is open.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue Seeking Testers Build artifacts on CI UI/UX Anything to do with changes or additions to UI/UX elements.
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

OBS Crashes when switching scenes by hotkey and an Image source file dialog box is open
3 participants