Browse Source

+ added unit dpms (header conversion of X11/extensions/dpms.h)

Nikolay Nikolov 4 years ago
parent
commit
68c964bf59

+ 6 - 0
packages/x11/fpmake.pp

@@ -189,6 +189,12 @@ begin
           AddUnit('xlib');
         end;
     T:=P.Targets.AddUnit('xmd.pp');
+    T:=P.Targets.AddUnit('dpms.pp');
+      with T.Dependencies do
+        begin
+          AddInclude('dpmsconst.inc');
+          AddUnit('xlib');
+        end;
 
 {$ifndef ALLPACKAGES}
     Run;

+ 52 - 0
packages/x11/src/dpms.pp

@@ -0,0 +1,52 @@
+(*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************)
+
+unit dpms;
+
+interface
+
+uses
+  ctypes, xmd, xlib;
+
+const
+  libXext = 'Xext';
+
+{$I dpmsconst.inc}
+
+function DPMSQueryExtension(display: PDisplay; event_base, error_base: Pcint): TBoolResult; cdecl; external libXext;
+function DPMSGetVersion(display: PDisplay; major_version, minor_version: Pcint): TStatus; cdecl; external libXext;
+function DPMSCapable(display: PDisplay): TBoolResult; cdecl; external libXext;
+function DPMSSetTimeouts(display: PDisplay; standby, suspend, off: CARD16): TStatus; cdecl; external libXext;
+function DPMSGetTimeouts(display: PDisplay; standby, suspend, off: PCARD16): TBoolResult; cdecl; external libXext;
+function DPMSEnable(display: PDisplay): TStatus; cdecl; external libXext;
+function DPMSDisable(display: PDisplay): TStatus; cdecl; external libXext;
+function DPMSForceLevel(display: PDisplay; level: CARD16): TStatus; cdecl; external libXext;
+function DPMSInfo(display: PDisplay; power_level: PCARD16; state: PBoolResult): TStatus; cdecl; external libXext;
+
+implementation
+end.

+ 41 - 0
packages/x11/src/dpmsconst.inc

@@ -0,0 +1,41 @@
+(*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital
+Equipment Corporation.
+
+******************************************************************)
+
+const
+  DPMSMajorVersion   = 1;
+  DPMSMinorVersion   = 2;
+
+  DPMSExtensionName  = 'DPMS';
+
+  DPMSModeOn         = 0;
+  DPMSModeStandby    = 1;
+  DPMSModeSuspend    = 2;
+  DPMSModeOff        = 3;
+
+  DPMSInfoNotifyMask = 1 shl 0;
+  DPMSInfoNotify     = 0;

+ 1 - 0
packages/x11/src/xlib.pp

@@ -45,6 +45,7 @@ type
      For function results, longbool is OK, since everything <>0 
      is interpreted as true, so we introduce TBoolResult. }
    TBool = cint;
+   PBoolResult = ^TBoolResult;
    TBoolResult = longbool;
    PStatus = ^TStatus;
    TStatus = cint;

+ 16 - 0
packages/x11/tests/dpms_linktest.pp

@@ -0,0 +1,16 @@
+{ this program just links all externals, declared in the dpms unit }
+program dpms_linktest;
+uses
+  dpms;
+begin
+  halt(0);
+  DPMSQueryExtension(nil,nil,nil);
+  DPMSGetVersion(nil,nil,nil);
+  DPMSCapable(nil);
+  DPMSSetTimeouts(nil,0,0,0);
+  DPMSGetTimeouts(nil,nil,nil,nil);
+  DPMSEnable(nil);
+  DPMSDisable(nil);
+  DPMSForceLevel(nil,0);
+  DPMSInfo(nil,nil,nil);
+end.