From 0c822d5bfafdff603eed4dd44960ed87066412c0 Mon Sep 17 00:00:00 2001 From: IoI_xD Date: Tue, 14 Apr 2026 23:49:04 -0700 Subject: [PATCH] some wayland fixes curtosey of valgrind --- include/Mw/LowLevel/Wayland.h | 3 +++ src/backend/wayland.c | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index 7b31bd7..ce1630c 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -123,6 +123,7 @@ typedef struct wayland_call_table { void (*cairo_pattern_set_filter)(cairo_pattern_t* pattern, cairo_filter_t filter); void (*cairo_set_antialias)(cairo_t*, cairo_antialias_t); + void (*cairo_set_operator)(cairo_t* cr, cairo_operator_t op); } wayland_call_table_t; @@ -220,6 +221,7 @@ MwInline int wayland_load_funcs() { CAIRO_FUNC(cairo_stroke); CAIRO_FUNC(cairo_set_source_surface); CAIRO_FUNC(cairo_fill); + CAIRO_FUNC(cairo_set_operator); CAIRO_FUNC(cairo_pattern_set_filter); #undef CAIRO_FUNC @@ -277,6 +279,7 @@ MwInline int wayland_load_funcs() { #define cairo_stroke wl_call_tbl.cairo_stroke #define cairo_set_source_surface wl_call_tbl.cairo_set_source_surface #define cairo_fill wl_call_tbl.cairo_fill +#define cairo_set_operator wl_call_tbl.cairo_set_operator #define cairo_pattern_set_filter wl_call_tbl.cairo_pattern_set_filter #ifndef WL_PROTOCOLS_DEFINED diff --git a/src/backend/wayland.c b/src/backend/wayland.c index bbc1220..8bb6f3e 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -2082,7 +2082,9 @@ static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLL } cairo_close_path(handle->wayland.front_cairo); + cairo_set_operator(handle->wayland.front_cairo, CAIRO_OPERATOR_SOURCE); cairo_fill(handle->wayland.front_cairo); + cairo_set_operator(handle->wayland.front_cairo, CAIRO_OPERATOR_OVER); handle->wayland.events_pending = 1; } @@ -2264,6 +2266,8 @@ static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) { cairo_set_source_surface(c, pixmap->wayland.cs, 0, 0); cairo_pattern_set_filter(cairo_get_source(c), CAIRO_FILTER_NEAREST); + cairo_set_operator(handle->wayland.front_cairo, CAIRO_OPERATOR_OVER); + cairo_paint(c); cairo_set_source_surface(selected_cairo, cs, rect->x, rect->y); @@ -2577,11 +2581,6 @@ static void MwLLEndStateChangeImpl(MwLL handle) { } static int MwLLWaylandCallInitImpl(void) { - /* - * Order of precedence: - * - MILSKO_BACKEND - * - manually checking environment variables - */ #ifdef __linux__ MwBool loadWayland = MwFALSE; if(getenv("MILSKO_BACKEND")) {