Window creation/X11: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Minimal changes to make runnable) |
|||
Line 348: | Line 348: | ||
<lang lisp>;;; Single-file/interactive setup; large applications should define an ASDF system instead |
<lang lisp>;;; Single-file/interactive setup; large applications should define an ASDF system instead |
||
(cl:require :asdf) |
|||
(asdf:operate 'asdf:load-op :clx) |
|||
(cl:defpackage #:rc-xlib-window |
|||
(:use #:cl #:xlib)) |
|||
(cl:in-package #:rc-xlib-window) |
|||
(let ((display (open-default-display |
(let* ((display (open-default-display)) |
||
⚫ | |||
(root-window (screen-root screen)) |
|||
(black-pixel (screen-black-pixel screen)) |
|||
(white-pixel (screen-white-pixel screen)) |
|||
(window (create-window :parent root-window |
|||
⚫ | |||
:width 100 :height 100 |
|||
:background white-pixel |
|||
:event-mask '(:exposure :key-press))) |
|||
(gc (create-gcontext :drawable window |
|||
:foreground black-pixel |
|||
:background white-pixel))) |
|||
(map-window window) |
|||
(unwind-protect |
(unwind-protect |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
(draw-rectangle window gc 20 20 10 10 t) |
|||
(draw-glyphs window gc 10 40 "Hello, World!") |
|||
nil #| continue receiving events |#) |
|||
(key-press () |
|||
t #| non-nil result signals event-case to exit |#)) |
|||
(when window |
|||
(destroy-window window)) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
(draw-rectangle window gc 20 20 10 10 t) |
|||
</lang> |
|||
(draw-glyphs window gc 10 40 "Hello, World!") |
|||
nil #| continue receiving events |#) |
|||
(key-press () |
|||
t #| non-nil result signals event-case to exit |#)))) |
|||
⚫ | |||
=={{header|Go}}== |
=={{header|Go}}== |