core: enable x11 and set as default for linux

This commit is contained in:
Joshua Holmes 2024-10-10 12:54:00 -07:00 committed by Stephen Gutekanst
parent 9a0398e782
commit fcba68282d
2 changed files with 32 additions and 27 deletions

View file

@ -74,7 +74,7 @@ display_mode: DisplayMode = .windowed,
vsync_mode: VSyncMode = .triple,
border: bool,
headless: bool,
size: Core.Size,
size: *Core.Size,
cursor_mode: CursorMode = .normal,
cursor_shape: CursorShape = .arrow,
surface_descriptor: *gpu.Surface.DescriptorFromXlibWindow,
@ -119,8 +119,8 @@ pub fn init(
root_window,
@divFloor(libx11.XDisplayWidth(display, screen), 2), // TODO: add window width?
@divFloor(libx11.XDisplayHeight(display, screen), 2), // TODO: add window height?
options.size.width,
options.size.height,
linux.size.width,
linux.size.height,
0,
c.DefaultDepth(display, screen),
c.InputOutput,
@ -130,7 +130,7 @@ pub fn init(
);
var window_attrs: c.XWindowAttributes = undefined;
_ = libx11.XGetWindowAttributes(display, window, &window_attrs);
const window_size = Core.Size{
linux.size = Core.Size{
.width = @intCast(window_attrs.width),
.height = @intCast(window_attrs.height),
};
@ -180,7 +180,7 @@ pub fn init(
.display_mode = .windowed,
.border = options.border,
.headless = options.headless,
.size = window_size,
.size = &linux.size,
.cursors = std.mem.zeroes([@typeInfo(CursorShape).@"enum".fields.len]?c.Cursor),
.surface_descriptor = surface_descriptor,
.libxkbcommon = try LibXkbCommon.load(),