Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

uses Xlib;

2 views
Skip to first unread message

Iwao Watanabe

unread,
Sep 6, 2001, 9:13:35 AM9/6/01
to
こんばんは。
Kylix でXlibが使えるということで、少し試してみました。

コンパイル例

$ dcc -$O+ winonly.pas
Borland Delphi for Linux Version 14.0 Open Edition
Copyright (c) 1983,2001 Borland Software Corporation
winonly.pas(30)
31 lines, 0.11 seconds, 13624 bytes code, 2080 bytes data.
$ ls -l winonly
-rwxr-xr-x 1 iwao cclub 18744 Sep 6 22:02 winonly
$ ./winonly
  … とめるときは Ctrl-C です。

Xlib.pasは大部分がlibX11.soへのシンボル定義でした。
若干抜けているAPIがありますが、その大きさに少し感動しました。

CのXlibとPASCALを知っていればすぐに使えそうです。

program winonly;

uses Xlib;

var display:PDisplay;
mywindow:Window;
wx,wy,width,height,border_width:integer;
background,border:Pixel;
event:XEvent;

begin
display := XOpenDisplay(pchar(''));
if display = nil then exit;

wx := 0; wy := 0;
width := 320; height := 200;
border_width := 2;
background := XWhitePixel(display,XDefaultScreen(display));
border := background;

mywindow := XCreateSimpleWindow(display,XDefaultRootWindow(display),
wx,wy,width,height,border_width,background,border);

XMapWindow(display,mywindow);

while true do
XNextEvent(display,@event);

end.


0 new messages