xace: typesafe hook function for XACE_SCREEN_ACCESS
he generic XaceHook() call isn't typesafe (und unnecessarily slow). Better add an explicit function, just like we already have for others. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
This commit is contained in:
parent
47d6c3ad75
commit
51d8bcfc0d
|
@ -115,6 +115,13 @@ int XaceHookServerAccess(ClientPtr client, Mask access_mode)
|
||||||
return rec.status;
|
return rec.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode)
|
||||||
|
{
|
||||||
|
XaceScreenAccessRec rec = { client, screen, access_mode, Success };
|
||||||
|
CallCallbacks(&XaceHooks[XACE_SCREEN_ACCESS], &rec);
|
||||||
|
return rec.status;
|
||||||
|
}
|
||||||
|
|
||||||
/* Entry point for hook functions. Called by Xserver.
|
/* Entry point for hook functions. Called by Xserver.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
@ -139,7 +146,6 @@ XaceHook(int hook, ...)
|
||||||
* sets calldata directly to a single argument (with no return result)
|
* sets calldata directly to a single argument (with no return result)
|
||||||
*/
|
*/
|
||||||
switch (hook) {
|
switch (hook) {
|
||||||
case XACE_SCREEN_ACCESS:
|
|
||||||
case XACE_SCREENSAVER_ACCESS:
|
case XACE_SCREENSAVER_ACCESS:
|
||||||
u.screen.client = va_arg(ap, ClientPtr);
|
u.screen.client = va_arg(ap, ClientPtr);
|
||||||
u.screen.screen = va_arg(ap, ScreenPtr);
|
u.screen.screen = va_arg(ap, ScreenPtr);
|
||||||
|
|
|
@ -91,6 +91,7 @@ int XaceHookReceiveAccess(ClientPtr client, WindowPtr win, xEventPtr ev, int cou
|
||||||
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode);
|
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode);
|
||||||
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext);
|
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext);
|
||||||
int XaceHookServerAccess(ClientPtr client, Mask access_mode);
|
int XaceHookServerAccess(ClientPtr client, Mask access_mode);
|
||||||
|
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
|
||||||
|
|
||||||
|
|
||||||
/* Register a callback for a given hook.
|
/* Register a callback for a given hook.
|
||||||
|
|
|
@ -614,7 +614,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
pDrawables[i]->pScreen;
|
pDrawables[i]->pScreen;
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||||
|
|
||||||
rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
|
rc = XaceHookScreenAccess(client, pScreen, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto freeScrVisInfo;
|
goto freeScrVisInfo;
|
||||||
|
|
||||||
|
|
|
@ -2523,7 +2523,7 @@ ProcInstallColormap(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
|
rc = XaceHookScreenAccess(client, pcmp->pScreen, DixSetAttrAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
if (rc == BadValue)
|
if (rc == BadValue)
|
||||||
rc = BadColor;
|
rc = BadColor;
|
||||||
|
@ -2552,7 +2552,7 @@ ProcUninstallColormap(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess);
|
rc = XaceHookScreenAccess(client, pcmp->pScreen, DixSetAttrAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
if (rc == BadValue)
|
if (rc == BadValue)
|
||||||
rc = BadColor;
|
rc = BadColor;
|
||||||
|
@ -2582,8 +2582,7 @@ ProcListInstalledColormaps(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
|
rc = XaceHookScreenAccess(client, pWin->drawable.pScreen, DixGetAttrAccess);
|
||||||
DixGetAttrAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -3154,7 +3153,7 @@ ProcQueryBestSize(ClientPtr client)
|
||||||
if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
|
if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
pScreen = pDraw->pScreen;
|
pScreen = pDraw->pScreen;
|
||||||
rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
|
rc = XaceHookScreenAccess(client, pScreen, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
(*pScreen->QueryBestSize) (stuff->class, &stuff->width,
|
(*pScreen->QueryBestSize) (stuff->class, &stuff->width,
|
||||||
|
|
|
@ -880,8 +880,7 @@ ProcXFixesHideCursor(ClientPtr client)
|
||||||
* This is the first time this client has hid the cursor
|
* This is the first time this client has hid the cursor
|
||||||
* for this screen.
|
* for this screen.
|
||||||
*/
|
*/
|
||||||
ret = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
|
ret = XaceHookScreenAccess(client, pWin->drawable.pScreen, DixHideAccess);
|
||||||
DixHideAccess);
|
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -938,8 +937,7 @@ ProcXFixesShowCursor(ClientPtr client)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
|
rc = XaceHookScreenAccess(client, pWin->drawable.pScreen, DixShowAccess);
|
||||||
DixShowAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue