specify linux cm target size at beginning

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-11-27 16:56:02 +08:00
parent 51cfa6f666
commit 248f18f0d8
2 changed files with 14 additions and 1 deletions

View File

@ -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);
}

View File

@ -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);