mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-17 13:33:55 +00:00
Compare commits
4 Commits
b6d2bf194c
...
27c7872e70
Author | SHA1 | Date | |
---|---|---|---|
![]() |
27c7872e70 | ||
![]() |
c07f3f0171 | ||
![]() |
0b18fa5058 | ||
![]() |
be5a13d7b3 |
@ -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"
|
||||||
|
@ -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),
|
||||||
|
Loading…
Reference in New Issue
Block a user