doublebuffered wayland #38

Merged
IoI_xD merged 6 commits from doublebuffered into master 2026-09-14 07:09:45 +09:00
Showing only changes of commit 48756c2681 - Show all commits

double buffering handled properly on child widgets

IoIxD 2026-09-13 14:24:55 -07:00

View file

@ -925,8 +925,6 @@ static void draw_child(MwLL handle, MwLL child) {
while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent;
selected_cairo = handle->wayland.cairo.front_cairo_back;
wl_surface_commit(child->wayland.framebuffer.surface);
cs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, child->wayland.ww, child->wayland.wh);
@ -939,8 +937,8 @@ static void draw_child(MwLL handle, MwLL child) {
cairo_paint(c);
cairo_set_source_surface(selected_cairo, cs, child->wayland.x, child->wayland.y);
cairo_paint(selected_cairo);
cairo_set_source_surface(handle->wayland.cairo.front_cairo_back, cs, child->wayland.x, child->wayland.y);
cairo_paint(handle->wayland.cairo.front_cairo_back);
cairo_destroy(c);
cairo_surface_destroy(cs);
@ -949,6 +947,8 @@ static void draw_child(MwLL handle, MwLL child) {
}
static void draw_children(MwLL handle) {
wl_surface_damage(handle->wayland.framebuffer.surface, 0, 0, handle->wayland.ww, handle->wayland.wh);
MwLLWaylandChildrenIterate(handle, draw_child);
if(handle->wayland.configured) MwLLWaylandBufferUpdate(handle, &handle->wayland.framebuffer);
@ -959,10 +959,6 @@ static void cascade_child(MwLL handle, MwLL child) {
child->wayland.do_cascading_draw = 10;
}
static void count_child(MwLL handle, MwLL child) {
handle->wayland.cascading_child_num++;
}
static void frontbuffer_draw(MwLL handle) {
cairo_t* c;
cairo_surface_t* cs;
@ -985,11 +981,7 @@ static void frontbuffer_draw(MwLL handle) {
}
void MwLLWaylandCascadeChildren(MwLL handle) {
handle->wayland.cascading_child_num = 0;
MwLLWaylandChildrenIterate(handle, count_child);
handle->wayland.do_cascading_draw = handle->wayland.cascading_child_num * 10;
MwLLWaylandChildrenIterate(handle, cascade_child);
handle->wayland.do_cascading_draw = 1;
}
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
@ -1330,13 +1322,7 @@ static void MwLLEndDrawImpl(MwLL handle) {
}
MwLLWaylandBufferUpdate(handle, &handle->wayland.framebuffer);
// MwLLWaylandCascadeChildren(handle);
draw_children(handle);
}
if(handle->wayland.type != MwLL_WAYLAND_SUBLEVEL) {
wl_surface_damage(handle->wayland.framebuffer.surface, 0, 0, handle->wayland.ww, handle->wayland.wh);
frontbuffer_draw(handle);
MwLLWaylandCascadeChildren(handle);
}
}
@ -1401,9 +1387,7 @@ static int MwLLPendingImpl(MwLL handle) {
if(handle->wayland.do_cascading_draw) {
draw_children(handle);
if(handle->wayland.do_cascading_draw > 0)
handle->wayland.do_cascading_draw--;
frontbuffer_draw(handle);
}
handle->wayland.end_time = MwTimeGetTick();