summaryrefslogtreecommitdiff
path: root/xserver/randr
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2013-12-28 14:40:03 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2013-12-28 14:40:03 +0000
commitfc3a735d42a0dcd748b6b8dc2c63bafde01effd0 (patch)
tree9b40fc63ccdb80ebec638a8c31e73c17f8dbbaeb /xserver/randr
parentda8308393b93d5c87075d65ace98cd249643e165 (diff)
Update to xserver 1.14.5
Diffstat (limited to 'xserver/randr')
-rw-r--r--xserver/randr/randr.c120
-rw-r--r--xserver/randr/randrstr.h12
-rw-r--r--xserver/randr/rrcrtc.c6
-rw-r--r--xserver/randr/rrinfo.c2
-rw-r--r--xserver/randr/rroutput.c7
-rw-r--r--xserver/randr/rrpointer.c2
-rw-r--r--xserver/randr/rrprovider.c25
-rw-r--r--xserver/randr/rrscreen.c2
8 files changed, 170 insertions, 6 deletions
diff --git a/xserver/randr/randr.c b/xserver/randr/randr.c
index f0decfc6c..3c5142771 100644
--- a/xserver/randr/randr.c
+++ b/xserver/randr/randr.c
@@ -420,12 +420,40 @@ 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)
{
RREventPtr *pHead, pRREvent;
ClientPtr client;
ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr iter;
+ rrScrPrivPtr pSlaveScrPriv;
rrScrPriv(pScreen);
int i;
@@ -450,6 +478,16 @@ TellChanged(WindowPtr pWin, pointer value)
if (crtc->changed)
RRDeliverCrtcEvent(client, pWin, crtc);
}
+
+ xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ for (i = 0; i < pSlaveScrPriv->numCrtcs; i++) {
+ RRCrtcPtr crtc = pSlaveScrPriv->crtcs[i];
+
+ if (crtc->changed)
+ RRDeliverCrtcEvent(client, pWin, crtc);
+ }
+ }
}
if (pRREvent->mask & RROutputChangeNotifyMask) {
@@ -459,11 +497,67 @@ TellChanged(WindowPtr pWin, pointer value)
if (output->changed)
RRDeliverOutputEvent(client, pWin, output);
}
+
+ xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ for (i = 0; i < pSlaveScrPriv->numOutputs; i++) {
+ RROutputPtr output = pSlaveScrPriv->outputs[i];
+
+ if (output->changed)
+ RRDeliverOutputEvent(client, pWin, output);
+ }
+ }
+ }
+
+ if (pRREvent->mask & RRProviderChangeNotifyMask) {
+ xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ if (pSlaveScrPriv->provider->changed)
+ RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider);
+ }
+ }
+
+ if (pRREvent->mask & RRResourceChangeNotifyMask) {
+ if (pScrPriv->resourcesChanged) {
+ RRDeliverResourceEvent(client, pWin);
+ }
}
}
return WT_WALKCHILDREN;
}
+void
+RRSetChanged(ScreenPtr pScreen)
+{
+ /* set changed bits on the master screen only */
+ ScreenPtr master;
+ rrScrPriv(pScreen);
+ rrScrPrivPtr mastersp;
+
+ if (pScreen->isGPU) {
+ master = pScreen->current_master;
+ if (!master)
+ return;
+ mastersp = rrGetScrPriv(master);
+ }
+ else {
+ master = pScreen;
+ mastersp = pScrPriv;
+ }
+
+ mastersp->changed = TRUE;
+}
+
/*
* Something changed; send events and adjust pointer position
*/
@@ -474,6 +568,8 @@ RRTellChanged(ScreenPtr pScreen)
rrScrPriv(pScreen);
rrScrPrivPtr mastersp;
int i;
+ ScreenPtr iter;
+ rrScrPrivPtr pSlaveScrPriv;
if (pScreen->isGPU) {
master = pScreen->current_master;
@@ -484,7 +580,7 @@ RRTellChanged(ScreenPtr pScreen)
mastersp = pScrPriv;
}
- if (pScrPriv->changed) {
+ if (mastersp->changed) {
UpdateCurrentTimeIf();
if (mastersp->configChanged) {
mastersp->lastConfigTime = currentTime;
@@ -492,11 +588,33 @@ 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++)
pScrPriv->crtcs[i]->changed = FALSE;
+
+ xorg_list_for_each_entry(iter, &master->output_slave_list, output_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ for (i = 0; i < pSlaveScrPriv->numOutputs; i++)
+ pSlaveScrPriv->outputs[i]->changed = FALSE;
+ for (i = 0; i < pSlaveScrPriv->numCrtcs; i++)
+ pSlaveScrPriv->crtcs[i]->changed = FALSE;
+ }
+ xorg_list_for_each_entry(iter, &master->offload_slave_list, offload_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ }
+ xorg_list_for_each_entry(iter, &master->unattached_list, unattached_head) {
+ pSlaveScrPriv = rrGetScrPriv(iter);
+ pSlaveScrPriv->provider->changed = FALSE;
+ }
+
if (mastersp->layoutChanged) {
pScrPriv->layoutChanged = FALSE;
RRPointerScreenConfigured(master);
diff --git a/xserver/randr/randrstr.h b/xserver/randr/randrstr.h
index 25174798f..27b4ba05c 100644
--- a/xserver/randr/randrstr.h
+++ b/xserver/randr/randrstr.h
@@ -166,6 +166,7 @@ struct _rrProvider {
Bool pendingProperties;
struct _rrProvider *offload_sink;
struct _rrProvider *output_source;
+ Bool changed;
};
#if RANDR_12_INTERFACE
@@ -336,6 +337,7 @@ typedef struct _rrScrPriv {
RRProviderDestroyProcPtr rrProviderDestroy;
+ Bool resourcesChanged; /* screen resources change */
} rrScrPrivRec, *rrScrPrivPtr;
extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
@@ -485,7 +487,14 @@ 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
+RRSetChanged(ScreenPtr pScreen);
+
/*
* Send all pending events
*/
@@ -919,6 +928,9 @@ RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities);
extern _X_EXPORT Bool
RRProviderLookup(XID id, RRProviderPtr *provider_p);
+extern _X_EXPORT void
+RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider);
+
/* rrproviderproperty.c */
extern _X_EXPORT void
diff --git a/xserver/randr/rrcrtc.c b/xserver/randr/rrcrtc.c
index 6e2eca5ad..5cdfd0510 100644
--- a/xserver/randr/rrcrtc.c
+++ b/xserver/randr/rrcrtc.c
@@ -39,7 +39,7 @@ RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged)
if (pScreen) {
rrScrPriv(pScreen);
- pScrPriv->changed = TRUE;
+ RRSetChanged(pScreen);
/*
* Send ConfigureNotify on any layout change
*/
@@ -102,6 +102,8 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
crtc->pScreen = pScreen;
pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
+ RRResourcesChanged(pScreen);
+
return crtc;
}
@@ -672,6 +674,8 @@ RRCrtcDestroyResource(pointer value, XID pid)
break;
}
}
+
+ RRResourcesChanged(pScreen);
}
if (crtc->scanout_pixmap)
diff --git a/xserver/randr/rrinfo.c b/xserver/randr/rrinfo.c
index 1408d6f64..fc57bd408 100644
--- a/xserver/randr/rrinfo.c
+++ b/xserver/randr/rrinfo.c
@@ -225,7 +225,7 @@ RRScreenSetSizeRange(ScreenPtr pScreen,
pScrPriv->minHeight = minHeight;
pScrPriv->maxWidth = maxWidth;
pScrPriv->maxHeight = maxHeight;
- pScrPriv->changed = TRUE;
+ RRSetChanged(pScreen);
pScrPriv->configChanged = TRUE;
}
diff --git a/xserver/randr/rroutput.c b/xserver/randr/rroutput.c
index 88781ba0f..2b0b82f4c 100644
--- a/xserver/randr/rroutput.c
+++ b/xserver/randr/rroutput.c
@@ -36,7 +36,7 @@ RROutputChanged(RROutputPtr output, Bool configChanged)
output->changed = TRUE;
if (pScreen) {
rrScrPriv(pScreen);
- pScrPriv->changed = TRUE;
+ RRSetChanged(pScreen);
if (configChanged)
pScrPriv->configChanged = TRUE;
}
@@ -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++)
diff --git a/xserver/randr/rrpointer.c b/xserver/randr/rrpointer.c
index ec803e9d1..eb6b6770c 100644
--- a/xserver/randr/rrpointer.c
+++ b/xserver/randr/rrpointer.c
@@ -82,7 +82,7 @@ RRPointerToNearestCrtc(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
else
dx = 0;
if (y < crtc->y)
- dy = crtc->y - x;
+ dy = crtc->y - y;
else if (y > crtc->y + scan_height)
dy = y - (crtc->y + scan_height);
else
diff --git a/xserver/randr/rrprovider.c b/xserver/randr/rrprovider.c
index b321e6227..2334ad277 100644
--- a/xserver/randr/rrprovider.c
+++ b/xserver/randr/rrprovider.c
@@ -304,6 +304,9 @@ ProcRRSetProviderOutputSource(ClientPtr client)
pScrPriv->rrProviderSetOutputSource(pScreen, provider, source_provider);
+ provider->changed = TRUE;
+ RRSetChanged(pScreen);
+
RRTellChanged (pScreen);
return Success;
@@ -333,6 +336,9 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
pScrPriv->rrProviderSetOffloadSink(pScreen, provider, sink_provider);
+ provider->changed = TRUE;
+ RRSetChanged(pScreen);
+
RRTellChanged (pScreen);
return Success;
@@ -357,6 +363,7 @@ RRProviderCreate(ScreenPtr pScreen, const char *name,
provider->nameLength = nameLength;
memcpy(provider->name, name, nameLength);
provider->name[nameLength] = '\0';
+ provider->changed = FALSE;
if (!AddResource (provider->id, RRProviderType, (pointer) provider))
return NULL;
@@ -416,3 +423,21 @@ RRProviderLookup(XID id, RRProviderPtr *provider_p)
return TRUE;
return FALSE;
}
+
+void
+RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ rrScrPriv(pScreen);
+
+ xRRProviderChangeNotifyEvent pe = {
+ .type = RRNotify + RREventBase,
+ .subCode = RRNotify_ProviderChange,
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .window = pWin->drawable.id,
+ .provider = provider->id
+ };
+
+ WriteEventsToClient(client, 1, (xEvent *) &pe);
+}
diff --git a/xserver/randr/rrscreen.c b/xserver/randr/rrscreen.c
index 39340ccee..36179ae89 100644
--- a/xserver/randr/rrscreen.c
+++ b/xserver/randr/rrscreen.c
@@ -143,7 +143,7 @@ RRScreenSizeNotify(ScreenPtr pScreen)
pScrPriv->height = pScreen->height;
pScrPriv->mmWidth = pScreen->mmWidth;
pScrPriv->mmHeight = pScreen->mmHeight;
- pScrPriv->changed = TRUE;
+ RRSetChanged(pScreen);
/* pScrPriv->sizeChanged = TRUE; */
RRTellChanged(pScreen);