From 0070192418fc18f46b3446f934869079107d2ff7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 13 Jul 2007 10:23:07 -0700 Subject: Add the 1.3 output dpms change notify event. --- configure.ac | 2 +- include/X11/extensions/Xrandr.h | 11 +++++++++++ src/Xrandr.c | 21 +++++++++++++++++---- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 16e5a14..5ed42b0 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,7 @@ dnl try to keep these the same. Note that the library has an extra dnl digit in the version number to track changes which don't affect the dnl protocol, so Xrandr version l.n.m corresponds to protocol version l.n dnl -AC_INIT(libXrandr, 1.2.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXrandr) +AC_INIT(libXrandr, 1.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXrandr) AC_CONFIG_AUX_DIR(.) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE diff --git a/include/X11/extensions/Xrandr.h b/include/X11/extensions/Xrandr.h index d87976b..16d7836 100644 --- a/include/X11/extensions/Xrandr.h +++ b/include/X11/extensions/Xrandr.h @@ -116,6 +116,17 @@ typedef struct { int state; /* NewValue, Deleted */ } XRROutputPropertyNotifyEvent; +typedef struct { + int type; /* event base */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* window which selected for this event */ + int subtype; /* RRNotify_OutputDPMSChange */ + RROutput output; /* affected output */ + CARD16 level; /* New DPMS level */ +} XRROutputDPMSChangeNotifyEvent; + /* internal representation is private to the library */ typedef struct _XRRScreenConfiguration XRRScreenConfiguration; diff --git a/src/Xrandr.c b/src/Xrandr.c index fdaa80d..f6c804d 100644 --- a/src/Xrandr.c +++ b/src/Xrandr.c @@ -129,12 +129,18 @@ static Bool XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire) aevent->state = awire->state; return True; } - - break; + case RRNotify_OutputDPMSChange: { + XRROutputDPMSChangeNotifyEvent *aevent = + (XRROutputDPMSChangeNotifyEvent *) event; + xRROutputDPMSChangeNotifyEvent *awire = + (xRROutputDPMSChangeNotifyEvent *) wire; + aevent->output = awire->output; + aevent->level = awire->level; + return True; } - } + } /* RRNotify subtype switch */ + } /* RRNotify */ } - return False; } @@ -204,6 +210,13 @@ static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire) awire->state = aevent->state; return True; } + case RRNotify_OutputDPMSChange: { + xRROutputDPMSChangeNotifyEvent *awire = (xRROutputDPMSChangeNotifyEvent *) wire; + XRROutputDPMSChangeNotifyEvent *aevent = (XRROutputDPMSChangeNotifyEvent *) event; + awire->output = aevent->output; + awire->level = aevent->level; + return True; + } } } } -- cgit v1.2.1