mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
Xi: helper for private structure retrieval
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
c349470433
commit
b5210be9eb
@@ -28,11 +28,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
* Globals referenced elsewhere in the server.
|
||||
*
|
||||
*/
|
||||
#include "privates.h"
|
||||
|
||||
#ifndef EXGLOBALS_H
|
||||
#define EXGLOBALS_H 1
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#include "include/privates.h"
|
||||
|
||||
extern int IEventBase;
|
||||
extern int BadDevice;
|
||||
extern int BadMode;
|
||||
@@ -73,6 +75,8 @@ extern RESTYPE RT_INPUTCLIENT;
|
||||
|
||||
extern DevPrivateKeyRec XIClientPrivateKeyRec;
|
||||
|
||||
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
|
||||
static inline XIClientPtr XIClientPriv(ClientPtr client) {
|
||||
return dixLookupPrivate(&client->devPrivates, &XIClientPrivateKeyRec);
|
||||
}
|
||||
|
||||
#endif /* EXGLOBALS_H */
|
||||
|
||||
@@ -75,7 +75,7 @@ ProcXIAllowEvents(ClientPtr client)
|
||||
Window grabWindow = 0;
|
||||
uint32_t touchId = 0;
|
||||
|
||||
XIClientPtr xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
XIClientPtr xi_client = XIClientPriv(client);
|
||||
if (!xi_client)
|
||||
return BadImplementation;
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ static Bool ShouldListGestureInfo(ClientPtr client)
|
||||
* and then a completely separate module within the client uses broken libxcb to call
|
||||
* XIQueryDevice.
|
||||
*/
|
||||
XIClientPtr pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
XIClientPtr pXIClient = XIClientPriv(client);
|
||||
if (pXIClient->major_version) {
|
||||
return version_compare(pXIClient->major_version, pXIClient->minor_version, 2, 4) >= 0;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ ProcXIQueryPointer(ClientPtr client)
|
||||
WindowPtr pWin, t;
|
||||
SpritePtr pSprite;
|
||||
XkbStatePtr state;
|
||||
XIClientPtr xi_client;
|
||||
Bool have_xi22 = FALSE;
|
||||
|
||||
REQUEST(xXIQueryPointerReq);
|
||||
@@ -89,7 +88,8 @@ ProcXIQueryPointer(ClientPtr client)
|
||||
* do not know about touches, so we must report emulated button presses. 2.2
|
||||
* and later clients are aware of touches, so we don't include emulated
|
||||
* button presses in the reply. */
|
||||
xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
XIClientPtr xi_client = XIClientPriv(client);
|
||||
|
||||
if (version_compare(xi_client->major_version,
|
||||
xi_client->minor_version, 2, 2) >= 0)
|
||||
have_xi22 = TRUE;
|
||||
|
||||
@@ -55,7 +55,6 @@ extern XExtensionVersion XIVersion; /* defined in getvers.c */
|
||||
int
|
||||
ProcXIQueryVersion(ClientPtr client)
|
||||
{
|
||||
XIClientPtr pXIClient;
|
||||
int major, minor;
|
||||
|
||||
REQUEST(xXIQueryVersionReq);
|
||||
@@ -67,7 +66,7 @@ ProcXIQueryVersion(ClientPtr client)
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
XIClientPtr pXIClient = XIClientPriv(client);
|
||||
|
||||
if (version_compare(XIVersion.major_version, XIVersion.minor_version,
|
||||
stuff->major_version, stuff->minor_version) > 0) {
|
||||
|
||||
@@ -2429,15 +2429,13 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
|
||||
static BOOL
|
||||
FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root)
|
||||
{
|
||||
XIClientPtr client_xi_version;
|
||||
int cmp;
|
||||
|
||||
/* device not grabbed -> don't filter */
|
||||
if (!grab)
|
||||
return FALSE;
|
||||
|
||||
client_xi_version =
|
||||
dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
XIClientPtr client_xi_version = XIClientPriv(client);
|
||||
|
||||
cmp = version_compare(client_xi_version->major_version,
|
||||
client_xi_version->minor_version, 2, 0);
|
||||
|
||||
@@ -204,7 +204,6 @@ test_XIQueryVersion_multiple(void)
|
||||
{
|
||||
xXIQueryVersionReq request;
|
||||
ClientRec client;
|
||||
XIClientPtr pXIClient;
|
||||
int rc;
|
||||
|
||||
init_simple();
|
||||
@@ -261,7 +260,7 @@ test_XIQueryVersion_multiple(void)
|
||||
assert(rc == Success);
|
||||
|
||||
/* real version is changed, too! */
|
||||
pXIClient = dixLookupPrivate(&client.devPrivates, XIClientPrivateKey);
|
||||
XIClientPtr pXIClient = XIClientPriv(&client);
|
||||
assert(pXIClient->minor_version == 3);
|
||||
|
||||
/* client tries to set lower version, no change */
|
||||
@@ -286,7 +285,7 @@ test_XIQueryVersion_multiple(void)
|
||||
assert(rc == Success);
|
||||
|
||||
/* but real client version must not be lowered */
|
||||
pXIClient = dixLookupPrivate(&client.devPrivates, XIClientPrivateKey);
|
||||
pXIClient = XIClientPriv(&client);
|
||||
assert(pXIClient->minor_version == 3);
|
||||
|
||||
request.major_version = 2;
|
||||
|
||||
Reference in New Issue
Block a user