fix cmake
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoIxD 2026-07-09 15:55:11 -07:00
commit 53878b08ee
2 changed files with 43 additions and 11 deletions

View file

@ -197,7 +197,32 @@ if(MW_USE_WAYLAND)
)
endfunction()
function(scan_wayland_protocol_from_file proto file)
SET(proto_c ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland/wayland-${proto}-protocol.c)
execute_process(
COMMAND wayland-scanner private-code ${CMAKE_CURRENT_SOURCE_DIR}/resource/wayland/${file} ${proto_c}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
target_sources(
Mw
PRIVATE
${proto_c}
)
execute_process(
COMMAND wayland-scanner client-header ${CMAKE_CURRENT_SOURCE_DIR}/resource/wayland/${file} ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/${proto}-client-protocol.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
COMMAND_ECHO STDOUT
)
endfunction()
check_include_files(wayland-client.h HAVE_WL_H)
check_include_files(xkbcommon/xkbcommon.h HAVE_XKBCOMMON_H)
@ -215,6 +240,7 @@ if(MW_USE_WAYLAND)
scan_wayland_protocol("unstable" "primary-selection" "-unstable-v1")
scan_wayland_protocol("unstable" "pointer-constraints" "-unstable-v1")
scan_wayland_protocol("unstable" "relative-pointer" "-unstable-v1")
scan_wayland_protocol_from_file("wlr-layer-shell" "wlr-layer-shell-unstable-v1.xml")
target_sources(
Mw

View file

@ -234,12 +234,14 @@ static void xdg_surface_configure(
}
void MwLLWaylandBufferUpdate(MwLL self, struct _MwLLWaylandShmBuffer* buffer) {
memcpy(buffer->buf, buffer->buf_back, buffer->buf_size);
if(buffer->surface) {
// Yes this is needed every time, it's how we fix weston.
if(self->wayland.configured)
wl_surface_attach(buffer->surface, buffer->shm_buffer, 0, 0);
wl_surface_commit(buffer->surface);
if(self->wayland.configured) {
memcpy(buffer->buf, buffer->buf_back, buffer->buf_size);
if(buffer->surface) {
// Yes this is needed every time, it's how we fix weston.
if(self->wayland.configured)
wl_surface_attach(buffer->surface, buffer->shm_buffer, 0, 0);
wl_surface_commit(buffer->surface);
}
}
}
@ -306,11 +308,15 @@ static void setup_toplevel(MwLL r, int x, int y) {
/* Perform the initial commit and wait for the first configure event */
wl_surface_commit(r->wayland.backbuffer.surface);
wl_surface_commit(r->wayland.framebuffer.surface);
if(wl_display_roundtrip(r->wayland.display) == -1) {
printf("roundtrip failed\n");
raise(SIGTRAP);
return;
while(!r->wayland.configured) {
if(wl_display_roundtrip(r->wayland.display) == -1) {
printf("roundtrip failed\n");
raise(SIGTRAP);
return;
}
}
/* setup decorations if we can */
if(r->wayland.has_decorations) {
zxdg_decoration_manager_v1_context_t* dec = WAYLAND_GET_INTERFACE(r->wayland, zxdg_decoration_manager_v1)->context;