mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 05:21:31 +11:00
parent
79aebf06dc
commit
2cc8fa1eac
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
- On X11, the `Moved` event is no longer sent when the window is resized without changing position.
|
- On X11, the `Moved` event is no longer sent when the window is resized without changing position.
|
||||||
- `MouseCursor` and `CursorState` now implement `Default`.
|
- `MouseCursor` and `CursorState` now implement `Default`.
|
||||||
- `WindowBuilder::with_resizable` implemented for Windows.
|
- `WindowBuilder::with_resizable` implemented for Windows & X11.
|
||||||
- On X11, if the monitor's width or height in millimeters is reported as 0, the DPI is now 1.0 instead of +inf.
|
- On X11, if the monitor's width or height in millimeters is reported as 0, the DPI is now 1.0 instead of +inf.
|
||||||
- On X11, the environment variable `WINIT_HIDPI_FACTOR` has been added for overriding DPI factor.
|
- On X11, the environment variable `WINIT_HIDPI_FACTOR` has been added for overriding DPI factor.
|
||||||
- On X11, enabling transparency no longer causes the window contents to flicker when resizing.
|
- On X11, enabling transparency no longer causes the window contents to flicker when resizing.
|
||||||
|
|
|
@ -11,8 +11,6 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
events_loop.run_forever(|event| {
|
events_loop.run_forever(|event| {
|
||||||
println!("{:?}", event);
|
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
winit::Event::WindowEvent {
|
winit::Event::WindowEvent {
|
||||||
event: winit::WindowEvent::CloseRequested,
|
event: winit::WindowEvent::CloseRequested,
|
||||||
|
|
|
@ -422,7 +422,7 @@ pub struct WindowAttributes {
|
||||||
/// The default is `None`.
|
/// The default is `None`.
|
||||||
pub max_dimensions: Option<(u32, u32)>,
|
pub max_dimensions: Option<(u32, u32)>,
|
||||||
|
|
||||||
/// [Windows only] Whether the window is resizable or not
|
/// [Windows & X11 only] Whether the window is resizable or not
|
||||||
///
|
///
|
||||||
/// The default is `true`.
|
/// The default is `true`.
|
||||||
pub resizable: bool,
|
pub resizable: bool,
|
||||||
|
|
|
@ -216,16 +216,23 @@ impl UnownedWindow {
|
||||||
|
|
||||||
// set size hints
|
// set size hints
|
||||||
{
|
{
|
||||||
|
let mut min_dimensions = window_attrs.min_dimensions;
|
||||||
|
let mut max_dimensions = window_attrs.max_dimensions;
|
||||||
|
if !window_attrs.resizable {
|
||||||
|
max_dimensions = Some(dimensions);
|
||||||
|
min_dimensions = Some(dimensions);
|
||||||
|
}
|
||||||
|
|
||||||
let mut size_hints = xconn.alloc_size_hints();
|
let mut size_hints = xconn.alloc_size_hints();
|
||||||
(*size_hints).flags = ffi::PSize;
|
(*size_hints).flags = ffi::PSize;
|
||||||
(*size_hints).width = dimensions.0 as c_int;
|
(*size_hints).width = dimensions.0 as c_int;
|
||||||
(*size_hints).height = dimensions.1 as c_int;
|
(*size_hints).height = dimensions.1 as c_int;
|
||||||
if let Some((min_width, min_height)) = window_attrs.min_dimensions {
|
if let Some((min_width, min_height)) = min_dimensions {
|
||||||
(*size_hints).flags |= ffi::PMinSize;
|
(*size_hints).flags |= ffi::PMinSize;
|
||||||
(*size_hints).min_width = min_width as c_int;
|
(*size_hints).min_width = min_width as c_int;
|
||||||
(*size_hints).min_height = min_height as c_int;
|
(*size_hints).min_height = min_height as c_int;
|
||||||
}
|
}
|
||||||
if let Some((max_width, max_height)) = window_attrs.max_dimensions {
|
if let Some((max_width, max_height)) = max_dimensions {
|
||||||
(*size_hints).flags |= ffi::PMaxSize;
|
(*size_hints).flags |= ffi::PMaxSize;
|
||||||
(*size_hints).max_width = max_width as c_int;
|
(*size_hints).max_width = max_width as c_int;
|
||||||
(*size_hints).max_height = max_height as c_int;
|
(*size_hints).max_height = max_height as c_int;
|
||||||
|
|
|
@ -53,7 +53,7 @@ impl WindowBuilder {
|
||||||
///
|
///
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
///
|
///
|
||||||
/// This only has an effect on Windows.
|
/// This only has an effect on Windows & X11.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn with_resizable(mut self, resizable: bool) -> WindowBuilder {
|
pub fn with_resizable(mut self, resizable: bool) -> WindowBuilder {
|
||||||
self.window.resizable = resizable;
|
self.window.resizable = resizable;
|
||||||
|
|
Loading…
Reference in a new issue