-
Notifications
You must be signed in to change notification settings - Fork 567
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
fix dropdown position for gtk backend #2117
Conversation
85bed8c
to
c1b70e0
Compare
I am quite unsure if we should add this logic into set_position(). Instead, we could use different get_position methods, i.e: get_window_position: Returns the position of the window decoration top-left corner. Also, I have only tested this on Debian/Linux. |
This is tricky, unfortunately, and will definitely need testing on wayland because window positioning works differently there. Note that we currently have the I think one reasonable choice for If we want a friendly API for positioning child windows relative to the content of the parent, we could handle the insets in druid's |
Tried that, but how do I call |
|
c1b70e0
to
c8bc5fe
Compare
Thanks for the hint! Just updated the patch and implemented it as you suggested. I haven't updated the doc comments for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just delete the doc on content_insets
, because after this change there won't be anything special about our GTK implementation of them anymore.
druid/src/contexts.rs
Outdated
|
||
if matches!( | ||
window_config.level, | ||
Some(WindowLevel::DropDown(_) | WindowLevel::Tooltip(_)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the WindowLevel
docs the difference between various levels is only in their z-order, so I don't think you should change behavior based on WindowLevel
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the
WindowLevel
docs the difference between various levels is only in their z-order, so I don't think you should change behavior based onWindowLevel
.
Well, the docs also say:
Describes the purpose of a window and should be mapped appropriately to match platform conventions.
WindowLevel is also used to set the WM type hint, so this is by sure more than a Z-order.
Anyways, I cant see any other property which indicates the window type, so what exactly do you have in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, although it isn't particularly consistent with the previous sentence. I guess we need to figure out (and document!) what else WindowLevel
is actually supposed to mean.
But I still think it would be surprising if window positioning worked differently for different kinds of windows: why should it be that tooltips are relative to the parent's content but modals are relative to the parent's window decorations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I still think it would be surprising if window positioning worked differently for different kinds of windows: why should it be that tooltips are relative to the parent's content but modals are relative to the parent's window decorations?
Agreed. That is why is suggested to use two different get_position
methods (get_window_position
and get_position
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. That is why is suggested to use two different
get_position
methods (get_window_position
andget_position
).
Please ignore that last argument - it does not really makes any difference.
But I still think it would be surprising if window positioning worked differently for different kinds of windows: why should it be that tooltips are relative to the parent's content but modals are relative to the parent's window decorations?
Thought a bit more about that, and it is quite obvious that dropdowns and tooltips need to be positioned relative to the content root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it's very natural for dropdowns and tooltips to be positioned relative to the content. But there are also some disadvantages:
- it's undocumented
- it differs from established APIs, like
gtk_window_move
and (I think)SetWindowPos
on windows, which are always relative to the window frame - if we support other type hints in the future, we will need to decide (and document!) how they're treated
The first point is the big one: if we're going to go down this road, it needs to be clearly documented.
401742c
to
30b1a71
Compare
Signed-off-by: Dietmar Maurer <[email protected]>
30b1a71
to
c2c685c
Compare
Ok, so I removed the code in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience!
This finally fixes the dropdown position on gtk/linux. This needs latest druid with: linebender/druid#2117
This finally fixes the dropdown position on gtk/linux. This needs latest druid with: linebender/druid#2117
We need to position internal windows (dropdowns, tooltips) relative
to the content area.
Signed-off-by: Dietmar Maurer [email protected]