wayland: fallback if selected_cairo is null

This commit is contained in:
IoIxD 2026-03-22 16:15:50 -07:00
commit 09441380b5
2 changed files with 4 additions and 2 deletions

View file

@ -235,6 +235,7 @@ struct _MwLLWayland {
cairo_surface_t* back_cs;
cairo_t* front_cairo;
cairo_t* back_cairo;
/* The cairo to actually use for draw operations. Typically is front_cairo, but MwLLBeginDraw can change this to the back_cairo so it can be used to draw window decorations. */
cairo_t* selected_cairo;
};

View file

@ -1960,6 +1960,7 @@ static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
cairo_t* c;
cairo_surface_t* cs;
cairo_t * selected_cairo = handle->wayland.selected_cairo ? handle->wayland.selected_cairo : handle->wayland.front_cairo;
cs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, rect->width, rect->height);
c = cairo_create(cs);
@ -1973,8 +1974,8 @@ static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
cairo_paint(c);
cairo_set_source_surface(handle->wayland.selected_cairo, cs, rect->x, rect->y);
cairo_paint(handle->wayland.selected_cairo);
cairo_set_source_surface(selected_cairo, cs, rect->x, rect->y);
cairo_paint(selected_cairo);
cairo_destroy(c);
cairo_surface_destroy(cs);