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

Add seperate focus style to controls for keyboard/gamepad and mouse/touch #6577

Open
Shadowblitz16 opened this issue Mar 27, 2023 · 3 comments
Labels
breaks compat Proposal will inevitably break compatibility topic:gui topic:input

Comments

@Shadowblitz16
Copy link

Shadowblitz16 commented Mar 27, 2023

Describe the project you are working on

Windows 95 Theme

Describe the problem or limitation you are having in your project

Godot has a limitation where it treats both keyboard and mouse focus and the same thing
This makes it impossible to make a accurate windows 95 theme due to the fact win32 treated them separately

Describe the feature / enhancement and how it helps to overcome the problem or limitation

  • Rename focus style to keyboard focus
  • Add mouse focus
  • Rename Control.grab_focus to Control.grab_keyboard_focus()
  • Add Control.grab_mouse_focus()
  • Add ablity to add shaders to focus styles (this is due to the fact that keyboard focus in win32 uses a negative filter)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Here is a picture of a windows95 button without any keyboard or mouse focus
image

Here is a picture of a windows95 button with both keyboard focus (dotted rectangle) and mouse focus (black border)
image

If this enhancement will not be used often, can it be worked around with a few lines of script?

No

Is there a reason why this should be core and not an add-on in the asset library?

It makes themes most customizable

@YuriSizov YuriSizov added topic:input topic:gui breaks compat Proposal will inevitably break compatibility labels Mar 27, 2023
@Calinou
Copy link
Member

Calinou commented Mar 27, 2023

I haven't seen any modern applications use separate styles for different focus types. What I've seen though is not drawing any focus outline for mouse-induced focus, but this is exactly what #2011 covers (I have a WIP at https://github.com/Calinou/godot/tree/button-focus-visible).

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2023
@Calinou Calinou reopened this Mar 27, 2023
@Shadowblitz16
Copy link
Author

I do have an issue with calling it mouse and keyboard focus since mouse could be touch and keyboard could be gamepad.
Maybe someone else has a brighter idea for names

@ibe-denaux
Copy link

ibe-denaux commented Feb 21, 2024

I was struggling with this since the current way focus works makes it very hard to make a GUI with both mouse and keyboard support without mouse users having their UI cluttered with a noisy focus style.

For most apps, it would already be helpful for Control nodes to have a 'keyboard only' focus mode so that users don't see a focus when they don't need to. I agree that this proposal would be the best way to handle it though.

A current workaround I thought of using is to have two separate themes that activate based on the input (mouse or keyboard), but this feels incredibly hacky, and doesn't work for the windows 95 theme example. Let me know if anyone has a better workaround though.

I do have an issue with calling it mouse and keyboard focus since mouse could be touch and keyboard could be gamepad.
Maybe someone else has a brighter idea for names

I agree, maybe something like Keyboard -> Directional, and Mouse -> Screen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks compat Proposal will inevitably break compatibility topic:gui topic:input
Projects
None yet
Development

No branches or pull requests

4 participants