XSHAPE(3)

✨ XSHAPE ✨

okay bestie, sit down, hydrate, because this is the X nonrectangular shape functions page from section 3 of the manual (XSHAPE(3), in case you were wondering which page you wandered into πŸ’…). It's the whole girlboss toolkit for making windows that are not rectangles. groundbreaking, honestly.


πŸ“œ SYNTAX πŸ“œ

first things first, you gotta bring the header along or nothing works:

#include <X11/extensions/shape.h>

and here's every single function, signature and all, no notes:

Bool XShapeQueryExtension (
     Display *dpy,
     int *event_basep,
     int *error_basep);

Status XShapeQueryVersion (
     Display *dpy,
     int *major_versionp,
     int *minor_versionp);

void XShapeCombineRegion (
     Display *dpy,
     Window dest,
     int destKind,
     int xOff,
     int yOff,
     struct _XRegion *r,
     int op);

void XShapeCombineRectangles (
     Display *dpy,
     XID dest,
     int destKind,
     int xOff,
     int yOff,
     XRectangle *rects,
     int n_rects,
     int op,
     int ordering);

void XShapeCombineMask (
     Display *dpy,
     XID dest,
     int destKind,
     int xOff,
     int yOff,
     Pixmap src,
     int op);

void XShapeCombineShape (
     Display *dpy,
     XID dest,
     int destKind,
     int xOff,
     int yOff,
     Pixmap src,
     int srcKind,
     int op);

void XShapeOffsetShape (
     Display *dpy,
     XID dest,
     int destKind,
     int xOff,
     int yOff);

Status XShapeQueryExtents (
     Display *dpy,
     Window window,
     int *bShaped,
     int *xbs,
     int *ybs,
     unsigned int *wbs,
     unsigned int *hbs,
     int *cShaped,
     int *xcs,
     int *ycs,
     unsigned int *wcs,
     unsigned int *hcs);

void XShapeSelectInput (
     Display *dpy,
     Window window,
     unsigned longmask);

unsigned long XShapeInputSelected (
     Display *dpy,
     Window window);

XRectangle *XShapeGetRectangles (
     Display *dpy,
     Window window,
     int kind,
     int *count,
     int *ordering);
⚠️ heads up bestie: XShapeSelectInput really does take an unsigned longmask with no space, exactly like that. That's not me being messy, that's the source material. copy it verbatim or the compiler will simply Not.

🧬 STRUCTURES 🧬

there is exactly one struct on this page and she is the moment:

typedef struct {
    int type; /* of event */
    unsigned long serial;    /* # of last request processed by server */
    Bool send_event;    /* true if this came from a SendEvent request */
    Display *display;   /* Display the event was read from */
    Window window; /* window of event */
    int kind; /* ShapeBounding or ShapeClip */
    int x, y; /* extents of new region */
    unsigned width, height;
    Time time;     /* server timestamp when region changed */
    Bool shaped;   /* true if the region exists */
} XShapeEvent;

every comment in there is load-bearing, keep them 🫢


πŸ’– DESCRIPTION πŸ’–

so the tea is: the X11 Nonrectangular Window Shape Extension adds nonrectangular windows to the X Window System. that's it. that's the description. iconic of her honestly 🌈


πŸŽ€ PREDEFINED VALUES πŸŽ€

🧚 Operations

these are the things you can do to a shape, pick your fighter:

  • ShapeSet
  • ShapeUnion
  • ShapeIntersect
  • ShapeSubtract
  • ShapeInvert

πŸ¦‹ Shape Kinds

the two flavours of shape, no third option, don't ask:

  • ShapeBounding
  • ShapeClip

⭐ Event defines

the event-adjacent constants, your notifications basically:

  • ShapeNotifyMask
  • ShapeNotify

πŸ’€ BUGS πŸ’€

ngl, and I quote: this manual page needs a lot more work. she said "I'm under construction" and meant it 😭


🌸 SEE ALSO 🌸

go read X11 Nonrectangular Window Shape Extension next, bestie. that's the whole reading list.


okay that's the whole page, you ate it, I'm so proud of you πŸ’œ this one's from X Version 11, shipped with libXext 1.3.6 β€” XSHAPE(3) and out, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from