diff options
author | Michal Srb <msrb@suse.com> | 2013-10-30 13:33:50 +0200 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-10-30 08:09:27 -0700 |
commit | a9ca93dcf9a711b3d60fbad31cbd44e0c82b6f42 (patch) | |
tree | c7a853df714b162ce9b708ba8c9d451b90753a99 /randr | |
parent | 4b39ea8a918fe6117bf34dc1cba67a4e56d0d1fb (diff) |
randr: send RRResourceChangeNotify event
Send RRResourceChangeNotify event when provider, output or crtc was created or
destroyed. I.e. when the list of resources returned by RRGetScreenResources and
RRGetProviders changes.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'randr')
-rw-r--r-- | randr/randr.c | 36 | ||||
-rw-r--r-- | randr/randrstr.h | 4 | ||||
-rw-r--r-- | randr/rrcrtc.c | 4 | ||||
-rw-r--r-- | randr/rroutput.c | 5 |
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++) |