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

set_fullscreen(false) is invalid #5424

Open
whq-003 opened this issue Jun 18, 2024 · 1 comment
Open

set_fullscreen(false) is invalid #5424

whq-003 opened this issue Jun 18, 2024 · 1 comment
Labels
a:platform-windows Issue specific to Windows (mT,bS) bug Something isn't working

Comments

@whq-003
Copy link

whq-003 commented Jun 18, 2024

I can use set_fullscreen(true) to set the window in full mode, but can't use set_fullscreen(false) return the normal mode.
My system is Windows 11, and the language is Rust.

main.rs:

#![windows_subsystem = "windows"]

slint::include_modules!();

pub fn main() {
    let app = App::new().unwrap();

    let mut prev_is_fullscreen = false;

    {
        let app_weak = app.as_weak();
        app.on_fullscreen(move || {
            let main_window = app_weak.unwrap();
            prev_is_fullscreen = !prev_is_fullscreen;
            main_window.window().set_fullscreen(prev_is_fullscreen);
        });
    }

    let _ = app.run();
}

scene.slint:

import { Button, HorizontalBox, VerticalBox} from "std-widgets.slint";

export component App inherits Window {
    preferred-width: 800px;
    preferred-height: 600px;
    title: "Simple Player";
    icon: @image-url("../assets/logo.png");
    callback fullscreen();
    HorizontalLayout {
        Rectangle {
            background: #ffffff00;
            Button {
                width: 40px;
                icon: @image-url("../assets/full.png");
                clicked => {
                    root.fullscreen()
                }
            }
        }
    }
}
@ogoffart ogoffart added the a:platform-windows Issue specific to Windows (mT,bS) label Jun 28, 2024
@ogoffart
Copy link
Member

Thanks for filing an issue.

(I couldn't reproduce on X11, so I assume it is windows specific)

@ogoffart ogoffart added the bug Something isn't working label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:platform-windows Issue specific to Windows (mT,bS) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants