miext: rootless: use PostCreateResources screen hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new PostCreateScreenResources screen hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									766f51e0c1
								
							
						
					
					
						commit
						88455524fe
					
				| 
						 | 
					@ -80,8 +80,6 @@ typedef struct _RootlessScreenRec {
 | 
				
			||||||
    RootlessFrameProcsPtr imp;
 | 
					    RootlessFrameProcsPtr imp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Wrapped screen functions
 | 
					    // Wrapped screen functions
 | 
				
			||||||
    CreateScreenResourcesProcPtr CreateScreenResources;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    CreateWindowProcPtr CreateWindow;
 | 
					    CreateWindowProcPtr CreateWindow;
 | 
				
			||||||
    RealizeWindowProcPtr RealizeWindow;
 | 
					    RealizeWindowProcPtr RealizeWindow;
 | 
				
			||||||
    UnrealizeWindowProcPtr UnrealizeWindow;
 | 
					    UnrealizeWindowProcPtr UnrealizeWindow;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,31 +111,17 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
 | 
				
			||||||
 *  Rootless implementations typically set a null framebuffer pointer, which
 | 
					 *  Rootless implementations typically set a null framebuffer pointer, which
 | 
				
			||||||
 *  causes problems with miCreateScreenResources. We fix things up here.
 | 
					 *  causes problems with miCreateScreenResources. We fix things up here.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static Bool
 | 
					static void RootlessCreateScreenResources(CallbackListPtr *pcbl,
 | 
				
			||||||
RootlessCreateScreenResources(ScreenPtr pScreen)
 | 
					                                          ScreenPtr pScreen, Bool *ret)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Bool ret = TRUE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SCREEN_UNWRAP(pScreen, CreateScreenResources);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (pScreen->CreateScreenResources != NULL)
 | 
					 | 
				
			||||||
        ret = (*pScreen->CreateScreenResources) (pScreen);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SCREEN_WRAP(pScreen, CreateScreenResources);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!ret)
 | 
					 | 
				
			||||||
        return ret;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Make sure we have a valid screen pixmap. */
 | 
					    /* Make sure we have a valid screen pixmap. */
 | 
				
			||||||
 | 
					 | 
				
			||||||
    RootlessUpdateScreenPixmap(pScreen);
 | 
					    RootlessUpdateScreenPixmap(pScreen);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    return ret;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void RootlessCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
 | 
					static void RootlessCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    dixScreenUnhookClose(pScreen, RootlessCloseScreen);
 | 
					    dixScreenUnhookClose(pScreen, RootlessCloseScreen);
 | 
				
			||||||
 | 
					    dixScreenUnhookPostCreateResources(pScreen, RootlessCreateScreenResources);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    RootlessScreenRec *s = SCREENREC(pScreen);
 | 
					    RootlessScreenRec *s = SCREENREC(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -649,6 +635,7 @@ RootlessWrap(ScreenPtr pScreen)
 | 
				
			||||||
    dixScreenHookClose(pScreen, RootlessCloseScreen);
 | 
					    dixScreenHookClose(pScreen, RootlessCloseScreen);
 | 
				
			||||||
    dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy);
 | 
					    dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy);
 | 
				
			||||||
    dixScreenHookWindowPosition(pScreen, RootlessWindowPosition);
 | 
					    dixScreenHookWindowPosition(pScreen, RootlessWindowPosition);
 | 
				
			||||||
 | 
					    dixScreenHookPostCreateResources(pScreen, RootlessCreateScreenResources);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define WRAP(a) \
 | 
					#define WRAP(a) \
 | 
				
			||||||
    if (pScreen->a) { \
 | 
					    if (pScreen->a) { \
 | 
				
			||||||
| 
						 | 
					@ -659,7 +646,6 @@ RootlessWrap(ScreenPtr pScreen)
 | 
				
			||||||
    } \
 | 
					    } \
 | 
				
			||||||
    pScreen->a = Rootless##a
 | 
					    pScreen->a = Rootless##a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    WRAP(CreateScreenResources);
 | 
					 | 
				
			||||||
    WRAP(CreateGC);
 | 
					    WRAP(CreateGC);
 | 
				
			||||||
    WRAP(CopyWindow);
 | 
					    WRAP(CopyWindow);
 | 
				
			||||||
    WRAP(PaintWindow);
 | 
					    WRAP(PaintWindow);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue