mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Use CGDisplayBounds not CGDisplayPixelsWide, optimize get mac display size
This commit is contained in:
parent
d9a01c0511
commit
fbaa3998c6
@ -11,8 +11,10 @@
|
|||||||
MMSizeInt32 getMainDisplaySize(void){
|
MMSizeInt32 getMainDisplaySize(void){
|
||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
CGDirectDisplayID displayID = CGMainDisplayID();
|
CGDirectDisplayID displayID = CGMainDisplayID();
|
||||||
return MMSizeInt32Make((int32_t)CGDisplayPixelsWide(displayID),
|
CGRect displayRect = CGDisplayBounds(displayID);
|
||||||
(int32_t)CGDisplayPixelsHigh(displayID));
|
|
||||||
|
CGSize size = displayRect.size;
|
||||||
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user