diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-23 08:54:39 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-23 08:54:39 +0000 |
commit | 1e00430227e56fd2691f8374418f352c171039b1 (patch) | |
tree | 0451194af432a8b80270defb403bb100f1e95d90 /gfx/x11 | |
parent | 2ecc101eb1573c272d570289987807c44937631b (diff) | |
download | fpGUI-1e00430227e56fd2691f8374418f352c171039b1.tar.xz |
The first part of removing the obsolete fpGUI and replacing it with the new multi-handle design from the prototypes directory.
Diffstat (limited to 'gfx/x11')
-rw-r--r-- | gfx/x11/Makefile | 1985 | ||||
-rw-r--r-- | gfx/x11/Makefile.fpc | 27 | ||||
-rwxr-xr-x | gfx/x11/build.sh | 3 | ||||
-rw-r--r-- | gfx/x11/fpgfxpackage.lpk | 77 | ||||
-rw-r--r-- | gfx/x11/fpgfxpackage.pas | 15 | ||||
-rw-r--r-- | gfx/x11/gfx_x11.pas | 2037 | ||||
-rw-r--r-- | gfx/x11/gfxinterface.pas | 45 | ||||
-rw-r--r-- | gfx/x11/unitxft.pas | 162 |
8 files changed, 0 insertions, 4351 deletions
diff --git a/gfx/x11/Makefile b/gfx/x11/Makefile deleted file mode 100644 index a4d1387d..00000000 --- a/gfx/x11/Makefile +++ /dev/null @@ -1,1985 +0,0 @@ -# -# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/28] -# -default: all -MAKEFILETARGETS=i386-linux -BSDs = freebsd netbsd openbsd darwin -UNIXs = linux $(BSDs) solaris qnx -LIMIT83fs = go32v2 os2 emx watcom -FORCE: -.PHONY: FORCE -override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) -ifneq ($(findstring darwin,$(OSTYPE)),) -inUnix=1 #darwin -SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) -else -ifeq ($(findstring ;,$(PATH)),) -inUnix=1 -SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) -else -SEARCHPATH:=$(subst ;, ,$(PATH)) -endif -endif -SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) -ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) -ifeq ($(PWD),) -$(error You need the GNU utils package to use this Makefile) -else -PWD:=$(firstword $(PWD)) -SRCEXEEXT= -endif -else -PWD:=$(firstword $(PWD)) -SRCEXEEXT=.exe -endif -ifndef inUnix -ifeq ($(OS),Windows_NT) -inWinNT=1 -else -ifdef OS2_SHELL -inOS2=1 -endif -endif -else -ifneq ($(findstring cygdrive,$(PATH)),) -inCygWin=1 -endif -endif -ifdef inUnix -SRCBATCHEXT=.sh -else -ifdef inOS2 -SRCBATCHEXT=.cmd -else -SRCBATCHEXT=.bat -endif -endif -ifdef inUnix -PATHSEP=/ -else -PATHSEP:=$(subst /,\,/) -ifdef inCygWin -PATHSEP=/ -endif -endif -ifdef PWD -BASEDIR:=$(subst \,/,$(shell $(PWD))) -ifdef inCygWin -ifneq ($(findstring /cygdrive/,$(BASEDIR)),) -BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) -BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) -BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) -endif -endif -else -BASEDIR=. -endif -ifdef inOS2 -ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ECHO),) -ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ECHO),) -ECHO=echo -else -ECHO:=$(firstword $(ECHO)) -endif -else -ECHO:=$(firstword $(ECHO)) -endif -endif -export ECHO -endif -override DEFAULT_FPCDIR=/opt/fpc/src -ifndef FPC -ifdef PP -FPC=$(PP) -endif -endif -ifndef FPC -FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) -ifneq ($(FPCPROG),) -FPCPROG:=$(firstword $(FPCPROG)) -FPC:=$(shell $(FPCPROG) -PB) -ifneq ($(findstring Error,$(FPC)),) -override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) -endif -else -override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) -endif -endif -override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) -override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) -FOUNDFPC:=$(strip $(wildcard $(FPC))) -ifeq ($(FOUNDFPC),) -FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))) -ifeq ($(FOUNDFPC),) -$(error Compiler $(FPC) not found) -endif -endif -ifndef FPC_COMPILERINFO -FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO) -endif -ifndef FPC_VERSION -FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO)) -endif -export FPC FPC_VERSION FPC_COMPILERINFO -unexport CHECKDEPEND ALLDEPENDENCIES -ifndef CPU_TARGET -ifdef CPU_TARGET_DEFAULT -CPU_TARGET=$(CPU_TARGET_DEFAULT) -endif -endif -ifndef OS_TARGET -ifdef OS_TARGET_DEFAULT -OS_TARGET=$(OS_TARGET_DEFAULT) -endif -endif -ifneq ($(words $(FPC_COMPILERINFO)),5) -FPC_COMPILERINFO+=$(shell $(FPC) -iSP) -FPC_COMPILERINFO+=$(shell $(FPC) -iTP) -FPC_COMPILERINFO+=$(shell $(FPC) -iSO) -FPC_COMPILERINFO+=$(shell $(FPC) -iTO) -endif -ifndef CPU_SOURCE -CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) -endif -ifndef CPU_TARGET -CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) -endif -ifndef OS_SOURCE -OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) -endif -ifndef OS_TARGET -OS_TARGET:=$(word 5,$(FPC_COMPILERINFO)) -endif -FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) -FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) -ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) -TARGETSUFFIX=$(OS_TARGET) -SOURCESUFFIX=$(OS_SOURCE) -else -TARGETSUFFIX=$(FULL_TARGET) -SOURCESUFFIX=$(FULL_SOURCE) -endif -ifneq ($(FULL_TARGET),$(FULL_SOURCE)) -CROSSCOMPILE=1 -endif -ifeq ($(findstring makefile,$(MAKECMDGOALS)),) -ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) -$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) -endif -endif -ifneq ($(findstring $(OS_TARGET),$(BSDs)),) -BSDhier=1 -endif -ifeq ($(OS_TARGET),linux) -linuxHier=1 -endif -export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE -ifdef FPCDIR -override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) -override FPCDIR=wrong -endif -else -override FPCDIR=wrong -endif -ifdef DEFAULT_FPCDIR -ifeq ($(FPCDIR),wrong) -override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) -ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) -override FPCDIR=wrong -endif -endif -endif -ifeq ($(FPCDIR),wrong) -ifdef inUnix -override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) -ifeq ($(wildcard $(FPCDIR)/units),) -override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) -endif -else -override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) -override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) -override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) -override FPCDIR:=$(BASEDIR) -ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) -override FPCDIR=c:/pp -endif -endif -endif -endif -endif -ifndef CROSSBINDIR -CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) -endif -ifndef BINUTILSPREFIX -ifndef CROSSBINDIR -ifdef CROSSCOMPILE -BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- -endif -endif -endif -UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) -ifeq ($(UNITSDIR),) -UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) -endif -PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) -override PACKAGE_NAME=fpgfx -override PACKAGE_VERSION=0.2 -ifeq ($(FULL_TARGET),i386-linux) -override TARGET_UNITS+=gfx_x11 gfximpl -endif -override INSTALL_FPCPACKAGE=y -ifeq ($(FULL_TARGET),i386-linux) -override COMPILER_OPTIONS+=-S2h -endif -ifeq ($(FULL_TARGET),i386-linux) -override COMPILER_UNITDIR+=.. ../emulayer -endif -ifeq ($(FULL_TARGET),i386-linux) -override COMPILER_UNITTARGETDIR+=../units -endif -ifdef REQUIRE_UNITSDIR -override UNITSDIR+=$(REQUIRE_UNITSDIR) -endif -ifdef REQUIRE_PACKAGESDIR -override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) -endif -ifdef ZIPINSTALL -ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) -UNIXHier=1 -endif -else -ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) -UNIXHier=1 -endif -endif -ifndef INSTALL_PREFIX -ifdef PREFIX -INSTALL_PREFIX=$(PREFIX) -endif -endif -ifndef INSTALL_PREFIX -ifdef UNIXHier -INSTALL_PREFIX=/usr/local -else -ifdef INSTALL_FPCPACKAGE -INSTALL_BASEDIR:=/pp -else -INSTALL_BASEDIR:=/$(PACKAGE_NAME) -endif -endif -endif -export INSTALL_PREFIX -ifdef INSTALL_FPCSUBDIR -export INSTALL_FPCSUBDIR -endif -ifndef DIST_DESTDIR -DIST_DESTDIR:=$(BASEDIR) -endif -export DIST_DESTDIR -ifndef COMPILER_UNITTARGETDIR -ifdef PACKAGEDIR_MAIN -COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX) -else -COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX) -endif -endif -ifndef COMPILER_TARGETDIR -COMPILER_TARGETDIR=. -endif -ifndef INSTALL_BASEDIR -ifdef UNIXHier -ifdef INSTALL_FPCPACKAGE -INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) -else -INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) -endif -else -INSTALL_BASEDIR:=$(INSTALL_PREFIX) -endif -endif -ifndef INSTALL_BINDIR -ifdef UNIXHier -INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin -else -INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin -ifdef INSTALL_FPCPACKAGE -ifdef CROSSCOMPILE -ifdef CROSSINSTALL -INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX) -else -INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) -endif -else -INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) -endif -endif -endif -endif -ifndef INSTALL_UNITDIR -INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) -ifdef INSTALL_FPCPACKAGE -ifdef PACKAGE_NAME -INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) -endif -endif -endif -ifndef INSTALL_LIBDIR -ifdef UNIXHier -INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib -else -INSTALL_LIBDIR:=$(INSTALL_UNITDIR) -endif -endif -ifndef INSTALL_SOURCEDIR -ifdef UNIXHier -ifdef BSDhier -SRCPREFIXDIR=share/src -else -ifdef linuxHier -SRCPREFIXDIR=share/src -else -SRCPREFIXDIR=src -endif -endif -ifdef INSTALL_FPCPACKAGE -ifdef INSTALL_FPCSUBDIR -INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) -else -INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) -endif -else -INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -endif -else -ifdef INSTALL_FPCPACKAGE -ifdef INSTALL_FPCSUBDIR -INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) -else -INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) -endif -else -INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source -endif -endif -endif -ifndef INSTALL_DOCDIR -ifdef UNIXHier -ifdef BSDhier -DOCPREFIXDIR=share/doc -else -ifdef linuxHier -DOCPREFIXDIR=share/doc -else -DOCPREFIXDIR=doc -endif -endif -ifdef INSTALL_FPCPACKAGE -INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) -else -INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -endif -else -ifdef INSTALL_FPCPACKAGE -INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) -else -INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc -endif -endif -endif -ifndef INSTALL_EXAMPLEDIR -ifdef UNIXHier -ifdef INSTALL_FPCPACKAGE -ifdef BSDhier -INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) -else -ifdef linuxHier -INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples -else -INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) -endif -endif -else -ifdef BSDhier -INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -else -ifdef linuxHier -INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -else -INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) -endif -endif -endif -else -ifdef INSTALL_FPCPACKAGE -INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) -else -INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples -endif -endif -endif -ifndef INSTALL_DATADIR -INSTALL_DATADIR=$(INSTALL_BASEDIR) -endif -ifndef INSTALL_SHAREDDIR -INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib -endif -ifdef CROSSCOMPILE -ifndef CROSSBINDIR -CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) -ifeq ($(CROSSBINDIR),) -CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) -endif -endif -else -CROSSBINDIR= -endif -ifeq ($(OS_SOURCE),linux) -ifndef GCCLIBDIR -ifeq ($(CPU_TARGET),i386) -ifneq ($(findstring x86_64,$(shell uname -a)),) -ifeq ($(BINUTILSPREFIX),) -GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) -endif -endif -endif -ifeq ($(CPU_TARGET),powerpc64) -ifeq ($(BINUTILSPREFIX),) -GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) -endif -endif -endif -ifndef GCCLIBDIR -CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) -ifneq ($(CROSSGCC),) -GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) -endif -endif -ifndef OTHERLIBDIR -OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') -endif -endif -ifdef inUnix -ifeq ($(OS_SOURCE),netbsd) -OTHERLIBDIR+=/usr/pkg/lib -endif -export GCCLIBDIR OTHERLIB -endif -BATCHEXT=.bat -LOADEREXT=.as -EXEEXT=.exe -PPLEXT=.ppl -PPUEXT=.ppu -OEXT=.o -ASMEXT=.s -SMARTEXT=.sl -STATICLIBEXT=.a -SHAREDLIBEXT=.so -SHAREDLIBPREFIX=libfp -STATICLIBPREFIX=libp -IMPORTLIBPREFIX=libimp -RSTEXT=.rst -ifeq ($(findstring 1.0.,$(FPC_VERSION)),) -ifeq ($(OS_TARGET),go32v1) -STATICLIBPREFIX= -SHORTSUFFIX=v1 -endif -ifeq ($(OS_TARGET),go32v2) -STATICLIBPREFIX= -SHORTSUFFIX=dos -endif -ifeq ($(OS_TARGET),watcom) -STATICLIBPREFIX= -OEXT=.obj -ASMEXT=.asm -SHAREDLIBEXT=.dll -SHORTSUFFIX=wat -endif -ifeq ($(OS_TARGET),linux) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=lnx -endif -ifeq ($(OS_TARGET),freebsd) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=fbs -endif -ifeq ($(OS_TARGET),netbsd) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=nbs -endif -ifeq ($(OS_TARGET),openbsd) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=obs -endif -ifeq ($(OS_TARGET),win32) -SHAREDLIBEXT=.dll -SHORTSUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -BATCHEXT=.cmd -AOUTEXT=.out -STATICLIBPREFIX= -SHAREDLIBEXT=.dll -SHORTSUFFIX=os2 -ECHO=echo -endif -ifeq ($(OS_TARGET),emx) -BATCHEXT=.cmd -AOUTEXT=.out -STATICLIBPREFIX= -SHAREDLIBEXT=.dll -SHORTSUFFIX=emx -ECHO=echo -endif -ifeq ($(OS_TARGET),amiga) -EXEEXT= -SHAREDLIBEXT=.library -SHORTSUFFIX=amg -endif -ifeq ($(OS_TARGET),morphos) -EXEEXT= -SHAREDLIBEXT=.library -SHORTSUFFIX=mos -endif -ifeq ($(OS_TARGET),atari) -EXEEXT=.ttp -SHORTSUFFIX=ata -endif -ifeq ($(OS_TARGET),beos) -BATCHEXT=.sh -EXEEXT= -SHORTSUFFIX=be -endif -ifeq ($(OS_TARGET),solaris) -BATCHEXT=.sh -EXEEXT= -SHORTSUFFIX=sun -endif -ifeq ($(OS_TARGET),qnx) -BATCHEXT=.sh -EXEEXT= -SHORTSUFFIX=qnx -endif -ifeq ($(OS_TARGET),netware) -EXEEXT=.nlm -STATICLIBPREFIX= -SHORTSUFFIX=nw -endif -ifeq ($(OS_TARGET),netwlibc) -EXEEXT=.nlm -STATICLIBPREFIX= -SHORTSUFFIX=nwl -endif -ifeq ($(OS_TARGET),macos) -BATCHEXT= -EXEEXT= -DEBUGSYMEXT=.xcoff -SHORTSUFFIX=mac -endif -ifeq ($(OS_TARGET),darwin) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=dwn -endif -ifeq ($(OS_TARGET),gba) -EXEEXT=.gba -SHAREDLIBEXT=.so -SHORTSUFFIX=gba -endif -else -ifeq ($(OS_TARGET),go32v1) -PPUEXT=.pp1 -OEXT=.o1 -ASMEXT=.s1 -SMARTEXT=.sl1 -STATICLIBEXT=.a1 -SHAREDLIBEXT=.so1 -STATICLIBPREFIX= -SHORTSUFFIX=v1 -endif -ifeq ($(OS_TARGET),go32v2) -STATICLIBPREFIX= -SHORTSUFFIX=dos -endif -ifeq ($(OS_TARGET),watcom) -STATICLIBPREFIX= -SHORTSUFFIX=wat -endif -ifeq ($(OS_TARGET),linux) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=lnx -endif -ifeq ($(OS_TARGET),freebsd) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=fbs -endif -ifeq ($(OS_TARGET),netbsd) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=nbs -endif -ifeq ($(OS_TARGET),openbsd) -BATCHEXT=.sh -EXEEXT= -HASSHAREDLIB=1 -SHORTSUFFIX=obs -endif -ifeq ($(OS_TARGET),win32) -PPUEXT=.ppw -OEXT=.ow -ASMEXT=.sw -SMARTEXT=.slw -STATICLIBEXT=.aw -SHAREDLIBEXT=.dll -SHORTSUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -BATCHEXT=.cmd -PPUEXT=.ppo -ASMEXT=.so2 -OEXT=.oo2 -AOUTEXT=.out -SMARTEXT=.sl2 -STATICLIBPREFIX= -STATICLIBEXT=.ao2 -SHAREDLIBEXT=.dll -SHORTSUFFIX=os2 -ECHO=echo -endif -ifeq ($(OS_TARGET),amiga) -EXEEXT= -PPUEXT=.ppu -ASMEXT=.s -OEXT=.o -SMARTEXT=.sl -STATICLIBEXT=.a -SHAREDLIBEXT=.library -SHORTSUFFIX=amg -endif -ifeq ($(OS_TARGET),atari) -PPUEXT=.ppu -ASMEXT=.s -OEXT=.o -SMARTEXT=.sl -STATICLIBEXT=.a -EXEEXT=.ttp -SHORTSUFFIX=ata -endif -ifeq ($(OS_TARGET),beos) -BATCHEXT=.sh -PPUEXT=.ppu -ASMEXT=.s -OEXT=.o -SMARTEXT=.sl -STATICLIBEXT=.a -EXEEXT= -SHORTSUFFIX=be -endif -ifeq ($(OS_TARGET),solaris) -BATCHEXT=.sh -PPUEXT=.ppu -ASMEXT=.s -OEXT=.o -SMARTEXT=.sl -STATICLIBEXT=.a -EXEEXT= -SHORTSUFFIX=sun -endif -ifeq ($(OS_TARGET),qnx) -BATCHEXT=.sh -PPUEXT=.ppu -ASMEXT=.s -OEXT=.o -SMARTEXT=.sl -STATICLIBEXT=.a -EXEEXT= -SHORTSUFFIX=qnx -endif -ifeq ($(OS_TARGET),netware) -STATICLIBPREFIX= -PPUEXT=.ppu -OEXT=.o -ASMEXT=.s -SMARTEXT=.sl -STATICLIBEXT=.a -SHAREDLIBEXT=.nlm -EXEEXT=.nlm -SHORTSUFFIX=nw -endif -ifeq ($(OS_TARGET),netwlibc) -STATICLIBPREFIX= -PPUEXT=.ppu -OEXT=.o -ASMEXT=.s -SMARTEXT=.sl -STATICLIBEXT=.a -SHAREDLIBEXT=.nlm -EXEEXT=.nlm -SHORTSUFFIX=nwl -endif -ifeq ($(OS_TARGET),macos) -BATCHEXT= -PPUEXT=.ppu -ASMEXT=.s -OEXT=.o -SMARTEXT=.sl -STATICLIBEXT=.a -EXEEXT= -DEBUGSYMEXT=.xcoff -SHORTSUFFIX=mac -endif -endif -ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) -FPCMADE=fpcmade.$(SHORTSUFFIX) -ZIPSUFFIX=$(SHORTSUFFIX) -ZIPCROSSPREFIX= -ZIPSOURCESUFFIX=src -ZIPEXAMPLESUFFIX=exm -else -FPCMADE=fpcmade.$(TARGETSUFFIX) -ZIPSOURCESUFFIX=.source -ZIPEXAMPLESUFFIX=.examples -ifdef CROSSCOMPILE -ZIPSUFFIX=.$(SOURCESUFFIX) -ZIPCROSSPREFIX=$(TARGETSUFFIX)- -else -ZIPSUFFIX=.$(TARGETSUFFIX) -ZIPCROSSPREFIX= -endif -endif -ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ECHO),) -ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ECHO),) -ECHO= __missing_command_ECHO -else -ECHO:=$(firstword $(ECHO)) -endif -else -ECHO:=$(firstword $(ECHO)) -endif -endif -export ECHO -ifndef DATE -DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(DATE),) -DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(DATE),) -DATE= __missing_command_DATE -else -DATE:=$(firstword $(DATE)) -endif -else -DATE:=$(firstword $(DATE)) -endif -endif -export DATE -ifndef GINSTALL -GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(GINSTALL),) -GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(GINSTALL),) -GINSTALL= __missing_command_GINSTALL -else -GINSTALL:=$(firstword $(GINSTALL)) -endif -else -GINSTALL:=$(firstword $(GINSTALL)) -endif -endif -export GINSTALL -ifndef CPPROG -CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(CPPROG),) -CPPROG= __missing_command_CPPROG -else -CPPROG:=$(firstword $(CPPROG)) -endif -endif -export CPPROG -ifndef RMPROG -RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(RMPROG),) -RMPROG= __missing_command_RMPROG -else -RMPROG:=$(firstword $(RMPROG)) -endif -endif -export RMPROG -ifndef MVPROG -MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(MVPROG),) -MVPROG= __missing_command_MVPROG -else -MVPROG:=$(firstword $(MVPROG)) -endif -endif -export MVPROG -ifndef MKDIRPROG -MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(MKDIRPROG),) -MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(MKDIRPROG),) -MKDIRPROG= __missing_command_MKDIRPROG -else -MKDIRPROG:=$(firstword $(MKDIRPROG)) -endif -else -MKDIRPROG:=$(firstword $(MKDIRPROG)) -endif -endif -export MKDIRPROG -ifndef ECHOREDIR -ifndef inUnix -ECHOREDIR=echo -else -ECHOREDIR=$(ECHO) -endif -endif -ifndef COPY -COPY:=$(CPPROG) -fp -endif -ifndef COPYTREE -COPYTREE:=$(CPPROG) -Rfp -endif -ifndef MKDIRTREE -MKDIRTREE:=$(MKDIRPROG) -p -endif -ifndef MOVE -MOVE:=$(MVPROG) -f -endif -ifndef DEL -DEL:=$(RMPROG) -f -endif -ifndef DELTREE -DELTREE:=$(RMPROG) -rf -endif -ifndef INSTALL -ifdef inUnix -INSTALL:=$(GINSTALL) -c -m 644 -else -INSTALL:=$(COPY) -endif -endif -ifndef INSTALLEXE -ifdef inUnix -INSTALLEXE:=$(GINSTALL) -c -m 755 -else -INSTALLEXE:=$(COPY) -endif -endif -ifndef MKDIR -MKDIR:=$(GINSTALL) -m 755 -d -endif -export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR -ifndef PPUMOVE -PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUMOVE),) -PPUMOVE= __missing_command_PPUMOVE -else -PPUMOVE:=$(firstword $(PPUMOVE)) -endif -endif -export PPUMOVE -ifndef FPCMAKE -FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(FPCMAKE),) -FPCMAKE= __missing_command_FPCMAKE -else -FPCMAKE:=$(firstword $(FPCMAKE)) -endif -endif -export FPCMAKE -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= __missing_command_ZIPPROG -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= __missing_command_TARPROG -else -TARPROG:=$(firstword $(TARPROG)) -endif -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG -ASNAME=$(BINUTILSPREFIX)as -LDNAME=$(BINUTILSPREFIX)ld -ARNAME=$(BINUTILSPREFIX)ar -RCNAME=$(BINUTILSPREFIX)rc -ifneq ($(findstring 1.0.,$(FPC_VERSION)),) -ifeq ($(OS_TARGET),win32) -ifeq ($(CROSSBINDIR),) -ASNAME=asw -LDNAME=ldw -ARNAME=arw -endif -endif -endif -ifndef ASPROG -ifdef CROSSBINDIR -ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) -else -ASPROG=$(ASNAME) -endif -endif -ifndef LDPROG -ifdef CROSSBINDIR -LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) -else -LDPROG=$(LDNAME) -endif -endif -ifndef RCPROG -ifdef CROSSBINDIR -RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) -else -RCPROG=$(RCNAME) -endif -endif -ifndef ARPROG -ifdef CROSSBINDIR -ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) -else -ARPROG=$(ARNAME) -endif -endif -AS=$(ASPROG) -LD=$(LDPROG) -RC=$(RCPROG) -AR=$(ARPROG) -PPAS=ppas$(SRCBATCHEXT) -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif -ifdef DATE -DATESTR:=$(shell $(DATE) +%Y%m%d) -else -DATESTR= -endif -ifndef UPXPROG -ifeq ($(OS_TARGET),go32v2) -UPXPROG:=1 -endif -ifeq ($(OS_TARGET),win32) -UPXPROG:=1 -endif -ifdef UPXPROG -UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(UPXPROG),) -UPXPROG= -else -UPXPROG:=$(firstword $(UPXPROG)) -endif -else -UPXPROG= -endif -endif -export UPXPROG -ZIPOPT=-9 -ZIPEXT=.zip -ifeq ($(USETAR),bz2) -TAROPT=vj -TAREXT=.tar.bz2 -else -TAROPT=vz -TAREXT=.tar.gz -endif -override REQUIRE_PACKAGES=rtl fcl -ifeq ($(FULL_TARGET),i386-linux) -REQUIRE_PACKAGES_RTL=1 -REQUIRE_PACKAGES_HASH=1 -REQUIRE_PACKAGES_PASZLIB=1 -REQUIRE_PACKAGES_NETDB=1 -REQUIRE_PACKAGES_LIBASYNC=1 -REQUIRE_PACKAGES_PTHREADS=1 -REQUIRE_PACKAGES_FCL=1 -REQUIRE_PACKAGES_PASJPEG=1 -REQUIRE_PACKAGES_IBASE=1 -REQUIRE_PACKAGES_POSTGRES=1 -REQUIRE_PACKAGES_MYSQL=1 -REQUIRE_PACKAGES_ODBC=1 -REQUIRE_PACKAGES_ORACLE=1 -REQUIRE_PACKAGES_SQLITE=1 -endif -ifdef REQUIRE_PACKAGES_RTL -PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_RTL),) -ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) -UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) -else -UNITDIR_RTL=$(PACKAGEDIR_RTL) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_RTL)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE) -endif -else -PACKAGEDIR_RTL= -UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_RTL),) -UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override COMPILER_UNITDIR+=$(UNITDIR_RTL) -endif -endif -ifdef REQUIRE_PACKAGES_HASH -PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_HASH),) -ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),) -UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX) -else -UNITDIR_HASH=$(PACKAGEDIR_HASH) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_HASH)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE) -endif -else -PACKAGEDIR_HASH= -UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_HASH),) -UNITDIR_HASH:=$(firstword $(UNITDIR_HASH)) -else -UNITDIR_HASH= -endif -endif -ifdef UNITDIR_HASH -override COMPILER_UNITDIR+=$(UNITDIR_HASH) -endif -endif -ifdef REQUIRE_PACKAGES_PASZLIB -PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_PASZLIB),) -ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)),) -UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX) -else -UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_PASZLIB)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE) -endif -else -PACKAGEDIR_PASZLIB= -UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_PASZLIB),) -UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) -else -UNITDIR_PASZLIB= -endif -endif -ifdef UNITDIR_PASZLIB -override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) -endif -endif -ifdef REQUIRE_PACKAGES_NETDB -PACKAGEDIR_NETDB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /netdb/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_NETDB),) -ifneq ($(wildcard $(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX)),) -UNITDIR_NETDB=$(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX) -else -UNITDIR_NETDB=$(PACKAGEDIR_NETDB) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_NETDB)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_NETDB) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_NETDB)/$(FPCMADE) -endif -else -PACKAGEDIR_NETDB= -UNITDIR_NETDB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /netdb/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_NETDB),) -UNITDIR_NETDB:=$(firstword $(UNITDIR_NETDB)) -else -UNITDIR_NETDB= -endif -endif -ifdef UNITDIR_NETDB -override COMPILER_UNITDIR+=$(UNITDIR_NETDB) -endif -endif -ifdef REQUIRE_PACKAGES_LIBASYNC -PACKAGEDIR_LIBASYNC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libasync/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_LIBASYNC),) -ifneq ($(wildcard $(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX)),) -UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX) -else -UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_LIBASYNC)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_LIBASYNC) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBASYNC)/$(FPCMADE) -endif -else -PACKAGEDIR_LIBASYNC= -UNITDIR_LIBASYNC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libasync/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_LIBASYNC),) -UNITDIR_LIBASYNC:=$(firstword $(UNITDIR_LIBASYNC)) -else -UNITDIR_LIBASYNC= -endif -endif -ifdef UNITDIR_LIBASYNC -override COMPILER_UNITDIR+=$(UNITDIR_LIBASYNC) -endif -endif -ifdef REQUIRE_PACKAGES_PTHREADS -PACKAGEDIR_PTHREADS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_PTHREADS),) -ifneq ($(wildcard $(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX)),) -UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX) -else -UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_PTHREADS)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_PTHREADS) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_PTHREADS)/$(FPCMADE) -endif -else -PACKAGEDIR_PTHREADS= -UNITDIR_PTHREADS:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_PTHREADS),) -UNITDIR_PTHREADS:=$(firstword $(UNITDIR_PTHREADS)) -else -UNITDIR_PTHREADS= -endif -endif -ifdef UNITDIR_PTHREADS -override COMPILER_UNITDIR+=$(UNITDIR_PTHREADS) -endif -endif -ifdef REQUIRE_PACKAGES_FCL -PACKAGEDIR_FCL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_FCL),) -ifneq ($(wildcard $(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX)),) -UNITDIR_FCL=$(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX) -else -UNITDIR_FCL=$(PACKAGEDIR_FCL) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_FCL)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_FCL) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL)/$(FPCMADE) -endif -else -PACKAGEDIR_FCL= -UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_FCL),) -UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) -else -UNITDIR_FCL= -endif -endif -ifdef UNITDIR_FCL -override COMPILER_UNITDIR+=$(UNITDIR_FCL) -endif -endif -ifdef REQUIRE_PACKAGES_PASJPEG -PACKAGEDIR_PASJPEG:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_PASJPEG),) -ifneq ($(wildcard $(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX)),) -UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX) -else -UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_PASJPEG)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_PASJPEG) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_PASJPEG)/$(FPCMADE) -endif -else -PACKAGEDIR_PASJPEG= -UNITDIR_PASJPEG:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_PASJPEG),) -UNITDIR_PASJPEG:=$(firstword $(UNITDIR_PASJPEG)) -else -UNITDIR_PASJPEG= -endif -endif -ifdef UNITDIR_PASJPEG -override COMPILER_UNITDIR+=$(UNITDIR_PASJPEG) -endif -endif -ifdef REQUIRE_PACKAGES_IBASE -PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_IBASE),) -ifneq ($(wildcard $(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX)),) -UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX) -else -UNITDIR_IBASE=$(PACKAGEDIR_IBASE) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_IBASE)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_IBASE) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_IBASE)/$(FPCMADE) -endif -else -PACKAGEDIR_IBASE= -UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_IBASE),) -UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) -else -UNITDIR_IBASE= -endif -endif -ifdef UNITDIR_IBASE -override COMPILER_UNITDIR+=$(UNITDIR_IBASE) -endif -endif -ifdef REQUIRE_PACKAGES_POSTGRES -PACKAGEDIR_POSTGRES:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /postgres/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_POSTGRES),) -ifneq ($(wildcard $(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX)),) -UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX) -else -UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_POSTGRES)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_POSTGRES) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_POSTGRES)/$(FPCMADE) -endif -else -PACKAGEDIR_POSTGRES= -UNITDIR_POSTGRES:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /postgres/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_POSTGRES),) -UNITDIR_POSTGRES:=$(firstword $(UNITDIR_POSTGRES)) -else -UNITDIR_POSTGRES= -endif -endif -ifdef UNITDIR_POSTGRES -override COMPILER_UNITDIR+=$(UNITDIR_POSTGRES) -endif -endif -ifdef REQUIRE_PACKAGES_MYSQL -PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_MYSQL),) -ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX)),) -UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX) -else -UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_MYSQL)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_MYSQL) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_MYSQL)/$(FPCMADE) -endif -else -PACKAGEDIR_MYSQL= -UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_MYSQL),) -UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) -else -UNITDIR_MYSQL= -endif -endif -ifdef UNITDIR_MYSQL -override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) -endif -endif -ifdef REQUIRE_PACKAGES_ODBC -PACKAGEDIR_ODBC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /odbc/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_ODBC),) -ifneq ($(wildcard $(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX)),) -UNITDIR_ODBC=$(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX) -else -UNITDIR_ODBC=$(PACKAGEDIR_ODBC) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_ODBC)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_ODBC) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_ODBC)/$(FPCMADE) -endif -else -PACKAGEDIR_ODBC= -UNITDIR_ODBC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /odbc/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_ODBC),) -UNITDIR_ODBC:=$(firstword $(UNITDIR_ODBC)) -else -UNITDIR_ODBC= -endif -endif -ifdef UNITDIR_ODBC -override COMPILER_UNITDIR+=$(UNITDIR_ODBC) -endif -endif -ifdef REQUIRE_PACKAGES_ORACLE -PACKAGEDIR_ORACLE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /oracle/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_ORACLE),) -ifneq ($(wildcard $(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX)),) -UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX) -else -UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_ORACLE)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_ORACLE) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_ORACLE)/$(FPCMADE) -endif -else -PACKAGEDIR_ORACLE= -UNITDIR_ORACLE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /oracle/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_ORACLE),) -UNITDIR_ORACLE:=$(firstword $(UNITDIR_ORACLE)) -else -UNITDIR_ORACLE= -endif -endif -ifdef UNITDIR_ORACLE -override COMPILER_UNITDIR+=$(UNITDIR_ORACLE) -endif -endif -ifdef REQUIRE_PACKAGES_SQLITE -PACKAGEDIR_SQLITE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_SQLITE),) -ifneq ($(wildcard $(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX)),) -UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX) -else -UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_SQLITE)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_SQLITE) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_SQLITE)/$(FPCMADE) -endif -else -PACKAGEDIR_SQLITE= -UNITDIR_SQLITE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_SQLITE),) -UNITDIR_SQLITE:=$(firstword $(UNITDIR_SQLITE)) -else -UNITDIR_SQLITE= -endif -endif -ifdef UNITDIR_SQLITE -override COMPILER_UNITDIR+=$(UNITDIR_SQLITE) -endif -endif -ifndef NOCPUDEF -override FPCOPTDEF=$(CPU_TARGET) -endif -ifneq ($(OS_TARGET),$(OS_SOURCE)) -override FPCOPT+=-T$(OS_TARGET) -endif -ifneq ($(CPU_TARGET),$(CPU_SOURCE)) -override FPCOPT+=-P$(CPU_TARGET) -endif -ifeq ($(OS_SOURCE),openbsd) -override FPCOPT+=-FD$(NEW_BINUTILS_PATH) -endif -ifndef CROSSBOOTSTRAP -ifneq ($(BINUTILSPREFIX),) -override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc -endif -ifneq ($(BINUTILSPREFIX),) -override FPCOPT+=-Xr$(RLINKPATH) -endif -endif -ifdef UNITDIR -override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) -endif -ifdef LIBDIR -override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) -endif -ifdef OBJDIR -override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) -endif -ifdef INCDIR -override FPCOPT+=$(addprefix -Fi,$(INCDIR)) -endif -ifdef LINKSMART -override FPCOPT+=-XX -endif -ifdef CREATESMART -override FPCOPT+=-CX -endif -ifdef DEBUG -override FPCOPT+=-gl -override FPCOPTDEF+=DEBUG -endif -ifdef RELEASE -ifneq ($(findstring 2.0.,$(FPC_VERSION)),) -ifeq ($(CPU_TARGET),i386) -FPCCPUOPT:=-OG2p3 -endif -ifeq ($(CPU_TARGET),powerpc) -FPCCPUOPT:=-O1r -endif -else -FPCCPUOPT:=-O1r -endif -override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n -override FPCOPTDEF+=RELEASE -endif -ifdef STRIP -override FPCOPT+=-Xs -endif -ifdef OPTIMIZE -override FPCOPT+=-O2 -endif -ifdef VERBOSE -override FPCOPT+=-vwni -endif -ifdef COMPILER_OPTIONS -override FPCOPT+=$(COMPILER_OPTIONS) -endif -ifdef COMPILER_UNITDIR -override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) -endif -ifdef COMPILER_LIBRARYDIR -override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) -endif -ifdef COMPILER_OBJECTDIR -override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) -endif -ifdef COMPILER_INCLUDEDIR -override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) -endif -ifdef CROSSBINDIR -override FPCOPT+=-FD$(CROSSBINDIR) -endif -ifdef COMPILER_TARGETDIR -override FPCOPT+=-FE$(COMPILER_TARGETDIR) -ifeq ($(COMPILER_TARGETDIR),.) -override TARGETDIRPREFIX= -else -override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ -endif -endif -ifdef COMPILER_UNITTARGETDIR -override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) -ifeq ($(COMPILER_UNITTARGETDIR),.) -override UNITTARGETDIRPREFIX= -else -override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ -endif -else -ifdef COMPILER_TARGETDIR -override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) -override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) -endif -endif -ifdef CREATESHARED -override FPCOPT+=-Cg -ifeq ($(CPU_TARGET),i386) -override FPCOPT+=-Aas -endif -endif -ifdef LINKSHARED -endif -ifdef GCCLIBDIR -override FPCOPT+=-Fl$(GCCLIBDIR) -endif -ifdef OTHERLIBDIR -override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) -endif -ifdef OPT -override FPCOPT+=$(OPT) -endif -ifdef FPCOPTDEF -override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) -endif -ifdef CFGFILE -override FPCOPT+=@$(CFGFILE) -endif -ifdef USEENV -override FPCEXTCMD:=$(FPCOPT) -override FPCOPT:=!FPCEXTCMD -export FPCEXTCMD -endif -override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) -override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) -ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) -override ACROSSCOMPILE=1 -endif -ifdef ACROSSCOMPILE -override FPCOPT+=$(CROSSOPT) -endif -override COMPILER:=$(FPC) $(FPCOPT) -ifeq (,$(findstring -s ,$(COMPILER))) -EXECPPAS= -else -ifeq ($(FULL_SOURCE),$(FULL_TARGET)) -EXECPPAS:=@$(PPAS) -endif -endif -.PHONY: fpc_units -ifneq ($(TARGET_UNITS),) -override ALLTARGET+=fpc_units -override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) -override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS)) -override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) -override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) -endif -fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES) -ifdef TARGET_RSTS -override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) -override CLEANRSTFILES+=$(RSTFILES) -endif -.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared -$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) - @$(ECHOREDIR) Compiled > $(FPCMADE) -fpc_all: $(FPCMADE) -fpc_smart: - $(MAKE) all LINKSMART=1 CREATESMART=1 -fpc_debug: - $(MAKE) all DEBUG=1 -fpc_release: - $(MAKE) all RELEASE=1 -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res -$(COMPILER_UNITTARGETDIR): - $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) -$(COMPILER_TARGETDIR): - $(MKDIRTREE) $(COMPILER_TARGETDIR) -%$(PPUEXT): %.pp - $(COMPILER) $< - $(EXECPPAS) -%$(PPUEXT): %.pas - $(COMPILER) $< - $(EXECPPAS) -%$(EXEEXT): %.pp - $(COMPILER) $< - $(EXECPPAS) -%$(EXEEXT): %.pas - $(COMPILER) $< - $(EXECPPAS) -%$(EXEEXT): %.lpr - $(COMPILER) $< - $(EXECPPAS) -%$(EXEEXT): %.dpr - $(COMPILER) $< - $(EXECPPAS) -%.res: %.rc - windres -i $< -o $@ -vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) -vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) -vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) -vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) -vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) -vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) -.PHONY: fpc_shared -override INSTALLTARGET+=fpc_shared_install -ifndef SHARED_LIBVERSION -SHARED_LIBVERSION=$(FPC_VERSION) -endif -ifndef SHARED_LIBNAME -SHARED_LIBNAME=$(PACKAGE_NAME) -endif -ifndef SHARED_FULLNAME -SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) -endif -ifndef SHARED_LIBUNITS -SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) -override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) -endif -fpc_shared: -ifdef HASSHAREDLIB - $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 -ifneq ($(SHARED_BUILD),n) - $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) -endif -else - @$(ECHO) Shared Libraries not supported -endif -fpc_shared_install: -ifneq ($(SHARED_BUILD),n) -ifneq ($(SHARED_LIBUNITS),) -ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) - $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) -endif -endif -endif -.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall -ifdef INSTALL_UNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) -endif -ifdef INSTALL_BUILDUNIT -override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) -endif -ifdef INSTALLPPUFILES -override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) -ifneq ($(UNITTARGETDIRPREFIX),) -override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) -override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) -endif -override INSTALL_CREATEPACKAGEFPC=1 -endif -ifdef INSTALLEXEFILES -ifneq ($(TARGETDIRPREFIX),) -override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) -endif -endif -fpc_install: all $(INSTALLTARGET) -ifdef INSTALLEXEFILES - $(MKDIR) $(INSTALL_BINDIR) -ifdef UPXPROG - -$(UPXPROG) $(INSTALLEXEFILES) -endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) -endif -ifdef INSTALL_CREATEPACKAGEFPC -ifdef FPCMAKE -ifdef PACKAGE_VERSION -ifneq ($(wildcard Makefile.fpc),) - $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc - $(MKDIR) $(INSTALL_UNITDIR) - $(INSTALL) Package.fpc $(INSTALL_UNITDIR) -endif -endif -endif -endif -ifdef INSTALLPPUFILES - $(MKDIR) $(INSTALL_UNITDIR) - $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) -ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) -endif -ifneq ($(wildcard $(LIB_FULLNAME)),) - $(MKDIR) $(INSTALL_LIBDIR) - $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) -ifdef inUnix - ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) -endif -endif -endif -ifdef INSTALL_FILES - $(MKDIR) $(INSTALL_DATADIR) - $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) -endif -fpc_sourceinstall: distclean - $(MKDIR) $(INSTALL_SOURCEDIR) - $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) -fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) -ifdef HASEXAMPLES - $(MKDIR) $(INSTALL_EXAMPLEDIR) -endif -ifdef EXAMPLESOURCEFILES - $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) -endif -ifdef TARGET_EXAMPLEDIRS - $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) -endif -.PHONY: fpc_distinstall -fpc_distinstall: install exampleinstall -.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall -ifndef PACKDIR -ifndef inUnix -PACKDIR=$(BASEDIR)/../fpc-pack -else -PACKDIR=/tmp/fpc-pack -endif -endif -ifndef ZIPNAME -ifdef DIST_ZIPNAME -ZIPNAME=$(DIST_ZIPNAME) -else -ZIPNAME=$(PACKAGE_NAME) -endif -endif -ifndef FULLZIPNAME -FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX) -endif -ifndef ZIPTARGET -ifdef DIST_ZIPTARGET -ZIPTARGET=DIST_ZIPTARGET -else -ZIPTARGET=install -endif -endif -ifndef USEZIP -ifdef inUnix -USETAR=1 -endif -endif -ifndef inUnix -USEZIPWRAPPER=1 -endif -ifdef USEZIPWRAPPER -ZIPPATHSEP=$(PATHSEP) -ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT)) -else -ZIPPATHSEP=/ -endif -ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) -ifdef USETAR -ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT) -ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * -else -ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * -endif -fpc_zipinstall: - $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 - $(MKDIR) $(DIST_DESTDIR) - $(DEL) $(ZIPDESTFILE) -ifdef USEZIPWRAPPER -ifneq ($(ECHOREDIR),echo) - $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) - $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) - $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) -else - echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) -endif -ifdef inUnix - /bin/sh $(ZIPWRAPPER) -else - $(ZIPWRAPPER) -endif - $(DEL) $(ZIPWRAPPER) -else - $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) -endif - $(DELTREE) $(PACKDIR) -fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX) -fpc_zipexampleinstall: -ifdef HASEXAMPLES - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX) -endif -fpc_zipdistinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=distinstall -.PHONY: fpc_clean fpc_cleanall fpc_distclean -ifdef EXEFILES -override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) -endif -ifdef CLEAN_UNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) -endif -ifdef CLEANPPUFILES -override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) -ifdef DEBUGSYMEXT -override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) -endif -override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) -endif -fpc_clean: $(CLEANTARGET) -ifdef CLEANEXEFILES - -$(DEL) $(CLEANEXEFILES) -endif -ifdef CLEANPPUFILES - -$(DEL) $(CLEANPPUFILES) -endif -ifneq ($(CLEANPPULINKFILES),) - -$(DEL) $(CLEANPPULINKFILES) -endif -ifdef CLEANRSTFILES - -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) -endif -ifdef CLEAN_FILES - -$(DEL) $(CLEAN_FILES) -endif -ifdef LIB_NAME - -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) -endif - -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) - -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) -fpc_cleanall: $(CLEANTARGET) -ifdef CLEANEXEFILES - -$(DEL) $(CLEANEXEFILES) -endif -ifdef COMPILER_UNITTARGETDIR -ifdef CLEANPPUFILES - -$(DEL) $(CLEANPPUFILES) -endif -ifneq ($(CLEANPPULINKFILES),) - -$(DEL) $(CLEANPPULINKFILES) -endif -ifdef CLEANRSTFILES - -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) -endif -endif - -$(DELTREE) units - -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -ifneq ($(PPUEXT),.ppu) - -$(DEL) *.o *.ppu *.a -endif - -$(DELTREE) *$(SMARTEXT) - -$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) - -$(DEL) *_ppas$(BATCHEXT) -ifdef AOUTEXT - -$(DEL) *$(AOUTEXT) -endif -ifdef DEBUGSYMEXT - -$(DEL) *$(DEBUGSYMEXT) -endif -fpc_distclean: cleanall -.PHONY: fpc_baseinfo -override INFORULES+=fpc_baseinfo -fpc_baseinfo: - @$(ECHO) - @$(ECHO) == Package info == - @$(ECHO) Package Name..... $(PACKAGE_NAME) - @$(ECHO) Package Version.. $(PACKAGE_VERSION) - @$(ECHO) - @$(ECHO) == Configuration info == - @$(ECHO) - @$(ECHO) FPC.......... $(FPC) - @$(ECHO) FPC Version.. $(FPC_VERSION) - @$(ECHO) Source CPU... $(CPU_SOURCE) - @$(ECHO) Target CPU... $(CPU_TARGET) - @$(ECHO) Source OS.... $(OS_SOURCE) - @$(ECHO) Target OS.... $(OS_TARGET) - @$(ECHO) Full Source.. $(FULL_SOURCE) - @$(ECHO) Full Target.. $(FULL_TARGET) - @$(ECHO) SourceSuffix. $(SOURCESUFFIX) - @$(ECHO) TargetSuffix. $(TARGETSUFFIX) - @$(ECHO) - @$(ECHO) == Directory info == - @$(ECHO) - @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) - @$(ECHO) - @$(ECHO) Basedir......... $(BASEDIR) - @$(ECHO) FPCDir.......... $(FPCDIR) - @$(ECHO) CrossBinDir..... $(CROSSBINDIR) - @$(ECHO) UnitsDir........ $(UNITSDIR) - @$(ECHO) PackagesDir..... $(PACKAGESDIR) - @$(ECHO) - @$(ECHO) GCC library..... $(GCCLIBDIR) - @$(ECHO) Other library... $(OTHERLIBDIR) - @$(ECHO) - @$(ECHO) == Tools info == - @$(ECHO) - @$(ECHO) As........ $(AS) - @$(ECHO) Ld........ $(LD) - @$(ECHO) Ar........ $(AR) - @$(ECHO) Rc........ $(RC) - @$(ECHO) - @$(ECHO) Mv........ $(MVPROG) - @$(ECHO) Cp........ $(CPPROG) - @$(ECHO) Rm........ $(RMPROG) - @$(ECHO) GInstall.. $(GINSTALL) - @$(ECHO) Echo...... $(ECHO) - @$(ECHO) Shell..... $(SHELL) - @$(ECHO) Date...... $(DATE) - @$(ECHO) FPCMake... $(FPCMAKE) - @$(ECHO) PPUMove... $(PPUMOVE) - @$(ECHO) Upx....... $(UPXPROG) - @$(ECHO) Zip....... $(ZIPPROG) - @$(ECHO) - @$(ECHO) == Object info == - @$(ECHO) - @$(ECHO) Target Loaders........ $(TARGET_LOADERS) - @$(ECHO) Target Units.......... $(TARGET_UNITS) - @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) - @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) - @$(ECHO) Target Dirs........... $(TARGET_DIRS) - @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) - @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) - @$(ECHO) - @$(ECHO) Clean Units......... $(CLEAN_UNITS) - @$(ECHO) Clean Files......... $(CLEAN_FILES) - @$(ECHO) - @$(ECHO) Install Units....... $(INSTALL_UNITS) - @$(ECHO) Install Files....... $(INSTALL_FILES) - @$(ECHO) - @$(ECHO) == Install info == - @$(ECHO) - @$(ECHO) DateStr.............. $(DATESTR) - @$(ECHO) ZipName.............. $(ZIPNAME) - @$(ECHO) ZipPrefix............ $(ZIPPREFIX) - @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX) - @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) - @$(ECHO) FullZipName.......... $(FULLZIPNAME) - @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) - @$(ECHO) - @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) - @$(ECHO) Install binary dir... $(INSTALL_BINDIR) - @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) - @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) - @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) - @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) - @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) - @$(ECHO) Install data dir..... $(INSTALL_DATADIR) - @$(ECHO) - @$(ECHO) Dist destination dir. $(DIST_DESTDIR) - @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) - @$(ECHO) -.PHONY: fpc_info -fpc_info: $(INFORULES) -.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ - fpc_makefile_dirs -fpc_makefile: - $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc -fpc_makefile_sub1: -ifdef TARGET_DIRS - $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) -endif -ifdef TARGET_EXAMPLEDIRS - $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) -endif -fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) -fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 -fpc_makefiles: fpc_makefile fpc_makefile_dirs -all: fpc_all -debug: fpc_debug -smart: fpc_smart -release: fpc_release -units: fpc_units -examples: -shared: fpc_shared -install: fpc_install -sourceinstall: fpc_sourceinstall -exampleinstall: fpc_exampleinstall -distinstall: fpc_distinstall -zipinstall: fpc_zipinstall -zipsourceinstall: fpc_zipsourceinstall -zipexampleinstall: fpc_zipexampleinstall -zipdistinstall: fpc_zipdistinstall -clean: fpc_clean -distclean: fpc_distclean -cleanall: fpc_cleanall -info: fpc_info -makefiles: fpc_makefiles -.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles -ifneq ($(wildcard fpcmake.loc),) -include fpcmake.loc -endif diff --git a/gfx/x11/Makefile.fpc b/gfx/x11/Makefile.fpc deleted file mode 100644 index dcc60812..00000000 --- a/gfx/x11/Makefile.fpc +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile.fpc for fpGFX X11 target -# - -[package] -name=fpgfx -version=0.3 - -[require] -packages=fcl -unitdir=.. ../emulayer - -[target] -units=gfx_x11 gfxinterface -rst=gfx_x11 - -[compiler] -unitdir=.. ../emulayer -unittargetdir=../units -options=-S2h - -[install] -fpcpackage=y - -[default] -fpcdir=/opt/fpc/src - diff --git a/gfx/x11/build.sh b/gfx/x11/build.sh deleted file mode 100755 index 43f0e876..00000000 --- a/gfx/x11/build.sh +++ /dev/null @@ -1,3 +0,0 @@ - -ppc386 -S2cgi -O1 -gl -vewnhi -l -Fu../ -Fu. -FUlib/i386-linux/ fpgfxpackage.pas - diff --git a/gfx/x11/fpgfxpackage.lpk b/gfx/x11/fpgfxpackage.lpk deleted file mode 100644 index fc7f3ad9..00000000 --- a/gfx/x11/fpgfxpackage.lpk +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0"?> -<CONFIG> - <Package Version="2"> - <Name Value="fpgfxpackage"/> - <Author Value="Graeme Geldenhuys"/> - <CompilerOptions> - <Version Value="5"/> - <SearchPaths> - <OtherUnitFiles Value="../"/> - <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> - </SearchPaths> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> - <Description Value="Free Pascal GFX Library - [Linux] -"/> - <License Value="Modified LGPL -"/> - <Version Minor="4"/> - <Files Count="9"> - <Item1> - <Filename Value="../gfxbase.pas"/> - <UnitName Value="GfxBase"/> - </Item1> - <Item2> - <Filename Value="gfx_x11.pas"/> - <UnitName Value="GFX_X11"/> - </Item2> - <Item3> - <Filename Value="gfxinterface.pas"/> - <UnitName Value="gfxinterface"/> - </Item3> - <Item4> - <Filename Value="../schar16.pas"/> - <UnitName Value="schar16"/> - </Item4> - <Item5> - <Filename Value="../unitkeys.pas"/> - <UnitName Value="unitkeys"/> - </Item5> - <Item6> - <Filename Value="../fpgfx.pas"/> - <UnitName Value="fpgfx"/> - </Item6> - <Item7> - <Filename Value="../gelimage.pas"/> - <UnitName Value="GELImage"/> - </Item7> - <Item8> - <Filename Value="../commandlineparams.pas"/> - <UnitName Value="CommandLineParams"/> - </Item8> - <Item9> - <Filename Value="../fputf8utils.pas"/> - <UnitName Value="fpUTF8Utils"/> - </Item9> - </Files> - <LazDoc Paths="../../docs/xml/gfx/"/> - <RequiredPkgs Count="1"> - <Item1> - <PackageName Value="FCL"/> - <MinVersion Major="1" Valid="True"/> - </Item1> - </RequiredPkgs> - <UsageOptions> - <UnitPath Value="$(PkgOutDir)/"/> - </UsageOptions> - <PublishOptions> - <Version Value="2"/> - <IgnoreBinaries Value="False"/> - </PublishOptions> - </Package> -</CONFIG> diff --git a/gfx/x11/fpgfxpackage.pas b/gfx/x11/fpgfxpackage.pas deleted file mode 100644 index e3e60e76..00000000 --- a/gfx/x11/fpgfxpackage.pas +++ /dev/null @@ -1,15 +0,0 @@ -{ This file was automatically created by Lazarus. Do not edit! -This source is only used to compile and install the package. - } - -unit fpgfxpackage; - -interface - -uses - GfxBase, GFX_X11, gfxinterface, schar16, unitkeys, fpgfx, GELImage, - CommandLineParams, fpUTF8Utils; - -implementation - -end. diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas deleted file mode 100644 index 37674396..00000000 --- a/gfx/x11/gfx_x11.pas +++ /dev/null @@ -1,2037 +0,0 @@ -{ - fpGUI - Free Pascal Graphical User Interface - - GFX_X11 - X11/XLib target implementation - - Copyright (C) 2006 - 2007 See the file AUTHORS, included in this - distribution, for details of the copyright. - - See the file COPYING.modifiedLGPL, included in this distribution, - for details about the copyright. - - 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. -} -unit GFX_X11; - -{$IFDEF Debug} - {$ASSERTIONS On} -{$ENDIF} - -{$ifdef fpc} - {$mode objfpc}{$H+} -{$endif} - - -interface - -uses - SysUtils, Classes, ctypes, // FPC units - X, XLib, XUtil, // X11 units - unitxft, // Xft font support - GfxBase; // fpGFX units - - -resourcestring - // X11 exception strings - SGCCreationFailed = 'Creation of X11 graphics context failed'; - SXCanvasInvalidFontClass = 'Tried to set font of class "%s" into X11 context; only TXFont is allowed.'; - SOpenDisplayFailed = 'Opening of display "%s" failed'; - SWindowCreationFailed = 'Creation of X11 window failed'; - SWindowUnsupportedPixelFormat = 'Window uses unsupported pixel format: %d bits per pixel'; - SNoDefaultFont = 'Unable to load default font'; - SIncompatibleCanvasForBlitting = 'Cannot blit from %s to %s'; - - -type - EX11Error = class(EGfxError); - TX11Canvas = class; - TX11Application = class; - - // Returns True if it 'ate' the event - TX11EventFilter = function (const AEvent: TXEvent): Boolean of object; - - - { This will hide the actual font implementation form the rest of GFX/X11 } - - { TX11FontResourceImpl } - - TX11FontResourceImpl = class(TObject) - private - FFontData: PXftFont; - public - constructor Create(const Descriptor: String); - destructor Destroy; override; - function GetAscent: integer; - function GetDescent: integer; - function GetHeight: integer; - property FontData: PXftFont read FFontData; - end; - - - { TX11Font } - - TX11Font = class(TFCustomFont) - private - FFontStruct: TX11FontResourceImpl; - public - constructor Create(const Descriptor: String); - destructor Destroy; override; - class function GetDefaultFontName(const AFontClass: TGfxFontClass): String; override; - property FontStruct: TX11FontResourceImpl read FFontStruct; - end; - - - PX11CanvasState = ^TX11CanvasState; - TX11CanvasState = record - Prev: PX11CanvasState; - Matrix: TGfxMatrix; - Region: TRegion; - Color: TGfxPixel; - Font: TFCustomFont; - end; - - - { TX11Canvas } - - TX11Canvas = class(TFCustomCanvas) - private - FGC: TGC; - FVisual: PVisual; - FRegion: TRegion; - FDefaultFont: TX11FontResourceImpl; - FFontStruct: TX11FontResourceImpl; - FXftDraw: PXftDraw; - FStateStackpointer: PX11CanvasState; - FColormap: TColormap; - FCurColor: TGfxPixel; - FFont: TFCustomFont; - procedure Resized(NewWidth, NewHeight: Integer); - protected - function DoExcludeClipRect(const ARect: TRect): Boolean; override; - function DoIntersectClipRect(const ARect: TRect): Boolean; override; - function DoUnionClipRect(const ARect: TRect): Boolean; override; - function DoGetClipRect: TRect; override; - procedure DoDrawArc(const ARect: TRect; StartAngle, EndAngle: Single); override; - procedure DoDrawCircle(const ARect: TRect); override; - procedure DoDrawLine(const AFrom, ATo: TPoint); override; - procedure DoDrawRect(const ARect: TRect); override; - procedure DoDrawPoint(const APoint: TPoint); override; - procedure DoFillRect(const ARect: TRect); override; - procedure DoFillTriangle(const P1, P2, P3: TPoint); override; - procedure DoTextOut(const APosition: TPoint; const AText: String); override; - procedure DoCopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; const ADestPos: TPoint); override; - procedure DoMaskedCopyRect(ASource, AMask: TFCustomCanvas; const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); override; - procedure DoDrawImageRect(AImage: TFCustomBitmap; ASourceRect: TRect; const ADestPos: TPoint); override; - public - constructor Create(AColormap: TColormap; AXDrawable: X.TDrawable; ADefaultFont: TX11FontResourceImpl); - destructor Destroy; override; - function MapColor(const AColor: TGfxColor): TGfxPixel; override; - function FontCellHeight: Integer; override; - function TextExtent(const AText: String): TSize; override; - procedure SaveState; override; - procedure RestoreState; override; - procedure EmptyClipRect; override; - procedure DoSetColor(AColor: TGfxPixel); override; - procedure SetFont(AFont: TFCustomFont); override; - procedure SetLineStyle(ALineStyle: TGfxLineStyle); override; - procedure DrawPolyLine(const Coords: array of TPoint); override; - property GC: TGC read FGC; - property Visual: PVisual read FVisual; - property Colormap: TColormap read FColormap; - property Region: TRegion read FRegion; - end; - - - TX11WindowCanvas = class(TX11Canvas) - public - constructor Create(AColormap: TColormap; - AXDrawable: X.TDrawable; ADefaultFont: TX11FontResourceImpl); - end; - - - TX11PixmapCanvas = class(TX11Canvas) - public - constructor Create(AColormap: TColormap; - AHandle: TPixmap; APixelFormat: TGfxPixelFormat); - destructor Destroy; override; - end; - - - TX11MonoPixmapCanvas = class(TX11PixmapCanvas) - constructor Create(AColormap: TColormap; AHandle: TPixmap); - end; - - { TX11Bitmap } - - TX11Bitmap = class(TFCustomBitmap) - private - IsLocked: Boolean; - public - constructor Create(AWidth, AHeight: Integer; APixelFormat: TGfxPixelFormat); override; - destructor Destroy; override; - procedure Lock(out AData: Pointer; out AStride: LongWord); override; - procedure Unlock; override; - end; - - { TX11Screen } - - TX11Screen = class(TFCustomScreen) - private - FScreenIndex: Integer; - FScreenInfo: PScreen; - protected - procedure SetMousePos(const NewPos: TPoint); override; - function GetMousePos: TPoint; override; - public - constructor Create; override; - function CreateBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas; override; - function CreateMonoBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas; override; - property ScreenIndex: Integer read FScreenIndex; - property ScreenInfo: PScreen read FScreenInfo; - end; - - - { TX11Application } - - TX11Application = class(TFCustomApplication) - private - FDefaultFont: TX11FontResourceImpl; - FEventFilter: TX11EventFilter; - Handle: PDisplay; - FWMProtocols: TAtom; // Atom for "WM_PROTOCOLS" - FWMDeleteWindow: TAtom; // Atom for "WM_DELETE_WINDOW" - FWMHints: TAtom; // Atom for "_MOTIF_WM_HINTS" - function FindWindowByXID(XWindowID: X.TWindow): TFCustomWindow; - public - { default methods } - constructor Create; override; - destructor Destroy; override; - procedure Initialize(ADisplayName: String = ''); override; - procedure Run; override; - procedure Quit; override; - { properties } - property X11Display: PDisplay read Handle; - property DisplayName: String read FDisplayName write FDisplayName; - property EventFilter: TX11EventFilter read FEventFilter write FEventFilter; - end; - - { TX11Window } - - TX11Window = class(TFCustomWindow) - private - FHandle: PtrUInt; - FComposeStatus: TXComposeStatus; - FComposeBuffer: String[32]; - FCurCursorHandle: X.TCursor; - FXEvent: PXEvent; - function StartComposing(const Event: TXEvent): TKeySym; - procedure EndComposing; - procedure Configure(var Event: TXConfigureEvent); message X.ConfigureNotify; - procedure ClientMessage(var Event: TXClientMessageEvent); message X.ClientMessage; - protected - IsExposing: Boolean; - CanMaximize: Boolean; - - { Internal resource allocation methods } - procedure DoSetCursor; override; - procedure DoSetWindowOptions; override; - function GetHandle: PtrUInt; override; - procedure CreateWindow; override; - - { Other internal methods } - function ConvertShiftState(AState: Cardinal): TShiftState; - function KeySymToKeycode(KeySym: TKeySym): Word; - procedure UpdateMotifWMHints; - - { Event processing methods } - procedure EvCreate; override; - procedure EvFocusIn; override; - procedure EvFocusOut; override; - procedure EvHide; override; - procedure EvKeyPressed(AKey: Word); override; - procedure EvKeyReleased(AKey: Word); override; - procedure EvKeyChar(AKeyChar: Char); override; - procedure EvMouseEnter(const AMousePos: TPoint); override; - procedure EvMouseLeave; override; - procedure EvMousePressed(AButton: TMouseButton; const AMousePos: TPoint); override; - procedure EvMouseReleased(AButton: TMouseButton; const AMousePos: TPoint); override; - procedure EvMouseMove(const AMousePos: TPoint); override; - procedure EvMouseWheel(AWheelDelta: Single; const AMousePos: TPoint); override; - procedure EvPaint; override; - procedure EvMove; override; - procedure EvResize; override; - procedure EvShow; override; - public - { Constructors / Destructors } - constructor Create(AParent: TFCustomWindow; AWindowOptions: TFWindowOptions); override; - destructor Destroy; override; - { Widget controling methods } - function GetTitle: String; override; - procedure SetTitle(const ATitle: String); override; - procedure SetPosition(const APosition: TPoint); override; - procedure SetSize(const ASize: TSize); override; - procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); override; - procedure SetClientSize(const ASize: TSize); override; - procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); override; - procedure Show; override; - procedure Invalidate; override; - procedure CaptureMouse; override; - procedure ReleaseMouse; override; - end; - - -var - LeaderWindow: X.TWindow; - ClientLeaderAtom: TAtom; - -function RectToXRect(const ARect: TRect): TXRectangle; -function XRectToRect(const ARect: TXRectangle): TRect; -function GetXEventName(Event: LongInt): String; -function XButtonToMouseButton(const XButton: cint; var MouseButton: TMouseButton): Boolean; - -implementation - -uses - GELImage - ,fpGFX - ,fpUTF8Utils - ,Xatom - {,keysym ,libc , } - ; - -resourcestring - SFontCreationFailed = 'Could not create font with descriptor "%s"'; - -{ TX11Font } - -constructor TX11Font.Create(const Descriptor: String); -begin - inherited Create; - FFontStruct := TX11FontResourceImpl.Create(Descriptor); -end; - -destructor TX11Font.Destroy; -begin - if Assigned(FontStruct) then - begin - FFontStruct.Free; - end; - inherited Destroy; -end; - -class function TX11Font.GetDefaultFontName(const AFontClass: TGfxFontClass): String; -const - FontNames: array[TGfxFontClass] of String = ( - 'times', 'bitstream vera sans', 'courier', 'symbol'); -begin - Result := FontNames[AFontClass]; -end; - - -{ TX11Canvas } - -constructor TX11Canvas.Create(AColormap: TColormap; AXDrawable: X.TDrawable; ADefaultFont: TX11FontResourceImpl); -var - DummyWnd: PWindow; - DummyInt: LongInt; - GCValues: XLib.TXGCValues; -begin - inherited Create; - FColormap := AColormap; - FHandle := AXDrawable; - FDefaultFont := ADefaultFont; - XGetGeometry(GFApplication.Handle, Handle, @DummyWnd, @DummyInt, @DummyInt, - @FWidth, @FHeight, @DummyInt, @DummyInt); - - GCValues.graphics_exposures := False; - FGC := XCreateGC(GFApplication.Handle, Handle, GCGraphicsExposures, @GCValues); - if not Assigned(GC) then - raise EX11Error.Create(SGCCreationFailed); - - XSetLineAttributes(GFApplication.Handle, GC, 0, - LineSolid, CapNotLast, JoinMiter); - - FFontStruct := FDefaultFont; - FXftDraw := XftDrawCreate(GFApplication.Handle, Handle, - XDefaultVisual(GFApplication.Handle, XDefaultScreen(GFApplication.Handle)), - XDefaultColormap(GFApplication.Handle, XDefaultScreen(GFApplication.Handle))); - - FRegion := XCreateRegion; - Resized(Width, Height); // Set up a proper clipping region -end; - -destructor TX11Canvas.Destroy; -begin - if FXftDraw <> nil then - XftDrawDestroy(FXftDraw); - - XDestroyRegion(Region); - if Assigned(GC) then - XFreeGC(GFApplication.Handle, GC); - inherited Destroy; -end; - -procedure TX11Canvas.SaveState; -var - SavedState: PX11CanvasState; - NewRegion: TRegion; -begin - New(SavedState); - SavedState^.Prev := FStateStackpointer; - SavedState^.Matrix := Matrix; - SavedState^.Region := Region; - NewRegion := XCreateRegion; - XUnionRegion(Region, NewRegion, NewRegion); - FRegion := NewRegion; - SavedState^.Color := FCurColor; - SavedState^.Font := FFont; - FStateStackpointer := SavedState; -end; - -procedure TX11Canvas.RestoreState; -var - SavedState: PX11CanvasState; -begin - SavedState := FStateStackpointer; - FStateStackpointer := SavedState^.Prev; - Matrix := SavedState^.Matrix; - - XDestroyRegion(Region); - FRegion := SavedState^.Region; - XSetRegion(GFApplication.Handle, GC, Region); - - DoSetColor(SavedState^.Color); - SetFont(SavedState^.Font); - - Dispose(SavedState); -end; - -procedure TX11Canvas.EmptyClipRect; -begin - XDestroyRegion(Region); - FRegion := XCreateRegion; - XSetRegion(GFApplication.Handle, GC, Region); -end; - -function TX11Canvas.DoExcludeClipRect(const ARect: TRect): Boolean; -var - RectRegion: TRegion; - XRect: TXRectangle; -begin - XRect := RectToXRect(ARect); - RectRegion := XCreateRegion; - XUnionRectWithRegion(@XRect, RectRegion, RectRegion); - XSubtractRegion(Region, RectRegion, Region); - XDestroyRegion(RectRegion); - XSetRegion(GFApplication.Handle, GC, Region); - Result := XEmptyRegion(Region) = 0; -end; - -function TX11Canvas.DoIntersectClipRect(const ARect: TRect): Boolean; -var - RectRegion: TRegion; - XRect: TXRectangle; -begin - XRect := RectToXRect(ARect); - RectRegion := XCreateRegion; - XUnionRectWithRegion(@XRect, RectRegion, RectRegion); - XIntersectRegion(Region, RectRegion, Region); - XDestroyRegion(RectRegion); - XSetRegion(GFApplication.Handle, GC, Region); - Result := XEmptyRegion(Region) = 0; -end; - -function TX11Canvas.DoUnionClipRect(const ARect: TRect): Boolean; -var - XRect: TXRectangle; -begin - XRect := RectToXRect(ARect); - XUnionRectWithRegion(@XRect, Region, Region); - XSetRegion(GFApplication.Handle, GC, Region); - Result := XEmptyRegion(Region) = 0; -end; - -function TX11Canvas.DoGetClipRect: TRect; -var - XRect: TXRectangle; -begin - XClipBox(Region, @XRect); - Result := XRectToRect(XRect); -end; - -function TX11Canvas.MapColor(const AColor: TGfxColor): TGfxPixel; -var - Color: TXColor; -begin - Color.Pixel := 0; - Color.Red := AColor.Red * $FF; - Color.Green := AColor.Green * $FF; - Color.Blue := AColor.Blue * $FF; - XAllocColor(GFApplication.Handle, Colormap, @Color); - Result := Color.Pixel; -end; - -procedure TX11Canvas.DoSetColor(AColor: TGfxPixel); -begin - if AColor <> FCurColor then - begin - XSetForeground(GFApplication.Handle, GC, AColor); - FCurColor := AColor; - end; -end; - -procedure TX11Canvas.SetFont(AFont: TFCustomFont); -begin - if AFont = FFont then - Exit; //==> - - FFont := AFont; - - if not Assigned(AFont) then - begin - if FFontStruct = FDefaultFont then - Exit; //==> - FFontStruct := FDefaultFont; - end - else - begin - if not AFont.InheritsFrom(TX11Font) then - raise EGfxError.CreateFmt(SXCanvasInvalidFontClass, [AFont.ClassName]); - if TX11Font(AFont).FontStruct = FFontStruct then - Exit; //==> - FFontStruct := TX11Font(AFont).FontStruct; - end; - FFontStruct := TX11Font(AFont).FontStruct; -end; - -procedure TX11Canvas.SetLineStyle(ALineStyle: TGfxLineStyle); -const - DotDashes: array[0..1] of Char = #4#2; - { It was #1#1 which gives 1 pixel dots. Now it gives a 4 pixel line and a - 2 pixel space. } -begin - case ALineStyle of - lsSolid: - XSetLineAttributes(GFApplication.Handle, GC, 0, - LineSolid, CapNotLast, JoinMiter); - lsDot: - begin - XSetLineAttributes(GFApplication.Handle, GC, 0, - LineOnOffDash, CapNotLast, JoinMiter); - XSetDashes(GFApplication.Handle, GC, 0, DotDashes, 2); - end; - end; -end; - -procedure TX11Canvas.DoDrawArc(const ARect: TRect; StartAngle, EndAngle: Single); -begin - with ARect do - XDrawArc(GFApplication.Handle, Handle, GC, - Left, Top, Right - Left - 1, Bottom - Top - 1, - Round(StartAngle * 64), Round((EndAngle - StartAngle) * 64)); -end; - -procedure TX11Canvas.DoDrawCircle(const ARect: TRect); -begin - with ARect do - XDrawArc(GFApplication.Handle, Handle, GC, - Left, Top, Right - Left - 1, Bottom - Top - 1, 0, 23040); -end; - -procedure TX11Canvas.DoDrawLine(const AFrom, ATo: TPoint); -begin - XDrawLine(GFApplication.Handle, Handle, GC, AFrom.x, AFrom.y, ATo.x, ATo.y); -end; - -procedure TX11Canvas.DrawPolyLine(const Coords: array of TPoint); -var - Points: PXPoint; - CoordsIndex, PointsIndex: Integer; - Pt: TPoint; -begin - Points := nil; - GetMem(Points, (High(Coords) - Low(Coords) + 1) * SizeOf(TXPoint)); - CoordsIndex := Low(Coords); - PointsIndex := 0; - for CoordsIndex := Low(Coords) to High(Coords) do - begin - Pt := Transform(Coords[CoordsIndex]); - Points[PointsIndex].x := Pt.x; - Points[PointsIndex].y := Pt.y; - Inc(PointsIndex); - end; - - XDrawLines(GFApplication.Handle, Handle, GC, Points, PointsIndex, CoordModeOrigin); - - FreeMem(Points); -end; - -procedure TX11Canvas.DoDrawRect(const ARect: TRect); -begin - with ARect do - XDrawRectangle(GFApplication.Handle, Handle, GC, Left, Top, - Right - Left - 1, Bottom - Top - 1); -end; - -procedure TX11Canvas.DoDrawPoint(const APoint: TPoint); -begin - XDrawPoint(GFApplication.Handle, Handle, GC, APoint.x, APoint.y); -end; - -procedure TX11Canvas.DoFillRect(const ARect: TRect); -begin - with ARect do - XFillRectangle(GFApplication.Handle, Handle, GC, Left, Top, - Right - Left, Bottom - Top); -end; - -procedure TX11Canvas.DoFillTriangle(const P1, P2, P3: TPoint); -var - pts: array[1..3] of TXPoint; - pt: TPoint; -begin - pt := Transform(P1); - pts[1].X := pt.X; pts[1].Y := pt.Y; - pt := Transform(P2); - pts[2].X := pt.X; pts[2].Y := pt.Y; - pt := Transform(P3); - pts[3].X := pt.X; pts[3].Y := pt.Y; - - XFillPolygon(GFApplication.Handle, Handle, GC, @pts, 3, 0, CoordModeOrigin); -end; - -function TX11Canvas.FontCellHeight: Integer; -begin - Result := FFontStruct.GetHeight; -end; - -function TX11Canvas.TextExtent(const AText: String): TSize; -var - extents: TXGlyphInfo; -begin - if Length(AText) = 0 then - begin - Result.cx := 0; - Result.cy := 0; - end - else - begin - XftTextExtentsUtf8(GFApplication.Handle, FFontStruct.FontData, PChar(AText), Length(AText), extents); - Result.cx := extents.xOff; - Result.cy := extents.yOff; - end; -end; - -procedure TX11Canvas.DoTextOut(const APosition: TPoint; const AText: String); -var - fntColor: TXftColor; - //-------------- - procedure SetXftColor(c: TGfxPixel; var colxft: TXftColor); - begin - colxft.color.blue := (c and $000000FF) shl 8; - colxft.color.green := (c and $0000FF00); - colxft.color.red := (c and $00FF0000) shr 8; - - colxft.color.alpha := (c and $7F000000) shr 15; - colxft.color.alpha := colxft.color.alpha xor $FFFF; // invert: 0 in GfxColor means not translucent - - colxft.pixel := 0; - end; - -begin - if UTF8Length(AText) < 1 then - Exit; //==> - - SetXftColor(FCurColor,fntColor); - XftDrawSetClip(FXftDraw, FRegion); - XftDrawStringUtf8(FXftDraw, fntColor, FFontStruct.FontData, APosition.x, - Aposition.y + FFontStruct.GetAscent, PChar(AText), Length(AText)); -end; - -procedure TX11Canvas.DoCopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; - const ADestPos: TPoint); -var - RealHeight: Integer; -begin - if not ASource.InheritsFrom(TX11Canvas) then - raise EX11Error.CreateFmt(SIncompatibleCanvasForBlitting, - [ASource.ClassName, Self.ClassName]); - - if (ASource <> Self) and (ASource.PixelFormat.FormatType = ftMono) then - begin - // !!!: This case will probably be removed completely very soon - RealHeight := ASourceRect.Bottom - ASourceRect.Top; - if ADestPos.y + RealHeight > Height then - RealHeight := Height - ADestPos.y; - XSetClipMask(GFApplication.Handle, GC, TX11Canvas(ASource).Handle); - XSetClipOrigin(GFApplication.Handle, GC, ADestPos.x, ADestPos.y); - XFillRectangle(GFApplication.Handle, Handle, GC, ADestPos.x, ADestPos.y, - ASource.Width, RealHeight); - // Restore old clipping settings - XSetClipOrigin(GFApplication.Handle, GC, 0, 0); - XSetRegion(GFApplication.Handle, GC, Region); - end else - XCopyArea(GFApplication.Handle, TX11Canvas(ASource).Handle, Handle, GC, - ASourceRect.Left, ASourceRect.Top, - ASourceRect.Right - ASourceRect.Left, - ASourceRect.Bottom - ASourceRect.Top, ADestPos.x, ADestPos.y); -end; - -procedure TX11Canvas.DoMaskedCopyRect(ASource, AMask: TFCustomCanvas; - const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); -var - RectWidth, RectHeight: Integer; - DestPos, MaskPos: TPoint; - SourceRect: TRect; -begin - if not ASource.InheritsFrom(TX11Canvas) then - raise EX11Error.CreateFmt(SIncompatibleCanvasForBlitting, - [ASource.ClassName, Self.ClassName]); - if not AMask.InheritsFrom(TX11MonoPixmapCanvas) then - raise EX11Error.CreateFmt(SIncompatibleCanvasForBlitting, - [AMask.ClassName, Self.ClassName]); - - RectWidth := ASourceRect.Right - ASourceRect.Left; - RectHeight := ASourceRect.Bottom - ASourceRect.Top; - - { !!!: Attention! The current implementation only clips to the ClipRect, - i.e. the outer bounds of the current clipping region. In other words, the - result is only correct for a simple rectangle clipping region. } - with DoGetClipRect do - begin - if (ADestPos.x + RectWidth <= Left) or (ADestPos.y + RectHeight <= Top) then - exit; - - DestPos := ADestPos; - MaskPos := AMaskPos; - SourceRect := ASourceRect; - - if DestPos.x < Left then - begin - Inc(MaskPos.x, Left - DestPos.x); - Inc(SourceRect.Left, Left - DestPos.x); - DestPos.x := Left; - end; - if DestPos.y < Top then - begin - Inc(MaskPos.y, Top - DestPos.y); - Inc(SourceRect.Top, Top - DestPos.y); - DestPos.y := Top; - end; - - if (DestPos.x >= Right) or (DestPos.y >= Bottom) then - exit; - - if DestPos.x + RectWidth > Right then - RectWidth := Right - DestPos.x; - if DestPos.y + RectHeight > Bottom then - RectHeight := Bottom - DestPos.y; - end; - - if (RectWidth <= 0) or (RectHeight <= 0) then - exit; - - - XSetClipMask(GFApplication.Handle, GC, TX11Canvas(AMask).Handle); - XSetClipOrigin(GFApplication.Handle, GC, - DestPos.x - MaskPos.x, DestPos.y - MaskPos.y); - - XCopyArea(GFApplication.Handle, TX11Canvas(ASource).Handle, Handle, GC, - SourceRect.Left, SourceRect.Top, RectWidth, RectHeight, - DestPos.x, DestPos.y); - - // Restore old clipping settings - XSetClipOrigin(GFApplication.Handle, GC, 0, 0); - XSetRegion(GFApplication.Handle, GC, Region); -end; - -procedure TX11Canvas.DoDrawImageRect(AImage: TFCustomBitmap; ASourceRect: TRect; - const ADestPos: TPoint); -var - Image: XLib.PXImage; - ConvertFormat: TGfxPixelFormat; -begin - {$IFDEF VerboseFPGUI} - WriteLn('>: DoDrawImageRect'); - {$ENDIF} - - {$IFDEF VerboseFPGUI} - ASSERT(AImage.InheritsFrom(TX11Bitmap)); - ASSERT(not TX11Bitmap(AImage).IsLocked); - {$ENDIF} - - // !!!: Add support for XF86 4 and XShm etc. to speed this up! - Image := XCreateImage(GFApplication.Handle, Visual, - FormatTypeBPPTable[PixelFormat.FormatType], ZPixmap, 0, nil, - ASourceRect.Right - ASourceRect.Left, - ASourceRect.Bottom - ASourceRect.Top, 8, 0); - - {$IFDEF VerboseFPGUIp} - WriteLn('Size allocat for imageaed: ', Image^.bytes_per_line * (ASourceRect.Bottom - ASourceRect.Top) + 1); - {$ENDIF} - - { Here its necessary to alloc an extra byte, otherwise it will fail on 32-bits - machines, but still work on 64-bits machines. The cause of this is unknown. } - Image^.data := GetMem(Image^.bytes_per_line * (ASourceRect.Bottom - ASourceRect.Top) + 1); - - if (AImage.PixelFormat.FormatType = ftMono) and - Self.InheritsFrom(TX11MonoPixmapCanvas) then - // mirror the bits within all image data bytes...: - FlipMonoImageBits(ASourceRect, TX11Bitmap(AImage).Data, - TX11Bitmap(AImage).Stride, 0, 0, Image^.data, Image^.bytes_per_line) - else - begin - ConvertFormat := PixelFormat; - - { !!!: The following is a workaround: At least the XFree86 X server for - ATI graphics adapters uses 32 bit padding per pixel for 24 bpp - images...?!? To be checked: Is this always the case or only for ATI? } - if ConvertFormat.FormatType = ftRGB24 then - ConvertFormat.FormatType := ftRGB32; - - ConvertImage(ASourceRect, AImage.PixelFormat, AImage.Palette, - TX11Bitmap(AImage).Data, TX11Bitmap(AImage).Stride, - 0, 0, ConvertFormat, Image^.data, Image^.bytes_per_line); - end; - XPutImage(GFApplication.Handle, Handle, GC, - Image, 0, 0, ADestPos.x, ADestPos.y, AImage.Width, AImage.Height); - - FreeMem(Image^.data); - Image^.data := nil; - XDestroyImage(Image); - - {$IFDEF VerboseFPGUI} - WriteLn('<: DoDrawImageRect'); - {$ENDIF} -end; - - -procedure TX11Canvas.Resized(NewWidth, NewHeight: Integer); -var - XRect: TXRectangle; -begin - FWidth := NewWidth; - FHeight := NewHeight; - - XDestroyRegion(Region); - XRect.x := 0; - XRect.y := 0; - XRect.Width := Width; - XRect.Height := Height; - FRegion := XCreateRegion; - XUnionRectWithRegion(@XRect, Region, Region); -end; - - -{ TX11WindowCanvas } - -constructor TX11WindowCanvas.Create(AColormap: TColormap; - AXDrawable: X.TDrawable; ADefaultFont: TX11FontResourceImpl); -var - Attr: XLib.TXWindowAttributes; -begin - inherited Create(AColormap, AXDrawable, ADefaultFont); - - XGetWindowAttributes(GFApplication.Handle, Handle, @Attr); - FVisual := Attr.Visual; - - case Attr.Depth of - 1: PixelFormat.FormatType := ftMono; - 4: PixelFormat.FormatType := ftPal4; - 8: PixelFormat.FormatType := ftPal8; - 16: PixelFormat.FormatType := ftRGB16; - 24: PixelFormat.FormatType := ftRGB24; - 32: PixelFormat.FormatType := ftRGB32; - else - raise EX11Error.CreateFmt(SWindowUnsupportedPixelFormat, [Attr.Depth]); - end; - - if Attr.Depth >= 16 then - begin - PixelFormat.RedMask := Visual^.red_mask; - PixelFormat.GreenMask := Visual^.green_mask; - PixelFormat.BlueMask := Visual^.blue_mask; - end; -end; - - -{ TX11PixmapCanvas } - -constructor TX11PixmapCanvas.Create(AColormap: TColormap; - AHandle: TPixmap; APixelFormat: TGfxPixelFormat); -begin - inherited Create(AColormap, AHandle, nil); - FPixelFormat := APixelFormat; -end; - - -destructor TX11PixmapCanvas.Destroy; -begin - XFreePixmap(GFApplication.Handle, Handle); - inherited Destroy; -end; - -{ TX11MonoPixmapCanvas } - -constructor TX11MonoPixmapCanvas.Create(AColormap: TColormap; AHandle: TPixmap); -begin - inherited Create(AColormap, AHandle, PixelFormatMono); -end; - -{ TX11Bitmap } - -constructor TX11Bitmap.Create(AWidth, AHeight: Integer; APixelFormat: TGfxPixelFormat); -begin - inherited Create(AWidth, AHeight, APixelFormat); - - case APixelFormat.FormatType of - ftMono: - FStride := (AWidth + 7) shr 3; - ftPal4, ftPal4A: - FStride := (AWidth + 1) and not 1; - else - FStride := AWidth * (FormatTypeBPPTable[APixelFormat.FormatType] shr 3); - end; - - GetMem(FData, FStride * Height); -end; - -destructor TX11Bitmap.Destroy; -begin - FreeMem(FData); - inherited Destroy; -end; - -procedure TX11Bitmap.Lock(out AData: Pointer; out AStride: LongWord); -begin - ASSERT(not IsLocked); - IsLocked := True; - - AData := Data; - AStride := Stride; -end; - -procedure TX11Bitmap.Unlock; -begin - ASSERT(IsLocked); - IsLocked := False; -end; - - -{ TX11Screen } - -procedure TX11Screen.SetMousePos(const NewPos: TPoint); -begin - -end; - -function TX11Screen.GetMousePos: TPoint; -begin - -end; - -constructor TX11Screen.Create; -begin - inherited Create; - FScreenIndex := 0; - FScreenInfo := XScreenOfDisplay(GFApplication.Handle, ScreenIndex); -end; - -function TX11Screen.CreateBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas; -var - Depth: Integer; - PixelFormat: TGfxPixelFormat; -begin - Depth := XDefaultDepthOfScreen(ScreenInfo); - case Depth of - 1: PixelFormat.FormatType := ftMono; - 4: PixelFormat.FormatType := ftPal4; - 8: PixelFormat.FormatType := ftPal8; - 16: PixelFormat.FormatType := ftRGB16; - 24: PixelFormat.FormatType := ftRGB24; - 32: PixelFormat.FormatType := ftRGB32; - else - raise EX11Error.CreateFmt(SWindowUnsupportedPixelFormat, [Depth]); - end; - - if Depth >= 16 then - with XDefaultVisualOfScreen(ScreenInfo)^ do - begin - PixelFormat.RedMask := red_mask; - PixelFormat.GreenMask := green_mask; - PixelFormat.BlueMask := blue_mask; - end; - - Result := TX11PixmapCanvas.Create( - XDefaultColormapOfScreen(ScreenInfo), - XCreatePixmap(GFApplication.Handle, XRootWindowOfScreen(ScreenInfo), AWidth, AHeight, Depth), - PixelFormat); -end; - -function TX11Screen.CreateMonoBitmapCanvas(AWidth, AHeight: Integer): TFCustomCanvas; -begin - Result := TX11MonoPixmapCanvas.Create( - XDefaultColormap(GFApplication.Handle, ScreenIndex), - XCreatePixmap(GFApplication.Handle, XRootWindowOfScreen(ScreenInfo), - AWidth, AHeight, 1)); -end; - - -{ TX11Application } - -constructor TX11Application.Create; -begin - inherited Create; - -end; - - -destructor TX11Application.Destroy; -var - i: Integer; -begin - if Assigned(Forms) then - begin - for i := 0 to Forms.Count - 1 do - TFCustomWindow(Forms[i]).Free; - end; - - if Assigned(FDefaultFont) then - begin - FDefaultFont.Free; -{ - if FDefaultFont^.fid <> 0 then - XUnloadFont(Handle, FDefaultFont^.fid); - XFreeFontInfo(nil, FDefaultFont, 0); -} - end; - - if Assigned(Handle) then - XCloseDisplay(Handle); - - inherited Destroy; -end; - -procedure TX11Application.Run; -var - XEvent: TXEvent; - WindowEntry: TX11Window; - MouseButton: TMouseButton; - Sum: Integer; - NewEvent: TXEvent; -begin - inherited Run; - - while (not (QuitWhenLastWindowCloses and (Forms.Count = 0))) and - (DoBreakRun = False) do - begin - if Assigned(OnIdle) then - begin - if not XCheckMaskEvent(Handle, MaxInt, @XEvent) then - begin - if Assigned(OnIdle) then OnIdle(Self); - - continue; - end; - end - else - XNextEvent(Handle, @XEvent); - - // if the event filter returns true then it ate the message - if Assigned(FEventFilter) and FEventFilter(XEvent) then continue; - - if Forms.Count = 0 then continue; - - // According to a comment in X.h, the valid event types start with 2! - if XEvent._type >= 2 then - begin - WindowEntry := TX11Window(FindWindowByXID(XEvent.XAny.Window)); - - if not Assigned(WindowEntry) then - begin - WriteLn('fpGFX/X11: Received X event "', GetXEventName(XEvent._type), '" for unknown window'); - continue; - end; - - WindowEntry.FXEvent := @XEvent; - - case XEvent._type of - X.DestroyNotify: - begin - Forms.Remove(WindowEntry); - end; - X.KeyPress: - begin - WindowEntry.EvKeyPressed(XEvent.xkey.keycode); - end; - X.KeyRelease: - begin - WindowEntry.EvKeyReleased(XEvent.xkey.keycode); - end; - X.ButtonPress: - begin - if XButtonToMouseButton(XEvent.xbutton.button, MouseButton) then - WindowEntry.EvMousePressed(MouseButton, - Point(XEvent.xbutton.x, XEvent.xbutton.y)) - else - begin - if XEvent.xbutton.button = 4 then Sum := -1 - else Sum := 1; - - // Check for other mouse wheel messages in the queue - while XCheckTypedWindowEvent(GFApplication.Handle, - WindowEntry.Handle, X.ButtonPress, @NewEvent) do - begin - if NewEvent.xbutton.Button = 4 then - Dec(Sum) - else if NewEvent.xbutton.Button = 5 then - Inc(Sum) - else - begin - XPutBackEvent(GFApplication.Handle, @NewEvent); - break; - end; - end; - - WindowEntry.EvMouseWheel( - Sum, Point(XEvent.xbutton.x, XEvent.xbutton.y)); - end; - end; - X.ButtonRelease: - begin - { Release events are only for mouse buttons, and not mouse wheel moviments } - if (XEvent.xbutton.button >= 1) and (XEvent.xbutton.button <= 3) then - begin - XButtonToMouseButton(XEvent.xbutton.button, MouseButton); - - WindowEntry.EvMouseReleased( - MouseButton, - Point(XEvent.xbutton.x, XEvent.xbutton.y)); - end; - end; - X.EnterNotify: - begin - WindowEntry.EvMouseEnter( - Point(XEvent.xbutton.x, XEvent.xbutton.y)); - end; - X.LeaveNotify: - begin - WindowEntry.EvMouseLeave(); - end; - X.MotionNotify: - begin - WindowEntry.EvMouseMove( - Point(XEvent.xbutton.x, XEvent.xbutton.y)); - end; - X.FocusIn: - begin - WindowEntry.EvFocusIn(); - end; - X.FocusOut: - begin - WindowEntry.EvFocusOut(); - end; - X.MapNotify: - begin - WindowEntry.EvShow(); - end; - X.UnmapNotify: - begin - WindowEntry.EvHide(); - end; - X.ReparentNotify: - begin - WindowEntry.EvCreate(); - end; - X.Expose: - begin - {$Note We can do performance tuning here by looking at Count. - For now we are just ignoring all expose messages where Count <> 0 } - if XEvent.xexpose.count = 0 then - begin - WindowEntry.EvPaint(); - end; - end; - X.ConfigureNotify: - begin - WindowEntry.Dispatch(XEvent); - end; - X.ClientMessage: - begin - WindowEntry.Dispatch(XEvent); - end; - else - WriteLn('fpGFX/X11: Unhandled X11 event received: ', GetXEventName(XEvent._type)); - end; - - end; - end; - DoBreakRun := False; -end; - -procedure TX11Application.Quit; -begin - DoBreakRun := True; -end; - -function TX11Application.FindWindowByXID(XWindowID: X.TWindow): TFCustomWindow; -var - i: Integer; - EndSubSearch: Boolean; { Necessary to quit the recursion } - - { Recursively searches sub-windows } - procedure SearchSubWindows(AForm: TFCustomWindow; var ATarget: TFCustomWindow); - var - j: Integer; - begin - for j := 0 to AForm.ChildWindows.Count - 1 do - begin - if EndSubSearch then Exit; - - if TFCustomWindow(AForm.ChildWindows[j]).Handle = XWindowID then - begin - ATarget := TFCustomWindow(Result.ChildWindows[j]); - - EndSubSearch := True; - - Exit; - end; - - SearchSubWindows(TFCustomWindow(AForm.ChildWindows[j]), ATarget); - end; - end; - -begin - { Loops througth all windows on the application } - for i := 0 to Forms.Count - 1 do - begin - Result := TFCustomWindow(Forms[i]); - - if Result.Handle = XWindowID then exit; - - EndSubSearch := False; - - SearchSubWindows(TFCustomWindow(Forms[i]), Result); - - if Result.Handle = XWindowID then exit; - end; - Result := nil; -end; - -procedure TX11Application.Initialize(ADisplayName: String = ''); -begin - if Length(ADisplayName) = 0 then - begin - // Maybe it was passed as a -display parameter. Lets check first! - if FDisplayName = '' then - FDisplayName := XDisplayName(nil) - end - else - FDisplayName := ADisplayName; - - Handle := XOpenDisplay(PChar(DisplayName)); - - if not Assigned(Handle) then - raise EX11Error.CreateFmt(SOpenDisplayFailed, [DisplayName]); - -// FDefaultFont := TX11FontResourceImpl.Create('Arial-10'); - FDefaultFont := TX11FontResourceImpl.Create('Sans-10'); - - if not Assigned(FDefaultFont) then - raise EX11Error.Create(SNoDefaultFont); -end; - -{ TX11Window } - -{ Note, this only creates a window, it doesn't actually show the window. It - is still invisible. To make it visible, we need to call Show(). } -constructor TX11Window.Create(AParent: TFCustomWindow; AWindowOptions: TFWindowOptions); -var - Colormap: TColormap; -begin - inherited Create(AParent, AWindowOptions); - - CreateWindow; - - { Creates the canvas } - - Colormap := XDefaultColormap(GFApplication.Handle, XDefaultScreen(GFApplication.Handle)); - - FCanvas := TX11WindowCanvas.Create(Colormap, Handle, GFApplication.FDefaultFont); -end; - -destructor TX11Window.Destroy; -begin - if Assigned(OnClose) then - OnClose(Self); - - FCanvas.Free; - if FCurCursorHandle <> 0 then - XFreeCursor(GFApplication.Handle, FCurCursorHandle); - - GFApplication.RemoveWindow(Self); - - XDestroyWindow(GFApplication.Handle, Handle); - - inherited Destroy; -end; - -procedure TX11Window.SetPosition(const APosition: TPoint); -var - Supplied: PtrInt; - SizeHints: PXSizeHints; - - dx, dy: integer; - lx, ly: integer; - cw : PWindow; -begin - if FParent = nil then - begin - {$Note This doesn't work yet. I want to position a new window relative to - another window. Used for popup windows, like the TComboBox dropdown. } - {$IFDEF DEBUG} writeln('SetPosition with no Parent'); {$ENDIF} - lx := APosition.x; - ly := APosition.y; - - XTranslateCoordinates(GFApplication.Handle, Handle, - XDefaultRootWindow(GFApplication.Handle), - lx, ly, @dx, @dy, @cw); - lx := dx; - ly := dy; - end - else - begin - {$IFDEF DEBUG} writeln('SetPosition inside parent'); {$ENDIF} - lx := APosition.x; - ly := APosition.y; - end; - {$IFDEF DEBUG} Writeln(Format('was (%d,%d) and is now (%d,%d)', [APosition.x, APosition.y, lx, ly])); {$ENDIF} - - SizeHints := XAllocSizeHints; - XGetWMNormalHints(GFApplication.Handle, Handle, SizeHints, @Supplied); - SizeHints^.flags := SizeHints^.flags or PPosition; - SizeHints^.x := lx; - SizeHints^.y := ly; - XSetWMNormalHints(GFApplication.Handle, Handle, SizeHints); - XFree(SizeHints); - XMoveWindow(GFApplication.Handle, Handle, lx, ly); -end; - -procedure TX11Window.SetSize(const ASize: TSize); -begin - // !!!: Implement this properly - WriteLn('fpGFX/X11: TXWindow.SetSize is not properly implemented yet'); - SetClientSize(ASize); -end; - -procedure TX11Window.SetMinMaxSize(const AMinSize, AMaxSize: TSize); -begin - // !!!: Implement this properly - WriteLn('fpGFX/X11: TXWindow.SetMinMaxSize is not properly implemented yet'); - SetMinMaxClientSize(AMinSize, AMaxSize); -end; - -procedure TX11Window.SetClientSize(const ASize: TSize); -var - ChangeMask: Cardinal; - Changes: TXWindowChanges; -begin - ChangeMask := 0; - - if ASize.cx <> ClientWidth then - begin - ChangeMask := CWWidth; - Changes.Width := ASize.cx; - end; - - if ASize.cy <> ClientHeight then - begin - ChangeMask := ChangeMask or CWHeight; - Changes.Height := ASize.cy; - end; - - if ChangeMask <> 0 then - XConfigureWindow(GFApplication.Handle, Handle, ChangeMask, @Changes); -end; - -procedure TX11Window.SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); -var - Supplied: PtrInt; - SizeHints: PXSizeHints; -begin - CanMaximize := (AMaxSize.cx = 0) or (AMaxSize.cy = 0) or - (AMaxSize.cx > AMinSize.cx) or (AMaxSize.cy > AMinSize.cy); - UpdateMotifWMHints; - - SizeHints := XAllocSizeHints; - XGetWMNormalHints(GFApplication.Handle, Handle, SizeHints, @Supplied); - with SizeHints^ do - begin - if (AMinSize.cx > 0) or (AMinSize.cy > 0) then - begin - flags := flags or PMinSize; - min_width := AMinSize.cx; - min_height := AMinSize.cy; - end else - flags := flags and not PMinSize; - - if (AMaxSize.cx > 0) or (AMaxSize.cy > 0) then - begin - flags := flags or PMaxSize; - if AMaxSize.cx > 0 then - max_width := AMaxSize.cx - else - max_width := 32767; - if AMaxSize.cy > 0 then - max_height := AMaxSize.cy - else - max_height := 32767; - end else - flags := flags and not PMaxSize; - end; - - XSetWMNormalHints(GFApplication.Handle, Handle, SizeHints); - XFree(SizeHints); -end; - -{ Makes the window visible and raises it to the top of the stack. } -procedure TX11Window.Show; -begin - GFApplication.AddWindow(self); - XMapRaised(GFApplication.Handle, Handle); -end; - -procedure TX11Window.Invalidate; -begin - EvPaint(); -end; - -procedure TX11Window.CaptureMouse; -begin - XGrabPointer(GFApplication.Handle, Handle, - True, - ButtonPressMask or ButtonReleaseMask or EnterWindowMask or LeaveWindowMask or PointerMotionMask, - GrabModeAsync, - GrabModeAsync, - 0, - 0, - CurrentTime - ); -end; - -procedure TX11Window.ReleaseMouse; -begin - XUngrabPointer(GFApplication.Handle, CurrentTime); -end; - -procedure TX11Window.EvCreate; -begin - if Assigned(OnCreate) then OnCreate(Self) -end; - -procedure TX11Window.EvFocusIn; -begin - if Assigned(OnFocusIn) then OnFocusIn(Self); -end; - -procedure TX11Window.EvFocusOut; -begin - if Assigned(OnFocusOut) then OnFocusOut(Self); -end; - -procedure TX11Window.EvHide; -begin - if Assigned(OnHide) then OnHide(Self); -end; - -procedure TX11Window.EvKeyPressed(AKey: Word); -var - KeySym: TKeySym; -begin - KeySym := StartComposing(FXEvent^); - - if Assigned(OnKeyPressed) then - OnKeyPressed(Self, AKey, ConvertShiftState(FXEvent^.xkey.state)) - else if Assigned(Parent) then TX11Window(Parent).EvKeyPressed(AKey); - - if (FXEvent^.xkey.state and (ControlMask or Mod1Mask)) = 0 then EndComposing; -end; - -procedure TX11Window.EvKeyReleased(AKey: Word); -var - KeySym: TKeySym; -begin - KeySym := StartComposing(FXEvent^); - - if Assigned(OnKeyReleased) then - OnKeyReleased(Self, KeySymToKeycode(KeySym), ConvertShiftState(FXEvent^.xkey.state)) - else if Assigned(Parent) then TX11Window(Parent).EvKeyReleased(AKey); - - // Do not call EndComposing, as this would generate duplicate KeyChar events! -end; - -procedure TX11Window.EvKeyChar(AKeyChar: Char); -begin -{ if Assigned(OnKeyChar) then OnKeyChar(Self, Chr(AEvent.wParam)) - else if Assigned(Parent) then Parent.ProcessEvent(AEvent); } -end; - -procedure TX11Window.EvMouseEnter(const AMousePos: TPoint); -begin - if Assigned(OnMouseEnter) then - OnMouseEnter(Self, ConvertShiftState(FXEvent^.xbutton.state), AMousePos) - else if Assigned(Parent) then TX11Window(Parent).EvMouseEnter(AMousePos); -end; - -procedure TX11Window.EvMouseLeave; -begin - if Assigned(OnMouseLeave) then OnMouseLeave(Self) - else if Assigned(Parent) then TX11Window(Parent).EvMouseLeave(); -end; - -procedure TX11Window.EvMousePressed(AButton: TMouseButton; - const AMousePos: TPoint); -begin - if Assigned(OnMousePressed) then - OnMousePressed(Self, AButton, ConvertShiftState(FXEvent^.xbutton.state), AMousePos) - else if Assigned(Parent) then TX11Window(Parent).EvMousePressed(AButton, AMousePos); -end; - -procedure TX11Window.EvMouseReleased(AButton: TMouseButton; - const AMousePos: TPoint); -begin - if Assigned(OnMouseReleased) then - OnMouseReleased(Self, AButton, - ConvertShiftState(FXEvent^.xbutton.state), AMousePos) - else if Assigned(Parent) then TX11Window(Parent).EvMouseReleased(AButton, AMousePos); -end; - -procedure TX11Window.EvMouseMove(const AMousePos: TPoint); -begin - if Assigned(OnMouseMove) then - OnMouseMove(Self, ConvertShiftState(FXEvent^.xbutton.state), AMousePos) - else if Assigned(Parent) then TX11Window(Parent).EvMouseMove(AMousePos); -end; - -procedure TX11Window.EvMouseWheel(AWheelDelta: Single; const AMousePos: TPoint); -begin - if Assigned(OnMouseWheel) then - OnMouseWheel(Self, ConvertShiftState(FXEvent^.xbutton.state), AWheelDelta, AMousePos) - else if Assigned(Parent) then TX11Window(Parent).EvMouseWheel(AWheelDelta, AMousePos); -end; - -procedure TX11Window.EvPaint; -begin - if Assigned(OnPaint) then OnPaint(Self); -end; - -procedure TX11Window.EvMove; -begin - if Assigned(OnMove) then OnMove(Self); -end; - -procedure TX11Window.EvResize; -begin - if Assigned(OnResize) then OnResize(Self); -end; - -procedure TX11Window.EvShow; -begin - if Assigned(OnShow) then OnShow(Self); -end; - -function TX11Window.GetTitle: String; -var - s: PChar; -begin - XFetchName(GFApplication.Handle, Handle, @s); - Result := s; - XFree(s); -end; - -procedure TX11Window.SetTitle(const ATitle: String); -var - tp: TXTextProperty; -begin - tp.value := PCUChar(ATitle); - tp.encoding := XA_WM_NAME; - tp.format := 8; - tp.nitems := UTF8Length(ATitle); - - XSetWMName(GFApplication.Handle, Handle, @tp); - XStoreName(GFApplication.Handle, Handle, PChar(ATitle)); - XSetIconName(GFApplication.Handle, Handle, PChar(ATitle)); - XSetWMIconName(GFApplication.Handle, Handle, @tp); -end; - -procedure TX11Window.DoSetCursor; -const - CursorTable: array[TFCursor] of Integer = ( - -1, // crDefault - -2, // crNone !!!: not implemented - -1, // crArrow - 34, // crCross - 152, // crIBeam - 52, // crSize - 116, // crSizeNS - 108, // crSizeWE - 114, // crUpArrow - 150, // crHourGlass - 0, // crNoDrop - 92); // crHelp -var - ID: Integer; -begin - if FCurCursorHandle <> 0 then - XFreeCursor(GFApplication.Handle, FCurCursorHandle); - ID := CursorTable[Cursor]; - if ID = -1 then - FCurCursorHandle := 0 - else - FCurCursorHandle := XCreateFontCursor(GFApplication.Handle, ID); - XDefineCursor(GFApplication.Handle, Handle, FCurCursorHandle); -end; - -procedure TX11Window.DoSetWindowOptions; -begin - -end; - -function TX11Window.GetHandle: PtrUInt; -begin - Result := FHandle; -end; - -procedure TX11Window.CreateWindow; -const - WindowHints: TXWMHints = ( - flags: InputHint or StateHint or WindowGroupHint; - input: True; - initial_state: NormalState; - icon_pixmap: 0; - icon_window: 0; - icon_x: 0; - icon_y: 0; - icon_mask: 0; - window_group: 0; - ); -var - Colormap: TColormap; - Attr: TXSetWindowAttributes; - SizeHints: TXSizeHints; - ClassHint: PXClassHint; - lParentHandle: X.TWindow; - mask: longword; -begin - if (not (woX11SkipWMHints in WindowOptions)) and (woWindow in WindowOptions) then - begin - if LeaderWindow = 0 then - begin - LeaderWindow := XCreateSimpleWindow(GFApplication.Handle, - XDefaultRootWindow(GFApplication.Handle), 0, 0, 1, 1, 0, 0, 0); - - ClassHint := XAllocClassHint; - ClassHint^.res_name := 'fpGFX'; // !!! use app name - ClassHint^.res_class := 'FpGFX'; - XSetWMProperties(GFApplication.Handle, LeaderWindow, nil, nil, nil, 0, nil, nil, - ClassHint); - XFree(ClassHint); - ClientLeaderAtom := XInternAtom(GFApplication.Handle, 'WM_CLIENT_LEADER', False); - end; - end; - - Colormap := XDefaultColormap(GFApplication.Handle, XDefaultScreen(GFApplication.Handle)); - Attr.Colormap := Colormap; - - SizeHints.flags := XUtil.PSize; - SizeHints.x := 0; - SizeHints.y := 0; - SizeHints.width := 200; - SizeHints.height := 200; - - { Make sure we use the correct parent handle } - if FParent <> nil then - lParentHandle := TX11Window(FParent).Handle - else - lParentHandle := XDefaultRootWindow(GFApplication.Handle); - - { setup attributes and masks } - if (woBorderless in WindowOptions) or (woToolWindow in WindowOptions) then - begin - Attr.Override_Redirect := True; // this removes window borders - mask := CWOverrideRedirect;// or CWColormap; - end - else if (woPopup in WindowOptions) then - begin - Attr.Override_Redirect := True; // this removes window borders - Attr.save_under := True; - mask := CWOverrideRedirect or CWSaveUnder; - end - else - begin - Attr.Override_Redirect := False; - mask := CWColormap; - end; - - FHandle := XCreateWindow( - GFApplication.Handle, - lParentHandle, // parent - SizeHints.x, SizeHints.x, // position (top, left) - SizeHints.width, SizeHints.height, // default size (width, height) - 0, // border size - CopyFromParent, // depth - InputOutput, // class - XDefaultVisual(GFApplication.Handle, XDefaultScreen(GFApplication.Handle)), // visual - mask, - @Attr); - - if FHandle = 0 then - raise EX11Error.Create(SWindowCreationFailed); - - XSelectInput(GFApplication.Handle, FHandle, KeyPressMask or KeyReleaseMask - or ButtonPressMask or ButtonReleaseMask - or EnterWindowMask or LeaveWindowMask - or ButtonMotionMask or PointerMotionMask - or ExposureMask - or FocusChangeMask - or StructureNotifyMask -// or PropertyChangeMask - ); - - if (not (woX11SkipWMHints in WindowOptions)) and (woWindow in WindowOptions) then - begin - XSetStandardProperties(GFApplication.Handle, Handle, nil, nil, 0, - argv, argc, @SizeHints); - - XSetWMNormalHints(GFApplication.Handle, Handle, @SizeHints); - - WindowHints.flags := WindowGroupHint; - WindowHints.window_group := LeaderWindow; - XSetWMHints(GFApplication.Handle, Handle, @WindowHints); - - XChangeProperty(GFApplication.Handle, Handle, ClientLeaderAtom, 33, 32, - PropModeReplace, @LeaderWindow, 1); - - // We want to get a Client Message when the user tries to close this window - if GFApplication.FWMProtocols = 0 then - GFApplication.FWMProtocols := XInternAtom(GFApplication.Handle, 'WM_PROTOCOLS', False); - if GFApplication.FWMDeleteWindow = 0 then - GFApplication.FWMDeleteWindow := XInternAtom(GFApplication.Handle, 'WM_DELETE_WINDOW', False); - - // send close event instead of quitting the whole application... - XSetWMProtocols(GFApplication.Handle, FHandle, @GFApplication.FWMDeleteWindow, 1); - end; - - { Child windows do not appear until parent (lParentHandle) is mapped } - if FParent <> nil then - XMapSubwindows(GFApplication.Handle, lParentHandle); - - // for modal windows, this is necessary -// if (woModal in WindowOptions) then -// XSetTransientForHint(GFApplication.Handle, Handle, Handle); -end; - -function TX11Window.ConvertShiftState(AState: Cardinal): TShiftState; -begin - Result := []; - if (AState and Button1Mask) <> 0 then - Include(Result, ssLeft); - if (AState and Button2Mask) <> 0 then - Include(Result, ssMiddle); - if (AState and Button3Mask) <> 0 then - Include(Result, ssRight); - if (AState and ShiftMask) <> 0 then - Include(Result, ssShift); - if (AState and LockMask) <> 0 then - Include(Result, ssCaps); - if (AState and ControlMask) <> 0 then - Include(Result, ssCtrl); - if (AState and Mod1Mask) <> 0 then - Include(Result, ssAlt); - if (AState and Mod2Mask) <> 0 then - Include(Result, ssNum); - if (AState and Mod4Mask) <> 0 then - Include(Result, ssSuper); - if (AState and Mod5Mask) <> 0 then - Include(Result, ssScroll); - if (AState and (1 shl 13)) <> 0 then - Include(Result, ssAltGr); -end; - -function TX11Window.KeySymToKeycode(KeySym: TKeySym): Word; -const - Table_20aX: array[$20a0..$20ac] of Word = (keyEcuSign, keyColonSign, - keyCruzeiroSign, keyFFrancSign, keyLiraSign, keyMillSign, keyNairaSign, - keyPesetaSign, keyRupeeSign, keyWonSign, keyNewSheqelSign, keyDongSign, - keyEuroSign); - Table_feXX: array[$fe50..$fe60] of Word = (keyDeadGrave, keyDeadAcute, - keyDeadCircumflex, keyDeadTilde, keyDeadMacron,keyDeadBreve, - keyDeadAbovedot, keyDeadDiaeresis, keyDeadRing, keyDeadDoubleacute, - keyDeadCaron, keyDeadCedilla, keyDeadOgonek, keyDeadIota, - keyDeadVoicedSound, keyDeadSemivoicedSound, keyDeadBelowdot); - Table_ff5X: array[$ff50..$ff58] of Word = (keyHome, keyLeft, keyUp, keyRight, - keyDown, keyPrior, keyNext, keyEnd, keyBegin); - Table_ff6X: array[$ff60..$ff6b] of Word = (keySelect, keyPrintScreen, - keyExecute, keyNIL, keyInsert, keyUndo, keyRedo, keyMenu, keyFind, - keyCancel, keyHelp, keyBreak); - Table_ff9X: array[$ff91..$ff9f] of Word = (keyPF1, keyPF2, keyPF3, keyPF4, - keyP7, keyP4, keyP8, keyP6, keyP2, keyP9, keyP3, keyP1, keyP5, keyP0, - keyPDecimal); - Table_ffeX: array[$ffe1..$ffee] of Word = (keyShiftL, keyShiftR, keyCtrlL, - keyCtrlR, keyCapsLock, keyShiftLock, keyMetaL, keyMetaR, keyAltL, keyAltR, - keySuperL, keySuperR, keyHyperL, keyHyperR); -begin - case KeySym of - 0..Ord('a')-1, Ord('z')+1..$bf, $f7: - Result := KeySym; - Ord('a')..Ord('z'), $c0..$f6, $f8..$ff: - Result := KeySym - 32; - $20a0..$20ac: Result := Table_20aX[KeySym]; - $fe20: Result := keyTab; - $fe50..$fe60: Result := Table_feXX[KeySym]; - $ff08: Result := keyBackspace; - $ff09: Result := keyTab; - $ff0a: Result := keyLinefeed; - $ff0b: Result := keyClear; - $ff0d: Result := keyReturn; - $ff13: Result := keyPause; - $ff14: Result := keyScrollLock; - $ff15: Result := keySysRq; - $ff1b: Result := keyEscape; - $ff50..$ff58: Result := Table_ff5X[KeySym]; - $ff60..$ff6b: Result := Table_ff6X[KeySym]; - $ff7e: Result := keyModeSwitch; - $ff7f: Result := keyNumLock; - $ff80: Result := keyPSpace; - $ff89: Result := keyPTab; - $ff8d: Result := keyPEnter; - $ff91..$ff9f: Result := Table_ff9X[KeySym]; - $ffaa: Result := keyPAsterisk; - $ffab: Result := keyPPlus; - $ffac: Result := keyPSeparator; - $ffad: Result := keyPMinus; - $ffae: Result := keyPDecimal; - $ffaf: Result := keyPSlash; - $ffb0..$ffb9: Result := keyP0 + KeySym - $ffb0; - $ffbd: Result := keyPEqual; - $ffbe..$ffe0: Result := keyF1 + KeySym - $ffbe; - $ffe1..$ffee: Result := Table_ffeX[KeySym]; - $ffff: Result := keyDelete; - else - Result := keyNIL; - end; -{$IFDEF Debug} - if Result = keyNIL then - WriteLn('fpGFX/X11: Unknown KeySym: $', IntToHex(KeySym, 4)); -{$ENDIF} -end; - -procedure TX11Window.UpdateMotifWMHints; -type - PMotifWmHints = ^TMotifWmHints; - TMotifWmHints = packed record - Flags, Functions, Decorations: LongWord; - InputMode: LongInt; - Status: LongWord; - end; -const - MWM_HINTS_FUNCTIONS = 1; - MWM_HINTS_DECORATIONS = 2; - FuncAll = 1; - FuncResize = 2; - FuncMove = 4; - FuncMinimize = 8; - FuncMaximize = 16; - FuncClose = 32; - DecorAll = 1; - DecorBorder = 2; - DecorResizeH = 4; - DecorTitle = 8; - DecorMenu = 16; - DecorMinimize = 32; - DecorMaximize = 64; -var - PropType: TAtom; - PropFormat: LongInt; - PropItemCount, PropBytesAfter: LongWord; - Hints: PMotifWmHints; - NewHints: TMotifWmHints; -begin - if GFApplication.FWMHints = 0 then - GFApplication.FWMHints := - XInternAtom(GFApplication.Handle, '_MOTIF_WM_HINTS', False); - - XGetWindowProperty(GFApplication.Handle, Handle, - GFApplication.FWMHints, 0, 5, False, AnyPropertyType, @PropType, - @PropFormat, @PropItemCount, @PropBytesAfter, @Hints); - - NewHints.Flags := MWM_HINTS_FUNCTIONS or MWM_HINTS_DECORATIONS; - NewHints.Functions := FuncResize or FuncMove or FuncMinimize or FuncClose; - - if (woToolWindow in WindowOptions) or (woWindow in WindowOptions) or - (woPopup in WindowOptions) then - NewHints.Decorations := DecorBorder or DecorTitle or DecorMenu or DecorMinimize - else - NewHints.Decorations := 0; - if CanMaximize then - begin - NewHints.Functions := NewHints.Functions or FuncMaximize; - NewHints.Decorations := NewHints.Decorations or DecorMaximize; - end; - - if Assigned(Hints) then - begin - Hints^.Flags := Hints^.Flags or NewHints.Flags; - Hints^.Decorations := NewHints.Decorations; - Hints^.Functions := NewHints.Functions; - end else - Hints := @NewHints; - - XChangeProperty(GFApplication.Handle, Handle, - GFApplication.FWMHints, GFApplication.FWMHints, - 32, PropModeReplace, Pointer(Hints), 5); - if Hints <> @NewHints then - XFree(Hints); -end; - -function TX11Window.StartComposing(const Event: TXEvent): TKeySym; -begin - SetLength(FComposeBuffer, - XLookupString(@Event, @FComposeBuffer[1], - SizeOf(FComposeBuffer) - 1, @Result, @FComposeStatus)); -end; - -procedure TX11Window.EndComposing; -var - i: Integer; -begin - if Assigned(OnKeyChar) then - for i := 1 to Length(FComposeBuffer) do - OnKeyChar(Self, FComposeBuffer[i]); -end; - -procedure TX11Window.Configure(var Event: TXConfigureEvent); -begin - while XCheckTypedWindowEvent(GFApplication.Handle, Handle, - X.ConfigureNotify, @Event) do; - - if (Event.x <> Left) or (Event.y <> Top) then - begin - FLeft := Event.x; - FTop := Event.y; - if Assigned(OnMove) then - OnMove(Self); - end; - if (Event.Width <> Width) or (Event.Height <> Height) then - begin - // !!!: The following 2 lines are _quite_ wrong... :) - FWidth := Event.Width; - FHeight := Event.Height; - FClientWidth := Event.Width; - FClientHeight := Event.Height; - TX11Canvas(Canvas).Resized(ClientWidth, ClientHeight); - if Assigned(OnResize) then - OnResize(Self); - end; -end; - -procedure TX11Window.ClientMessage(var Event: TXClientMessageEvent); -begin - if Event.message_type = GFApplication.FWMProtocols then - if Event.Data.l[0] = GFApplication.FWMDeleteWindow then - begin - if CanClose then - Free; - end else - WriteLn('fpGFX/X11: Unknown client protocol message: ', Event.Data.l[0]) - else - WriteLn('fpGFX/X11: Unknown client message: ', Event.message_type); -end; - -{ Global utility functions } - -function RectToXRect(const ARect: TRect): TXRectangle; -begin - Result.x := ARect.Left; - Result.y := ARect.Top; - Result.width := ARect.Right - ARect.Left; - Result.height := ARect.Bottom - ARect.Top; -end; - -function XRectToRect(const ARect: TXRectangle): TRect; -begin - Result.Left := ARect.x; - Result.Top := ARect.y; - Result.Right := ARect.x + ARect.width; - Result.Bottom := ARect.y + ARect.height; -end; - -function GetXEventName(Event: LongInt): String; -const - EventNames: array[2..34] of String = ( - 'KeyPress', 'KeyRelease', 'ButtonPress', 'ButtonRelease', 'MotionNotify', - 'EnterNotify', 'LeaveNotify', 'FocusIn', 'FocusOut', 'KeymapNotify', - 'Expose', 'GraphicsExpose', 'NoExpose', 'VisibilityNotify', 'CreateNotify', - 'DestroyNotify', 'UnmapNotify', 'MapNotify', 'MapRequest', 'ReparentNotify', - 'ConfigureNotify', 'ConfigureRequest', 'GravityNotify', 'ResizeRequest', - 'CirculateNotify', 'CirculateRequest', 'PropertyNotify', 'SelectionClear', - 'SelectionRequest', 'SelectionNotify', 'ColormapNotify', 'ClientMessage', - 'MappingNotify'); -begin - if (Event >= Low(EventNames)) and (Event <= High(EventNames)) then - Result := EventNames[Event] - else - Result := '#' + IntToStr(Event); -end; - -{ Returns True if the button is indeed a mouse button - and False if it's the mouse wheel } -function XButtonToMouseButton(const XButton: cint; var MouseButton: TMouseButton): Boolean; -const - ButtonTable: array[1..3] of TMouseButton = (mbLeft, mbMiddle, mbRight); -begin - Result := False; - - if (XButton > 3) or (XButton < 1) then Exit; - - MouseButton := ButtonTable[XButton]; - - Result := True; -end; - -{ TX11FontResourceImpl } - -constructor TX11FontResourceImpl.Create(const Descriptor: String); -begin - FFontData := XftFontOpenName(GFApplication.Handle, XDefaultScreen(GFApplication.Handle), PChar(Descriptor)); - if not Assigned(FFontData) then - raise EX11Error.CreateFmt(SFontCreationFailed, [Descriptor]); -end; - -destructor TX11FontResourceImpl.Destroy; -begin - if Assigned(FFontData) then - XftFontClose(GFApplication.Handle, FFontData); - inherited Destroy; -end; - -function TX11FontResourceImpl.GetAscent: integer; -begin - Result := FFontData^.Ascent; -end; - -function TX11FontResourceImpl.GetDescent: integer; -begin - Result := FFontData^.Descent; -end; - -function TX11FontResourceImpl.GetHeight: integer; -begin - Result := GetAscent + GetDescent; -end; - -end. - - diff --git a/gfx/x11/gfxinterface.pas b/gfx/x11/gfxinterface.pas deleted file mode 100644 index f6df234c..00000000 --- a/gfx/x11/gfxinterface.pas +++ /dev/null @@ -1,45 +0,0 @@ -{ - fpGUI - Free Pascal Graphical User Interface - - GFXInterface - Default target selection unit for X11 target - - Copyright (C) 2006 - 2007 See the file AUTHORS, included in this - distribution, for details of the copyright. - - See the file COPYING.modifiedLGPL, included in this distribution, - for details about redistributing fpGUI. - - 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. -} -unit gfxinterface; - -{$ifdef fpc} - {$mode objfpc}{$H+} -{$endif} - -interface - -uses - GFX_X11; - -type - - TDefCanvas = TX11Canvas; - - TDefFont = TX11Font; - - TDefScreen = TX11Screen; - - TDefApplication = TX11Application; - - TDefWindow = TX11Window; - - TDefBitmap = TX11Bitmap; - - -implementation - -end. - diff --git a/gfx/x11/unitxft.pas b/gfx/x11/unitxft.pas deleted file mode 100644 index a4b1f6c0..00000000 --- a/gfx/x11/unitxft.pas +++ /dev/null @@ -1,162 +0,0 @@ -{ - fpGFX - Free Pascal Graphics Library - Copyright (C) 2006-2007 by Graeme Geldenhuys - member of the fpGFX development team. - - Xft interface functions - - See the file COPYING.fpGFX, included in this distribution, - for details about the copyright. - - 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. - - **********************************************************************} - - -unit unitxft; - -{$mode objfpc}{$H+} - -{$linklib Xft} - -interface -uses - Classes - ,SysUtils - ,X - ,XLib - ,Xutil - ; - - -type - TPicture = longword; - - TXftDraw = record - dummy : Pointer; - end; - PXftDraw = ^TXftDraw; - - TXftFont = record - ascent : integer; - descent : integer; - height : integer; - max_advance_width : integer; - ptr1 : Pointer; // charset - ptr2 : Pointer; // pattern - end; - PXftFont = ^TXftFont; - - TXRenderColor = record - red : word; - green : word; - blue : word; - alpha : word; - end; - - TXftColor = record - pixel : ptrint; - color : TXRenderColor; - end; - - TXGlyphInfo = packed record - width : word; - height : word; - x : smallint; - y : smallint; - xOff : smallint; - yOff : smallint; - end; - - TFcPattern = record - dummy : integer; - end; - - PFcPattern = ^TFcPattern; - PPFcPattern = ^PFcPattern; - - TFcFontSet = packed record - nfont : integer; - sfont : integer; - fonts : PPFcPattern; - end; - PFcFontSet = ^TFcFontSet; - -const - FC_FAMILY : PChar = 'family'; - FC_SIZE : PChar = 'size'; - FC_SCALABLE : PChar = 'scalable'; - - FcTypeVoid = 0; - FcTypeInteger = 1; - FcTypeDouble = 2; - FcTypeString = 3; - FcTypeBool = 4; - FcTypeMatrix = 5; - FcTypeCharSet = 6; - FcTypeFTFace = 7; - FcTypeLangSet = 8; - -function XftDrawCreate(display : PXDisplay; win : TXID; vis : PVisual; colorm : longint) : PXftDraw; cdecl; -procedure XftDrawChange(xftd : PXftDraw; win : TXID); cdecl; -procedure XftDrawDestroy(draw : PXftDraw); cdecl; - -function XftDrawPicture(draw : PXftDraw) : TPicture; cdecl; - -function XftFontOpenName(display : PXDisplay; scr : integer; par3 : PChar) : PXftFont; cdecl; -procedure XftFontClose(display : PXDisplay; fnt : PXftFont); cdecl; - -procedure XftDrawStringUtf8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; -procedure XftDrawString8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; -procedure XftDrawString16(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; - -procedure XftTextExtentsUtf8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; -procedure XftTextExtents8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; -procedure XftTextExtents16(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; - -//function XftGlyphExists(display : PXDisplay; fnt : PXftFont; ch : integer) : longbool; cdecl; - -//procedure XftDrawSetClipRectangles(draw : PXftDraw; xorigin, yorigin : integer; rect : PXRectangle; rnum : integer); cdecl; - -procedure XftDrawSetClip(draw : PXftDraw; rg : TRegion); cdecl; - -function XftListFonts(display : PXDisplay; screen : integer; params : array of const) : PFcFontSet; cdecl; -function XftNameUnparse(pat : PFcPattern; dest : PChar; destlen : integer) : boolean; cdecl; -procedure FcFontSetDestroy(fsp : PFcFontSet); cdecl; - - - -implementation - - -function XftDrawCreate(display : PXDisplay; win : TXID; vis : PVisual; colorm : longint) : PXftDraw; cdecl; external; -procedure XftDrawChange(xftd : PXftDraw; win : TXID); cdecl; external; -procedure XftDrawDestroy(draw : PXftDraw); cdecl; external; - -function XftDrawPicture(draw : PXftDraw) : TPicture; cdecl; external; - -function XftFontOpenName(display : PXDisplay; scr : integer; par3 : PChar) : PXftFont; cdecl; external; -procedure XftFontClose(display : PXDisplay; fnt : PXftFont); cdecl; external; - -procedure XftDrawStringUtf8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; -procedure XftDrawString8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; -procedure XftDrawString16(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; - -procedure XftTextExtentsUtf8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; -procedure XftTextExtents8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; -procedure XftTextExtents16(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; - -//function XftGlyphExists(display : PXDisplay; fnt : PXftFont; ch : integer) : longbool; cdecl; external; - -//procedure XftDrawSetClipRectangles(draw : PXftDraw; xorigin, yorigin : integer; rect : PXRectangle; rnum : integer); cdecl; external; - -procedure XftDrawSetClip(draw : PXftDraw; rg : TRegion); cdecl; external; - -function XftListFonts(display : PXDisplay; screen : integer; params : array of const) : PFcFontSet; cdecl; external; -function XftNameUnparse(pat : PFcPattern; dest : PChar; destlen : integer) : boolean; cdecl; external; -procedure FcFontSetDestroy(fsp : PFcFontSet); cdecl; external; - -end. - |