-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(core): add an option for preventing window overflow #9687
base: dev
Are you sure you want to change the base?
feat(core): add an option for preventing window overflow #9687
Conversation
…t-window-overflow
We probably need some better documentations and names, and also implementation for linux and mac |
Just a note: on macOS, you will need to turn off |
Co-authored-by: Jason Tsai <[email protected]>
Package Changes Through 657b479There are 8 changes which include tauri-bundler with minor, tauri-cli with minor, @tauri-apps/cli with minor, tauri with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with patch, @tauri-apps/api with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Searched around a bit but didn't find a good way of doing it on linux, I guess falling back to use the monitor size is not all that bad |
since we can't make breaking changes anymore right now
@@ -3906,7 +3945,7 @@ fn create_window<T: UserEvent, F: Fn(RawWindow) + Send + 'static>( | |||
} | |||
|
|||
#[cfg(desktop)] | |||
if window_builder.center { | |||
if window_builder.prevent_overflow.is_some() || window_builder.center { | |||
let monitor = if let Some(window_position) = &window_builder.inner.window.position { | |||
event_loop.available_monitors().find(|m| { |
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 don't remember why we are doing it this way, but can't we change this to monitor_from_point
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.
window_builder.inner.window.position
is a Position
here that we need to convert to physical position with scale factor so I don't think we can use monitor_from_point
here, also I think monitor_from_point
was introduced after this PR was made?
/// | ||
/// ## Platform-specific | ||
/// | ||
/// - **Linux:** Prevent overflowing the monitor instead of workarea |
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.
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.
Ah, didn't know it exits, do you think we can move this get_work_area_size
to tao
instead? If not we'll need a way to access the inner gdk::Monitor
from tao
// Left and right window shadow counts as part of the window on Windows | ||
// We need to include it when calculating positions, but not size | ||
let mut shadow_width = 0; |
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.
why do we need to include it? I think we should just include the starting of the window border not shadow
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.
If I remembered correctly, the shadow counts as part of the window when we set the positions, say your shadow is 5px left right bottom, and you set the window's position to (0, 0), then the actual window's top left will be placed at (5, 0
Closes #9671