Compare commits

...

2 Commits

Author SHA1 Message Date
Blink-A
fb9301753c
Merge be5a13d7b3 into 0de26ecee4 2024-09-17 13:45:32 -07:00
Blink-A
be5a13d7b3
Update screen_c.h 2024-08-18 16:34:02 +08:00

View File

@ -15,12 +15,25 @@ MMSizeInt32 getMainDisplaySize(void) {
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);
// Display *display = XGetMainDisplay();
// const int screen = DefaultScreen(display);
return MMSizeInt32Make(
(int32_t)DisplayWidth(display, screen),
(int32_t)DisplayHeight(display, screen));
// return MMSizeInt32Make(
// (int32_t)DisplayWidth(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)
return MMSizeInt32Make(
(int32_t)GetSystemMetrics(SM_CXSCREEN),