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 functionality to hide windows from taskbar (Windows only). #99856

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

Conversation

Lielay9
Copy link
Contributor

@Lielay9 Lielay9 commented Nov 29, 2024

Implements godotengine/godot-proposals#8467 for Windows.
About property name:
Window flag names seem to be negated (Why?), e.g. "unresizable", "unfocusable".

  1. show_in_taskbar would break the trend (default value would be true).
  2. hide_in_taskbar is not great, since it works contradictorily tovisibility = true/false
  3. skip_taskbar is little less descriptive but works intuitively. (CHOSEN)

About the approach:
Windows has 3~4 ways to hide/remove/delete a bar from the taskbar.

  1. WS_EX_TOOLWINDOW extended style. Also changes the appearance of the window, which is not ideal. I have yet to see this style used by Windows itself.
  2. Win 32 docs (Yeah no):

...you can create a hidden window and make this hidden window the owner of your visible window.

  1. WS_EX_NOACTIVATE extended style. Doesn't change the style, but the window can't be edited or interacted with... except if you activate the window afterwards, sometimes with some undocumented ways like we do currently :^)
  2. Just get the taskbar list (ITaskbarList) and delete the tab. Shouldn't have any side effects on window style etc. Seems to be the way most handle this. (CHOSEN)
Previous constraints that were removed:

There are currently 2 arbitrary limitations that can be removed if folks find them too restrictive.

  • Main window can't be hidden. I don't see how this would be useful. Added mainly to avoid people accidentally minimizing all their windows.

  • Taskbar visibility can't be changed when the window is visible. Again, not sure why anyone would need this. Added because I doubt it would be useful and because I'm too lazy to find out if it is possible on other platforms, and because I don't want to find out what bugs toggling it can cause (the real reason).

Untested on win 10, need help, own machine went kaboom.

@Lielay9
Copy link
Contributor Author

Lielay9 commented Nov 30, 2024

There probably should be a sister pr to add a way to remove/disable the title buttons. There's just about never a reason to have a minimize button if the user can't restore the window. I can do it for Windows, or rather I already have something... But I would appreciate if someone could inform me what options are available on other platforms in regards to that so the approach is compatible.
For reference, in Windows the title buttons can be visible, disabled(greyd e.g. when unresizable is true) or hidden(disabled and not visible) and in sysmenu or not. Personally I only use visible/disabled i.e remove WS_MINIMIZEBOX and WS_MAXIMIZEBOX.

@Lielay9 Lielay9 marked this pull request as ready for review November 30, 2024 00:27
@Lielay9 Lielay9 requested review from a team as code owners November 30, 2024 00:27
@Faless
Copy link
Collaborator

Faless commented Nov 30, 2024

This PR does not seem to address the problem stated in godotengine/godot-proposals#8467 :

The proposal OP says:

I am working on a widget software for windows and the user can creates different widgets (which are windows in godot) with many types of functionality.

And:

The feature would help me overcome the issue by hiding the godot app from the taskbar, not interfering with the user workflow or filled with unnecessary icons.

This means removing the app from the taskbar:

  1. For visible windows (widget)
  2. Possibly for the main window too (unclear from the OP but likely)

Both things does not seem to be possible with the implementation in this PR.

@Lielay9

This comment was marked as resolved.

@Lielay9 Lielay9 force-pushed the windows_tool_window branch from 91748b8 to 9d4037e Compare November 30, 2024 16:42
@Lielay9
Copy link
Contributor Author

Lielay9 commented Nov 30, 2024

Removed both constraints, widget app should be possible now :>

If other platforms can't toggle visibility, then that should be documented.

@Lielay9 Lielay9 force-pushed the windows_tool_window branch from 4b9d560 to 1cea0a3 Compare December 14, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants