Quellcode durchsuchen

* manual cleanup of merge

git-svn-id: branches/fixes_2_2@8452 -
peter vor 18 Jahren
Ursprung
Commit
e5a9d4c870

+ 0 - 8
.gitattributes

@@ -3161,8 +3161,6 @@ packages/extra/ptc/Makefile -text
 packages/extra/ptc/Makefile.fpc -text
 packages/extra/ptc/aread.inc svneol=native#text/x-pascal
 packages/extra/ptc/areai.inc svneol=native#text/x-pascal
-packages/extra/ptc/basecond.inc -text
-packages/extra/ptc/baseconi.inc -text
 packages/extra/ptc/baseconsoled.inc svneol=native#text/x-pascal
 packages/extra/ptc/baseconsolei.inc svneol=native#text/x-pascal
 packages/extra/ptc/basesurfaced.inc svneol=native#text/x-pascal
@@ -3340,10 +3338,6 @@ packages/extra/ptc/wince/includes.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/check.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/extensions.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/includes.inc svneol=native#text/x-pascal
-packages/extra/ptc/x11/modesd.inc svneol=native#text/x-pascal
-packages/extra/ptc/x11/modesi.inc svneol=native#text/x-pascal
-packages/extra/ptc/x11/svnimaged.inc svneol=native#text/x-pascal
-packages/extra/ptc/x11/svnimagei.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11consoled.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11consolei.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11dga1displayd.inc svneol=native#text/x-pascal
@@ -3358,10 +3352,8 @@ packages/extra/ptc/x11/x11imaged.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11imagei.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11modesd.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11modesi.inc svneol=native#text/x-pascal
-packages/extra/ptc/x11/x11windowd.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11windowdisplayd.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/x11windowdisplayi.inc svneol=native#text/x-pascal
-packages/extra/ptc/x11/x11windowi.inc svneol=native#text/x-pascal
 packages/extra/ptc/x11/xunikey.inc svneol=native#text/x-pascal
 packages/extra/rexx/Makefile svneol=native#text/plain
 packages/extra/rexx/Makefile.fpc svneol=native#text/plain

+ 25 - 2
packages/extra/ptc/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/22]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-embedded
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -382,6 +382,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_UNITS+=ptc
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=ptc
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_UNITS+=ptc
 endif
@@ -535,6 +538,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_LOADERS+=$(CPU_LOADERS)
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_LOADERS+=$(CPU_LOADERS)
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_LOADERS+=$(CPU_LOADERS)
 endif
@@ -688,6 +694,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_EXAMPLEDIRS+=demos examples
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_EXAMPLEDIRS+=demos examples
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_EXAMPLEDIRS+=demos examples
 endif
@@ -841,6 +850,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_UNITDIR+=x11 dos/cga dos/fakemode dos/textfx2 dos/timeunit dos/vesa win32/directx
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_UNITDIR+=x11 dos/cga dos/fakemode dos/textfx2 dos/timeunit dos/vesa win32/directx
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_UNITDIR+=x11 dos/cga dos/fakemode dos/textfx2 dos/timeunit dos/vesa win32/directx
 endif
@@ -994,6 +1006,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_TARGETDIR+=.
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_TARGETDIR+=.
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_TARGETDIR+=.
 endif
@@ -1986,6 +2001,10 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_X11=1
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HERMES=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
@@ -2880,6 +2899,10 @@ ifeq ($(FULL_TARGET),powerpc64-linux)
 TARGET_EXAMPLEDIRS_DEMOS=1
 TARGET_EXAMPLEDIRS_EXAMPLES=1
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+TARGET_EXAMPLEDIRS_DEMOS=1
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 TARGET_EXAMPLEDIRS_DEMOS=1
 TARGET_EXAMPLEDIRS_EXAMPLES=1

+ 0 - 57
packages/extra/ptc/basecond.inc

@@ -1,57 +0,0 @@
-{
-    Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
-    Original C++ version by Glenn Fiedler ([email protected])
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-}
-
-Type
-  TPTCBaseConsole=Class(TPTCBaseSurface)
-  Private
-    FReleaseEnabled : Boolean;
-  Public
-    Constructor Create;
-    Procedure configure(Const _file : String); Virtual; Abstract;
-    Function modes : PPTCMode; Virtual; Abstract;
-    Procedure open(Const _title : String; _pages : Integer = 0); Overload; Virtual; Abstract;
-    Procedure open(Const _title : String; Const _format : TPTCFormat;
-                   _pages : Integer = 0); Overload; Virtual; Abstract;
-    Procedure open(Const _title : String; _width, _height : Integer;
-                   Const _format : TPTCFormat; _pages : Integer = 0); Overload; Virtual; Abstract;
-    Procedure open(Const _title : String; Const _mode : TPTCMode;
-                   _pages : Integer = 0); Overload; Virtual; Abstract;
-    Procedure close; Virtual; Abstract;
-    Procedure flush; Virtual; Abstract;
-    Procedure finish; Virtual; Abstract;
-    Procedure update; Virtual; Abstract;
-    Procedure update(Const _area : TPTCArea); Virtual; Abstract;
-    
-    { event handling }
-    Function NextEvent(Var event : TPTCEvent; wait : Boolean; Const EventMask : TPTCEventMask) : Boolean; Virtual; Abstract;
-    Function PeekEvent(wait : Boolean; Const EventMask : TPTCEventMask) : TPTCEvent; Virtual; Abstract;
-    
-    { key handling }
-    Function KeyPressed : Boolean;
-    Function PeekKey(Var k : TPTCKeyEvent) : Boolean;
-    Procedure ReadKey(Var k : TPTCKeyEvent);
-    Procedure ReadKey;
-    Property KeyReleaseEnabled : Boolean Read FReleaseEnabled Write FReleaseEnabled;
-    
-    Function pages : Integer; Virtual; Abstract;
-    Function name : String; Virtual; Abstract;
-    Function title : String; Virtual; Abstract;
-    Function information : String; Virtual; Abstract;
-  End;

+ 0 - 88
packages/extra/ptc/baseconi.inc

@@ -1,88 +0,0 @@
-{
-    Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
-    Original C++ version by Glenn Fiedler ([email protected])
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-}
-
-Constructor TPTCBaseConsole.Create;
-
-Begin
-  FReleaseEnabled := False;
-End;
-
-Function TPTCBaseConsole.KeyPressed : Boolean;
-
-Var
-  k, kpeek : TPTCEvent;
-
-Begin
-  k := Nil;
-  Try
-    Repeat
-      kpeek := PeekEvent(False, [PTCKeyEvent]);
-      If kpeek = Nil Then
-        Exit(False);
-      If FReleaseEnabled Or (kpeek As TPTCKeyEvent).Press Then
-        Exit(True);
-      NextEvent(k, False, [PTCKeyEvent]);
-    Until False;
-  Finally
-    k.Free;
-  End;
-End;
-
-Procedure TPTCBaseConsole.ReadKey(Var k : TPTCKeyEvent);
-
-Var
-  ev : TPTCEvent;
-
-Begin
-  ev := k;
-  Try
-    Repeat
-      NextEvent(ev, True, [PTCKeyEvent]);
-    Until FReleaseEnabled Or (ev As TPTCKeyEvent).Press;
-  Finally
-    k := ev As TPTCKeyEvent;
-  End;
-End;
-
-Function TPTCBaseConsole.PeekKey(Var k : TPTCKeyEvent) : Boolean;
-
-Begin
-  If KeyPressed Then
-  Begin
-    ReadKey(k);
-    Result := True;
-  End
-  Else
-    Result := False;
-End;
-
-Procedure TPTCBaseConsole.ReadKey;
-
-Var
-  k : TPTCKeyEvent;
-
-Begin
-  k := TPTCKeyEvent.Create;
-  Try
-    ReadKey(k);
-  Finally
-    k.Free;
-  End;
-End;

+ 14 - 3
packages/extra/ptc/demos/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/22]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-embedded
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -231,7 +231,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 override PACKAGE_NAME=ptc-demos
-override PACKAGE_VERSION=2.2.1
+override PACKAGE_VERSION=0.99.5
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_PROGRAMS+=fire flower land lights mojo texwarp tunnel tunnel3d
 endif
@@ -382,6 +382,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_PROGRAMS+=fire flower land lights mojo texwarp tunnel tunnel3d
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_PROGRAMS+=fire flower land lights mojo texwarp tunnel tunnel3d
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_PROGRAMS+=fire flower land lights mojo texwarp tunnel tunnel3d
 endif
@@ -535,6 +538,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_UNITDIR+=../$(UNITTARGETDIRPREFIX)
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_UNITDIR+=../$(UNITTARGETDIRPREFIX)
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_UNITDIR+=../$(UNITTARGETDIRPREFIX)
 endif
@@ -1577,6 +1583,11 @@ REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_PTC=1
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HERMES=1
+REQUIRE_PACKAGES_PTC=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1

+ 1 - 1
packages/extra/ptc/demos/Makefile.fpc

@@ -4,7 +4,7 @@
 
 [package]
 name=ptc-demos
-version=2.2.1
+version=0.99.5
 
 [target]
 programs=fire flower land lights mojo texwarp tunnel tunnel3d

+ 14 - 3
packages/extra/ptc/examples/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/22]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-embedded
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -231,7 +231,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 override PACKAGE_NAME=ptc-examples
-override PACKAGE_VERSION=2.2.1
+override PACKAGE_VERSION=0.99.5
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_PROGRAMS+=area buffer clear clip con_info console hicolor image keyboard keybrd2 modes palette pixel random save stretch timer
 endif
@@ -382,6 +382,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override TARGET_PROGRAMS+=area buffer clear clip con_info console hicolor image keyboard keybrd2 modes palette pixel random save stretch timer
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_PROGRAMS+=area buffer clear clip con_info console hicolor image keyboard keybrd2 modes palette pixel random save stretch timer
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_PROGRAMS+=area buffer clear clip con_info console hicolor image keyboard keybrd2 modes palette pixel random save stretch timer
 endif
@@ -535,6 +538,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_UNITDIR+=../$(UNITTARGETDIRPREFIX)
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_UNITDIR+=../$(UNITTARGETDIRPREFIX)
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_UNITDIR+=../$(UNITTARGETDIRPREFIX)
 endif
@@ -1577,6 +1583,11 @@ REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_PTC=1
 endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HERMES=1
+REQUIRE_PACKAGES_PTC=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1

+ 1 - 1
packages/extra/ptc/examples/Makefile.fpc

@@ -4,7 +4,7 @@
 
 [package]
 name=ptc-examples
-version=2.2.1
+version=0.99.5
 
 [target]
 programs=area buffer clear clip con_info console hicolor image keyboard \

+ 0 - 19
packages/extra/ptc/x11/modesd.inc

@@ -1,19 +0,0 @@
-Type
-  TX11Modes = Class(TObject)
-  Private
-    FDisplay : PDisplay;
-    FScreen : cint;
-
-    FModeList : PPXF86VidModeModeInfo;
-    FModeListCount : cint;
-    FSavedMode : PXF86VidModeModeLine;
-    FSavedDotClock : cint;
-
-    Procedure GetModes;
-    Function FindNumberOfBestMode(width, height : Integer) : Integer;
-  Public
-    Constructor Create(display : PDisplay; screen : cint);
-    Destructor Destroy; Override;
-    Procedure SetBestMode(width, height : Integer);
-    Procedure RestorePreviousMode;
-  End;

+ 0 - 146
packages/extra/ptc/x11/modesi.inc

@@ -1,146 +0,0 @@
-Constructor TX11Modes.Create(display : PDisplay; screen : Integer);
-
-Var
-  dummy1, dummy2 : cint;
-
-Begin
-  FSavedMode := Nil;
-  FSavedDotClock := 0;
-  FModeList := Nil;
-  FModeListCount := 0;
-
-  FDisplay := display;
-  FScreen := screen;
-
-  If Not XF86VidModeQueryExtension(FDisplay, @dummy1, @dummy2) Then
-    Raise TPTCError.Create('VidMode extension not available');
-End;
-
-Destructor TX11Modes.Destroy;
-
-Begin
-  If FSavedMode <> Nil Then
-  Begin
-    RestorePreviousMode;
-    If FSavedMode^.privsize <> 0 Then
-      XFree(FSavedMode^.c_private);
-    Dispose(FSavedMode);
-  End;
-
-  If FModeList <> Nil Then
-    XFree(FModeList);
-
-  Inherited Destroy;
-End;
-
-Procedure TX11Modes.GetModes;
-
-Begin
-  { If we have been called before, do nothing }
-  If FModeList <> Nil Then
-    Exit;
-
-  { Save previous mode }
-  New(FSavedMode);
-  FillChar(FSavedMode^, SizeOf(FSavedMode^), 0);
-  XF86VidModeGetModeLine(FDisplay, FScreen, @FSavedDotClock, FSavedMode);
-
-  { Get all available video modes }
-  XF86VidModeGetAllModeLines(FDisplay, FScreen, @FModeListCount, @FModeList);
-End;
-
-Function TX11Modes.FindNumberOfBestMode(width, height : Integer) : Integer;
-
-Var
-  min_diff : Integer;
-  d_x, d_y : Integer;
-  found_mode : Integer;
-  I : Integer;
-
-Begin
-  { Try an exact match }
-  For I := 0 To FModeListCount - 1 Do
-    If (FModeList[I]^.hdisplay = width) And (FModeList[I]^.vdisplay = height) Then
-      Exit(I);
-
-  { Try to find a mode that matches the width first }
-  For I := 0 To FModeListCount - 1 Do
-    If (FModeList[I]^.hdisplay = width) And (FModeList[I]^.vdisplay >= height) Then
-      Exit(I);
-
-  { Next try to match the height }
-  For I := 0 To FModeListCount - 1 Do
-    If (FModeList[I]^.hdisplay >= width) And (FModeList[I]^.vdisplay = height) Then
-      Exit(I);
-
-  { Finally, find the mode that is bigger than the requested one and makes }
-  { the least difference }
-  found_mode := -1;
-  min_diff := High(Integer);
-  For I := 0 To FModeListCount - 1 Do
-    If (FModeList[I]^.hdisplay >= width) And (FModeList[I]^.vdisplay >= height) Then
-    Begin
-      d_x := FModeList[I]^.hdisplay - width;
-      d_x *= d_x;
-      d_y := FModeList[I]^.vdisplay - height;
-      d_y *= d_y;
-      If (d_x + d_y) < min_diff Then
-      Begin
-        min_diff := d_x + d_y;
-        found_mode := I;
-      End;
-    End;
-
-  If found_mode <> -1 Then
-    Result := found_mode
-  Else
-    Raise TPTCError.Create('Cannot find matching DGA video mode');
-End;
-
-Procedure TX11Modes.SetBestMode(width, height : Integer);
-
-Var
-  BestMode : Integer;
-
-Begin
-  GetModes;
-
-  BestMode := FindNumberOfBestMode(width, height);
-  If Not XF86VidModeSwitchToMode(FDisplay, FScreen, FModeList[BestMode]) Then
-    Raise TPTCError.Create('Error switching to the requested video mode');
-
-  XWarpPointer(FDisplay, None, RootWindow(FDisplay, FScreen), 0, 0, 0, 0,
-               FModeList[BestMode]^.hdisplay Div 2,
-	       FModeList[BestMode]^.vdisplay Div 2);
-
-  If Not XF86VidModeSetViewPort(FDisplay, FScreen, 0, 0) Then
-    Raise TPTCError.Create('Error moving the viewport to the upper-left corner');
-End;
-
-Procedure TX11Modes.RestorePreviousMode;
-
-Var
-  ModeInfo : TXF86VidModeModeInfo;
-
-Begin
-  If FSavedMode <> Nil Then
-  Begin
-    {FSavedMode is a TXF86VidModeModeLine, but XF86VidModeSwitchToMode wants a
-                     TXF86VidModeModeInfo :}
-    FillChar(ModeInfo, SizeOf(ModeInfo), 0);
-    ModeInfo.dotclock := FSavedDotClock;
-    ModeInfo.hdisplay := FSavedMode^.hdisplay;
-    ModeInfo.hsyncstart := FSavedMode^.hsyncstart;
-    ModeInfo.hsyncend := FSavedMode^.hsyncend;
-    ModeInfo.htotal := FSavedMode^.htotal;
-    ModeInfo.vdisplay := FSavedMode^.vdisplay;
-    ModeInfo.vsyncstart := FSavedMode^.vsyncstart;
-    ModeInfo.vsyncend := FSavedMode^.vsyncend;
-    ModeInfo.vtotal := FSavedMode^.vtotal;
-    ModeInfo.flags := FSavedMode^.flags;
-    ModeInfo.privsize := FSavedMode^.privsize;
-    ModeInfo.c_private := FSavedMode^.c_private;
-    
-    XF86VidModeSwitchToMode(FDisplay, FScreen, @ModeInfo);
-  End;
-End;

+ 0 - 42
packages/extra/ptc/x11/svnimaged.inc

@@ -1,42 +0,0 @@
-Type
-  TX11Image = Class(TObject)
-  Protected
-    m_width, m_height : DWord;
-    m_disp : PDisplay;
-    m_image : PXImage;
-  Public
-    Constructor Create(display : PDisplay; screen, width, height : Integer; format : TPTCFormat);
-    Destructor Destroy; Override;
-    Procedure put(w : TWindow; gc : TGC; x, y : Integer); Virtual; Abstract;
-    Procedure put(w : TWindow; gc : TGC; sx, sy, dx, dy,
-                  width, height : Integer); Virtual; Abstract;
-    Function lock : Pointer; Virtual; Abstract;
-    Function pitch : Integer; Virtual; Abstract;
-  End;
-  TX11NormalImage = Class(TX11Image)
-  Private
-    m_pixels : PUint8;
-  Public
-    Constructor Create(display : PDisplay; screen, width, height : Integer; format : TPTCFormat);
-    Destructor Destroy; Override;
-    Procedure put(w : TWindow; gc : TGC; x, y : Integer); Override;
-    Procedure put(w : TWindow; gc : TGC; sx, sy, dx, dy,
-                  width, height : Integer); Override;
-    Function lock : Pointer; Override;
-    Function pitch : Integer; Override;
-  End;
-{$IFDEF HAVE_X11_EXTENSIONS_XSHM}
-  TX11SHMImage = Class(TX11Image)
-  Public
-    Constructor Create(display : PDisplay; screen, width, height : Integer; format : TPTCFormat);
-    Destructor Destroy; Override;
-    Procedure put(w : TWindow; gc : TGC; x, y : Integer); Override;
-    Procedure put(w : TWindow; gc : TGC; sx, sy, dx, dy,
-                  width, height : Integer); Override;
-    Function lock : Pointer; Override;
-    Function pitch : Integer; Override;
-  Private
-    shminfo : TXShmSegmentInfo;
-    FShmAttached : Boolean;
-  End;
-{$ENDIF}

+ 0 - 198
packages/extra/ptc/x11/svnimagei.inc

@@ -1,198 +0,0 @@
-
-{$WARNING this should be in the IPC unit!!!}
-Const
-{  IPC_CREAT = $200;
-  IPC_EXCL = $400;
-  IPC_NOWAIT = $800;}
-
-  IPC_PRIVATE = 0;
-
-Constructor TX11Image.Create(display : PDisplay; screen, width, height : Integer; format : TPTCFormat);
-
-Begin
-  m_width := width;
-  m_height := height;
-  m_disp := display;
-  m_image := Nil;
-End;
-
-Destructor TX11Image.Destroy;
-
-Begin
-  Inherited Destroy;
-End;
-
-Constructor TX11NormalImage.Create(display : PDisplay; screen, width, height : Integer; format : TPTCFormat);
-
-Var
-  xpad, xpitch : Integer;
-  tmp_m_pixels : PChar;
-
-Begin
-  { cerr << "Creating normal image" << endl << flush; }
-  m_image := Nil;
-  m_pixels := Nil;
-  Inherited Create(display, screen, width, height, format);
-  xpad := format.bits;
-  If format.bits = 24 Then
-    xpad := 32;
-  xpitch := width * format.bits Div 8;
-  Inc(xpitch, 3);
-  xpitch := xpitch And (Not 3);
-  m_pixels := GetMem(xpitch * height);
-  Pointer(tmp_m_pixels) := Pointer(m_pixels);
-  m_image := XCreateImage(display, DefaultVisual(display, screen),
-                          DefaultDepth(display, screen),
-			  ZPixmap, 0, tmp_m_pixels,
-			  width, height, xpad, 0);
-  If m_image = Nil Then
-    Raise TPTCError.Create('cannot create XImage');
-End;
-
-Destructor TX11NormalImage.Destroy;
-
-Begin
-  If m_image <> Nil Then
-  Begin
-    { Restore XImage's buffer pointer }
-    m_image^.data := Nil;
-    XDestroyImage(m_image);
-  End;
-  If m_pixels <> Nil Then
-    FreeMem(m_pixels);
-  Inherited Destroy;
-End;
-
-Procedure TX11NormalImage.put(w : TWindow; gc : TGC; x, y : Integer);
-
-Begin
-  XPutImage(m_disp, w, gc, m_image, 0, 0, x, y, m_width, m_height);
-  XSync(m_disp, False);
-End;
-
-Procedure TX11NormalImage.put(w : TWindow; gc : TGC; sx, sy, dx, dy,
-                    width, height : Integer);
-
-Begin
-  XPutImage(m_disp, w, gc, m_image, sx, sy, dx, dy, width, height);
-  XSync(m_disp, False);
-End;
-
-Function TX11NormalImage.lock : Pointer;
-
-Begin
-  lock := m_pixels;
-End;
-
-Function TX11NormalImage.pitch : Integer;
-
-Begin
-  pitch := m_image^.bytes_per_line;
-End;
-
-{$IFDEF HAVE_X11_EXTENSIONS_XSHM}
-
-Var
-  Fshm_error : Boolean;
-  Fshm_oldhandler : Function(disp : PDisplay; xev : PXErrorEvent) : Integer; CDecl;
-
-Function Fshm_errorhandler(disp : PDisplay; xev : PXErrorEvent) : Integer; CDecl;
-
-Begin
-  If xev^.error_code=BadAccess Then
-  Begin
-    Fshm_error := True;
-    Result := 0;
-  End
-  Else
-    Result := Fshm_oldhandler(disp, xev);
-End;
-
-Constructor TX11SHMImage.Create(display : PDisplay; screen, width, height : Integer; format : TPTCFormat);
-
-Begin
-  { cerr << "Creating SHM image" << endl << flush; }
-  shminfo.shmid := -1;
-  shminfo.shmaddr := Pointer(-1);
-  FShmAttached := False;
-  m_image := Nil;
-  Inherited Create(display, screen, width, height, format);
-  m_image := XShmCreateImage(display, DefaultVisual(display, screen),
-                             DefaultDepth(display, screen),
-			     ZPixmap, Nil, @shminfo, width, height);
-  If m_image = Nil Then
-    Raise TPTCError.Create('cannot create SHM image');
-
-  shminfo.shmid := shmget(IPC_PRIVATE, m_image^.bytes_per_line * m_image^.height,
-                          IPC_CREAT Or &777);
-  If shminfo.shmid = -1 Then
-    Raise TPTCError.Create('cannot get shared memory segment');
-  
-  shminfo.shmaddr := shmat(shminfo.shmid, Nil, 0);
-  shminfo.readOnly := False;
-  m_image^.data := shminfo.shmaddr;
-  
-  If Pointer(shminfo.shmaddr) = Pointer(-1) Then
-    Raise TPTCError.Create('cannot allocate shared memory');
-
-  // Try and attach the segment to the server. Bugfix: Have to catch
-  // bad access errors in case it runs over the net.
-  Fshm_error := False;
-  Fshm_oldhandler := XSetErrorHandler(@Fshm_errorhandler);
-  Try
-    If XShmAttach(display, @shminfo) = 0 Then
-      Raise TPTCError.Create('cannot attach shared memory segment to display');
-
-    XSync(display, False);
-    If Fshm_error Then
-      Raise TPTCError.Create('cannot attach shared memory segment to display');
-    FShmAttached := True;
-  Finally
-    XSetErrorHandler(Fshm_oldhandler);
-  End;
-End;
-
-Destructor TX11SHMImage.Destroy;
-
-Begin
-  If FShmAttached Then
-  Begin
-    XShmDetach(m_disp, @shminfo);
-    XSync(m_disp, False);
-  End;
-  If m_image <> Nil Then
-    XDestroyImage(m_image);
-  If Pointer(shminfo.shmaddr) <> Pointer(-1) Then
-    shmdt(shminfo.shmaddr);
-  If shminfo.shmid <> -1 Then
-    shmctl(shminfo.shmid, IPC_RMID, Nil);
-  Inherited Destroy;
-End;
-
-Procedure TX11SHMImage.put(w : TWindow; gc : TGC; x, y : Integer);
-
-Begin
-  XShmPutImage(m_disp, w, gc, m_image, 0, 0, x, y, m_width, m_height, False);
-  XSync(m_disp, False);
-End;
-
-Procedure TX11SHMImage.put(w : TWindow; gc : TGC; sx, sy, dx, dy,
-                    width, height : Integer);
-
-Begin
-  XShmPutImage(m_disp, w, gc, m_image, sx, sy, dx, dy, width, height, False);
-  XSync(m_disp, False);
-End;
-
-Function TX11SHMImage.lock : Pointer;
-
-Begin
-  lock := Pointer(shminfo.shmaddr);
-End;
-
-Function TX11SHMImage.pitch : Integer;
-
-Begin
-  pitch := m_image^.bytes_per_line;
-End;
-{$ENDIF}

+ 0 - 53
packages/extra/ptc/x11/x11windowd.inc

@@ -1,53 +0,0 @@
-Type
-  TX11WindowDisplay = Class(TX11Display)
-  Private
-    Function NextEvent(Var event : TPTCEvent; wait : Boolean; Const EventMask : TPTCEventMask) : Boolean; Override;
-    Function PeekEvent(wait : Boolean; Const EventMask : TPTCEventMask) : TPTCEvent; Override;
-    
-    Procedure EnterFullScreen;
-    Procedure LeaveFullScreen;
-    Procedure internal_ShowCursor(visible : Boolean);
-    Procedure HandleChangeFocus(NewFocus : Boolean);
-    Procedure HandleEvents;
-    Function createImage(disp : PDisplay; screen, _width, _height : Integer;
-                         _format : TPTCFormat) : TX11Image; { Factory method }
-    Procedure createColormap; { Register colour maps }
-    {eventHandler}
-    m_has_shm : Boolean;
-    m_window : TWindow;
-    m_primary : TX11Image;
-    m_destx, m_desty : Integer;
-    m_gc : TGC;
-    m_atom_close : TAtom; { X Atom for close window button }
-    m_keypressed : Boolean; { Key pressed since the last call to key() ? }
-{    m_keylast : TPTCKeyEvent;} { Last key pressed (scancode) }
-    FCursorVisible : Boolean;
-    FX11InvisibleCursor : TCursor; { Blank cursor }
-    FFullScreen : Boolean; { Keeps a snapshot of the PTC_X11_FULLSCREEN option
-                             taken at the time 'open' was called }
-    FFocus : Boolean;
-    FModeSwitcher : TX11Modes;
-    
-    FPreviousMouseButtonState : TPTCMouseButtonState;
-    FPreviousMouseX, FPreviousMouseY : Integer; { for calculating the deltas }
-    FPreviousMousePositionSaved : Boolean; { true, if FPreviousMouseX,
-           FPreviousMouseY and FPreviousMouseButtonState contain valid values }
-  Public
-    Constructor Create;
-    Destructor Destroy; Override;
-    
-    Procedure open(title : String; _width, _height : Integer; Const _format : TPTCFormat; disp : PDisplay; screen : Integer); Override;
-    Procedure open(disp : PDisplay; screen : Integer; w : TWindow; Const _format : TPTCFormat); Override;
-    Procedure open(disp : PDisplay; screen : Integer; _window : TWindow; Const _format : TPTCFormat; x, y, w, h : Integer); Override;
-    Procedure close; Override;
-    Procedure update; Override;
-    Procedure update(Const _area : TPTCArea); Override;
-    Function lock : Pointer; Override;
-    Procedure unlock; Override;
-    Procedure palette(Const _palette : TPTCPalette); Override;
-    Function pitch : Integer; Override;
-    Function getX11Window : TWindow; Override;
-    Function getX11GC : TGC; Virtual;
-    Function isFullScreen : Boolean; Override;
-    Procedure SetCursor(visible : Boolean); Override;
-  End;

+ 0 - 713
packages/extra/ptc/x11/x11windowi.inc

@@ -1,713 +0,0 @@
-Constructor TX11WindowDisplay.Create;
-
-Begin
-  m_has_shm := False;
-  m_primary := Nil;
-  m_window := 0;
-  m_colours := Nil;
-  m_keypressed := False;
-  FFullScreen := False;
-  FPreviousMousePositionSaved := False;
-  FFocus := True;
-  FModeSwitcher := Nil;
-  FX11InvisibleCursor := None;
-  FCursorVisible := True;
-  Inherited Create;
-//  XSHM_LoadLibrary;
-
-{$IFDEF HAVE_X11_EXTENSIONS_XSHM}
-  m_has_shm := True;
-{$ENDIF HAVE_X11_EXTENSIONS_XSHM}
-End;
-
-Destructor TX11WindowDisplay.Destroy;
-
-Begin
-  close;
-//  XSHM_UnloadLibrary;
-  Inherited Destroy;
-End;
-
-Procedure TX11WindowDisplay.open(title : String; _width, _height : Integer; Const _format : TPTCFormat; disp : PDisplay; screen : Integer);
-
-Var
-  tmpFormat : TPTCFormat;
-  xgcv : TXGCValues;
-  textprop : TXTextProperty;
-  e : TXEvent;
-  found : Boolean;
-  attr : TXSetWindowAttributes;
-  size_hints : PXSizeHints;
-  tmpArea : TPTCArea;
-  tmppchar : PChar;
-  tmpArrayOfCLong : Array[1..1] Of clong;
-  tmpPixmap : TPixmap;
-  BlackColor : TXColor;
-  BlankCursorData : Array[1..8] Of Byte = (0, 0, 0, 0, 0, 0, 0, 0);
-
-Begin
-  m_disp := disp;
-  m_screen := DefaultScreen(disp);
-  m_height := _height;
-  m_width := _width;
-  m_destx := 0;
-  m_desty := 0;
-  
-  FFullScreen := PTC_X11_FULLSCREEN In m_flags;
-  
-  FFocus := True;
-
-  FPreviousMousePositionSaved := False;
-
-  FillChar(BlackColor, SizeOf(BlackColor), 0);
-  BlackColor.red := 0;
-  BlackColor.green := 0;
-  BlackColor.blue := 0;
-
-  { Create the mode switcher object }
-  If FFullScreen Then
-    Try
-      FModeSwitcher := TX11Modes.Create(m_disp, m_screen);
-    Except
-      On error : TPTCError Do
-      Begin
-        {todo: log the error}
-        FModeSwitcher := Nil;
-      End;
-    End;
-
-  { Create the invisible cursor }
-  tmpPixmap := XCreateBitmapFromData(m_disp, RootWindow(m_disp, m_screen), @BlankCursorData, 8, 8);
-  Try
-    FX11InvisibleCursor := XCreatePixmapCursor(m_disp, tmpPixmap, tmpPixmap, @BlackColor, @BlackColor, 0, 0);
-  Finally
-    If tmpPixmap <> None Then
-      XFreePixmap(m_disp, tmpPixmap);
-  End;
-
-  { Check if we have that colour depth available.. Easy as there is no
-    format conversion yet }
-  tmpFormat := Nil;
-  Try
-    tmpFormat := getFormat(_format);
-    m_format.ASSign(tmpFormat);
-  Finally
-    tmpFormat.Free;
-  End;
-  tmpFormat := Nil;
-  
-  { Create a window }
-  m_window := XCreateSimpleWindow(m_disp, RootWindow(m_disp, m_screen), 0, 0,
-                _width, _height, 0, BlackPixel(m_disp, m_screen),
-		                    BlackPixel(m_disp, m_screen));
-  { Register the delete atom }
-  m_atom_close := XInternAtom(m_disp, 'WM_DELETE_WINDOW', False);
-  X11Check(XSetWMProtocols(m_disp, m_window, @m_atom_close, 1), 'XSetWMProtocols');
-  { Get graphics context }
-  xgcv.graphics_exposures := False;
-  m_gc := XCreateGC(m_disp, m_window, GCGraphicsExposures, @xgcv);
-  If m_gc = Nil Then
-    Raise TPTCError.Create('can''t create graphics context');
-  { Set window title }
-  tmppchar := PChar(title);
-  X11Check(XStringListToTextProperty(@tmppchar, 1, @textprop), 'XStringListToTextProperty');
-  Try
-    XSetWMName(m_disp, m_window, @textprop);
-    XFlush(m_disp);
-  Finally
-    XFree(textprop.value);
-  End;
-  
-  { Set normal hints }
-  size_hints := XAllocSizeHints;
-  Try
-    size_hints^.flags := PMinSize Or PBaseSize;
-    size_hints^.min_width := _width;
-    size_hints^.min_height := _height;
-    size_hints^.base_width := _width;
-    size_hints^.base_height := _height;
-    If FFullScreen Then
-    Begin
-      size_hints^.flags := size_hints^.flags Or PWinGravity;
-      size_hints^.win_gravity := StaticGravity;
-    End
-    Else
-    Begin
-      { not fullscreen - add maxsize limit=minsize, i.e. make window not resizable }
-      size_hints^.flags := size_hints^.flags Or PMaxSize;
-      size_hints^.max_width := _width;
-      size_hints^.max_height := _height;
-    End;
-    XSetWMNormalHints(m_disp, m_window, size_hints);
-    XFlush(m_disp);
-  Finally
-    XFree(size_hints);
-  End;
-  
-  { Set the _NET_WM_STATE property }
-  If FFullScreen Then
-  Begin
-    tmpArrayOfCLong[1] := XInternAtom(m_disp, '_NET_WM_STATE_FULLSCREEN', False);
-    
-    XChangeProperty(m_disp, m_window, 
-                    XInternAtom(m_disp, '_NET_WM_STATE', False),
-		    XA_ATOM,
-		    32, PropModeReplace, @tmpArrayOfCLong, 1);
-  End;
-  
-  { Map the window and wait for success }
-  XSelectInput(m_disp, m_window, StructureNotifyMask);
-  XMapRaised(m_disp, m_window);
-  Repeat
-    XNextEvent(disp, @e);
-    If e._type = MapNotify Then
-      Break;
-  Until False;
-  { Get keyboard input and sync }
-  XSelectInput(m_disp, m_window, KeyPressMask Or KeyReleaseMask Or
-                                 StructureNotifyMask Or FocusChangeMask Or
-				 ButtonPressMask Or ButtonReleaseMask Or
-				 PointerMotionMask);
-  XSync(m_disp, False);
-  { Create XImage using factory method }
-  m_primary := createImage(m_disp, m_screen, m_width, m_height, m_format);
-  
-  found := False;
-  Repeat
-    { Stupid loop. The key }
-    { events were causing }
-    { problems.. }
-    found := XCheckMaskEvent(m_disp, KeyPressMask Or KeyReleaseMask, @e);
-  Until Not found;
-  
-  attr.backing_store := Always;
-  XChangeWindowAttributes(m_disp, m_window, CWBackingStore, @attr);
-  
-  { Set clipping area }
-  tmpArea := TPTCArea.Create(0, 0, m_width, m_height);
-  Try
-    m_clip.ASSign(tmpArea);
-  Finally
-    tmpArea.Free;
-  End;
-  
-  { Installs the right colour map for 8 bit modes }
-  createColormap;
-
-  If FFullScreen Then
-    EnterFullScreen;
-End;
-
-Procedure TX11WindowDisplay.open(disp : PDisplay; screen : Integer; w : TWindow; Const _format : TPTCFormat);
-
-Begin
-End;
-
-Procedure TX11WindowDisplay.open(disp : PDisplay; screen : Integer; _window : TWindow; Const _format : TPTCFormat; x, y, w, h : Integer);
-
-Begin
-End;
-
-Procedure TX11WindowDisplay.close;
-
-Begin
-  FreeAndNil(FModeSwitcher);
-
-  {pthreads?!}
-  If m_cmap <> 0 Then
-  Begin
-    XFreeColormap(m_disp, m_cmap);
-    m_cmap := 0;
-  End;
-  
-  { Destroy XImage and buffer }
-  FreeAndNil(m_primary);
-  FreeMemAndNil(m_colours);
-  
-  { Hide and destroy window }
-  If (m_window <> 0) And (Not (PTC_X11_LEAVE_WINDOW In m_flags)) Then
-  Begin
-    XUnmapWindow(m_disp, m_window);
-    XSync(m_disp, False);
-    
-    XDestroyWindow(m_disp, m_window);
-  End;
-  
-  { Free the invisible cursor }
-  If FX11InvisibleCursor <> None Then
-  Begin
-    XFreeCursor(m_disp, FX11InvisibleCursor);
-    FX11InvisibleCursor := None;
-  End;
-End;
-
-Procedure TX11WindowDisplay.internal_ShowCursor(visible : Boolean);
-
-Var
-  attr : TXSetWindowAttributes;
-
-Begin
-  If visible Then
-    attr.cursor := None { Use the normal cursor }
-  Else
-    attr.cursor := FX11InvisibleCursor; { Set the invisible cursor }
-  
-  XChangeWindowAttributes(m_disp, m_window, CWCursor, @attr);
-End;
-
-Procedure TX11WindowDisplay.SetCursor(visible : Boolean);
-
-Begin
-  FCursorVisible := visible;
-  
-  If FFocus Then
-    internal_ShowCursor(FCursorVisible);
-End;
-
-Procedure TX11WindowDisplay.EnterFullScreen;
-
-Begin
-  { Try to switch mode }
-  If Assigned(FModeSwitcher) Then
-    FModeSwitcher.SetBestMode(m_width, m_height);
-
-  XSync(m_disp, False);
-End;
-
-Procedure TX11WindowDisplay.LeaveFullScreen;
-
-Begin
-  { Restore previous mode }
-  If Assigned(FModeSwitcher) Then
-    FModeSwitcher.RestorePreviousMode;
-
-  XSync(m_disp, False);
-End;
-
-Procedure TX11WindowDisplay.HandleChangeFocus(NewFocus : Boolean);
-
-Begin
-  { No change? }
-  If NewFocus = FFocus Then
-    Exit;
-
-  FFocus := NewFocus;
-  If FFocus Then
-  Begin
-    { focus in }
-    If FFullScreen Then
-      EnterFullScreen;
-    
-    internal_ShowCursor(FCursorVisible);
-  End
-  Else
-  Begin
-    { focus out }
-    If FFullScreen Then
-      LeaveFullScreen;
-    
-    internal_ShowCursor(True);
-  End;
-  
-  XSync(m_disp, False);
-End;
-
-Procedure TX11WindowDisplay.HandleEvents;
-
-Var
-  e : TXEvent;
-  NewFocus : Boolean;
-  NewFocusSpecified : Boolean;
-
-  Function UsefulEventsPending : Boolean;
-  
-  Var
-    tmpEvent : TXEvent;
-  
-  Begin
-    If XCheckTypedEvent(m_disp, ClientMessage, @tmpEvent) Then
-    Begin
-      Result := True;
-      XPutBackEvent(m_disp, @tmpEvent);
-      Exit;
-    End;
-    
-    If XCheckMaskEvent(m_disp, FocusChangeMask Or
-                       KeyPressMask Or KeyReleaseMask Or
-		       ButtonPressMask Or ButtonReleaseMask Or
-		       PointerMotionMask Or ExposureMask, @tmpEvent) Then
-    Begin
-      Result := True;
-      XPutBackEvent(m_disp, @tmpEvent);
-      Exit;
-    End;
-    
-    Result := False;
-  End;
-
-  Procedure HandleKeyEvent;
-  
-  Var
-    sym : TKeySym;
-    sym_modded : TKeySym; { modifiers like shift are taken into account here }
-    press : Boolean;
-    alt, shift, ctrl : Boolean;
-    uni : Integer;
-    key : TPTCKeyEvent;
-    buf : Array[1..16] Of Char;
-  
-  Begin
-    sym := XLookupKeySym(@e.xkey, 0);
-    XLookupString(@e.xkey, @buf, SizeOf(buf), @sym_modded, Nil);
-    uni := X11ConvertKeySymToUnicode(sym_modded);
-    alt := (e.xkey.state And Mod1Mask) <> 0;
-    shift := (e.xkey.state And ShiftMask) <> 0;
-    ctrl := (e.xkey.state And ControlMask) <> 0;
-    If e._type = KeyPress Then
-      press := True
-    Else
-      press := False;
-
-    key := Nil;
-    Case sym Shr 8 Of
-      0 : key := TPTCKeyEvent.Create(m_normalkeys[sym And $FF], uni, alt, shift, ctrl, press);
-      $FF : key := TPTCKeyEvent.Create(m_functionkeys[sym And $FF], uni, alt, shift, ctrl, press);
-      Else
-        key := TPTCKeyEvent.Create;
-    End;
-    FEventQueue.AddEvent(key);
-  End;
-  
-  Procedure HandleMouseEvent;
-  
-  Var
-    x, y : cint;
-    state : cuint;
-    PTCMouseButtonState : TPTCMouseButtonState;
-    
-    button : TPTCMouseButton;
-    before, after : Boolean;
-    cstate : TPTCMouseButtonState;
-    
-  Begin
-    Case e._type Of
-      MotionNotify : Begin
-        x := e.xmotion.x;
-	y := e.xmotion.y;
-	state := e.xmotion.state;
-      End;
-      ButtonPress, ButtonRelease : Begin
-        x := e.xbutton.x;
-	y := e.xbutton.y;
-	state := e.xbutton.state;
-	If e._type = ButtonPress Then
-	Begin
-	  Case e.xbutton.button Of
-	    Button1 : state := state Or Button1Mask;
-	    Button2 : state := state Or Button2Mask;
-	    Button3 : state := state Or Button3Mask;
-	    Button4 : state := state Or Button4Mask;
-	    Button5 : state := state Or Button5Mask;
-	  End;
-	End
-	Else
-	Begin
-	  Case e.xbutton.button Of
-	    Button1 : state := state And (Not Button1Mask);
-	    Button2 : state := state And (Not Button2Mask);
-	    Button3 : state := state And (Not Button3Mask);
-	    Button4 : state := state And (Not Button4Mask);
-	    Button5 : state := state And (Not Button5Mask);
-	  End;
-	End;
-      End;
-      Else
-        Raise TPTCError.Create('Internal Error');
-    End;
-    
-    If (state And Button1Mask) = 0 Then
-      PTCMouseButtonState := []
-    Else
-      PTCMouseButtonState := [PTCMouseButton1];
-    If (state And Button2Mask) <> 0 Then
-      PTCMouseButtonState := PTCMouseButtonState + [PTCMouseButton2];
-    If (state And Button3Mask) <> 0 Then
-      PTCMouseButtonState := PTCMouseButtonState + [PTCMouseButton3];
-    If (state And Button4Mask) <> 0 Then
-      PTCMouseButtonState := PTCMouseButtonState + [PTCMouseButton4];
-    If (state And Button5Mask) <> 0 Then
-      PTCMouseButtonState := PTCMouseButtonState + [PTCMouseButton5];
-    
-    If (x >= 0) And (x < m_width) And (y >= 0) And (y < m_height) Then
-    Begin
-      If Not FPreviousMousePositionSaved Then
-      Begin
-        FPreviousMouseX := x; { first DeltaX will be 0 }
-	FPreviousMouseY := y; { first DeltaY will be 0 }
-	FPreviousMouseButtonState := [];
-      End;
-      
-      { movement? }
-      If (x <> FPreviousMouseX) Or (y <> FPreviousMouseY) Then
-        FEventQueue.AddEvent(TPTCMouseEvent.Create(x, y, x - FPreviousMouseX, y - FPreviousMouseY, FPreviousMouseButtonState));
-      
-      { button presses/releases? }
-      cstate := FPreviousMouseButtonState;
-      For button := Low(button) To High(button) Do
-      Begin
-        before := button In FPreviousMouseButtonState;
-	after := button In PTCMouseButtonState;
-	If after And (Not before) Then
-	Begin
-	  { button was pressed }
-	  cstate := cstate + [button];
-	  FEventQueue.AddEvent(TPTCMouseButtonEvent.Create(x, y, 0, 0, cstate, True, button));
-	End
-	Else
-	  If before And (Not after) Then
-	  Begin
-	    { button was released }
-	    cstate := cstate - [button];
-	    FEventQueue.AddEvent(TPTCMouseButtonEvent.Create(x, y, 0, 0, cstate, False, button));
-	  End;
-      End;
-      
-      FPreviousMouseX := x;
-      FPreviousMouseY := y;
-      FPreviousMouseButtonState := PTCMouseButtonState;
-      FPreviousMousePositionSaved := True;
-    End;
-  End;
-
-Begin
-  NewFocusSpecified := False;
-  While UsefulEventsPending Do
-  Begin
-    XNextEvent(m_disp, @e);
-    Case e._type Of
-      FocusIn : Begin
-        NewFocus := True;
-	NewFocusSpecified := True;
-      End;
-      FocusOut : Begin
-        NewFocus := False;
-	NewFocusSpecified := True;
-      End;
-      ClientMessage : Begin
-        If (e.xclient.format = 32) And (TAtom(e.xclient.data.l[0]) = m_atom_close) Then
-          Halt(0);
-      End;
-      Expose : Begin
-        {...}
-      End;
-      KeyPress, KeyRelease : HandleKeyEvent;
-      ButtonPress, ButtonRelease, MotionNotify : HandleMouseEvent;
-    End;
-  End;
-  If NewFocusSpecified Then
-    HandleChangeFocus(NewFocus);
-End;
-
-Procedure TX11WindowDisplay.update;
-
-Begin
-  m_primary.put(m_window, m_gc, m_destx, m_desty);
-  
-  HandleEvents;
-End;
-
-Procedure TX11WindowDisplay.update(Const _area : TPTCArea);
-
-Var
-  updatearea : TPTCArea;
-  tmparea : TPTCArea;
-
-Begin
-  tmparea := TPTCArea.Create(0, 0, m_width, m_height);
-  Try
-    updatearea := TPTCClipper.clip(tmparea, _area);
-    Try
-      m_primary.put(m_window, m_gc, updatearea.left, updatearea.top,
-                    m_destx + updatearea.left, m_desty + updatearea.top,
-		    updatearea.width, updatearea.height);
-    Finally
-      updatearea.Free;
-    End;
-  Finally
-    tmparea.Free;
-  End;
-  
-  HandleEvents;
-End;
-
-Function TX11WindowDisplay.NextEvent(Var event : TPTCEvent; wait : Boolean; Const EventMask : TPTCEventMask) : Boolean;
-
-Var
-  tmpEvent : TXEvent;
-
-Begin
-  FreeAndNil(event);
-  Repeat
-    { process all events from the X queue and put them on our FEventQueue }
-    HandleEvents;
-    
-    { try to find an event that matches the EventMask }
-    event := FEventQueue.NextEvent(EventMask);
-    
-    If wait And (event = Nil) Then
-    Begin
-      { if the X event queue is empty, block until an event is received }
-      XPeekEvent(m_disp, @tmpEvent);
-    End;
-  Until (Not Wait) Or (event <> Nil);
-  Result := event <> Nil;
-End;
-
-Function TX11WindowDisplay.PeekEvent(wait : Boolean; Const EventMask : TPTCEventMask) : TPTCEvent;
-
-Var
-  tmpEvent : TXEvent;
-
-Begin
-  Repeat
-    { process all events from the X queue and put them on our FEventQueue }
-    HandleEvents;
-    
-    { try to find an event that matches the EventMask }
-    Result := FEventQueue.PeekEvent(EventMask);
-    
-    If wait And (Result = Nil) Then
-    Begin
-      { if the X event queue is empty, block until an event is received }
-      XPeekEvent(m_disp, @tmpEvent);
-    End;
-  Until (Not Wait) Or (Result <> Nil);
-End;
-
-Function TX11WindowDisplay.lock : Pointer;
-
-Begin
-  lock := m_primary.lock;
-End;
-
-Procedure TX11WindowDisplay.unlock;
-
-Begin
-End;
-
-Procedure TX11WindowDisplay.palette(Const _palette : TPTCPalette);
-
-Var
-  pal : PUint32;
-  i : Integer;
-
-Begin
-  pal := _palette.data;
-  If Not m_format.indexed Then
-    Exit;
-  For i := 0 To 255 Do
-  Begin
-    m_colours[i].pixel := i;
-
-    m_colours[i].red := ((pal[i] Shr 16) And $FF) Shl 8;
-    m_colours[i].green := ((pal[i] Shr 8) And $FF) Shl 8;
-    m_colours[i].blue := (pal[i] And $FF) Shl 8;
-
-    Byte(m_colours[i].flags) := DoRed Or DoGreen Or DoBlue;
-  End;
-  XStoreColors(m_disp, m_cmap, m_colours, 256);
-End;
-
-Function TX11WindowDisplay.pitch : Integer;
-
-Begin
-  pitch := m_primary.pitch;
-End;
-
-Function TX11WindowDisplay.createImage(disp : PDisplay; screen, _width, _height : Integer;
-                                       _format : TPTCFormat) : TX11Image;
-
-{$IFDEF HAVE_X11_EXTENSIONS_XSHM}
-Var
-  tmp : TX11Image;
-{$ENDIF}
-
-Begin
-  {todo: shm}
-  {$IFDEF HAVE_X11_EXTENSIONS_XSHM}
-  If m_has_shm And XShmQueryExtension(disp) Then
-  Begin
-    Try
-      tmp := TX11SHMImage.Create(disp, screen, _width, _height, _format);
-    Except
-      On e : TPTCError Do
-        tmp := TX11NormalImage.Create(disp, screen, _width, _height, _format);
-    End;
-    createImage := tmp;
-  End
-  Else
-  {$ENDIF}
-  createImage := TX11NormalImage.Create(disp, screen, _width, _height, _format);
-End;
-
-Function TX11WindowDisplay.getX11Window : TWindow;
-
-Begin
-  getX11Window := m_window;
-End;
-
-Function TX11WindowDisplay.getX11GC : TGC;
-
-Begin
-  getX11GC := m_gc;
-End;
-
-Function TX11WindowDisplay.isFullScreen : Boolean;
-
-Begin
-  Result := FFullScreen;
-End;
-
-Procedure TX11WindowDisplay.createColormap; { Register colour maps }
-
-Var
-  i : Integer;
-  r, g, b : Single;
-
-Begin
-  If m_format.bits = 8 Then
-  Begin
-    m_colours := GetMem(256 * SizeOf(TXColor));
-    If m_colours = Nil Then
-      Raise TPTCError.Create('Cannot allocate colour map cells');
-    m_cmap := XCreateColormap(m_disp, RootWindow(m_disp, m_screen),
-                              DefaultVisual(m_disp, m_screen), AllocAll);
-    If m_cmap = 0 Then
-      Raise TPTCError.Create('Cannot create colour map');
-    XInstallColormap(m_disp, m_cmap);
-    XSetWindowColormap(m_disp, m_window, m_cmap);
-  End
-  Else
-    m_cmap := 0;
-
-  { Set 332 palette, for now }
-  If (m_format.bits = 8) And m_format.direct Then
-  Begin
-    {Taken from PTC 0.72, i hope it's fine}
-    For i := 0 To 255 Do
-    Begin
-      r := ((i And $E0) Shr 5) * 255 / 7;
-      g := ((i And $1C) Shr 2) * 255 / 7;
-      b := (i And $03) * 255 / 3;
-      
-      m_colours[i].pixel := i;
-      
-      m_colours[i].red := Round(r) Shl 8;
-      m_colours[i].green := Round(g) Shl 8;
-      m_colours[i].blue := Round(b) Shl 8;
-      
-      Byte(m_colours[i].flags) := DoRed Or DoGreen Or DoBlue;
-    End;
-    XStoreColors(m_disp, m_cmap, m_colours, 256);
-  End;
-End;