#!/usr/bin/env sim Copyright (C) 2009 by Dipl.-Ing. Michael Niederle This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For details of the GNU General Public License see http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. $ButtonPressMask 0x0004 $ExposureMask 0x8000 $ButtonPress 4 $Expose 12 writeln "X11 Demo (Low Level API)" !X_display libX11'XOpenDisplay(NULL) if X_display->address() == 0: raise "Connection to X-Server failed!" !X_screen libX11'XDefaultScreen(X_display) $root_win libX11'XDefaultRootWindow(X_display) $color_map libX11'XDefaultColormap(X_display X_screen) $black libX11'XBlackPixel(X_display X_screen) $white libX11'XWhitePixel(X_display X_screen) $win libX11'XCreateSimpleWindow X_display root_win 1 1 300 200 0 black black ignore libX11'XStoreName(X_display win "hello") !X_gc libX11'XCreateGC(X_display win 0 NULL) ignore libX11'XSetForeground(X_display X_gc white) ignore libX11'XSelectInput(X_display win ExposureMask|ButtonPressMask) ignore libX11'XMapWindow(X_display win) $event allocate_memory('XEvent) do: [-> break] forever: ignore libX11'XNextEvent(X_display event) case event'type Expose: if event'xexpose'count < 1: ignore libX11'XDrawString(X_display win X_gc 10 20 "Hello, World!" 13) ButtonPress: break ignore libX11'XCloseDisplay(X_display)