| 1 | // Public API from X11/extensions/shape.h and shapeconst.h. |
| 2 | module shape |
| 3 | |
| 4 | import vx11 |
| 5 | |
| 6 | #flag -lXext |
| 7 | #include <X11/extensions/shape.h> |
| 8 | |
| 9 | pub const name = 'SHAPE' |
| 10 | pub const major_version = 1 |
| 11 | pub const minor_version = 1 |
| 12 | pub const shape_set = 0 |
| 13 | pub const shape_union = 1 |
| 14 | pub const shape_intersect = 2 |
| 15 | pub const shape_subtract = 3 |
| 16 | pub const shape_invert = 4 |
| 17 | pub const shape_bounding = 0 |
| 18 | pub const shape_clip = 1 |
| 19 | pub const shape_input = 2 |
| 20 | pub const notify_mask = 1 |
| 21 | pub const notify = 0 |
| 22 | pub const number_events = 1 |
| 23 | |
| 24 | @[typedef] |
| 25 | pub struct C.XShapeEvent { |
| 26 | pub mut: |
| 27 | @type i32 |
| 28 | serial vx11.CULong |
| 29 | send_event i32 |
| 30 | display &vx11.Display |
| 31 | window vx11.Window |
| 32 | kind i32 |
| 33 | x i32 |
| 34 | y i32 |
| 35 | width u32 |
| 36 | height u32 |
| 37 | time vx11.Time |
| 38 | shaped i32 |
| 39 | } |
| 40 | |
| 41 | pub type XShapeEvent = C.XShapeEvent |
| 42 | |
| 43 | fn C.XShapeQueryExtension(&vx11.Display, &i32, &i32) i32 |
| 44 | fn C.XShapeQueryVersion(&vx11.Display, &i32, &i32) i32 |
| 45 | fn C.XShapeCombineRegion(&vx11.Display, vx11.Window, i32, i32, i32, vx11.Region, i32) |
| 46 | fn C.XShapeCombineRectangles(&vx11.Display, vx11.Window, i32, i32, i32, &vx11.XRectangle, i32, i32, i32) |
| 47 | fn C.XShapeCombineMask(&vx11.Display, vx11.Window, i32, i32, i32, vx11.Pixmap, i32) |
| 48 | fn C.XShapeCombineShape(&vx11.Display, vx11.Window, i32, i32, i32, vx11.Window, i32, i32) |
| 49 | fn C.XShapeOffsetShape(&vx11.Display, vx11.Window, i32, i32, i32) |
| 50 | fn C.XShapeQueryExtents(&vx11.Display, vx11.Window, &i32, &i32, &i32, &u32, &u32, &i32, &i32, &i32, &u32, &u32) i32 |
| 51 | fn C.XShapeSelectInput(&vx11.Display, vx11.Window, vx11.CULong) |
| 52 | fn C.XShapeInputSelected(&vx11.Display, vx11.Window) vx11.CULong |
| 53 | fn C.XShapeGetRectangles(&vx11.Display, vx11.Window, i32, &i32, &i32) &vx11.XRectangle |
| 54 | |
| 55 | pub fn query_extension(d &vx11.Display, event_base &i32, error_base &i32) i32 { |
| 56 | return C.XShapeQueryExtension(d, event_base, error_base) |
| 57 | } |
| 58 | |
| 59 | pub fn query_version(d &vx11.Display, major &i32, minor &i32) i32 { |
| 60 | return C.XShapeQueryVersion(d, major, minor) |
| 61 | } |
| 62 | |
| 63 | pub fn combine_region(d &vx11.Display, w vx11.Window, kind i32, x i32, y i32, region vx11.Region, op i32) { |
| 64 | C.XShapeCombineRegion(d, w, kind, x, y, region, op) |
| 65 | } |
| 66 | |
| 67 | pub fn combine_rectangles(d &vx11.Display, w vx11.Window, kind i32, x i32, y i32, rectangles &vx11.XRectangle, count i32, op i32, ordering i32) { |
| 68 | C.XShapeCombineRectangles(d, w, kind, x, y, rectangles, count, op, ordering) |
| 69 | } |
| 70 | |
| 71 | pub fn combine_mask(d &vx11.Display, w vx11.Window, kind i32, x i32, y i32, pixmap vx11.Pixmap, op i32) { |
| 72 | C.XShapeCombineMask(d, w, kind, x, y, pixmap, op) |
| 73 | } |
| 74 | |
| 75 | pub fn combine_shape(d &vx11.Display, w vx11.Window, kind i32, x i32, y i32, source vx11.Window, source_kind i32, op i32) { |
| 76 | C.XShapeCombineShape(d, w, kind, x, y, source, source_kind, op) |
| 77 | } |
| 78 | |
| 79 | pub fn offset_shape(d &vx11.Display, w vx11.Window, kind i32, x i32, y i32) { |
| 80 | C.XShapeOffsetShape(d, w, kind, x, y) |
| 81 | } |
| 82 | |
| 83 | pub fn query_extents(d &vx11.Display, w vx11.Window, bounding_shaped &i32, bx &i32, by &i32, bw &u32, bh &u32, clip_shaped &i32, cx &i32, cy &i32, cw &u32, ch &u32) i32 { |
| 84 | return C.XShapeQueryExtents(d, w, bounding_shaped, bx, by, bw, bh, clip_shaped, cx, cy, cw, ch) |
| 85 | } |
| 86 | |
| 87 | pub fn select_input(d &vx11.Display, w vx11.Window, mask vx11.CULong) { |
| 88 | C.XShapeSelectInput(d, w, mask) |
| 89 | } |
| 90 | |
| 91 | pub fn input_selected(d &vx11.Display, w vx11.Window) vx11.CULong { |
| 92 | return C.XShapeInputSelected(d, w) |
| 93 | } |
| 94 | |
| 95 | // The returned rectangle array must be released with vx11.free. |
| 96 | pub fn get_rectangles(d &vx11.Display, w vx11.Window, kind i32, count &i32, ordering &i32) &vx11.XRectangle { |
| 97 | return C.XShapeGetRectangles(d, w, kind, count, ordering) |
| 98 | } |
| 99 | |