Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update screen_c.h #676

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions screen/screen_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down