12 void _xopenhook_preload_run(const char * phase
)
14 char * xopenhook_enable
= getenv("XOPENHOOK_ENABLE");
15 if(xopenhook_enable
!= NULL
&& strcmp(xopenhook_enable
, "1")==0)
17 unsetenv("XOPENHOOK_ENABLE");
18 setenv("XOPENHOOK_PHASE", phase
, 1);
19 system(getenv("XOPENHOOK_COMMAND"));
20 unsetenv("XOPENHOOK_PHASE");
21 setenv("XOPENHOOK_ENABLE", xopenhook_enable
, 1);
25 Display
* XOpenDisplay(const char * display_name
)
27 Display
* (*real_XOpenDisplay
)(const char *) = dlsym(RTLD_NEXT
, "XOpenDisplay");
29 Display
* display_handle
= real_XOpenDisplay(display_name
);
30 if(display_handle
!= NULL
) _xopenhook_preload_run("post-XOpenDisplay");
32 return display_handle
;
38 XvImageFormatValues
* XvListImageFormats (
43 XvImageFormatValues
* (*real_XvListImageFormats
)(Display
*, XvPortID
, int*) = dlsym(RTLD_NEXT
, "XvListImageFormats");
45 _xopenhook_preload_run("pre-XvListImageFormats");
46 XvImageFormatValues
*ret
= real_XvListImageFormats(dpy
, port
, num
);
47 _xopenhook_preload_run("post-XvListImageFormats");