From d2a2a440023644379aa36fba91c18d3f11658090 Mon Sep 17 00:00:00 2001 From: Hidenori Matsubayashi Date: Tue, 27 Jul 2021 14:48:40 +0900 Subject: [PATCH] Add x11 backend runner support (#22) --- README.md | 24 +++++++++++++++++++++--- lib/commands/run.dart | 9 +-------- lib/elinux_device_discovery.dart | 16 +++++++++++++++- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index de72175..00b1cdf 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ $ sudo mv flutter-elinux /opt/ $ export PATH=$PATH:/opt/flutter-elinux/bin ``` -### Install dependent libraries +### Install other tools ```Shell -$ sudo apt install curl +$ sudo apt install curl clang cmake pkg-config # If you want to use Weston as a Wayland compositor: $ sudo apt install weston ``` @@ -21,11 +21,29 @@ $ sudo apt install weston ### How to run flutter sample app in Weston You need to install a Wayland compositor such as Weston and launch it before launching your Flutter apps. +```Shell +$ flutter-elinux devices +3 connected devices: + +eLinux (desktop) • elinux-wayland • flutter-tester • Ubuntu 20.04.2 LTS 5.8.0-63-generic +eLinux (desktop) • elinux-x11 • flutter-tester • Ubuntu 20.04.2 LTS 5.8.0-63-generic +``` + ```Shell $ flutter-elinux create sample $ cd sample $ weston & -$ flutter-elinux run -d elinux +$ flutter-elinux run -d elinux-wayland +``` + +If you want to run your flutter app in X11, use `elinux-x11` instead of `elinux-wayland`: +```Shell +$ flutter-elinux run -d elinux-x11 +``` + +### How to run flutter sample app in X11 +```Shell + ``` ## Documentation diff --git a/lib/commands/run.dart b/lib/commands/run.dart index b90d9d3..b40b480 100644 --- a/lib/commands/run.dart +++ b/lib/commands/run.dart @@ -13,14 +13,7 @@ import '../elinux_plugins.dart'; class ELinuxRunCommand extends RunCommand with ELinuxExtension { ELinuxRunCommand({bool verboseHelp = false}) - : super(verboseHelp: verboseHelp) { - argParser.addOption( - 'target-backend-type', - defaultsTo: 'wayland', - allowed: ['wayland', 'gbm', 'eglstream', 'x11'], - help: 'Target backend type that the app will run on devices.', - ); - } + : super(verboseHelp: verboseHelp); @override Future> get requiredArtifacts async => diff --git a/lib/elinux_device_discovery.dart b/lib/elinux_device_discovery.dart index 54d20c6..505dc5a 100644 --- a/lib/elinux_device_discovery.dart +++ b/lib/elinux_device_discovery.dart @@ -121,7 +121,7 @@ class ELinuxDeviceDiscovery extends PollingDeviceDiscovery { // Adds current desktop host. devices.add( - ELinuxDevice('elinux', + ELinuxDevice('elinux-wayland', desktop: true, targetArch: _getCurrentHostPlatformArchName(), backendType: 'wayland', @@ -134,6 +134,20 @@ class ELinuxDeviceDiscovery extends PollingDeviceDiscovery { processManager: const LocalProcessManager(), )), ); + devices.add( + ELinuxDevice('elinux-x11', + desktop: true, + targetArch: _getCurrentHostPlatformArchName(), + backendType: 'x11', + logger: _logger ?? globals.logger, + processManager: _processManager ?? globals.processManager, + operatingSystemUtils: OperatingSystemUtils( + fileSystem: globals.fs, + logger: _logger ?? globals.logger, + platform: globals.platform, + processManager: const LocalProcessManager(), + )), + ); // Adds remote devices. for (final ELinuxRemoteDeviceConfig remoteDevice