From f0c05a28315f25d51b4f38a7eacb91c0cb3296c2 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 10 May 2023 14:35:16 -0400 Subject: [PATCH] GC: Fix XSetClipMask and enable clipping. --- xlib/GC.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xlib/GC.cpp b/xlib/GC.cpp index 0248ff9..5ebc1e3 100644 --- a/xlib/GC.cpp +++ b/xlib/GC.cpp @@ -398,6 +398,16 @@ XSetClipRectangles(Display *display, GC gc, int clip_x_origin, int clip_y_origin extern "C" Status XSetClipMask(Display* display, GC gc, Pixmap pixmap) { + if (pixmap == None) { + ClipMask* mask = gc_clip_mask(gc, false); + if (!mask) + return Success; + + mask->region.MakeEmpty(); + gc->dirty |= GCClipMask; + return Success; + } + XPixmap* pxm = Drawables::get_pixmap(pixmap); if (!pxm) return BadPixmap; @@ -571,7 +581,6 @@ _x_check_gc(XDrawable* drawable, GC gc) } if (gc->dirty & (GCClipMask | GCClipXOrigin | GCClipYOrigin)) { -#if 0 view->ConstrainClippingRegion(NULL); ClipMask* mask = gc_clip_mask(gc, false); if (mask && mask->region.CountRects() > 0) { @@ -579,7 +588,6 @@ _x_check_gc(XDrawable* drawable, GC gc) region.OffsetBy(gc->values.clip_x_origin, gc->values.clip_y_origin); view->ConstrainClippingRegion(®ion); } -#endif } gc->dirty = 0;