diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 8cc6000..9bf9f90 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -1382,6 +1382,16 @@ static void destroy_popup(MwLL r) { r->wayland.configured = MwFALSE; } +static void clip(MwLL handle){ + MwLL parent = handle->wayland.parent; + + if(parent && handle->wayland.type == MWLL_WAYLAND_SUBLEVEL) { + cairo_reset_clip(handle->wayland.cairo); + cairo_rectangle(handle->wayland.cairo, 0, 0, parent->wayland.ww + handle->wayland.x, parent->wayland.wh + handle->wayland.y); + cairo_clip(handle->wayland.cairo); + } +} + static void wl_logger(const char* fmt, va_list args) { vprintf(fmt, args); raise(SIGTRAP); @@ -1562,6 +1572,9 @@ static void MwLLEndDrawImpl(MwLL handle) { static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { int i; + + clip(handle); + cairo_set_source_rgb(handle->wayland.cairo, color->common.red / 255.0, color->common.green / 255.0, color->common.blue / 255.0); cairo_new_path(handle->wayland.cairo); for(i = 0; i < points_count; i++) { @@ -1721,15 +1734,11 @@ static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) { static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) { cairo_t* c; cairo_surface_t* cs; - MwLL parent = handle->wayland.parent; cs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, rect->width, rect->height); c = cairo_create(cs); - if(parent) { - cairo_rectangle(c, 0, 0, parent->wayland.ww + handle->wayland.x, parent->wayland.wh + handle->wayland.y); - cairo_clip(c); - } + clip(handle); cairo_scale(c, (double)rect->width / pixmap->common.width, (double)rect->height / pixmap->common.height); diff --git a/src/core.c b/src/core.c index f17fdbf..39cae92 100644 --- a/src/core.c +++ b/src/core.c @@ -815,6 +815,8 @@ void MwReparent(MwWidget handle, MwWidget new_parent) { arrput(new_parent->children, handle); MwDispatch(handle->parent, children_update); + + MwForceRender(handle); } MwClass MwGetClass(MwWidget handle) {