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
commit dbd36d06d3
5 changed files with 18 additions and 3 deletions

View file

@ -10,6 +10,7 @@
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <file_selector_linux/file_selector_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>
void fl_register_plugins(FlPluginRegistry* registry) {
@ -25,6 +26,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
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 =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View file

@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
desktop_lifecycle
file_selector_linux
flutter_secure_storage_linux
handy_window
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_default_size(window, 800, 600);
gtk_widget_show(GTK_WIDGET(window));
gtk_window_set_default_size(window, 1200, 720);
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(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));
}