Skip to content

Commit ea05169

Browse files
committed
Update documentation
1 parent 6b1c226 commit ea05169

File tree

2 files changed

+111
-11
lines changed

2 files changed

+111
-11
lines changed

README.md

Lines changed: 111 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,84 @@
11
Flutter Wayland
22
============
33

4-
A Flutter Embedder that talks to Wayland.
4+
A Flutter Embedder/Launcher that talks to Wayland.
55

66
![Running in Weston](assets/image.png)
77

8-
Build Setup Instructions
9-
------------------------
8+
Features:
9+
- Suited for running on [STB](https://en.wikipedia.org/wiki/Set-top_box) or any other embedded devices,
10+
- Provides only mininum required implementataion for launching Flutter application _(both JIT or AOT modes are supported)_:
11+
- keyboard support with repetition _(no touch support, only basic pointer events are implemented)_,
12+
- support the following Wayland extensions:
1013

11-
* Install the following packages (on Debian Stretch): `weston`, `libwayland-dev`, `cmake` and `ninja`.
12-
* From the source root `mkdir build` and move into the directory.
13-
* `cmake -G Ninja ../`. This should check you development environment for required packages, download the Flutter engine artifacts and unpack the same in the build directory.
14-
* `ninja` to build the embedder.
15-
* Run the embedder using `./flutter_wayland`. Make sure `weston` is running. See the instructions on running Flutter applications below.
14+
- [presentation-time](https://github.com/wayland-project/wayland-protocols/blob/master/stable/presentation-time/presentation-time.xml) with a fallback to frame callback,
15+
16+
- [XWayland keyboard grabbing protocol](https://github.com/wayland-project/wayland-protocols/tree/0a61d3516b10da4e65607a6dd97937ebedf6bcfa/unstable/xwayland-keyboard-grab) assumes [Wayland server](https://gitlab.freedesktop.org/dwrobel/weston/-/commits/dw-master-key-grab-2) implements it
17+
_(allows to run Flutter application as a main UI which will receive all key events even when not having a focus, which is needed to control other applications)_,
18+
19+
Build dependencies:
20+
-------------------
21+
- Fedora >=33:
22+
```
23+
dnf install cmake clang extra-cmake-modules pkgconf-pkg-config libxkbcommon-devel wayland-devel wayland-protocols-devel libwayland-client libwayland-egl gtk3-devel
24+
```
25+
26+
- Yocto
27+
```
28+
TOOLCHAIN = "clang"
29+
DEPENDS = "flutter-engine gtk+3 libxkbcommon wayland-protocols extra-cmake-modules"
30+
inherit pkgconfig cmake
31+
```
32+
33+
Build instructions:
34+
-------------------
35+
36+
```
37+
# If you don't have pkg-config flutter-engine.pc file
38+
# provide directory location of flutter_embedder.h file:
39+
EMBEDDER_INC=<directory-path-to-compiled-engine>/src/out/linux_release_x64
40+
# directory location of libflutter_engine.so (typically the same as for header files)
41+
FLUTTER_LIBDIR=${EMBEDDER_INC}
42+
43+
# Preferably use the same compiler as was used for compiling the engine:
44+
export CC=clang
45+
export CXX=clang++
46+
47+
mkdir -p build
48+
pushd build
49+
50+
# If you don't have flutter-engine.pc file
51+
cmake .. -DFLUTTER_ENGINE_LIBRARIES=flutter_engine -DFLUTTER_ENGINE_LIBRARY_DIRS=${FLUTTER_LIBDIR} -DFLUTTER_ENGINE_INCLUDE_DIRS=${EMBEDDER_INC}
52+
# otherwise
53+
cmake ..
54+
55+
# Common step to compile sources
56+
cmake --build . -j $(getconf _NPROCESSORS_ONLN) --verbose
57+
popd
58+
```
59+
60+
Direct runtime dependencies:
61+
---------------------
62+
```
63+
$ readelf -d flutter-launcher-wayland | grep NEEDED | awk '{gsub(/\[|\]/,"",$NF); print " - "$5}'
64+
- libdl.so.2
65+
- libxkbcommon.so.0
66+
- libEGL.so.1
67+
- libwayland-client.so.0
68+
- libwayland-egl.so.1
69+
- libflutter_engine.so
70+
- libstdc++.so.6
71+
- libm.so.6
72+
- libgcc_s.so.1
73+
- libc.so.6
74+
```
1675

1776
Running Flutter Applications
1877
----------------------------
1978

2079
```
21-
Flutter Wayland Embedder
22-
========================
80+
Usage: `flutter-launcher-wayland <asset_bundle_path> <flutter_flags>`
2381
24-
Usage: `flutter_wayland <asset_bundle_path> <flutter_flags>`
2582
2683
This utility runs an instance of a Flutter application and renders using
2784
Wayland core protocols.
@@ -41,4 +98,47 @@ asset_bundle_path: The Flutter application code needs to be snapshotted using
4198
`flutter_tester --help` using the test binary included in the
4299
Flutter tools.
43100
101+
Supported environment variables:
102+
LANG=<string>
103+
Value encoded as per setlocale(3) (e.g. "szl_PL.utf8") is
104+
passed to the engine via UpdateLocales().
105+
106+
See also: https://man7.org/linux/man-pages/man3/setlocale.3.html
107+
108+
FLUTTER_WAYLAND_PIXEL_RATIO=<double>
109+
Overwrites the pixel aspect ratio reported
110+
to the engine by FlutterEngineSendWindowMetricsEvent().
111+
112+
See also: https://api.flutter.dev/flutter/dart-ui/Window/devicePixelRatio.html
113+
114+
FLUTTER_WAYLAND_MAIN_UI=<int>
115+
Non-zero value enables grabbing all keys (even without having
116+
a focus) using Xwayland keyboard grabbing protocol (assuming
117+
server implement this extension).
118+
119+
See also: https://github.com/wayland-project/wayland-protocols/tree/0a61d3516b10da4e65607a6dd97937ebedf6bcfa/unstable/xwayland-keyboard-grab
120+
121+
FLUTTER_LAUNCHER_WAYLAND_DEBUG=<string>
122+
where <string> can be any of syslog(3) prioritynames or its
123+
unique abbreviation e.g. "err", "warning", "info" or "debug".
124+
125+
44126
```
127+
128+
Contributing:
129+
-------------
130+
Before submitting a new PR:
131+
- Format the code with `clang-format -i src/*.*`.
132+
- Make sure that code compiles fine with both `gcc >=11` and `clang >= 11` _(no single warning on clang)_.
133+
- Test on PC with both:
134+
135+
- AddressSanitizer (recompile code with: `-fsanitize=address -fPIE -fno-omit-frame-pointer`),
136+
137+
- TheadSanitizer (recompile code with: `-fsanitize=thread -fPIE -fno-omit-frame-pointer`).
138+
139+
Authors:
140+
--------
141+
Based on the original code from: https://github.com/chinmaygarde/flutter_wayland
142+
143+
Heavily rewritten by: Damian Wrobel <<[email protected]>>
144+

assets/image.png

243 KB
Loading

0 commit comments

Comments
 (0)