Compare commits

...

4 Commits

Author SHA1 Message Date
Blink-A
27c7872e70
Merge be5a13d7b3 into c07f3f0171 2025-01-25 18:14:24 +01:00
Evans
c07f3f0171
Merge pull request #701 from ronaldpetty/patch-1
Some checks failed
Go / test (macOS-latest) (push) Has been cancelled
Go / test (windows-latest) (push) Has been cancelled
Update README.md
2024-12-10 11:32:09 -08:00
Ronald Petty
0b18fa5058
Update README.md
Added missing import
2024-12-09 19:51:43 -08:00
Blink-A
be5a13d7b3
Update screen_c.h 2024-08-18 16:34:02 +08:00
2 changed files with 19 additions and 5 deletions

View File

@ -244,6 +244,7 @@ package main
import ( import (
"fmt" "fmt"
"strconv"
"github.com/go-vgo/robotgo" "github.com/go-vgo/robotgo"
"github.com/vcaesar/imgo" "github.com/vcaesar/imgo"

View File

@ -76,12 +76,25 @@ MMSizeInt32 getMainDisplaySize(void) {
CGSize size = displayRect.size; CGSize size = displayRect.size;
return MMSizeInt32Make((int32_t)size.width, (int32_t)size.height); return MMSizeInt32Make((int32_t)size.width, (int32_t)size.height);
#elif defined(USE_X11) #elif defined(USE_X11)
Display *display = XGetMainDisplay(); // Display *display = XGetMainDisplay();
const int screen = DefaultScreen(display); // const int screen = DefaultScreen(display);
return MMSizeInt32Make( // return MMSizeInt32Make(
(int32_t)DisplayWidth(display, screen), // (int32_t)DisplayWidth(display, screen),
(int32_t)DisplayHeight(display, screen)); // (int32_t)DisplayHeight(display, screen));
Display *display = XOpenDisplay(NULL);
if (display == NULL) {
return MMSizeInt32Make(0, 0); // Return an invalid size if unable to open display
}
const int screen = DefaultScreen(display);
MMSizeInt32 resolution = MMSizeInt32Make(
(int32_t)DisplayWidth(display, screen),
(int32_t)DisplayHeight(display, screen)
);
XCloseDisplay(display);
return resolution;
#elif defined(IS_WINDOWS) #elif defined(IS_WINDOWS)
return MMSizeInt32Make( return MMSizeInt32Make(
(int32_t)GetSystemMetrics(SM_CXSCREEN), (int32_t)GetSystemMetrics(SM_CXSCREEN),