From 8f7828f5d2f5940ccfffef9c4e119631477e3827 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 14 Mar 2022 16:40:51 +0100 Subject: [PATCH] handy_window: fix build on Ubuntu 18.04 It has too old GLib - libhandy requires 2.58. --- CHANGELOG.md | 4 ++++ README.md | 2 ++ linux/CMakeLists.txt | 1 + linux/handy_window_plugin.cc | 5 +++++ pubspec.yaml | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b2907..3059d63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.2 + +* Fix build on Ubuntu 18.04 with old glib version < 2.58. + ## 0.1.1 * Fix compatibility with the core18-based Flutter snap diff --git a/README.md b/README.md index 0927eef..ae79320 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ rounded bottom corners. |---|---| | | | +**NOTE:** Handy windows are only available on Ubuntu 20.04 (GLib >= 2.58) and later. + ## Usage Add the dependency to `pubspec.yaml`: diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index ce71cd0..15c9c37 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -28,6 +28,7 @@ if(GLIB_FOUND) ) add_subdirectory(libhandy) + add_definitions(-DHAVE_LIBHANDY) target_link_libraries(${PLUGIN_NAME} PRIVATE handy) else() message(WARNING "The `handy_window` package requires libglib2.0-0 >= 2.58 available in Ubuntu 20.04 and later. Using normal Flutter window instead.") diff --git a/linux/handy_window_plugin.cc b/linux/handy_window_plugin.cc index d5d0372..8b7730b 100644 --- a/linux/handy_window_plugin.cc +++ b/linux/handy_window_plugin.cc @@ -1,5 +1,7 @@ #include "include/handy_window/handy_window_plugin.h" +#if HAVE_LIBHANDY + #include #include #include @@ -212,3 +214,6 @@ void handy_window_plugin_register_with_registrar(FlPluginRegistrar* registrar) { FlView* view = fl_plugin_registrar_get_view(registrar); setup_handy_window(view); } +#else +void handy_window_plugin_register_with_registrar(FlPluginRegistrar*) {} +#endif diff --git a/pubspec.yaml b/pubspec.yaml index dbaaee0..740fc49 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: | homepage: https://github.com/canonical/ubuntu-flutter-plugins repository: https://github.com/canonical/ubuntu-flutter-plugins/tree/main/packages/handy_window issue_tracker: https://github.com/canonical/ubuntu-flutter-plugins/issues -version: 0.1.1 +version: 0.1.2 environment: sdk: ">=2.12.0 <3.0.0"