Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(Linux): Window Size and Position on launch #324

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"window_configuration.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
apply_standard_settings(${BINARY_NAME})
Expand Down
8 changes: 5 additions & 3 deletions linux/my_application.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "my_application.h"
#include "window_configuration.h"

#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
Expand Down Expand Up @@ -40,15 +41,16 @@ static void my_application_activate(GApplication* application) {
if (use_header_bar) {
GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "myWitWallet");
gtk_header_bar_set_title(header_bar, kFlutterWindowTitle);
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
}
else {
gtk_window_set_title(window, "myWitWallet");
gtk_window_set_title(window, kFlutterWindowTitle);
}

gtk_window_set_default_size(window, 1280, 720);
gtk_window_set_default_size(window, kFlutterWindowWidth, kFlutterWindowHeight);
gtk_window_set_position(window, GTK_WIN_POS_CENTER);
gtk_widget_show(GTK_WIDGET(window));

g_autoptr(FlDartProject) project = fl_dart_project_new();
Expand Down
5 changes: 5 additions & 0 deletions linux/window_configuration.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "window_configuration.h"

const char* kFlutterWindowTitle = "myWitWallet";
const unsigned int kFlutterWindowWidth = 400;
const unsigned int kFlutterWindowHeight = 700;
8 changes: 8 additions & 0 deletions linux/window_configuration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef WINDOW_CONFIGURATION_
#define WINDOW_CONFIGURATION_

extern const char* kFlutterWindowTitle;
extern const unsigned int kFlutterWindowWidth;
extern const unsigned int kFlutterWindowHeight;

#endif // WINDOW_CONFIGURATION_
Loading