25 releases

0.2.13 Nov 10, 2021
0.2.9 Oct 28, 2021
0.1.12 Jul 16, 2021

#223 in GUI

Download history 158/week @ 2021-08-15 42/week @ 2021-08-22 15/week @ 2021-08-29 65/week @ 2021-09-05 18/week @ 2021-09-12 43/week @ 2021-09-19 41/week @ 2021-09-26 31/week @ 2021-10-03 64/week @ 2021-10-10 60/week @ 2021-10-17 65/week @ 2021-10-24 38/week @ 2021-10-31 123/week @ 2021-11-07 41/week @ 2021-11-14 24/week @ 2021-11-21 62/week @ 2021-11-28

254 downloads per month

MIT license

3MB
1.5K SLoC

Rust 460 SLoC // 0.1% comments D 443 SLoC Go 237 SLoC // 0.3% comments C++ 164 SLoC // 0.1% comments Objective-C 62 SLoC Batch 60 SLoC Shell 35 SLoC C 30 SLoC

fltk-webview

This provides webview functionality for embedded fltk windows. The webview bindings are based on the webview-official-sys crate, which was modified for use with FLTK and to use the static WebView2Loader library on Windows along with a newer version of webview.

Usage

Add fltk-webview to your fltk application's Cargo.toml file:

[dependencies]
fltk = "1"
fltk-webview = "0.2"

Then you can embed a webview using fltk_webview::Webview::create:

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()
        .with_size(790, 590)
        .center_of_parent();
    win.end();
    win.make_resizable(true);
    win.show();

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

Dependencies

  • fltk-rs's dependencies, which can be found here.
  • On Windows: No other dependencies.
  • On MacOS: No other dependencies.
  • On X11/wayland platforms, webkit2gtk:
    • Debian-based distros: sudo apt-get install libwebkit2gtk-4.0-dev.
    • RHEL-based distros: sudo dnf install webkit2gtk3-devel.

Known Issues

  • On windows, building using the gnu toolchain will still require deploying the dlls (webview.dll and WebView2Loader.dlls, which can be found in the target/<profile> directory.
  • On X11/wayland platforms:
    • Need help with Gnome's mutter window manager fighting for ownership of the webview window, causing flickering in text fields!
    • If running on Wayland, you need to pass the GDK_BACKEND=x11 environment variable for webkit2gtk to work properly.

alt_test

alt_test

Dependencies

~11MB
~263K SLoC

e3a