diff --git a/flutter/linux/main.cc b/flutter/linux/main.cc index d409bfd2b..aae79349a 100644 --- a/flutter/linux/main.cc +++ b/flutter/linux/main.cc @@ -4,6 +4,7 @@ #define RUSTDESK_LIB_PATH "librustdesk.so" // #define RUSTDESK_LIB_PATH "/usr/lib/rustdesk/librustdesk.so" typedef bool (*RustDeskCoreMain)(); +bool gIsConnectionManager = false; bool flutter_rustdesk_core_main() { void* librustdesk = dlopen(RUSTDESK_LIB_PATH, RTLD_LAZY); @@ -24,6 +25,11 @@ int main(int argc, char** argv) { if (!flutter_rustdesk_core_main()) { return 0; } + for (int i = 0; i < argc; i++) { + if (strcmp(argv[i], "--cm") == 0) { + gIsConnectionManager = true; + } + } g_autoptr(MyApplication) app = my_application_new(); return g_application_run(G_APPLICATION(app), argc, argv); } diff --git a/flutter/linux/my_application.cc b/flutter/linux/my_application.cc index 97af444fa..215c6f0ee 100644 --- a/flutter/linux/my_application.cc +++ b/flutter/linux/my_application.cc @@ -14,6 +14,8 @@ struct _MyApplication { G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) +extern bool gIsConnectionManager; + // Implements GApplication::activate. static void my_application_activate(GApplication* application) { MyApplication* self = MY_APPLICATION(application); @@ -51,7 +53,12 @@ static void my_application_activate(GApplication* application) { // auto bdw = bitsdojo_window_from(window); // <--- add this line // bdw->setCustomFrame(true); // <-- add this line - gtk_window_set_default_size(window, 800, 600); // <-- comment this line + int width = 800, height = 600; + if (gIsConnectionManager) { + width = 300; + height = 400; + } + gtk_window_set_default_size(window, width, height); // <-- comment this line gtk_widget_show(GTK_WIDGET(window)); gtk_widget_set_opacity(GTK_WIDGET(window), 0);