feat: libhandy integration

- supports GTK 4 window borders

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-07-27 12:38:45 +02:00 committed by Krille Fear
parent f9065277fa
commit 82cb094b44
5 changed files with 18 additions and 3 deletions

View File

@ -10,6 +10,7 @@
#include <desktop_lifecycle/desktop_lifecycle_plugin.h> #include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <file_selector_linux/file_selector_plugin.h> #include <file_selector_linux/file_selector_plugin.h>
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h> #include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <handy_window/handy_window_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
@ -25,6 +26,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
g_autoptr(FlPluginRegistrar) handy_window_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "HandyWindowPlugin");
handy_window_plugin_register_with_registrar(handy_window_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View File

@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
desktop_lifecycle desktop_lifecycle
file_selector_linux file_selector_linux
flutter_secure_storage_linux flutter_secure_storage_linux
handy_window
url_launcher_linux url_launcher_linux
) )

View File

@ -48,18 +48,20 @@ static void my_application_activate(GApplication* application) {
gtk_window_set_title(window, "FluffyChat"); gtk_window_set_title(window, "FluffyChat");
} }
gtk_window_set_default_size(window, 800, 600); gtk_window_set_default_size(window, 1200, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new(); g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project); FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view)); fl_register_plugins(FL_PLUGIN_REGISTRY(view));
// rendering app after libhandy was loaded in order to have magic stuff happening before
gtk_widget_show(GTK_WIDGET(window));
gtk_widget_show(GTK_WIDGET(view));
gtk_widget_grab_focus(GTK_WIDGET(view)); gtk_widget_grab_focus(GTK_WIDGET(view));
} }

View File

@ -796,6 +796,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
handy_window:
dependency: "direct main"
description:
name: handy_window
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
highlight: highlight:
dependency: transitive dependency: transitive
description: description:

View File

@ -52,6 +52,7 @@ dependencies:
flutter_webrtc: ^0.8.7 flutter_webrtc: ^0.8.7
future_loading_dialog: ^0.2.3 future_loading_dialog: ^0.2.3
geolocator: ^7.6.2 geolocator: ^7.6.2
handy_window: ^0.1.6
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
image: ^3.1.1 image: ^3.1.1
image_picker: ^0.8.4+8 image_picker: ^0.8.4+8