Use CGDisplayBounds not CGDisplayPixelsWide, optimize get mac display size

This commit is contained in:
vcaesar 2020-01-05 07:59:44 -04:00
parent d9a01c0511
commit fbaa3998c6

View File

@ -11,8 +11,10 @@
MMSizeInt32 getMainDisplaySize(void){
#if defined(IS_MACOSX)
CGDirectDisplayID displayID = CGMainDisplayID();
return MMSizeInt32Make((int32_t)CGDisplayPixelsWide(displayID),
(int32_t)CGDisplayPixelsHigh(displayID));
CGRect displayRect = CGDisplayBounds(displayID);
CGSize size = displayRect.size;
return MMSizeInt32Make((int32_t)size.width, (int32_t)size.height);
#elif defined(USE_X11)
Display *display = XGetMainDisplay();
const int screen = DefaultScreen(display);