diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2018-10-01 16:58:30 +0300 |
---|---|---|
committer | Alexander Volkov <avolkov@astralinux.ru> | 2020-02-26 15:44:33 +0300 |
commit | 564d18c8e56cd6f271a928f1dc835b40e1f5a181 (patch) | |
tree | 287c1a265c9f228ce75cafa92bda5aed0be7217d | |
parent | 032909626b4b4757a4ad10823b199157538a58e9 (diff) |
Add DPMSInfoNotify event
This will allow applications to respond to changes of power level
of a monitor, e.g. an application may stop rendering and related
calculations when the monitor is off.
Bump DPMS version to 1.2, install dpmsproto.pc.
Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | dpmsproto.pc.in | 8 | ||||
-rw-r--r-- | include/X11/extensions/dpmsconst.h | 5 | ||||
-rw-r--r-- | include/X11/extensions/dpmsproto.h | 26 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | specs/xextproto/dpms.xml | 104 |
7 files changed, 143 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index 18f4203..59c49cf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,9 @@ dmx_HEADERS = \ dmxprotopkgconfigdir = $(datadir)/pkgconfig dmxprotopkgconfig_DATA = dmxproto.pc +dpmsprotopkgconfigdir = $(datadir)/pkgconfig +dpmsprotopkgconfig_DATA = dpmsproto.pc + dri2dir = $(includedir)/X11/extensions dri2_HEADERS = \ include/X11/extensions/dri2proto.h \ diff --git a/configure.ac b/configure.ac index 0df5858..5b73036 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,7 @@ AC_CONFIG_FILES([applewmproto.pc compositeproto.pc damageproto.pc dmxproto.pc + dpmsproto.pc dri2proto.pc dri3proto.pc evieproto.pc diff --git a/dpmsproto.pc.in b/dpmsproto.pc.in new file mode 100644 index 0000000..930d208 --- /dev/null +++ b/dpmsproto.pc.in @@ -0,0 +1,8 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ + +Name: DPMSProto +Description: DPMS extension headers +Version: 1.2 +Cflags: -I${includedir} diff --git a/include/X11/extensions/dpmsconst.h b/include/X11/extensions/dpmsconst.h index 75f0586..f46d2d9 100644 --- a/include/X11/extensions/dpmsconst.h +++ b/include/X11/extensions/dpmsconst.h @@ -30,7 +30,7 @@ Equipment Corporation. #define _DPMSCONST_H 1 #define DPMSMajorVersion 1 -#define DPMSMinorVersion 1 +#define DPMSMinorVersion 2 #define DPMSExtensionName "DPMS" @@ -39,5 +39,8 @@ Equipment Corporation. #define DPMSModeSuspend 2 #define DPMSModeOff 3 +#define DPMSInfoNotifyMask (1L << 0) +#define DPMSInfoNotify 0 + #endif /* !_DPMSCONST_H */ diff --git a/include/X11/extensions/dpmsproto.h b/include/X11/extensions/dpmsproto.h index c847016..6b7e419 100644 --- a/include/X11/extensions/dpmsproto.h +++ b/include/X11/extensions/dpmsproto.h @@ -39,6 +39,7 @@ Equipment Corporation. #define X_DPMSDisable 5 #define X_DPMSForceLevel 6 #define X_DPMSInfo 7 +#define X_DPMSSelectInput 8 #define DPMSNumberEvents 0 @@ -172,4 +173,29 @@ typedef struct { } xDPMSInfoReply; #define sz_xDPMSInfoReply 32 +typedef struct { + CARD8 reqType; /* always DPMSCode */ + CARD8 dpmsReqType; /* always X_DPMSSelectInput */ + CARD16 length B16; + CARD32 eventMask B32; +} xDPMSSelectInputReq; +#define sz_xDPMSSelectInputReq 8 + +typedef struct { + CARD8 type; + CARD8 extension; + CARD16 sequenceNumber B16; + CARD32 length; + CARD16 evtype B16; + CARD16 pad0 B16; + Time timestamp B32; + CARD16 power_level B16; + BOOL state; + CARD8 pad1; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; +} xDPMSInfoNotifyEvent; +#define sz_xDPMSInfoNotifyEvent 32 + #endif /* _DPMSPROTO_H_ */ diff --git a/meson.build b/meson.build index 68e622a..eadc2fd 100644 --- a/meson.build +++ b/meson.build @@ -29,6 +29,7 @@ pcs = [ ['compositeproto', '0.4.2'], ['damageproto', '1.2.1'], ['dmxproto', '2.3.1'], + ['dpmsproto', '1.2'], ['dri2proto', '2.8'], ['dri3proto', '1.2'], ['fixesproto', '5.0'], diff --git a/specs/xextproto/dpms.xml b/specs/xextproto/dpms.xml index f504ab7..823344d 100644 --- a/specs/xextproto/dpms.xml +++ b/specs/xextproto/dpms.xml @@ -175,7 +175,7 @@ increment for small, upward-compatible changes. Servers that support the protocol defined in this document will return a <emphasis remap='I'>server_major_version</emphasis> of one (1), and a <emphasis remap='I'>server_minor_version</emphasis> -of one (1). +of two (2). </para> <para> @@ -435,13 +435,81 @@ of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend or DPMSModeOff, otherwise it is undefined. </para> +<para> +<olink targetdoc='dpmslib' targetptr='DPMSSelectInput'><function>DPMSSelectInput</function></olink> +</para> + +<informaltable frame="none"> + <?dbfo keep-together="always" ?> + <tgroup cols='1' align='left' colsep='0' rowsep='0'> + <colspec colname='c1' colwidth="1.0*"/> + <tbody> + <row> + <entry> +<emphasis remap='I'>event_mask</emphasis>: CARD32 + </entry> + </row> + <row> + <entry>=></entry> + </row> + </tbody> + </tgroup> +</informaltable> + +<para> +This request specifies whether DPMS extension events should be generated for this client. +If DPMSInfoNotifyMask is set in <emphasis remap='I'>event-mask</emphasis>, then DPMSInfoNotifyEvent +events will be generated whenever the current DPMS on/off state or power level changes. +If no bits are set, then no events will be generated. +</para> + </chapter> -<chapter id="Events_and_Errors"> -<title>Events and Errors</title> +<chapter id="Events"> + +<title>Events</title> +<para> +The DPMS extension adds one event: +</para> <para> -No new events or errors are defined by this extension. +<function>DPMSInfoNotifyEvent</function> </para> + +<informaltable frame="none"> + <?dbfo keep-together="always" ?> + <tgroup cols='1' align='left' colsep='0' rowsep='0'> + <colspec colname='c1' colwidth="1.0*"/> + <tbody> + <row> + <entry> +<emphasis remap='I'>timestamp</emphasis>: TIMESTAMP + </entry> + </row> + <row> + <entry> +<emphasis remap='I'>power_level</emphasis>: CARD16 + </entry> + </row> + <row> + <entry> +<emphasis remap='I'>state</emphasis>: BOOL + </entry> + </row> + </tbody> + </tgroup> +</informaltable> + +<para> +This event is delivered to clients that have requested +DPMSInfoNotifyMask events using the <function>DPMSSelectInput</function> request +whenever the current DPMS on/off state or power level changes. +<emphasis remap='I'>state</emphasis> is one of DPMSEnabled or DPMSDisabled. +If <emphasis remap='I'>state</emphasis> is DPMSEnabled, +<emphasis remap='I'>power_level</emphasis> is one +of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend or DPMSModeOff, otherwise +it is undefined. +</para> + </chapter> <chapter id="Encoding"> @@ -563,5 +631,33 @@ The name of this extension is "DPMS". 21 unused </literallayout> + +<literallayout class="monospaced"> +<olink targetdoc='dpmslib' targetptr='DPMSSelectInput'><function>DPMSSelectInput</function></olink> + 1 CARD8 opcode + 1 8 DPMS opcode + 2 2 request length + 4 event mask + 0 no events + 1 DPMSInfoNotifyMask +</literallayout> + +<literallayout class="monospaced"> +<olink targetdoc='dpmslib' targetptr='DPMSInfoNotifyEvent'><function>DPMSInfoNotifyEvent</function></olink> + 1 GenericEvent type + 1 CARD8 DPMS extension offset + 2 CARD16 sequence number + 4 0 length + 2 DPMSInfoNotify evtype + 2 unused + 4 TIMESTAMP timestamp + 2 power_level + 0 DPMSModeOn + 1 DPMSModeStandby + 2 DPMSModeSuspend + 3 DPMSModeOff + 1 BOOL state + 13 unused +</literallayout> </chapter> </book> |