+ added unit xdbe (header translation of X11/extensions/Xdbe.h)

This commit is contained in:
Nikolay Nikolov 2021-08-06 00:14:01 +03:00
parent c3798a4a38
commit c6ef087850
4 changed files with 210 additions and 0 deletions

View File

@ -181,6 +181,13 @@ begin
AddUnit('x');
AddUnit('xlib');
end;
T:=P.Targets.AddUnit('xdbe.pp');
with T.Dependencies do
begin
AddInclude('dbe.inc');
AddUnit('x');
AddUnit('xlib');
end;
{$ifndef ALLPACKAGES}
Run;

52
packages/x11/src/dbe.inc Normal file
View File

@ -0,0 +1,52 @@
(******************************************************************************
*
* Copyright (c) 1994, 1995 Hewlett-Packard Company
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Hewlett-Packard
* Company shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the Hewlett-Packard Company.
*
* Header file for Xlib-related DBE
*
*****************************************************************************)
const
{ Values for swap_action field of XdbeSwapInfo structure }
XdbeUndefined = 0;
XdbeBackground = 1;
XdbeUntouched = 2;
XdbeCopied = 3;
{ Errors }
XdbeBadBuffer = 0;
DBE_PROTOCOL_NAME = 'DOUBLE-BUFFER';
{ Current version numbers }
DBE_MAJOR_VERSION = 1;
DBE_MINOR_VERSION = 0;
{ Used when adding extension; also used in Xdbe macros }
DbeNumberEvents = 0;
DbeBadBuffer = 0;
DbeNumberErrors = DbeBadBuffer + 1;

136
packages/x11/src/xdbe.pp Normal file
View File

@ -0,0 +1,136 @@
(******************************************************************************
*
* Copyright (c) 1994, 1995 Hewlett-Packard Company
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the Hewlett-Packard
* Company shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the Hewlett-Packard Company.
*
* Header file for Xlib-related DBE
*
*****************************************************************************)
unit xdbe;
{$PACKRECORDS c}
interface
uses
ctypes, x, xlib;
const
libXext = 'Xext';
{$I dbe.inc}
type
PXdbeVisualInfo = ^TXdbeVisualInfo;
TXdbeVisualInfo = record
visual: TVisualID; { one visual ID that supports double-buffering }
depth: cint; { depth of visual in bits }
perflevel: cint; { performance level of visual }
end;
PXdbeScreenVisualInfo = ^TXdbeScreenVisualInfo;
TXdbeScreenVisualInfo = record
count: cint; { number of items in visual_depth }
visinfo: PXdbeVisualInfo; { list of visuals & depths for scrn }
end;
PXdbeBackBuffer = ^TXdbeBackBuffer;
TXdbeBackBuffer = TDrawable;
PXdbeSwapAction = ^TXdbeSwapAction;
TXdbeSwapAction = cuchar;
PXdbeSwapInfo = ^TXdbeSwapInfo;
TXdbeSwapInfo = record
swap_window: TWindow; { window for which to swap buffers }
swap_action: TXdbeSwapAction; { swap action to use for swap_window }
end;
PXdbeBackBufferAttributes = ^TXdbeBackBufferAttributes;
TXdbeBackBufferAttributes = record
window: TWindow; { window that buffer belongs to }
end;
PXdbeBufferError = ^TXdbeBufferError;
TXdbeBufferError = record
_type: cint;
display: PDisplay; { display the event was read from }
buffer: TXdbeBackBuffer; { resource id }
serial: culong; { serial number of failed request }
error_code: cuchar; { error base + XdbeBadBuffer }
request_code: cuchar; { major opcode of failed request }
minor_code: cuchar; { minor opcode of failed request }
end;
function XdbeQueryExtension(
dpy: PDisplay;
major_version_return,
minor_version_return: Pcint
): TStatus; cdecl; external libXext;
function XdbeAllocateBackBufferName(
dpy: PDisplay;
window: TWindow;
swap_action: TXdbeSwapAction
): TXdbeBackBuffer; cdecl; external libXext;
function XdbeDeallocateBackBufferName(
dpy: PDisplay;
buffer: TXdbeBackBuffer
): TStatus; cdecl; external libXext;
function XdbeSwapBuffers(
dpy: PDisplay;
swap_info: PXdbeSwapInfo;
num_windows: cint
): TStatus; cdecl; external libXext;
function XdbeBeginIdiom(
dpy: PDisplay
): TStatus; cdecl; external libXext;
function XdbeEndIdiom(
dpy: PDisplay
): TStatus; cdecl; external libXext;
function XdbeGetVisualInfo(
dpy: PDisplay;
screen_specifiers: PDrawable;
num_screens: Pcint
): PXdbeScreenVisualInfo; cdecl; external libXext;
procedure XdbeFreeVisualInfo(
visual_info: PXdbeScreenVisualInfo
); cdecl; external libXext;
function XdbeGetBackBufferAttributes(
dpy: PDisplay;
buffer: TXdbeBackBuffer
): PXdbeBackBufferAttributes; cdecl; external libXext;
implementation
end.

View File

@ -0,0 +1,15 @@
program xdbe_linktest;
uses
xdbe;
begin
halt(0);
XdbeQueryExtension(nil,nil,nil);
XdbeAllocateBackBufferName(nil,0,0);
XdbeDeallocateBackBufferName(nil,0);
XdbeSwapBuffers(nil,nil,0);
XdbeBeginIdiom(nil);
XdbeEndIdiom(nil);
XdbeGetVisualInfo(nil,nil,nil);
XdbeFreeVisualInfo(nil);
XdbeGetBackBufferAttributes(nil,0);
end.