#!/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. writeln "X11 Demo (Object Level API)" !X11_display XOpenDisplay(NULL) if X11_display->address() == 0: raise "Connection to X-Server failed!" !X11_screen XDefaultScreen() $root_win XDefaultRootWindow() $BLACK XBlackPixel(X11_screen) $WHITE XWhitePixel(X11_screen) $win root_win->create_simple(1 1 300 200 0 BLACK BLACK) win->store_name "hello" !X11_gc win->create_GC(0 NULL) XSetForeground WHITE win->select_input X'ExposureMask|X'ButtonPressMask win->map $$event allocate_memory('XEvent) do: [-> break] forever: event->next case event'type X'Expose: if event'xexpose'count < 1: win->draw_string 10 20 "Hello, World!" 13 X'ButtonPress: break XCloseDisplay