1
1
#include " my_application.h"
2
2
3
3
#include < flutter_linux/flutter_linux.h>
4
+ #include < handy.h>
4
5
#ifdef GDK_WINDOWING_X11
5
6
#include < gdk/gdkx.h>
6
7
#endif
@@ -17,35 +18,9 @@ G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
17
18
// Implements GApplication::activate.
18
19
static void my_application_activate(GApplication* application) {
19
20
MyApplication* self = MY_APPLICATION (application);
20
- GtkWindow* window =
21
- GTK_WINDOW (gtk_application_window_new (GTK_APPLICATION (application)));
22
-
23
- // Use a header bar when running in GNOME as this is the common style used
24
- // by applications and is the setup most users will be using (e.g. Ubuntu
25
- // desktop).
26
- // If running on X and not using GNOME then just use a traditional title bar
27
- // in case the window manager does more exotic layout, e.g. tiling.
28
- // If running on Wayland assume the header bar will work (may need changing
29
- // if future cases occur).
30
- gboolean use_header_bar = TRUE ;
31
- #ifdef GDK_WINDOWING_X11
32
- GdkScreen* screen = gtk_window_get_screen (window);
33
- if (GDK_IS_X11_SCREEN (screen)) {
34
- const gchar* wm_name = gdk_x11_screen_get_window_manager_name (screen);
35
- if (g_strcmp0 (wm_name, " GNOME Shell" ) != 0 ) {
36
- use_header_bar = FALSE ;
37
- }
38
- }
39
- #endif
40
- if (use_header_bar) {
41
- GtkHeaderBar* header_bar = GTK_HEADER_BAR (gtk_header_bar_new ());
42
- gtk_widget_show (GTK_WIDGET (header_bar));
43
- gtk_header_bar_set_title (header_bar, " game_center" );
44
- gtk_header_bar_set_show_close_button (header_bar, TRUE );
45
- gtk_window_set_titlebar (window, GTK_WIDGET (header_bar));
46
- } else {
47
- gtk_window_set_title (window, " game_center" );
48
- }
21
+
22
+ GtkWindow* window = GTK_WINDOW (hdy_application_window_new ());
23
+ gtk_window_set_application (window, GTK_APPLICATION (application));
49
24
50
25
gtk_window_set_default_size (window, 1280 , 720 );
51
26
gtk_widget_show (GTK_WIDGET (window));
0 commit comments