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

gg: add linux support for fn screen_size() Size fix (#23146) #23326

Merged
merged 7 commits into from
Jan 2, 2025
Merged
Changes from 3 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
16 changes: 15 additions & 1 deletion vlib/gg/gg.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import sokol.sapp
import sokol.sgl
import sokol.gfx

pub struct C.Display {}
islonely marked this conversation as resolved.
Show resolved Hide resolved

fn C.XOpenDisplay(int) &C.Display
fn C.DefaultScreen(&C.Display) int
fn C.DisplayHeight(&C.Display, int) int
fn C.DisplayWidth(&C.Display, int) int

$if windows {
#flag -lgdi32
#include "windows.h"
Expand Down Expand Up @@ -739,7 +746,14 @@ pub fn screen_size() Size {
height: int(C.GetSystemMetrics(C.SM_CYSCREEN))
}
}
// TODO: linux, etc
$if linux {
display := C.XOpenDisplay(0)
islonely marked this conversation as resolved.
Show resolved Hide resolved
screen := C.DefaultScreen(display)
return Size{
width: C.DisplayWidth(display, screen)
height: C.DisplayHeight(display, screen)
}
}
return Size{}
}

Expand Down
Loading