Skip to content

Commit

Permalink
handy_window: fix build on Ubuntu 18.04
Browse files Browse the repository at this point in the history
It has too old GLib - libhandy requires 2.58.
  • Loading branch information
jpnurmi committed May 4, 2022
1 parent c328ec1 commit 8f7828f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ rounded bottom corners.
|---|---|
| <image src="https://raw.githubusercontent.com/canonical/ubuntu-flutter-plugins/main/packages/handy_window/images/handy-window.png" width="430"/> | <image src="https://raw.githubusercontent.com/canonical/ubuntu-flutter-plugins/main/packages/handy_window/images/flutter-window.png" width="400"/> |

**NOTE:** Handy windows are only available on Ubuntu 20.04 (GLib >= 2.58) and later.

## Usage

Add the dependency to `pubspec.yaml`:
Expand Down
1 change: 1 addition & 0 deletions linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
5 changes: 5 additions & 0 deletions linux/handy_window_plugin.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "include/handy_window/handy_window_plugin.h"

#if HAVE_LIBHANDY

#include <flutter_linux/flutter_linux.h>
#include <gtk/gtk.h>
#include <handy.h>
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 8f7828f

Please sign in to comment.