Xi: add GetClientPointer and GetPointerPairing requests.
dix: use PickKeyboard for ProcSetInputFocus and ProcGetInputFocus instead of the core keyboard.
This commit is contained in:
parent
0acf993e28
commit
f8cd19bd16
|
@ -32,6 +32,8 @@ libXi_la_SOURCES = \
|
|||
extinit.c \
|
||||
getbmap.c \
|
||||
getbmap.h \
|
||||
getcptr.c \
|
||||
getcptr.h \
|
||||
getdctl.c \
|
||||
getdctl.h \
|
||||
getfctl.c \
|
||||
|
@ -42,6 +44,8 @@ libXi_la_SOURCES = \
|
|||
getkmap.h \
|
||||
getmmap.c \
|
||||
getmmap.h \
|
||||
getpairp.c \
|
||||
getpairp.h \
|
||||
getprop.c \
|
||||
getprop.h \
|
||||
getselev.c \
|
||||
|
|
14
Xi/extinit.c
14
Xi/extinit.c
|
@ -86,11 +86,13 @@ SOFTWARE.
|
|||
#include "devbell.h"
|
||||
#include "getbmap.h"
|
||||
#include "getbmap.h"
|
||||
#include "getcptr.h"
|
||||
#include "getdctl.h"
|
||||
#include "getfctl.h"
|
||||
#include "getfocus.h"
|
||||
#include "getkmap.h"
|
||||
#include "getmmap.h"
|
||||
#include "getpairp.h"
|
||||
#include "getprop.h"
|
||||
#include "getselev.h"
|
||||
#include "getvers.h"
|
||||
|
@ -370,6 +372,10 @@ ProcIDispatch(register ClientPtr client)
|
|||
return ProcXQueryWindowAccess(client);
|
||||
else if (stuff->data == X_SetClientPointer)
|
||||
return ProcXSetClientPointer(client);
|
||||
else if (stuff->data == X_GetClientPointer)
|
||||
return ProcXGetClientPointer(client);
|
||||
else if (stuff->data == X_GetPairedPointer)
|
||||
return ProcXGetPairedPointer(client);
|
||||
else {
|
||||
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
|
||||
}
|
||||
|
@ -477,6 +483,10 @@ SProcIDispatch(register ClientPtr client)
|
|||
return SProcXQueryWindowAccess(client);
|
||||
else if (stuff->data == X_SetClientPointer)
|
||||
return SProcXSetClientPointer(client);
|
||||
else if (stuff->data == X_GetClientPointer)
|
||||
return SProcXGetClientPointer(client);
|
||||
else if (stuff->data == X_GetPairedPointer)
|
||||
return SProcXGetPairedPointer(client);
|
||||
else {
|
||||
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
|
||||
}
|
||||
|
@ -561,6 +571,10 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
|||
else if (rep->RepType == X_QueryWindowAccess)
|
||||
SRepXQueryWindowAccess(client, len,
|
||||
(xQueryWindowAccessReply*) rep);
|
||||
else if (rep->RepType == X_GetClientPointer)
|
||||
SRepXGetClientPointer(client, len, (xGetClientPointerReply*) rep);
|
||||
else if (rep->RepType == X_GetPairedPointer)
|
||||
SRepXGetPairedPointer(client, len, (xGetPairedPointerReply*) rep);
|
||||
else {
|
||||
FatalError("XINPUT confused sending swapped reply");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
|
||||
Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the author shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from the author.
|
||||
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "scrnintstr.h" /* screen structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "getcptr.h"
|
||||
|
||||
/***********************************************************************
|
||||
* This procedure allows a client to query another client's client pointer
|
||||
* setting.
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetClientPointer(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
REQUEST(xGetClientPointerReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->win, n);
|
||||
return ProcXGetClientPointer(client);
|
||||
}
|
||||
|
||||
int ProcXGetClientPointer(ClientPtr client)
|
||||
{
|
||||
int err;
|
||||
WindowPtr win;
|
||||
ClientPtr winclient;
|
||||
xGetClientPointerReply rep;
|
||||
REQUEST(xGetClientPointerReq);
|
||||
REQUEST_SIZE_MATCH(xGetClientPointerReq);
|
||||
|
||||
err = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
|
||||
if (err != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetClientPointer,
|
||||
stuff->win, err);
|
||||
return Success;
|
||||
}
|
||||
|
||||
winclient = wClient(win);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetClientPointer;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.set = (winclient->clientPtr != NULL);
|
||||
rep.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetClientPointerReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetClientPointer function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SRepXGetClientPointer(ClientPtr client, int size,
|
||||
xGetClientPointerReply* rep)
|
||||
{
|
||||
char n;
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright 2007 by Peter Hutterer <peter@cs.unisa.edu.au>
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of the above listed
|
||||
copyright holder(s) not be used in advertising or publicity pertaining
|
||||
to distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
|
||||
TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
|
||||
LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef GETCPTR_H
|
||||
#define GETCPTR_H 1
|
||||
int SProcXGetClientPointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXGetClientPointer(ClientPtr /* client */
|
||||
);
|
||||
|
||||
void SRepXGetClientPointer(ClientPtr /* client */,
|
||||
int /* size */,
|
||||
xGetClientPointerReply* /* rep */
|
||||
);
|
||||
|
||||
#endif /* GETCPTR_H */
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
|
||||
Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the author shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from the author.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "extnsionst.h"
|
||||
#include "extinit.h" /* LookupDeviceIntRec */
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiXsrv.h"
|
||||
#endif
|
||||
|
||||
#include "getpairp.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to query the paired pointer for a keyboard
|
||||
* device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetPairedPointer(ClientPtr client)
|
||||
{
|
||||
char n;
|
||||
REQUEST(xGetPairedPointerReq);
|
||||
swaps(&stuff->length, n);
|
||||
return (ProcXGetPairedPointer(client));
|
||||
}
|
||||
|
||||
int
|
||||
ProcXGetPairedPointer(ClientPtr client)
|
||||
{
|
||||
xGetPairedPointerReply rep;
|
||||
DeviceIntPtr kbd, ptr;
|
||||
|
||||
REQUEST(xGetPairedPointerReq);
|
||||
REQUEST_SIZE_MATCH(xGetPairedPointerReq);
|
||||
|
||||
kbd = LookupDeviceIntRec(stuff->deviceid);
|
||||
if (!kbd || !kbd->key) {
|
||||
SendErrorToClient(client, IReqCode, X_GetPairedPointer,
|
||||
stuff->deviceid, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
ptr = GetPairedPointer(kbd);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetPairedPointer;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
if (ptr == inputInfo.pointer)
|
||||
{
|
||||
rep.paired = FALSE;
|
||||
rep.deviceid = 0;
|
||||
} else
|
||||
{
|
||||
rep.paired = TRUE;
|
||||
rep.deviceid = ptr->id;
|
||||
}
|
||||
WriteReplyToClient(client, sizeof(xGetPairedPointerReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
SRepXGetPairedPointer(ClientPtr client, int size,
|
||||
xGetPairedPointerReply* rep)
|
||||
{
|
||||
char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
|
||||
Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the author shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from the author.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef GETPAIRP_H
|
||||
#define GETPAIRP_H 1
|
||||
|
||||
int SProcXGetPairedPointer(ClientPtr /* client */
|
||||
);
|
||||
int ProcXGetPairedPointer(ClientPtr /* client */
|
||||
);
|
||||
void SRepXGetPairedPointer(ClientPtr /* client */,
|
||||
int /* size */,
|
||||
xGetPairedPointerReply* /* rep */
|
||||
);
|
||||
|
||||
#endif /* GETPAIRP_H */
|
|
@ -164,3 +164,4 @@ SRepXQueryDevicePointer(ClientPtr client, int size,
|
|||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,6 @@ FreeCursor(pointer value, XID cid)
|
|||
}
|
||||
FreeCursorBits(pCurs->bits);
|
||||
xfree( pCurs);
|
||||
MPXDBG("freeing memory for cursor\n");
|
||||
return(Success);
|
||||
}
|
||||
|
||||
|
|
|
@ -3897,6 +3897,7 @@ int
|
|||
ProcSetInputFocus(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr kbd = PickKeyboard(client);
|
||||
REQUEST(xSetInputFocusReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xSetInputFocusReq);
|
||||
|
@ -3904,16 +3905,17 @@ ProcSetInputFocus(client)
|
|||
if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
|
||||
return Success;
|
||||
|
||||
return SetInputFocus(client, inputInfo.keyboard, stuff->focus,
|
||||
return SetInputFocus(client, kbd, stuff->focus,
|
||||
stuff->revertTo, stuff->time, FALSE);
|
||||
}
|
||||
|
||||
int
|
||||
ProcGetInputFocus(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr kbd = PickKeyboard(client);
|
||||
xGetInputFocusReply rep;
|
||||
/* REQUEST(xReq); */
|
||||
FocusClassPtr focus = inputInfo.keyboard->focus;
|
||||
FocusClassPtr focus = kbd->focus;
|
||||
|
||||
REQUEST_SIZE_MATCH(xReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
Loading…
Reference in New Issue