From 3e5b10f7208312e1ac2cdc1fcad415cac8410077 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Tue, 17 Sep 2024 13:11:02 -0700 Subject: [PATCH] Add: export XClose main display function --- robotgo.go | 5 +++++ screen/goScreen.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/robotgo.go b/robotgo.go index 7c79bd4c..5ac065a6 100644 --- a/robotgo.go +++ b/robotgo.go @@ -457,6 +457,11 @@ func GetXDisplayName() string { return gname } +// CloseMainDisplay close the main X11 display +func CloseMainDisplay() { + C.close_main_display() +} + // Deprecated: use the ScaledF(), // // ScaleX get the primary display horizontal DPI scale factor, drop diff --git a/screen/goScreen.h b/screen/goScreen.h index 24321bf6..d4349a5a 100644 --- a/screen/goScreen.h +++ b/screen/goScreen.h @@ -79,6 +79,14 @@ char* get_XDisplay_name() { #endif } +void close_main_display() { + #if defined(USE_X11) + XCloseMainDisplay(); + #else + // + #endif +} + uint32_t get_num_displays() { #if defined(IS_MACOSX) uint32_t count = 0;