fltk-webview icon indicating copy to clipboard operation
fltk-webview copied to clipboard

Windows 10, with display scale set 125%, resize of webview is strange

Open viruscamp opened this issue 3 years ago • 1 comments

My OS is Windows10, and have a display scale set to 125%.

When I ran the code below, the initial webview window fit the main windows, then I resized the main window, the webview resized follow the main window, but cannot full fill it, looks like 4/5 of the main windows, yes, it's (1/(125%)).

After I set display scale to 100%, it resizes as I expect.

use fltk::{app, prelude::*, window};

fn main() {
    let app = app::App::default();

    let mut win = window::Window::default()
        .with_size(800, 600)
        .with_label("Webview");
    
    let mut wv_win = window::Window::default_fill();
    wv_win.end();
    wv_win.make_resizable(true);

    win.end();
    win.make_resizable(true);
    win.show();

    let mut wv = fltk_webview::Webview::create(false, &mut wv_win);
    wv.navigate("https://bing.com");
    
    app.run().unwrap();
}

viruscamp avatar Sep 02 '22 09:09 viruscamp

I think it's a similar problem to https://github.com/fltk-rs/fltk-webview/issues/14

Basically it's better to keep the size of the webview window fixed since resizing/rescaling causes issues. To keep it fixed, it can be placed inside a group widget as in the previous issue. I've tried several solutions in the past to cope with this issue, and I don't think it's really because of a problem in FLTK or webview itself, rather an issue with the embedding itself when it comes to the different operating systems.

MoAlyousef avatar Sep 02 '22 14:09 MoAlyousef