ref: d180b70c6c69ffe8168cc8571772ad6e15ac6aba
dir: /testdraw.myr/
use std use draw const main = { var ev match draw.open() | `std.Err e: std.fatal("error: {}\n", e) | `std.Ok dpy: testpattern(dpy) draw.flush(dpy) while true ev = draw.event(dpy) match ev# | `draw.Mmove _: | `draw.Mdown (x, y, mask): std.put("click {} at {}\n", mask, (x, y)) | `draw.Mup (x, y, mask): std.put("release {} at {}\n", mask, (x, y)) | `draw.Kp 'q': break | _: std.put("ev: {}\n", ev) ;; std.free(ev) ;; draw.close(dpy) ;; } const testpattern = {dpy var w, r, p : draw.point match draw.getwindow(dpy, draw.Refnone) | `std.Ok win: w = win | `std.Err e: -> std.fatal("could not get window: {}\n", e); ;; r = [.x0=w.r.x0+100, .y0=w.r.y0+100, .x1=w.r.x0+200, .y1=w.r.y0+200] draw.fill(w, dpy.black, r) p = [.x=w.r.x0+100, .y=w.r.y0+210] draw.string(w, p, "hello world") }