34 releases

0.4.2 Feb 5, 2024
0.3.1 Jan 7, 2024
0.3.0 Mar 31, 2023
0.2.16 Sep 15, 2022
0.1.12 Jul 16, 2021

#795 in GUI

Download history 10/week @ 2024-01-11 5/week @ 2024-01-18 6/week @ 2024-01-25 3/week @ 2024-02-01 2/week @ 2024-02-08 37/week @ 2024-02-15 102/week @ 2024-02-22 35/week @ 2024-02-29 25/week @ 2024-03-07 28/week @ 2024-03-14 10/week @ 2024-03-21 33/week @ 2024-03-28 64/week @ 2024-04-04 5/week @ 2024-04-11

113 downloads per month

MIT license

190KB
261 lines

fltk-webview

This provides webview functionality for embedded fltk windows.

Usage

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

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

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

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

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 = 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.1-dev.
    • RHEL-based distros: sudo dnf install webkit2gtk3-devel.

Known Issues

The situation on linux is quite bad. It depends on whether you're running X11 or wayland. On wayland, this will use xwayland. On X11, I can't get embedding to work on Gnome's mutter window manager, which keeps fighting for ownership of the webview window, causing flickering or a blank screen!D=x11 environment variable for webkit2gtk to work properly.

alt_test

alt_test

Dependencies

~44MB
~302K SLoC