@Override
protected void setMask(final Component w, final Rectangle[] rectangles) {
Runnable action = new Runnable() {
public void run() {
X11 x11 = X11.INSTANCE;
Xext ext = Xext.INSTANCE;
Display dpy = x11.XOpenDisplay(null);
if (dpy == null) {
return;
}
Pixmap pm = null;
try {
X11.Window win = getDrawable(w);
if (rectangles == null
|| ((pm = createBitmap(dpy, win, rectangles)) == null)) {
ext.XShapeCombineMask(dpy, win,
X11.Xext.ShapeBounding, 0, 0, Pixmap.None,
X11.Xext.ShapeSet);
} else {
ext.XShapeCombineMask(dpy, win,
X11.Xext.ShapeBounding, 0, 0, pm,
X11.Xext.ShapeSet);
}
} finally {
if (pm != null) {