diff --git a/Xext/saver.c b/Xext/saver.c index 63a57b8382..87ffc0c60f 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -468,7 +468,7 @@ CreateSaverWindow(ScreenPtr pScreen) pPriv->installedMap = None; - if (GrabInProgress && GrabInProgress != pAttr->client->index) + if (dixAnyOtherGrabbed(pAttr->client)) return FALSE; pWin = dixCreateWindow(pSaver->wid, pScreen->root, diff --git a/dix/dispatch.c b/dix/dispatch.c index c93703efbc..8da0ab45db 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -4251,3 +4251,9 @@ DetachOffloadGPU(ScreenPtr secondary) secondary->is_offload_secondary = FALSE; } +bool dixAnyOtherGrabbed(ClientPtr client) +{ + return ((grabState == GrabActive) && + (grabClient != NULL) && + (grabClient != client)); +} diff --git a/dix/dix_priv.h b/dix/dix_priv.h index a1e1f37af3..0491597b13 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -10,6 +10,7 @@ * drivers or extension modules. Thus the definitions here are not part of the * Xserver's module API/ABI. */ +#include #include #include @@ -761,4 +762,19 @@ static inline int xmitClientEvent(ClientPtr pClient, xEvent ev) int dixAllocColor(ClientPtr client, Colormap cmap, CARD16 *red, CARD16 *green, CARD16 *blue, CARD32 *pixel); +/* + * retrieve current grab client or NULL (if no grab) + * + */ +ClientPtr dixGetGrabClient(void); + +/* + * Check whether any client has grabbed the server and it's not + * the given client. + * + * @param client the client to check against + * @return TRUE if any client, except the given one, has grabbed + */ +bool dixAnyOtherGrabbed(ClientPtr client); + #endif /* _XSERVER_DIX_PRIV_H */ diff --git a/include/globals.h b/include/globals.h index 48f18241b0..ead85c91e4 100644 --- a/include/globals.h +++ b/include/globals.h @@ -17,8 +17,6 @@ extern _X_EXPORT const char *defaultFontPath; extern _X_EXPORT int monitorResolution; extern _X_EXPORT int defaultColorVisualClass; - -extern _X_EXPORT int GrabInProgress; extern _X_EXPORT char *SeatId; #endif /* !_XSERV_GLOBAL_H_ */ diff --git a/os/connection.c b/os/connection.c index e91a4e06a5..c83462d2fa 100644 --- a/os/connection.c +++ b/os/connection.c @@ -134,7 +134,7 @@ static pid_t ParentProcess; static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ #endif -int GrabInProgress = 0; +static int GrabInProgress = 0; static void EstablishNewConnections(int curconn, int ready, void *data);