Skip to content
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

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

Open
gqf2008 opened this issue Feb 26, 2024 · 2 comments
Open

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

gqf2008 opened this issue Feb 26, 2024 · 2 comments
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working upstream Needs a fix upstream

Comments

@gqf2008
Copy link

gqf2008 commented Feb 26, 2024

  • 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();
}

@tronical
Copy link
Member

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

@tronical tronical added bug Something isn't working a:backend-winit Winit backend (mS,mO) labels Feb 26, 2024
@gqf2008
Copy link
Author

gqf2008 commented Mar 1, 2024

winit issues #3537

@ogoffart ogoffart added the upstream Needs a fix upstream label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:backend-winit Winit backend (mS,mO) bug Something isn't working upstream Needs a fix upstream
Projects
None yet
Development

No branches or pull requests

3 participants