mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
dix: add per-screen pixmap destructor mechanism
Right now, extension specific pixmap destruction procedures are implemented by wrapping the ScreenRec's DestroyPixmap() proc pointer: the extensions are storing the original pointer in their private data and putting in their own one. On each call, their proc restores the original one, calls it, and switches back again. When multiple extensions doing so, they're forming a kind of daisy chain. (the same is done for lots of 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. It's even getting worse: the proc also has to do ref counting, and only destroy the pixmap if refconter reaching zero - that's all done in the individual screen drivers. Therefore, all extensions must check for refcnt == 1, in order to know when to really act. This commit introduces a simple approach for letting extension hook into the pixmap destruction safely, w/o having to care much about side effects with the call chain. Extensions now can simply register their destructor proc (and an opaque pointer) and get called back - w/o ever having to mess with the ScreenRec's internal structures. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -679,6 +679,10 @@ typedef struct _Screen {
|
||||
/* additional screen close notify hooks (replaces wrapping CloseScreen)
|
||||
should NOT be touched outside of DIX core */
|
||||
CallbackListPtr hookClose;
|
||||
|
||||
/* additional pixmap destroy notify hooks (replaces wrapping DestroyPixmap)
|
||||
should NOT be touched outside of DIX core */
|
||||
CallbackListPtr hookPixmapDestroy;
|
||||
} ScreenRec;
|
||||
|
||||
static inline RegionPtr
|
||||
|
||||
@@ -218,5 +218,6 @@
|
||||
#define XORG_API_DIX_SCREEN_HOOK_WINDOW_DESTROY 1
|
||||
#define XORG_API_DIX_SCREEN_HOOK_WINDOW_POSITION 1
|
||||
#define XORG_API_DIX_SCREEN_HOOK_CLOSE 1
|
||||
#define XORG_API_DIX_SCREEN_HOOK_PIXMAP_DESTROY 1
|
||||
|
||||
#endif /* _XORG_SERVER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user