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 |
jneem
left a comment
There was a problem hiding this comment.
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.
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.
According to the
WindowLeveldocs 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.
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.
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.
Agreed. That is why is suggested to use two different
get_positionmethods (get_window_positionandget_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.
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_moveand (I think)SetWindowPoson 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 <dietmar@proxmox.com>
30b1a71 to
c2c685c
Compare
Ok, so I removed the code in |
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 dietmar@proxmox.com