Implement tooltip level on Windows platform#1737
Merged
jneem merged 3 commits intolinebender:masterfrom May 2, 2021
Merged
Conversation
Implement `WindowLevel::Tooltip` on Windows platform. Before change: - Tooltip window appear in taskbar - Window has strange min-size (probably due to OS min constraints) - Window steals focus from main app window After change: - Tooltip window doesn't appear in taskbar - Window fits any size (tested with nursery's `tooltip.rs`) - Window doesn't steal focus from main app window
Collaborator
|
Ok where did you find how to make the tooltip not steal focus? I was searching on how to do that but I came up empty. Where did you find about the calls to |
Collaborator
|
I'm putting this here because this pr addresses some issues from this issue #1626 |
Contributor
Author
|
Many trial and error with most |
jneem
approved these changes
May 1, 2021
Member
jneem
left a comment
There was a problem hiding this comment.
I'd be happier if someone who knows windows took a look, but I think it's been sitting long enough and it looks pretty much fine to me.
Contributor
Author
|
Thanks! 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement
WindowLevel::Tooltipon Windows platform.Before change:
After change:
tooltip.rs)Details
The change adds
SWP_NOACTIVATEin many calls toShowWindow()to prevent unwanted Win32 activation stealing the focus.SWP_NOOWNERZORDERis also added, inspired by Qt5 (see here).Some
is_focusableboolean is added to the state to discriminate between a regular "restore" and a non-activating show whenShowWindow()is called, because the former implicitly activates the window, stealing focus from the main app window and giving it to the tooltip.Tentative
WS_andWS_EX_flags are set forWindowLevel::ModalandWindowLevel::DropDown. They have not been tested, but feel like a good starting point for whoever's coming next to implement those. In particular note thatDropDownalmost surely wants to beWS_CHILDto allow keyboard focus while not graying out the main app window title bar. However, because they have not been tested,WindowBuilder::set_level()continues to emit a warning for those levels, and ignore them for now for consistency with the current behavior.