The Muq X support library isn't complete enough to do a lot as yet; The code so far was written primarily in the hope of teasing someone else into contributing to this project. If that doesn't happen, I'll get back to it once the rest of the server is in solid shape...
Here's a brief code sequence which exercises most of what works so far. It is intended to be executed interactively line-by-line:
( ConvenienceFor popping query-pointer stuff. ) : p8 pop pop pop pop pop pop pop pop ; ( Open display: ) "localhost:0" root-open-display --> display ( Find a screen on display: ) display display-roots[ |pop --> screen ]pop ( Find a color for foreground: ) screen screen-black-pixel --> fg-color ( Find a color for background: ) screen screen-white-pixel --> bg-color ( Find a font for text: ) display "8x13bold" open-font --> nice-font ( Find the root window for screen: ) screen screen-root --> window ( Query location of pointer on root window: ) window query-pointer ( Discard pointer information: ) p8 ( Create a pen (gcontext) to draw with: ) [ :drawable window :foreground fg-color :background bg-color :font nice-font | ]create-gcontext --> gcontext ( Create a white window of our very own: ) [ :enter-window :leave-window :button-press :button-release | ]make-event-mask --> event-mask [ :parent window :x 10 :y 10 :width 200 :height 100 :background bg-color :event-mask event-mask | ]create-window --> our-window ( Make our window visible: ) our-window map-window display flush-display ( Create a black window within our white window: ) [ :parent our-window :x 8 :y 8 :width 16 :height 16 :background fg-color :event-mask event-mask | ]create-window --> sub-window ( Make our subwindow visible: ) sub-window map-window display flush-display ( Destroy our subwindow: ) sub-window destroy-window display flush-display ( Draw some text in the window: ) [ our-window gcontext 10 20 "Hello world!" | ]draw-glyphs display flush-display
Go to the first, previous, next, last section, table of contents.