Moved some modules and added documentation

This commit is contained in:
2026-04-06 00:15:49 +02:00
parent 1f4f8a1fbd
commit f35f040efb
29 changed files with 276 additions and 70 deletions

View File

@@ -1,5 +1,7 @@
#lang scribble/manual
@defmodule{racket-webview/racket-webview-qt}
@title{Racket FFI Interface for @tt{rktwebview_qt}}
@author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]]
@@ -10,6 +12,11 @@ native @tt{rktwebview_qt} library. It loads the shared library, initializes the
native runtime, and exposes Racket functions for creating and controlling
webview windows.
If the Qt backend is available locally, it is loaded directly. Otherwise the
module attempts to resolve and download the backend. If that is not possible,
the module continues in a degraded mode in which a limited subset of the
FFI entry points will only display a warning and perform a no-op. All others will fail.
The wrapper translates the low-level C interface into a Racket-oriented API
based on structures, callbacks, and ordinary Racket values.
@@ -35,6 +42,45 @@ The shared library @tt{rktwebview_qt} must therefore be built against Qt
Earlier Qt versions are not supported.
@section{Backend Availability}
The module first checks whether the expected @tt{racket-webview-qt} backend is
already installed.
If it is not installed, the module attempts to resolve the configured download
site. If the site can be resolved and the configured archive is downloadable,
the backend is downloaded automatically.
If the download site cannot be resolved, if no archive is available for the
current operating system and machine architecture, or if the download fails, the
module does not immediately abort module loading. Instead it switches to a
degraded mode in which native FFI loading is disabled.
In that degraded mode, a textual reason is stored internally and selected FFI
entry points are replaced by fallback implementations.
When the backend cannot be loaded, the module defines fallback implementations
for missing FFI entry points through @racket[define-ffi-definer] and
@racket[#:default-make-fail].
These fallbacks behave in two different ways.
For a small set of initialization and shutdown functions, a non-failing fallback
is installed:
@itemlist[#:style 'compact
@item{@racket[rkt_webview_env] returns @racket[#t]}
@item{@racket[rkt_webview_events_waiting] returns @racket[0]}
@item{@racket[rkt_webview_init] returns @racket[#t]}
@item{@racket[rkt_webview_cleanup] returns @racket[#t]}]
All other missing FFI functions raise an exception when called.
Fallback warnings are emitted at most once per function. If native loading was
disabled because the backend was unavailable, the warning message includes the
recorded reason. If native loading was enabled but a specific symbol could not
be loaded from the library, the error names the library file.
@section{Module Initialization}
Loading the module performs several initialization steps automatically.
@@ -86,9 +132,9 @@ Although the structure is transparent, user code should normally treat it as
an opaque handle.
}
@defproc[(rkt-wv-win [wv rkt-wv?]) exact-integer?]{
Returns the native window handle associated with @racket[wv].
}
@;@defproc[(rkt-wv-win [wv rkt-wv?]) exact-integer?]{
@;Returns the native window handle associated with @racket[wv].
@;}
@section{HTTP(S) Contexts}