-
Notifications
You must be signed in to change notification settings - Fork 570
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
Support child windows in Windows #2042
Conversation
Sounds good! I'm a bit confused about the comment though (and please bear in mind that I know almost nothing about the win32 API).
I know at some point we discussed having children follow parents, but I don't remember where it was or what the outcome of the discussion was. But it's a decision that should be made intentionally and then documented. Right now, the only documented difference between |
No. It's the The only thing that sticks out in this PR is the flag TBH all this information is dispersed. But the meat of it is here.
All of the heavy lifting is does by Windows. Children are clipped if they do stick out.
That is good point. I honestly dont know how children are implemented in other platforms. Or if that concept even exists. That's why this PR has only Windows specific changes. I think it is fine to introduce something that is platform specific without changing shell API. |
I also forgot to include documentation for this new sub-window. But now I guess that'll depend on whether the the rationale behind this PR is accepted. |
I see, thanks for the explanation. The mental model I have for a "window" (based on linux, and I think it also applies to mac) is that it's basically a region that handles events and draws itself. The OS/window manager/compositor is in charge of positioning the windows, which includes giving them a z-order and figuring out which parts of which windows are visible. This makes Anyway, so my main opinion here (and I'm happy to get push-back, also cc'ing @cmyr who may have thoughts) is that we do not want to clip the children when they stick out: as far as I understood it (and bearing in mind that I'm working in the mental model above, which might not be the best one) the entire point of spawning new windows was to allow them to stick out if they're too big. For example, if we only wanted druid to support tooltips that stay in the main window, we'd just use a druid widget instead of bothering with all the portability issues that platform windows bring. I have fewer opinions about the child-window-follows-parent thing, mainly just that whatever we decide on should be consistent across platforms and documented. |
Every platform is different. If it's easier to do thing X in one platform should we not do it because it is unavailable in others? Should we ignore it for the sake of platform consistencies? FYI, Im not trying to be difficult. Dont get me wrong. I truly appreciate all your responses |
I am also confused by the "child cannot leave parent's client area". If this is intended to be used mainly for things like combo-boxes, I would expect that the child would, in some circumstances, need to draw outside of the parent's frame. Is this not a convention on windows? |
Sorry, I didn't express myself clearly. I wasn't trying to say that anything is wrong with Also, I appreciate your responses and I don't think you're being difficult at all. In fact, I think this sort of discussion is exactly what we need in order to have druid-shell behave sanely across platforms. Anyway, I think the key here is to identify:
My concern about windows-leaving-the-parent-rect was motivated by point 2, because my understanding behind the motivation for child windows was that sometimes we want dropdowns or tooltips or dialogs to be able to extend past the parent. For example, here is how firefox behaves on my system if it has a very small window: |
What Im trying to say is if a window might lay completely/partially outside parent, then it is tooltip. Not a child. It falls down to how end users utilize these windows. @jneem Suggestions dropdown does not cross parent. It must be a child. They very well could have made it a tooltip. |
All this also raises another question: can we not have a tooltip that follows the parent when it is dragged? This will remove the need to have a Another question: what about modals? They definitely should move with parent and lay within parent. So they cannot be tooltips. |
Just out of curiosity, I did a search on child windows in gtk and macos. So, for gtk, we might have to this the widget way like you are suggesting. And if it done with widgets, then it will be platform independent which will address your platform consistency concern. Is that the point you are trying to make? |
This completes the `Code` parsing and also adds F13 - F24 to the `Key` parsing code.
@cmyr what are you thoughts on this? There are two categories of sub windows. Ones that are unbounded (maybe drawn outside parent) and ones that are bounded (lie wholly within parent). Context menus are a good example. Here's example from Firefox and VSCode respectively: Two things to keep in mind in VSCode image:
Should druid support both types of contexts? I ask because if you say yes, then we'd have to support two types of sub-windows. Eg., |
VSCode doesn't actually do any of this intentionally. They are highly limited by electron / the web model that doesn't allow them to have proper child windows / drop downs, so they have to bind it to the parent window. This isn't intentional. |
Users requesting something similar is a fair request. |
* Replace test-env-log by test-log The crate was renamed and the latest release of test-env-log now raises deprecation warnings. * Upgrade tracing-subscriber
* Expand `log_to_console` doc comment Note that it panics when a global logger was already set * Reduce repetition. (as suggested by @PoignardAzur) Co-authored-by: jneem <[email protected]>
- x11::Application::xkb_context is not needed because we create keymap at start of Application::run() - x11::clipload: time and selection atom are not needed for INCR
Set button border radius for each corner separately
Explicit link is not needed Co-authored-by: jneem <[email protected]> Co-authored-by: Maan2003 <[email protected]>
…/druid into Child_windows_in_Windows
# Conflicts: # druid-shell/src/backend/windows/window.rs
I some how managed to F this branch up. :( |
This PR adds support for child (with type
WS_CHILD
) windows in Windows.Main difference between a tooltip window and child window is that the child:
UPDATE
After discussion on Zulip, it was decided to let dropdowns leave parent boundary.