summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
Diffstat (limited to 'randr')
-rw-r--r--randr/randr.c36
-rw-r--r--randr/randrstr.h4
-rw-r--r--randr/rrcrtc.c4
-rw-r--r--randr/rroutput.c5
4 files changed, 49 insertions, 0 deletions
diff --git a/randr/randr.c b/randr/randr.c
index fa0a4da71..9cec6f653 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -420,6 +420,32 @@ RRExtensionInit(void)
#endif
}
+void
+RRResourcesChanged(ScreenPtr pScreen)
+{
+ rrScrPriv(pScreen);
+ pScrPriv->resourcesChanged = TRUE;
+
+ RRSetChanged(pScreen);
+}
+
+static void
+RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ rrScrPriv(pScreen);
+
+ xRRResourceChangeNotifyEvent re = {
+ .type = RRNotify + RREventBase,
+ .subCode = RRNotify_ResourceChange,
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .window = pWin->drawable.id
+ };
+
+ WriteEventsToClient(client, 1, (xEvent *) &re);
+}
+
static int
TellChanged(WindowPtr pWin, pointer value)
{
@@ -480,6 +506,12 @@ TellChanged(WindowPtr pWin, pointer value)
RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
}
}
+
+ if (pRREvent->mask & RRResourceChangeNotifyMask) {
+ if (pScrPriv->resourcesChanged) {
+ RRDeliverResourceEvent(client, pWin);
+ }
+ }
}
return WT_WALKCHILDREN;
}
@@ -536,7 +568,11 @@ RRTellChanged(ScreenPtr pScreen)
}
pScrPriv->changed = FALSE;
mastersp->changed = FALSE;
+
WalkTree(master, TellChanged, (pointer) master);
+
+ mastersp->resourcesChanged = FALSE;
+
for (i = 0; i < pScrPriv->numOutputs; i++)
pScrPriv->outputs[i]->changed = FALSE;
for (i = 0; i < pScrPriv->numCrtcs; i++)
diff --git a/randr/randrstr.h b/randr/randrstr.h
index c93334938..15299fd6d 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -301,6 +301,7 @@ typedef struct _rrScrPriv {
Bool changed; /* some config changed */
Bool configChanged; /* configuration changed */
Bool layoutChanged; /* screen layout changed */
+ Bool resourcesChanged; /* screen resources change */
CARD16 minWidth, minHeight;
CARD16 maxWidth, maxHeight;
@@ -486,6 +487,9 @@ extern _X_EXPORT int
extern _X_EXPORT void
RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
+extern _X_EXPORT void
+ RRResourcesChanged(ScreenPtr pScreen);
+
/* randr.c */
/* set a screen change on the primary screen */
extern _X_EXPORT void
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 2f76b62be..99b3dca08 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -102,6 +102,8 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
crtc->pScreen = pScreen;
pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
+ RRResourcesChanged(pScreen);
+
return crtc;
}
@@ -669,6 +671,8 @@ RRCrtcDestroyResource(pointer value, XID pid)
break;
}
}
+
+ RRResourcesChanged(pScreen);
}
if (crtc->scanout_pixmap)
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 922d61f3d..2b0b82f4c 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -101,6 +101,9 @@ RROutputCreate(ScreenPtr pScreen,
return NULL;
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
+
+ RRResourcesChanged(pScreen);
+
return output;
}
@@ -355,6 +358,8 @@ RROutputDestroyResource(pointer value, XID pid)
break;
}
}
+
+ RRResourcesChanged(pScreen);
}
if (output->modes) {
for (m = 0; m < output->numModes; m++)