summaryrefslogtreecommitdiff
path: root/randr/rroutput.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-02-12 13:51:54 -0800
committerAdam Jackson <ajax@redhat.com>2018-02-27 12:34:26 -0500
commit39573605050f6253d14a4786bb79ce2b48537039 (patch)
tree4d5e1d34bb1a4c890d5db33287a0ebc6841c6b66 /randr/rroutput.c
parentb91c787c4cd2d20685db69426c539938c556128a (diff)
randr: Support "non-desktop" property
Tracks changes to the non-desktop property so that when non-zero, outputs will always appear to be disconnected. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@nwnk.net>
Diffstat (limited to 'randr/rroutput.c')
-rw-r--r--randr/rroutput.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 90fe4e6c1..d5c30aded 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -22,6 +22,7 @@
*/
#include "randrstr.h"
+#include <X11/Xatom.h>
RESTYPE RROutputType;
@@ -65,6 +66,7 @@ RROutputCreate(ScreenPtr pScreen,
RROutputPtr output;
RROutputPtr *outputs;
rrScrPrivPtr pScrPriv;
+ Atom nonDesktopAtom;
if (!RRInit())
return NULL;
@@ -111,6 +113,13 @@ RROutputCreate(ScreenPtr pScreen,
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
+ nonDesktopAtom = MakeAtom(RR_PROPERTY_NON_DESKTOP, strlen(RR_PROPERTY_NON_DESKTOP), TRUE);
+ if (nonDesktopAtom != BAD_RESOURCE) {
+ static const INT32 values[2] = { 0, 1 };
+ (void) RRConfigureOutputProperty(output, nonDesktopAtom, FALSE, FALSE, FALSE,
+ 2, values);
+ }
+ RROutputSetNonDesktop(output, FALSE);
RRResourcesChanged(pScreen);
return output;
@@ -311,6 +320,20 @@ RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight)
return TRUE;
}
+Bool
+RROutputSetNonDesktop(RROutputPtr output, Bool nonDesktop)
+{
+ const char *nonDesktopStr = RR_PROPERTY_NON_DESKTOP;
+ Atom nonDesktopProp = MakeAtom(nonDesktopStr, strlen(nonDesktopStr), TRUE);
+ uint32_t value = nonDesktop ? 1 : 0;
+
+ if (nonDesktopProp == None || nonDesktopProp == BAD_RESOURCE)
+ return FALSE;
+
+ return RRChangeOutputProperty(output, nonDesktopProp, XA_INTEGER, 32,
+ PropModeReplace, 1, &value, TRUE, FALSE) == Success;
+}
+
void
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
{
@@ -330,7 +353,7 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
.crtc = crtc ? crtc->id : None,
.mode = mode ? mode->mode.id : None,
.rotation = crtc ? crtc->rotation : RR_Rotate_0,
- .connection = output->connection,
+ .connection = output->nonDesktop ? RR_Disconnected : output->connection,
.subpixelOrder = output->subpixelOrder
};
WriteEventsToClient(client, 1, (xEvent *) &oe);
@@ -442,6 +465,7 @@ ProcRRGetOutputInfo(ClientPtr client)
.crtc = output->crtc ? output->crtc->id : None,
.mmWidth = output->mmWidth,
.mmHeight = output->mmHeight,
+ .connection = output->nonDesktop ? RR_Disconnected : output->connection,
.connection = output->connection,
.subpixelOrder = output->subpixelOrder,
.nCrtcs = output->numCrtcs,