slint icon indicating copy to clipboard operation
slint copied to clipboard

Windows::set_minimized(true) works only no-frame is false on macOS

Open gqf2008 opened this issue 11 months ago • 2 comments

  • Platform: macOS 14.3.1
  • Language: Rust
  • Slint: master
  • Backend: winit
  • example
import {  VerticalBox } from "std-widgets.slint";

export component Application inherits Window {
    no-frame: true;
    preferred-width: 400px;
    preferred-height: 300px;
    
    callback minimize-window();
    callback maximize-window();

    VerticalBox {
        Text {
            text: "minimize";
            vertical-alignment: center;
            horizontal-alignment: center;
            height: 50px;
            TouchArea {
                clicked => {
                    if (self.pressed && self.enabled) {
                        root.minimize-window();
                    }
                }
            }
        }
        Text {
            text: "maximize";
            vertical-alignment: center;
            horizontal-alignment: center;
            height: 50px;
            TouchArea {
                clicked => {
                    if (self.pressed && self.enabled) {
                        root.maximize-window();
                    }
                }
            }
        }
    }
}


use slint::ComponentHandle;

pub mod appwin {
    include!(env!("SLINT_INCLUDE_APP"));
}

fn main() {
    let app = appwin::Application::new().unwrap();
    let min_handle = app.as_weak();
    let max_handle = app.as_weak();
    app.on_minimize_window(move || {
        println!("on_minimize_window");
        let handle = min_handle.upgrade().unwrap();
        handle.window().set_minimized(true);
    });
    app.on_maximize_window(move || {
        println!("on_maximize_window");
        let handle = max_handle.upgrade().unwrap();
        handle.window().set_maximized(true);
    });
    app.run();
}

gqf2008 avatar Feb 26 '24 05:02 gqf2008

I can reproduce this. It works with the Qt backend, but not with the winit backend.

tronical avatar Feb 26 '24 09:02 tronical

winit issues #3537

gqf2008 avatar Mar 01 '24 01:03 gqf2008