Skip to content

Use a libhandy window to get all four window corners rounded #178

@Feichtmeier

Description

@Feichtmeier

Currently only the top window corners are rounded
image

Libhandy is a GTK lib to build gtk3 apps with border-radius in all edges.
Currently in ubuntu 21.10 it is used by almost all apps
i.e. nautilus
image

Libhandy will be replaced by libadwaita and gtk4 in Ubuntu so in the long run flutter should switch to gtk4
(see flutter/flutter#94804).

Until then we need to find a way to build my_application.cc with libhandy.

@clobrano created a patch to include it in the cmake build process

diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt
index 5e6b639..c31122a 100644
--- a/linux/CMakeLists.txt
+++ b/linux/CMakeLists.txt
@@ -42,6 +42,7 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
 # System-level dependencies.
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
+pkg_check_modules(LIBHANDY REQUIRED IMPORTED_TARGET libhandy-0.0)
 
 add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
 
@@ -54,6 +55,7 @@ add_executable(${BINARY_NAME}
 apply_standard_settings(${BINARY_NAME})
 target_link_libraries(${BINARY_NAME} PRIVATE flutter)
 target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
+target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::LIBHANDY)
 add_dependencies(${BINARY_NAME} flutter_assemble)
 # Only the install-generated bundle's copy of the executable will launch
 # correctly, since the resources must in the right relative locations. To avoid
diff --git a/linux/my_application.h b/linux/my_application.h
index 42e5184..de1428f 100644
--- a/linux/my_application.h
+++ b/linux/my_application.h
@@ -2,7 +2,8 @@
 #define FLUTTER_MY_APPLICATION_H_
 
 #include <gtk/gtk.h>
-
+#define HANDY_USE_UNSTABLE_API
+#include <handy.h>
 G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
                      GtkApplication);

but it needs changes in my_application.cc
to use all those HDY..... classes from libhandy :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions