shadowfb: Fix initialization
This has to run at initial CreateWindow time, at CreateScreenResources the root window doesn't actually exist yet. Tested-by: Michael Thayer <michael.thayer@oracle.com> Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Michael Thayer <michael.thayer@oracle.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
d9e99edd4d
commit
6d684f916b
|
@ -29,14 +29,14 @@
|
||||||
#include "picturestr.h"
|
#include "picturestr.h"
|
||||||
|
|
||||||
static Bool ShadowCloseScreen(ScreenPtr pScreen);
|
static Bool ShadowCloseScreen(ScreenPtr pScreen);
|
||||||
static Bool ShadowCreateScreenResources(ScreenPtr pScreen);
|
static Bool ShadowCreateRootWindow(WindowPtr pWin);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ScrnInfoPtr pScrn;
|
ScrnInfoPtr pScrn;
|
||||||
RefreshAreaFuncPtr preRefresh;
|
RefreshAreaFuncPtr preRefresh;
|
||||||
RefreshAreaFuncPtr postRefresh;
|
RefreshAreaFuncPtr postRefresh;
|
||||||
CloseScreenProcPtr CloseScreen;
|
CloseScreenProcPtr CloseScreen;
|
||||||
CreateScreenResourcesProcPtr CreateScreenResources;
|
CreateWindowProcPtr CreateWindow;
|
||||||
} ShadowScreenRec, *ShadowScreenPtr;
|
} ShadowScreenRec, *ShadowScreenPtr;
|
||||||
|
|
||||||
static DevPrivateKeyRec ShadowScreenKeyRec;
|
static DevPrivateKeyRec ShadowScreenKeyRec;
|
||||||
|
@ -71,10 +71,10 @@ ShadowFBInit2(ScreenPtr pScreen,
|
||||||
pPriv->postRefresh = postRefreshArea;
|
pPriv->postRefresh = postRefreshArea;
|
||||||
|
|
||||||
pPriv->CloseScreen = pScreen->CloseScreen;
|
pPriv->CloseScreen = pScreen->CloseScreen;
|
||||||
pPriv->CreateScreenResources = pScreen->CreateScreenResources;
|
pPriv->CreateWindow = pScreen->CreateWindow;
|
||||||
|
|
||||||
pScreen->CloseScreen = ShadowCloseScreen;
|
pScreen->CloseScreen = ShadowCloseScreen;
|
||||||
pScreen->CreateScreenResources = ShadowCreateScreenResources;
|
pScreen->CreateWindow = ShadowCreateRootWindow;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -117,16 +117,21 @@ shadowfbReportPost(DamagePtr damage, RegionPtr reg, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
ShadowCreateScreenResources(ScreenPtr pScreen)
|
ShadowCreateRootWindow(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
Bool ret;
|
Bool ret;
|
||||||
WindowPtr pWin = pScreen->root;
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
|
ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
|
||||||
|
|
||||||
pScreen->CreateScreenResources = pPriv->CreateScreenResources;
|
/* paranoia */
|
||||||
ret = pScreen->CreateScreenResources(pScreen);
|
if (pWin != pScreen->root)
|
||||||
pPriv->CreateScreenResources = pScreen->CreateScreenResources;
|
ErrorF("ShadowCreateRootWindow called unexpectedly\n");
|
||||||
pScreen->CreateScreenResources = ShadowCreateScreenResources;
|
|
||||||
|
/* call down, but don't hook ourselves back in; we know the first time
|
||||||
|
* we're called it's for the root window.
|
||||||
|
*/
|
||||||
|
pScreen->CreateWindow = pPriv->CreateWindow;
|
||||||
|
ret = pScreen->CreateWindow(pWin);
|
||||||
|
|
||||||
/* this might look like it leaks, but the damage code reaps listeners
|
/* this might look like it leaks, but the damage code reaps listeners
|
||||||
* when their drawable disappears.
|
* when their drawable disappears.
|
||||||
|
@ -159,7 +164,6 @@ ShadowCloseScreen(ScreenPtr pScreen)
|
||||||
ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
|
ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
|
||||||
|
|
||||||
pScreen->CloseScreen = pPriv->CloseScreen;
|
pScreen->CloseScreen = pPriv->CloseScreen;
|
||||||
pScreen->CreateScreenResources = pPriv->CreateScreenResources;
|
|
||||||
|
|
||||||
free(pPriv);
|
free(pPriv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue