mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
dix: add CreateScreenResources callback mechanism
Right now, extensions that need to be called after the CreateScreenResources proc had been run, must wrap the screen proc vector directly (all of them forming kind of daisy chain), and so - when called - temporarily restore the previous one, call it, wrap again, and if the call was successful finally doing it's own stuff. (same is done for many other procs) While that approach is looking nice and elegant on the drawing board, it's complicated, dangerous like a chainsaw and makes debugging hard, leading to pretty blurred API borders. Instead introducing a simple approach for letting extension hook into a post-CreateScreenResources callback list safely, w/o having to care much about side effects with the call chain. Extensions now can simply register their business logic and get called back - w/o ever having to mess with the ScreenRec's internal structures. Note that these hooks are executed *AFTER* the original CreateScreenResources() proc had been called SUCCESSFULLY (returned TRUE), so callees can rely on the DDX/driver had already done it's job. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#ifndef XORG_DIX_SCREEN_HOOKS_H
|
||||
#define XORG_DIX_SCREEN_HOOKS_H
|
||||
|
||||
#include <X11/Xdefs.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
#include "include/callback.h" /* CallbackListPtr */
|
||||
@@ -185,4 +186,36 @@ _X_EXPORT
|
||||
void dixScreenUnhookPixmapDestroy(ScreenPtr pScreen,
|
||||
XorgScreenPixmapDestroyProcPtr func);
|
||||
|
||||
/* prototype of screen close notification handler */
|
||||
typedef void (*XorgScreenPostCreateResourcesProcPtr)(CallbackListPtr *pcbl,
|
||||
ScreenPtr pScreen,
|
||||
Bool *ret);
|
||||
|
||||
/**
|
||||
* @brief register post-CreateScreenResources hook on the given screen
|
||||
*
|
||||
* @param pScreen pointer to the screen to register the notify hook into
|
||||
* @param func pointer to the hook function
|
||||
* @param arg opaque pointer passed to the hook
|
||||
*
|
||||
* This hook is called when CreateScreenResources() had been called
|
||||
* and returned TRUE.
|
||||
**/
|
||||
_X_EXPORT
|
||||
void dixScreenHookPostCreateResources(ScreenPtr pScreen,
|
||||
XorgScreenPostCreateResourcesProcPtr func);
|
||||
|
||||
/**
|
||||
* @brief unregister a post-CreateScreenResources hook on the given screen
|
||||
*
|
||||
* @param pScreen pointer to the screen to unregister the hook from
|
||||
* @param func pointer to the hook function
|
||||
* @param arg opaque pointer passed to the destructor
|
||||
*
|
||||
* @see dixScreenHookPostCreateResources
|
||||
**/
|
||||
_X_EXPORT
|
||||
void dixScreenUnhookPostCreateResources(ScreenPtr pScreen,
|
||||
XorgScreenPostCreateResourcesProcPtr func);
|
||||
|
||||
#endif /* DIX_SCREEN_HOOKS_H */
|
||||
|
||||
Reference in New Issue
Block a user