R6.6 is the Xorg base-line
This commit is contained in:
parent
cb6ef07bf0
commit
ded6147bfb
179
Xext/EVI.c
Normal file
179
Xext/EVI.c
Normal file
|
@ -0,0 +1,179 @@
|
|||
/* $Xorg: EVI.c,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
|
||||
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 Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS 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.
|
||||
********************************************************/
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "dix.h"
|
||||
#define _XEVI_SERVER_
|
||||
#include "XEVIstr.h"
|
||||
#include "EVIstruct.h"
|
||||
static unsigned char XEVIReqCode = 0;
|
||||
static EviPrivPtr eviPriv;
|
||||
static int
|
||||
ProcEVIQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xEVIQueryVersionReq);
|
||||
xEVIQueryVersionReply rep;
|
||||
register int n;
|
||||
REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = XEVI_MAJOR_VERSION;
|
||||
rep.minorVersion = XEVI_MAJOR_VERSION;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swaps(&rep.majorVersion, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
}
|
||||
WriteToClient(client, sizeof (xEVIQueryVersionReply), (char *)&rep);
|
||||
return (client->noClientException);
|
||||
}
|
||||
#define swapEviInfo(eviInfo, l) \
|
||||
{ \
|
||||
int l1 = l; \
|
||||
xExtendedVisualInfo *eviInfo1 = eviInfo; \
|
||||
while (l1-- > 0) { \
|
||||
swapl(&eviInfo1->core_visual_id, n); \
|
||||
swapl(&eviInfo1->transparency_value, n); \
|
||||
swaps(&eviInfo1->num_colormap_conflicts, n); \
|
||||
eviInfo1++; \
|
||||
} \
|
||||
}
|
||||
#define swapVisual(visual, l) \
|
||||
{ \
|
||||
int l1 = l; \
|
||||
VisualID32 *visual1 = visual; \
|
||||
while (l1-- > 0) { \
|
||||
swapl(visual1, n); \
|
||||
visual1++; \
|
||||
} \
|
||||
}
|
||||
static int
|
||||
ProcEVIGetVisualInfo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xEVIGetVisualInfoReq);
|
||||
xEVIGetVisualInfoReply rep;
|
||||
int n, n_conflict, n_info, sz_info, sz_conflict;
|
||||
VisualID32 *conflict;
|
||||
xExtendedVisualInfo *eviInfo;
|
||||
int status;
|
||||
REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
|
||||
status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
|
||||
&eviInfo, &n_info, &conflict, &n_conflict);
|
||||
if (status != Success)
|
||||
return status;
|
||||
sz_info = n_info * sz_xExtendedVisualInfo;
|
||||
sz_conflict = n_conflict * sz_VisualID32;
|
||||
rep.type = X_Reply;
|
||||
rep.n_info = n_info;
|
||||
rep.n_conflicts = n_conflict;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = (sz_info + sz_conflict) >> 2;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.n_info, n);
|
||||
swapl(&rep.n_conflicts, n);
|
||||
swapEviInfo(eviInfo, n_info);
|
||||
swapVisual(conflict, n_conflict);
|
||||
}
|
||||
WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
|
||||
WriteToClient(client, sz_info, (char *)eviInfo);
|
||||
WriteToClient(client, sz_conflict, (char *)conflict);
|
||||
eviPriv->freeVisualInfo(eviInfo, conflict);
|
||||
return (client->noClientException);
|
||||
}
|
||||
static int
|
||||
ProcEVIDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
case X_EVIQueryVersion:
|
||||
return ProcEVIQueryVersion (client);
|
||||
case X_EVIGetVisualInfo:
|
||||
return ProcEVIGetVisualInfo (client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
static int
|
||||
SProcEVIQueryVersion(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xEVIQueryVersionReq);
|
||||
int n;
|
||||
swaps(&stuff->length, n);
|
||||
return ProcEVIQueryVersion(client);
|
||||
}
|
||||
static int
|
||||
SProcEVIGetVisualInfo(ClientPtr client)
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xEVIGetVisualInfoReq);
|
||||
swaps(&stuff->length, n);
|
||||
return ProcEVIGetVisualInfo(client);
|
||||
}
|
||||
static int
|
||||
SProcEVIDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_EVIQueryVersion:
|
||||
return SProcEVIQueryVersion (client);
|
||||
case X_EVIGetVisualInfo:
|
||||
return SProcEVIGetVisualInfo (client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
EVIResetProc(ExtensionEntry *extEntry)
|
||||
{
|
||||
eviDDXReset();
|
||||
}
|
||||
/****************
|
||||
* XEVIExtensionInit
|
||||
*
|
||||
* Called from InitExtensions in main() or from QueryExtension() if the
|
||||
* extension is dynamically loaded.
|
||||
*
|
||||
****************/
|
||||
void
|
||||
EVIExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
if (extEntry = AddExtension(EVINAME, 0, 0,
|
||||
ProcEVIDispatch,
|
||||
SProcEVIDispatch,
|
||||
EVIResetProc, StandardMinorOpcode))
|
||||
{
|
||||
XEVIReqCode = (unsigned char)extEntry->base;
|
||||
eviPriv = eviDDXInit();
|
||||
}
|
||||
}
|
53
Xext/EVIstruct.h
Normal file
53
Xext/EVIstruct.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* $Xorg: EVIstruct.h,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
|
||||
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 Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS 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.
|
||||
********************************************************/
|
||||
#ifndef EVI_STRUCT_H
|
||||
#define EVI_STRUCT_H
|
||||
/*
|
||||
******************************************************************************
|
||||
** Per-ddx data
|
||||
******************************************************************************
|
||||
*/
|
||||
typedef int (*GetVisualInfoProc)(
|
||||
#if NeedNestedPrototypes
|
||||
VisualID32*,
|
||||
int,
|
||||
xExtendedVisualInfo**,
|
||||
int*,
|
||||
VisualID32**,
|
||||
int*
|
||||
#endif
|
||||
);
|
||||
typedef void (*FreeVisualInfoProc)(
|
||||
#if NeedNestedPrototypes
|
||||
xExtendedVisualInfo*,
|
||||
VisualID32*
|
||||
#endif
|
||||
);
|
||||
typedef struct _EviPrivRec {
|
||||
GetVisualInfoProc getVisualInfo;
|
||||
FreeVisualInfoProc freeVisualInfo;
|
||||
} EviPrivRec, *EviPrivPtr;
|
||||
extern EviPrivPtr eviDDXInit();
|
||||
extern void eviDDXReset();
|
||||
#endif /* EVI_STRUCT_H */
|
90
Xext/README.xtest1-ddx
Normal file
90
Xext/README.xtest1-ddx
Normal file
|
@ -0,0 +1,90 @@
|
|||
There are several code fragments that need to be placed in the device
|
||||
dependent part of the server. These are described below. These code
|
||||
fragments are device and implementation dependent.
|
||||
|
||||
This code fragment should go in your ddx InitInput() routine:
|
||||
|
||||
#ifdef XTESTEXT1
|
||||
extern KeyCode xtest_command_key;
|
||||
#endif
|
||||
|
||||
#ifdef XTESTEXT1
|
||||
xtest_command_key = <whatever-is-a-good-keycode-for-your-keyboard>;
|
||||
#endif
|
||||
|
||||
This code fragment should go at the front of the file that handles
|
||||
keyboards:
|
||||
|
||||
#ifdef XTESTEXT1
|
||||
/*
|
||||
* defined in xtestext1di.c
|
||||
*/
|
||||
extern int on_steal_input;
|
||||
extern Bool XTestStealKeyData();
|
||||
#endif XTESTEXT1
|
||||
|
||||
This code fragment should go in the function that parses input from the
|
||||
keyboard or pointer after you know what input action has occurred, but before
|
||||
you have told the server about it. If conditionalizes the actual function
|
||||
call to pass the information on:
|
||||
|
||||
#ifdef XTESTEXT1
|
||||
if (!on_steal_input ||
|
||||
XTestStealKeyData(code, direction, dev_type, x, y))
|
||||
#endif /* XTESTEXT1 */
|
||||
handle_device_event(...);
|
||||
|
||||
This code fragment should go in the function that handles mouse motion after
|
||||
you have figured out how much the mouse has moved:
|
||||
|
||||
#ifdef XTESTEXT1
|
||||
if (on_steal_input)
|
||||
XTestStealMotionData(dx, dy, dev, x, y);
|
||||
#endif XTESTEXT1
|
||||
|
||||
|
||||
This code fragment should go at the front of the os-specific code where
|
||||
you wait (by doing a select on the socket in our implementation) for
|
||||
something to happen:
|
||||
|
||||
#ifdef XTESTEXT1
|
||||
extern int playback_on;
|
||||
void XTestComputeWaitTime();
|
||||
#endif XTESTEXT1
|
||||
|
||||
These code fragments should go in the os-specific code on both sides of
|
||||
where you wait (by doing a select on the socket in our implementation)
|
||||
for something to happen:
|
||||
|
||||
#ifdef XTESTEXT1
|
||||
if (playback_on)
|
||||
XTestComputeWaitTime(wt = &waittime);
|
||||
#endif XTESTEXT1
|
||||
... code to do select ...
|
||||
WakeupHandler(i, LastSelectMask);
|
||||
#ifdef XTESTEXT1
|
||||
if (playback_on)
|
||||
i = XTestProcessInputAction(i, &waittime);
|
||||
#endif XTESTEXT1
|
||||
|
||||
|
||||
You also need to implement the following routines (documentation
|
||||
is needed; for now, see server/ddx/hp/hp/x_hil.c):
|
||||
|
||||
void
|
||||
XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey)
|
||||
int dev_type;
|
||||
int keycode;
|
||||
int keystate;
|
||||
int mousex;
|
||||
int mousey;
|
||||
|
||||
void
|
||||
XTestGetPointerPos(fmousex, fmousey)
|
||||
short *fmousex, *fmousey;
|
||||
|
||||
void
|
||||
XTestJumpPointer(jx, jy, dev_type)
|
||||
int jx;
|
||||
int jy;
|
||||
int dev_type;
|
88
Xext/SecurityPolicy
Normal file
88
Xext/SecurityPolicy
Normal file
|
@ -0,0 +1,88 @@
|
|||
version-1
|
||||
|
||||
# $Xorg: SecurityPolicy,v 1.3 2000/08/17 19:47:56 cpqbld Exp $
|
||||
|
||||
# The site policy fields are interpreted by the XC-QUERY-SECURITY-1
|
||||
# authorization protocol. The values are arbitrary and site-specific.
|
||||
# Refer to the Security Extension Specification for the usage of the policies.
|
||||
#sitepolicy A
|
||||
#sitepolicy B
|
||||
#sitepolicy C
|
||||
|
||||
# Property access rules:
|
||||
# property <property> <window> <permissions>
|
||||
# <window> ::= any | root | <propertyselector>
|
||||
# <propertyselector> ::= <property> | <property>=<value>
|
||||
# <permissions> :== [ <operation> | <action> | <space> ]*
|
||||
# <operation> :== r | w | d
|
||||
# r read
|
||||
# w write
|
||||
# d delete
|
||||
# <action> :== a | i | e
|
||||
# a allow
|
||||
# i ignore
|
||||
# e error
|
||||
|
||||
# Allow reading of application resources, but not writing.
|
||||
property RESOURCE_MANAGER root ar iw
|
||||
property SCREEN_RESOURCES root ar iw
|
||||
|
||||
# Ignore attempts to use cut buffers. Giving errors causes apps to crash,
|
||||
# and allowing access may give away too much information.
|
||||
property CUT_BUFFER0 root irw
|
||||
property CUT_BUFFER1 root irw
|
||||
property CUT_BUFFER2 root irw
|
||||
property CUT_BUFFER3 root irw
|
||||
property CUT_BUFFER4 root irw
|
||||
property CUT_BUFFER5 root irw
|
||||
property CUT_BUFFER6 root irw
|
||||
property CUT_BUFFER7 root irw
|
||||
|
||||
# If you are using Motif, you probably want these.
|
||||
property _MOTIF_DEFAULT_BINDINGS root ar iw
|
||||
property _MOTIF_DRAG_WINDOW root ar iw
|
||||
property _MOTIF_DRAG_TARGETS any ar iw
|
||||
property _MOTIF_DRAG_ATOMS any ar iw
|
||||
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
|
||||
|
||||
# If you are running CDE you also need these
|
||||
property _MOTIF_WM_INFO root arw
|
||||
property TT_SESSION root irw
|
||||
property WM_ICON_SIZE root irw
|
||||
property "SDT Pixel Set" any irw
|
||||
|
||||
# The next two rules let xwininfo -tree work when untrusted.
|
||||
property WM_NAME any ar
|
||||
|
||||
# Allow read of WM_CLASS, but only for windows with WM_NAME.
|
||||
# This might be more restrictive than necessary, but demonstrates
|
||||
# the <required property> facility, and is also an attempt to
|
||||
# say "top level windows only."
|
||||
property WM_CLASS WM_NAME ar
|
||||
|
||||
# These next three let xlsclients work untrusted. Think carefully
|
||||
# before including these; giving away the client machine name and command
|
||||
# may be exposing too much.
|
||||
property WM_STATE WM_NAME ar
|
||||
property WM_CLIENT_MACHINE WM_NAME ar
|
||||
property WM_COMMAND WM_NAME ar
|
||||
|
||||
# To let untrusted clients use the standard colormaps created by
|
||||
# xstdcmap, include these lines.
|
||||
property RGB_DEFAULT_MAP root ar
|
||||
property RGB_BEST_MAP root ar
|
||||
property RGB_RED_MAP root ar
|
||||
property RGB_GREEN_MAP root ar
|
||||
property RGB_BLUE_MAP root ar
|
||||
property RGB_GRAY_MAP root ar
|
||||
|
||||
# To let untrusted clients use the color management database created
|
||||
# by xcmsdb, include these lines.
|
||||
property XDCCC_LINEAR_RGB_CORRECTION root ar
|
||||
property XDCCC_LINEAR_RGB_MATRICES root ar
|
||||
property XDCCC_GRAY_SCREENWHITEPOINT root ar
|
||||
property XDCCC_GRAY_CORRECTION root ar
|
||||
|
||||
# To let untrusted clients use the overlay visuals that many vendors
|
||||
# support, include this line.
|
||||
property SERVER_OVERLAY_VISUALS root ar
|
810
Xext/appgroup.c
Normal file
810
Xext/appgroup.c
Normal file
|
@ -0,0 +1,810 @@
|
|||
/*
|
||||
Copyright 1996, 1998, 2001 The Open Group
|
||||
|
||||
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 OPEN GROUP 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 Open Group 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 Open Group.
|
||||
*/
|
||||
/* $Xorg: appgroup.c,v 1.6 2001/02/09 02:04:32 xorgcvs Exp $ */
|
||||
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "colormapst.h"
|
||||
#include "servermd.h"
|
||||
#define _XAG_SERVER_
|
||||
#include "Xagstr.h"
|
||||
#define _SECURITY_SERVER
|
||||
#include "security.h"
|
||||
#include "Xfuncproto.h"
|
||||
|
||||
#define XSERV_t
|
||||
#include <X11/Xtrans.h>
|
||||
#include "../os/osdep.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct _AppGroupRec {
|
||||
struct _AppGroupRec* next;
|
||||
XID appgroupId;
|
||||
ClientPtr* clients;
|
||||
int nclients;
|
||||
ClientPtr leader;
|
||||
Bool single_screen;
|
||||
Window default_root;
|
||||
VisualID root_visual;
|
||||
Colormap default_colormap;
|
||||
Pixel black_pixel;
|
||||
Pixel white_pixel;
|
||||
xConnSetupPrefix connSetupPrefix;
|
||||
char* ConnectionInfo;
|
||||
} AppGroupRec, *AppGroupPtr;
|
||||
|
||||
static int ProcXagDispatch (), SProcXagDispatch ();
|
||||
static void XagResetProc ();
|
||||
|
||||
static unsigned char XagReqCode = 0;
|
||||
static int XagErrorBase;
|
||||
static int XagCallbackRefCount = 0;
|
||||
|
||||
static RESTYPE RT_APPGROUP;
|
||||
static AppGroupPtr appGrpList = NULL;
|
||||
|
||||
extern WindowPtr* WindowTable;
|
||||
extern xConnSetupPrefix connSetupPrefix;
|
||||
extern char* ConnectionInfo;
|
||||
|
||||
static
|
||||
int XagAppGroupFree (what, id)
|
||||
pointer what;
|
||||
XID id; /* unused */
|
||||
{
|
||||
int i;
|
||||
AppGroupPtr pAppGrp = (AppGroupPtr) what;
|
||||
|
||||
if (pAppGrp->leader)
|
||||
for (i = 0; i < pAppGrp->nclients; i++) {
|
||||
pAppGrp->clients[i]->appgroup = NULL;
|
||||
CloseDownClient (pAppGrp->clients[i]);
|
||||
}
|
||||
|
||||
if (pAppGrp == appGrpList)
|
||||
appGrpList = appGrpList->next;
|
||||
else {
|
||||
AppGroupPtr tpAppGrp;
|
||||
for (tpAppGrp = appGrpList;
|
||||
tpAppGrp->next != NULL;
|
||||
tpAppGrp = tpAppGrp->next) {
|
||||
if (tpAppGrp->next == pAppGrp) {
|
||||
tpAppGrp->next = tpAppGrp->next->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) xfree (pAppGrp->clients);
|
||||
(void) xfree (pAppGrp->ConnectionInfo);
|
||||
(void) xfree (what);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void XagClientStateChange (pcbl, nulldata, calldata)
|
||||
CallbackListPtr* pcbl;
|
||||
pointer nulldata;
|
||||
pointer calldata;
|
||||
{
|
||||
SecurityAuthorizationPtr pAuth;
|
||||
NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
|
||||
ClientPtr pClient = pci->client;
|
||||
AppGroupPtr pAppGrp;
|
||||
XID authId;
|
||||
|
||||
if (!pClient->appgroup) {
|
||||
switch (pClient->clientState) {
|
||||
|
||||
case ClientStateAuthenticating:
|
||||
case ClientStateRunning:
|
||||
case ClientStateCheckingSecurity:
|
||||
return;
|
||||
|
||||
case ClientStateInitial:
|
||||
case ClientStateCheckedSecurity:
|
||||
/*
|
||||
* If the client is connecting via a firewall proxy (which
|
||||
* uses XC-QUERY-SECURITY-1, then the authId is available
|
||||
* during ClientStateCheckedSecurity, otherwise it's
|
||||
* available during ClientStateInitial.
|
||||
*
|
||||
* Don't get it from pClient because can't guarantee the order
|
||||
* of the callbacks and the security extension might not have
|
||||
* plugged it in yet.
|
||||
*/
|
||||
authId = AuthorizationIDOfClient(pClient);
|
||||
break;
|
||||
|
||||
case ClientStateGone:
|
||||
case ClientStateRetained:
|
||||
/*
|
||||
* Don't get if from AuthorizationIDOfClient because can't
|
||||
* guarantee the order of the callbacks and the security
|
||||
* extension may have torn down the client's private data
|
||||
*/
|
||||
authId = pClient->authId;
|
||||
break;
|
||||
}
|
||||
|
||||
if (authId == None)
|
||||
return;
|
||||
|
||||
pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(pClient,
|
||||
authId, SecurityAuthorizationResType, SecurityReadAccess);
|
||||
|
||||
if (pAuth == NULL)
|
||||
return;
|
||||
|
||||
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
|
||||
if (pAppGrp->appgroupId == pAuth->group) break;
|
||||
} else {
|
||||
pAppGrp = pClient->appgroup;
|
||||
}
|
||||
|
||||
if (!pAppGrp)
|
||||
return;
|
||||
|
||||
switch (pClient->clientState) {
|
||||
case ClientStateAuthenticating:
|
||||
case ClientStateRunning:
|
||||
case ClientStateCheckingSecurity:
|
||||
break;
|
||||
|
||||
case ClientStateInitial:
|
||||
case ClientStateCheckedSecurity:
|
||||
/* see the comment above about Initial vs. CheckedSecurity */
|
||||
{
|
||||
/* if this client already in AppGroup, don't add it again */
|
||||
int i;
|
||||
for (i = 0; i < pAppGrp->nclients; i++)
|
||||
if (pClient == pAppGrp->clients[i]) return;
|
||||
}
|
||||
pAppGrp->clients = (ClientPtr*) xrealloc (pAppGrp->clients,
|
||||
++pAppGrp->nclients * sizeof (ClientPtr));
|
||||
pAppGrp->clients[pAppGrp->nclients - 1] = pClient;
|
||||
pClient->appgroup = pAppGrp;
|
||||
break;
|
||||
|
||||
case ClientStateGone:
|
||||
case ClientStateRetained: /* client disconnected, dump it */
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < pAppGrp->nclients; i++)
|
||||
if (pAppGrp->clients[i] == pClient) {
|
||||
pAppGrp->clients[i] = NULL;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < pAppGrp->nclients; i++)
|
||||
if (pAppGrp->clients[i] == NULL && i + 1 < pAppGrp->nclients)
|
||||
pAppGrp->clients[i] = pAppGrp->clients[i + 1];
|
||||
pAppGrp->nclients--;
|
||||
}
|
||||
pClient->appgroup = NULL; /* redundant, pClient will be freed */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XagExtensionInit ()
|
||||
{
|
||||
ExtensionEntry* extEntry;
|
||||
|
||||
if (extEntry = AddExtension (XAGNAME,
|
||||
0,
|
||||
XagNumberErrors,
|
||||
ProcXagDispatch,
|
||||
SProcXagDispatch,
|
||||
XagResetProc,
|
||||
StandardMinorOpcode)) {
|
||||
XagReqCode = (unsigned char)extEntry->base;
|
||||
XagErrorBase = extEntry->errorBase;
|
||||
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
|
||||
}
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static
|
||||
void XagResetProc (extEntry)
|
||||
ExtensionEntry* extEntry;
|
||||
{
|
||||
DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
|
||||
XagCallbackRefCount = 0;
|
||||
while (appGrpList) XagAppGroupFree ((pointer) appGrpList, 0);
|
||||
}
|
||||
|
||||
static
|
||||
int ProcXagQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xXagQueryVersionReq);
|
||||
xXagQueryVersionReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXagQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequence_number = client->sequence;
|
||||
rep.server_major_version = XAG_MAJOR_VERSION;
|
||||
rep.server_minor_version = XAG_MINOR_VERSION;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequence_number, n);
|
||||
swapl (&rep.length, n);
|
||||
swaps (&rep.server_major_version, n);
|
||||
swaps (&rep.server_minor_version, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static
|
||||
void ProcessAttr (pAppGrp, client, attrib_mask, attribs)
|
||||
AppGroupPtr pAppGrp;
|
||||
ClientPtr client;
|
||||
unsigned int attrib_mask;
|
||||
CARD32* attribs;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= XagNappGroupLeader; i++) {
|
||||
switch (attrib_mask & (1 << i)) {
|
||||
case XagSingleScreenMask:
|
||||
pAppGrp->single_screen = *attribs;
|
||||
break;
|
||||
case XagDefaultRootMask:
|
||||
pAppGrp->default_root = *attribs;
|
||||
break;
|
||||
case XagRootVisualMask:
|
||||
pAppGrp->root_visual = *attribs;
|
||||
break;
|
||||
case XagDefaultColormapMask:
|
||||
pAppGrp->default_colormap = *attribs;
|
||||
break;
|
||||
case XagBlackPixelMask:
|
||||
pAppGrp->black_pixel = *attribs;
|
||||
break;
|
||||
case XagWhitePixelMask:
|
||||
pAppGrp->white_pixel = *attribs;
|
||||
break;
|
||||
case XagAppGroupLeaderMask:
|
||||
pAppGrp->leader = client;
|
||||
break;
|
||||
default: continue;
|
||||
}
|
||||
attribs++;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void CreateConnectionInfo (pAppGrp)
|
||||
AppGroupPtr pAppGrp;
|
||||
{
|
||||
extern int connBlockScreenStart;
|
||||
xConnSetup *setup = (xConnSetup*) ConnectionInfo;
|
||||
xWindowRoot* rootp;
|
||||
xWindowRoot* roots[MAXSCREENS];
|
||||
unsigned int rootlens[MAXSCREENS];
|
||||
xDepth* depth;
|
||||
int olen;
|
||||
int snum, i;
|
||||
|
||||
rootp = (xWindowRoot*) (ConnectionInfo + connBlockScreenStart);
|
||||
for (snum = 0; snum < screenInfo.numScreens; snum++) {
|
||||
|
||||
rootlens[snum] = sizeof (xWindowRoot);
|
||||
roots[snum] = rootp;
|
||||
|
||||
depth = (xDepth*) (rootp + 1);
|
||||
for (i = 0; i < rootp->nDepths; i++) {
|
||||
rootlens[snum] += sizeof (xDepth) +
|
||||
depth->nVisuals * sizeof (xVisualType);
|
||||
depth = (xDepth *)(((char*)(depth + 1)) +
|
||||
depth->nVisuals * sizeof (xVisualType));
|
||||
}
|
||||
rootp = (xWindowRoot*) depth;
|
||||
}
|
||||
snum = 0;
|
||||
if (pAppGrp->default_root) {
|
||||
for (; snum < screenInfo.numVideoScreens; snum++) {
|
||||
if (roots[snum]->windowId == pAppGrp->default_root)
|
||||
break;
|
||||
}
|
||||
}
|
||||
olen = connBlockScreenStart + rootlens[snum];
|
||||
for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++)
|
||||
olen += rootlens[i];
|
||||
pAppGrp->ConnectionInfo = (char*) xalloc (olen);
|
||||
if (!pAppGrp->ConnectionInfo)
|
||||
return;
|
||||
memmove (pAppGrp->ConnectionInfo, ConnectionInfo, connBlockScreenStart);
|
||||
((xConnSetup*) (pAppGrp->ConnectionInfo))->numRoots =
|
||||
1 + screenInfo.numScreens - screenInfo.numVideoScreens;
|
||||
memmove (pAppGrp->ConnectionInfo + connBlockScreenStart,
|
||||
(void*) roots[snum], rootlens[snum]);
|
||||
rootp = (xWindowRoot*) (pAppGrp->ConnectionInfo + connBlockScreenStart);
|
||||
if (pAppGrp->default_colormap) {
|
||||
rootp->defaultColormap = pAppGrp->default_colormap;
|
||||
rootp->whitePixel = pAppGrp->white_pixel;
|
||||
rootp->blackPixel = pAppGrp->black_pixel;
|
||||
}
|
||||
if (pAppGrp->root_visual)
|
||||
rootp->rootVisualID = pAppGrp->root_visual;
|
||||
rootp = (xWindowRoot*) (((char*)rootp) + rootlens[snum]);
|
||||
for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) {
|
||||
memmove ((void*) rootp, (void*) roots[i], rootlens[i]);
|
||||
rootp = (xWindowRoot*) (((char*) rootp) + rootlens[i]);
|
||||
}
|
||||
pAppGrp->connSetupPrefix = connSetupPrefix;
|
||||
pAppGrp->connSetupPrefix.length = olen >> 2;
|
||||
}
|
||||
|
||||
static
|
||||
AppGroupPtr CreateAppGroup (client, appgroupId, attrib_mask, attribs)
|
||||
ClientPtr client;
|
||||
XID appgroupId;
|
||||
unsigned int attrib_mask;
|
||||
CARD32* attribs;
|
||||
{
|
||||
AppGroupPtr pAppGrp;
|
||||
int i;
|
||||
|
||||
pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
|
||||
if (pAppGrp) {
|
||||
pAppGrp->next = appGrpList;
|
||||
appGrpList = pAppGrp;
|
||||
pAppGrp->appgroupId = appgroupId;
|
||||
pAppGrp->clients = (ClientPtr*) xalloc (0);
|
||||
pAppGrp->nclients = 0;
|
||||
pAppGrp->leader = NULL;
|
||||
pAppGrp->default_root = 0;
|
||||
pAppGrp->root_visual = 0;
|
||||
pAppGrp->default_colormap = 0;
|
||||
pAppGrp->black_pixel = -1;
|
||||
pAppGrp->white_pixel = -1;
|
||||
pAppGrp->ConnectionInfo = NULL;
|
||||
ProcessAttr (pAppGrp, client, attrib_mask, attribs);
|
||||
}
|
||||
return pAppGrp;
|
||||
}
|
||||
|
||||
static
|
||||
int AttrValidate (client, attrib_mask, pAppGrp)
|
||||
ClientPtr client;
|
||||
int attrib_mask;
|
||||
AppGroupPtr pAppGrp;
|
||||
{
|
||||
WindowPtr pWin;
|
||||
int idepth, ivids, found;
|
||||
ScreenPtr pScreen;
|
||||
DepthPtr pDepth;
|
||||
ColormapPtr pColormap;
|
||||
|
||||
pWin = LookupWindow (pAppGrp->default_root, client);
|
||||
/* XXX check that pWin is not NULL */
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
|
||||
return BadWindow;
|
||||
pDepth = pScreen->allowedDepths;
|
||||
if (pAppGrp->root_visual) {
|
||||
found = FALSE;
|
||||
for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) {
|
||||
for (ivids = 0; ivids < pDepth->numVids; ivids++) {
|
||||
if (pAppGrp->root_visual == pDepth->vids[ivids]) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
return BadMatch;
|
||||
}
|
||||
if (pAppGrp->default_colormap) {
|
||||
|
||||
pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP);
|
||||
/* XXX check that pColormap is not NULL */
|
||||
if (pColormap->pScreen != pScreen)
|
||||
return BadColor;
|
||||
if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))
|
||||
return BadMatch;
|
||||
}
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
/* static */
|
||||
int ProcXagCreate (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xXagCreateReq);
|
||||
AppGroupPtr pAppGrp;
|
||||
int ret;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE (xXagCreateReq);
|
||||
|
||||
LEGAL_NEW_RESOURCE (stuff->app_group, client);
|
||||
pAppGrp = CreateAppGroup (client, stuff->app_group,
|
||||
stuff->attrib_mask, (CARD32*) &stuff[1]);
|
||||
if (!pAppGrp)
|
||||
return BadAlloc;
|
||||
ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);
|
||||
if (ret != Success) {
|
||||
XagAppGroupFree ((pointer)pAppGrp, (XID)0);
|
||||
return ret;
|
||||
}
|
||||
if (pAppGrp->single_screen) {
|
||||
CreateConnectionInfo (pAppGrp);
|
||||
if (!pAppGrp->ConnectionInfo)
|
||||
return BadAlloc;
|
||||
}
|
||||
if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp))
|
||||
return BadAlloc;
|
||||
if (XagCallbackRefCount++ == 0)
|
||||
(void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
/* static */
|
||||
int ProcXagDestroy (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
AppGroupPtr pAppGrp;
|
||||
REQUEST (xXagDestroyReq);
|
||||
|
||||
REQUEST_SIZE_MATCH (xXagDestroyReq);
|
||||
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
|
||||
(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
|
||||
if (!pAppGrp) return XagBadAppGroup;
|
||||
FreeResource ((XID)stuff->app_group, RT_NONE);
|
||||
if (--XagCallbackRefCount == 0)
|
||||
(void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static
|
||||
int ProcXagGetAttr (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
AppGroupPtr pAppGrp;
|
||||
REQUEST (xXagGetAttrReq);
|
||||
xXagGetAttrReply rep;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXagGetAttrReq);
|
||||
pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client,
|
||||
(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);
|
||||
if (!pAppGrp) return XagBadAppGroup;
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequence_number = client->sequence;
|
||||
rep.default_root = pAppGrp->default_root;
|
||||
rep.root_visual = pAppGrp->root_visual;
|
||||
rep.default_colormap = pAppGrp->default_colormap;
|
||||
rep.black_pixel = pAppGrp->black_pixel;
|
||||
rep.white_pixel = pAppGrp->white_pixel;
|
||||
rep.single_screen = pAppGrp->single_screen;
|
||||
rep.app_group_leader = (pAppGrp->leader) ? 1 : 0;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequence_number, n);
|
||||
swapl (&rep.length, n);
|
||||
swapl (&rep.default_root, n);
|
||||
swapl (&rep.root_visual, n);
|
||||
swapl (&rep.default_colormap, n);
|
||||
swapl (&rep.black_pixel, n);
|
||||
swapl (&rep.white_pixel, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static
|
||||
int ProcXagQuery (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
ClientPtr pClient;
|
||||
AppGroupPtr pAppGrp;
|
||||
REQUEST (xXagQueryReq);
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXagQueryReq);
|
||||
pClient = LookupClient (stuff->resource, client);
|
||||
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
|
||||
for (n = 0; n < pAppGrp->nclients; n++)
|
||||
if (pAppGrp->clients[n] == pClient) {
|
||||
xXagQueryReply rep;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequence_number = client->sequence;
|
||||
rep.app_group = pAppGrp->appgroupId;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequence_number, n);
|
||||
swapl (&rep.length, n);
|
||||
swapl (&rep.app_group, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
static
|
||||
int ProcXagCreateAssoc (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xXagCreateAssocReq);
|
||||
|
||||
REQUEST_SIZE_MATCH (xXagCreateAssocReq);
|
||||
#ifdef WIN32
|
||||
if (stuff->window_type != XagWindowTypeWin32)
|
||||
#else
|
||||
if (stuff->window_type != XagWindowTypeX11)
|
||||
#endif
|
||||
return BadMatch;
|
||||
#ifdef WIN32 /* and Mac, etc */
|
||||
if (!LocalClient (client))
|
||||
return BadAccess;
|
||||
#endif
|
||||
|
||||
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static
|
||||
int ProcXagDestroyAssoc (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xXagDestroyAssocReq);
|
||||
|
||||
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
|
||||
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static
|
||||
int ProcXagDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XagQueryVersion:
|
||||
return ProcXagQueryVersion (client);
|
||||
case X_XagCreate:
|
||||
return ProcXagCreate (client);
|
||||
case X_XagDestroy:
|
||||
return ProcXagDestroy (client);
|
||||
case X_XagGetAttr:
|
||||
return ProcXagGetAttr (client);
|
||||
case X_XagQuery:
|
||||
return ProcXagQuery (client);
|
||||
case X_XagCreateAssoc:
|
||||
return ProcXagCreateAssoc (client);
|
||||
case X_XagDestroyAssoc:
|
||||
return ProcXagDestroyAssoc (client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xXagQueryVersionReq);
|
||||
swaps(&stuff->length, n);
|
||||
return ProcXagQueryVersion(client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagCreate (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST (xXagCreateReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE (xXagCreateReq);
|
||||
swapl (&stuff->app_group, n);
|
||||
swapl (&stuff->attrib_mask, n);
|
||||
SwapRestL (stuff);
|
||||
return ProcXagCreate (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagDestroy (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST (xXagDestroyReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xXagDestroyReq);
|
||||
swapl (&stuff->app_group, n);
|
||||
return ProcXagDestroy (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagGetAttr (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST (xXagGetAttrReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xXagGetAttrReq);
|
||||
swapl (&stuff->app_group, n);
|
||||
return ProcXagGetAttr (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagQuery (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST (xXagQueryReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xXagQueryReq);
|
||||
swapl (&stuff->resource, n);
|
||||
return ProcXagQuery (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagCreateAssoc (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST (xXagCreateAssocReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xXagCreateAssocReq);
|
||||
swapl (&stuff->window, n);
|
||||
swapl (&stuff->window_type, n);
|
||||
swaps (&stuff->system_window_len, n);
|
||||
return ProcXagCreateAssoc (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagDestroyAssoc (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST (xXagDestroyAssocReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
|
||||
swapl (&stuff->window, n);
|
||||
return ProcXagDestroyAssoc (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcXagDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XagQueryVersion:
|
||||
return SProcXagQueryVersion (client);
|
||||
case X_XagCreate:
|
||||
return SProcXagCreate (client);
|
||||
case X_XagDestroy:
|
||||
return SProcXagDestroy (client);
|
||||
case X_XagGetAttr:
|
||||
return SProcXagGetAttr (client);
|
||||
case X_XagQuery:
|
||||
return SProcXagQuery (client);
|
||||
case X_XagCreateAssoc:
|
||||
return SProcXagCreateAssoc (client);
|
||||
case X_XagDestroyAssoc:
|
||||
return SProcXagDestroyAssoc (client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
Colormap XagDefaultColormap (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
return (client->appgroup ? client->appgroup->default_colormap : None);
|
||||
}
|
||||
|
||||
VisualID XagRootVisual (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
return (client->appgroup ? client->appgroup->root_visual : 0);
|
||||
}
|
||||
|
||||
ClientPtr XagLeader (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
return (client->appgroup ? client->appgroup->leader : NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return whether the Map request event should be sent to the appgroup leader.
|
||||
* We don't want to send it to the leader when the window is on a different
|
||||
* screen, e.g. a print screen.
|
||||
*/
|
||||
Bool XagIsControlledRoot (client, pParent)
|
||||
ClientPtr client;
|
||||
WindowPtr pParent;
|
||||
{
|
||||
if (client->appgroup) {
|
||||
if (client->appgroup->single_screen &&
|
||||
pParent->drawable.id == client->appgroup->default_root)
|
||||
return TRUE;
|
||||
else if (!pParent->parent)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void XagConnectionInfo (client, conn_prefix, conn_info, num_screen)
|
||||
ClientPtr client;
|
||||
xConnSetupPrefix** conn_prefix;
|
||||
char** conn_info;
|
||||
int* num_screen;
|
||||
{
|
||||
if (client->appgroup && client->appgroup->ConnectionInfo) {
|
||||
*conn_prefix = &client->appgroup->connSetupPrefix;
|
||||
*conn_info = client->appgroup->ConnectionInfo;
|
||||
*num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots;
|
||||
}
|
||||
}
|
||||
|
||||
XID XagId (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
return (client->appgroup ? client->appgroup->appgroupId : 0);
|
||||
}
|
||||
|
||||
void XagGetDeltaInfo (client, buf)
|
||||
ClientPtr client;
|
||||
CARD32* buf;
|
||||
{
|
||||
*buf++ = (CARD32) client->appgroup->default_root;
|
||||
*buf++ = (CARD32) client->appgroup->root_visual;
|
||||
*buf++ = (CARD32) client->appgroup->default_colormap;
|
||||
*buf++ = (CARD32) client->appgroup->black_pixel;
|
||||
*buf = (CARD32) client->appgroup->white_pixel;
|
||||
}
|
||||
|
||||
void XagCallClientStateChange (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
if (appGrpList) {
|
||||
NewClientInfoRec clientinfo;
|
||||
|
||||
clientinfo.client = client;
|
||||
XagClientStateChange (NULL, NULL, (pointer)&clientinfo);
|
||||
}
|
||||
}
|
86
Xext/bigreq.c
Normal file
86
Xext/bigreq.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* $Xorg: bigreq.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1992, 1998 The Open Group
|
||||
|
||||
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 OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
*/
|
||||
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "bigreqstr.h"
|
||||
|
||||
static unsigned char XBigReqCode;
|
||||
static int ProcBigReqDispatch();
|
||||
static void BigReqResetProc();
|
||||
|
||||
void
|
||||
BigReqExtensionInit()
|
||||
{
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
|
||||
if (extEntry = AddExtension(XBigReqExtensionName, 0, 0,
|
||||
ProcBigReqDispatch, ProcBigReqDispatch,
|
||||
BigReqResetProc, StandardMinorOpcode))
|
||||
XBigReqCode = (unsigned char)extEntry->base;
|
||||
DeclareExtensionSecurity(XBigReqExtensionName, TRUE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
BigReqResetProc (extEntry)
|
||||
ExtensionEntry *extEntry;
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ProcBigReqDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xBigReqEnableReq);
|
||||
xBigReqEnableReply rep;
|
||||
register int n;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&stuff->length, n);
|
||||
}
|
||||
if (stuff->brReqType != X_BigReqEnable)
|
||||
return BadRequest;
|
||||
REQUEST_SIZE_MATCH(xBigReqEnableReq);
|
||||
client->big_requests = TRUE;
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.max_request_size = MAX_BIG_REQUEST_SIZE;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.max_request_size, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
340
Xext/cup.c
Normal file
340
Xext/cup.c
Normal file
|
@ -0,0 +1,340 @@
|
|||
/* $Xorg: cup.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1997, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
*/
|
||||
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "colormapst.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "servermd.h"
|
||||
#define _XCUP_SERVER_
|
||||
#include "Xcupstr.h"
|
||||
#include "Xfuncproto.h"
|
||||
|
||||
#include "../os/osdep.h"
|
||||
|
||||
static int ProcDispatch (), SProcDispatch ();
|
||||
static void ResetProc ();
|
||||
|
||||
static unsigned char ReqCode = 0;
|
||||
static int ErrorBase;
|
||||
|
||||
#if defined(WIN32) || defined(TESTWIN32)
|
||||
#define HAVE_SPECIAL_DESKTOP_COLORS
|
||||
#endif
|
||||
|
||||
static xColorItem citems[] = {
|
||||
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
|
||||
#define CUP_BLACK_PIXEL 0
|
||||
#define CUP_WHITE_PIXEL 1
|
||||
/* pix red green blue */
|
||||
{ 0, 0, 0, 0, 0, 0 },
|
||||
{ 1, 0xffff, 0xffff, 0xffff, 0, 0 }
|
||||
#else
|
||||
#ifndef WIN32
|
||||
/*
|
||||
This approximates the MS-Windows desktop colormap for testing
|
||||
purposes but has black and white pixels in the typical Unix
|
||||
locations, which should be switched if necessary if your system
|
||||
has blackPixel and whitePixel swapped. No entries are provided
|
||||
for colormap entries 254 and 255 because AllocColor/FindColor
|
||||
will reuse entries zero and one.
|
||||
*/
|
||||
{ 0, 0, 0, 0, 0, 0 },
|
||||
{ 1, 0xffff, 0xffff, 0xffff, 0, 0 },
|
||||
{ 2, 0x8000, 0, 0, 0, 0 },
|
||||
{ 3, 0, 0x8000, 0, 0, 0 },
|
||||
{ 4, 0x8000, 0x8000, 0, 0, 0 },
|
||||
{ 5, 0, 0, 0x8000, 0, 0 },
|
||||
{ 6, 0x8000, 0, 0x8000, 0, 0 },
|
||||
{ 7, 0, 0x8000, 0x8000, 0, 0 },
|
||||
{ 8, 0xc000, 0xc000, 0xc000, 0, 0 },
|
||||
{ 9, 0xc000, 0xdc00, 0xc000, 0, 0 },
|
||||
{ 246, 0xa000, 0xa000, 0xa000, 0, 0 },
|
||||
{ 247, 0x8000, 0x8000, 0x8000, 0, 0 },
|
||||
{ 248, 0xffff, 0, 0, 0, 0 },
|
||||
{ 249, 0, 0xffff, 0, 0, 0 },
|
||||
{ 250, 0xffff, 0xffff, 0, 0, 0 },
|
||||
{ 251, 0, 0, 0xffff, 0, 0 },
|
||||
{ 252, 0xffff, 0, 0xffff, 0, 0 },
|
||||
{ 253, 0, 0xffff, 0xffff, 0, 0 }
|
||||
#else
|
||||
/*
|
||||
this is the MS-Windows desktop, adjusted for X's 16-bit color
|
||||
specifications.
|
||||
*/
|
||||
{ 0, 0, 0, 0, 0, 0 },
|
||||
{ 1, 0x8000, 0, 0, 0, 0 },
|
||||
{ 2, 0, 0x8000, 0, 0, 0 },
|
||||
{ 3, 0x8000, 0x8000, 0, 0, 0 },
|
||||
{ 4, 0, 0, 0x8000, 0, 0 },
|
||||
{ 5, 0x8000, 0, 0x8000, 0, 0 },
|
||||
{ 6, 0, 0x8000, 0x8000, 0, 0 },
|
||||
{ 7, 0xc000, 0xc000, 0xc000, 0, 0 },
|
||||
{ 8, 0xc000, 0xdc00, 0xc000, 0, 0 },
|
||||
{ 9, 0xa600, 0xca00, 0xf000, 0, 0 },
|
||||
{ 246, 0xff00, 0xfb00, 0xf000, 0, 0 },
|
||||
{ 247, 0xa000, 0xa000, 0xa400, 0, 0 },
|
||||
{ 248, 0x8000, 0x8000, 0x8000, 0, 0 },
|
||||
{ 249, 0xff00, 0, 0, 0, 0 },
|
||||
{ 250, 0, 0xff00, 0, 0, 0 },
|
||||
{ 251, 0xff00, 0xff00, 0, 0, 0 },
|
||||
{ 252, 0, 0, 0xff00, 0, 0 },
|
||||
{ 253, 0xff00, 0, 0xff00, 0, 0 },
|
||||
{ 254, 0, 0xff00, 0xff00, 0, 0 },
|
||||
{ 255, 0xff00, 0xff00, 0xff00, 0, 0 }
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#define NUM_DESKTOP_COLORS (sizeof citems / sizeof citems[0])
|
||||
|
||||
void
|
||||
XcupExtensionInit ()
|
||||
{
|
||||
ExtensionEntry* extEntry;
|
||||
|
||||
if (extEntry = AddExtension (XCUPNAME,
|
||||
0,
|
||||
XcupNumberErrors,
|
||||
ProcDispatch,
|
||||
SProcDispatch,
|
||||
ResetProc,
|
||||
StandardMinorOpcode)) {
|
||||
ReqCode = (unsigned char)extEntry->base;
|
||||
ErrorBase = extEntry->errorBase;
|
||||
}
|
||||
|
||||
/* PC servers initialize the desktop colors (citems) here! */
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static
|
||||
void ResetProc (extEntry)
|
||||
ExtensionEntry* extEntry;
|
||||
{
|
||||
}
|
||||
|
||||
static
|
||||
int ProcQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xXcupQueryVersionReq);
|
||||
xXcupQueryVersionReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXcupQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequence_number = client->sequence;
|
||||
rep.server_major_version = XCUP_MAJOR_VERSION;
|
||||
rep.server_minor_version = XCUP_MINOR_VERSION;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequence_number, n);
|
||||
swapl (&rep.length, n);
|
||||
swaps (&rep.server_major_version, n);
|
||||
swaps (&rep.server_minor_version, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xXcupQueryVersionReply), (char *)&rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static
|
||||
int ProcGetReservedColormapEntries (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xXcupGetReservedColormapEntriesReq);
|
||||
xXcupGetReservedColormapEntriesReply rep;
|
||||
xColorItem* cptr;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq);
|
||||
|
||||
#ifndef HAVE_SPECIAL_DESKTOP_COLORS
|
||||
citems[CUP_BLACK_PIXEL].pixel =
|
||||
screenInfo.screens[stuff->screen]->blackPixel;
|
||||
citems[CUP_WHITE_PIXEL].pixel =
|
||||
screenInfo.screens[stuff->screen]->whitePixel;
|
||||
#endif
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.sequence_number = client->sequence;
|
||||
rep.length = NUM_DESKTOP_COLORS * 3;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequence_number, n);
|
||||
swapl (&rep.length, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
|
||||
for (n = 0, cptr = citems; n < NUM_DESKTOP_COLORS; n++, cptr++) {
|
||||
if (client->swapped) SwapColorItem (cptr);
|
||||
WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
|
||||
}
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static
|
||||
int ProcStoreColors (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xXcupStoreColorsReq);
|
||||
ColormapPtr pcmp;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
|
||||
pcmp = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap,
|
||||
RT_COLORMAP, SecurityWriteAccess);
|
||||
|
||||
if (pcmp) {
|
||||
int ncolors, n;
|
||||
xXcupStoreColorsReply rep;
|
||||
xColorItem* cptr;
|
||||
Pixel pixel;
|
||||
|
||||
if (!(pcmp->class & DynamicClass))
|
||||
return BadMatch;
|
||||
|
||||
ncolors = (client->req_len << 2) - SIZEOF (xXcupStoreColorsReq);
|
||||
if (ncolors % SIZEOF(xColorItem))
|
||||
return BadLength;
|
||||
|
||||
ncolors /= SIZEOF (xColorItem);
|
||||
|
||||
|
||||
for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
|
||||
Pixel pixel = cptr->pixel;
|
||||
|
||||
if (AllocColor (pcmp,
|
||||
&cptr->red, &cptr->green, &cptr->blue,
|
||||
&pixel, client->index) == Success) {
|
||||
cptr->pixel = pixel;
|
||||
cptr->flags = 0x08;
|
||||
} else
|
||||
cptr->flags = 0;
|
||||
cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.sequence_number = client->sequence;
|
||||
rep.length = ncolors * 3;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequence_number, n);
|
||||
swapl (&rep.length, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xXcupGetReservedColormapEntriesReply), (char *)&rep);
|
||||
for (n = 0, cptr = (xColorItem*) &stuff[1]; n < ncolors; n++) {
|
||||
if (client->swapped) SwapColorItem (cptr);
|
||||
WriteToClient (client, SIZEOF(xColorItem), (char *)cptr);
|
||||
cptr = (xColorItem*) (((char*)cptr) + SIZEOF(xColorItem));
|
||||
}
|
||||
return client->noClientException;
|
||||
} else {
|
||||
client->errorValue = stuff->cmap;
|
||||
return BadColor;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
int ProcDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XcupQueryVersion:
|
||||
return ProcQueryVersion (client);
|
||||
case X_XcupGetReservedColormapEntries:
|
||||
return ProcGetReservedColormapEntries (client);
|
||||
case X_XcupStoreColors:
|
||||
return ProcStoreColors (client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
int SProcQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xXcupQueryVersionReq);
|
||||
swaps(&stuff->length, n);
|
||||
return ProcQueryVersion(client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcGetReservedColormapEntries (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST (xXcupGetReservedColormapEntriesReq);
|
||||
swaps (&stuff->length, n);
|
||||
swapl (&stuff->screen, n);
|
||||
REQUEST_AT_LEAST_SIZE (xXcupGetReservedColormapEntriesReq);
|
||||
return ProcGetReservedColormapEntries (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcStoreColors (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
int count;
|
||||
xColorItem* pItem;
|
||||
|
||||
REQUEST (xXcupStoreColorsReq);
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq);
|
||||
swapl(&stuff->cmap, n);
|
||||
pItem = (xColorItem*) &stuff[1];
|
||||
for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
|
||||
SwapColorItem(pItem++);
|
||||
return ProcStoreColors (client);
|
||||
}
|
||||
|
||||
static
|
||||
int SProcDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XcupQueryVersion:
|
||||
return SProcQueryVersion (client);
|
||||
case X_XcupGetReservedColormapEntries:
|
||||
return SProcGetReservedColormapEntries (client);
|
||||
case X_XcupStoreColors:
|
||||
return SProcStoreColors (client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
|
433
Xext/dpms.c
Normal file
433
Xext/dpms.c
Normal file
|
@ -0,0 +1,433 @@
|
|||
/* $Xorg: dpms.c,v 1.3 2000/08/17 19:47:56 cpqbld Exp $ */
|
||||
/*****************************************************************
|
||||
|
||||
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software.
|
||||
|
||||
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
|
||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization from Digital
|
||||
Equipment Corporation.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "dpms.h"
|
||||
#include "dpmsstr.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static unsigned char DPMSCode;
|
||||
static int ProcDPMSDispatch(), SProcDPMSDispatch();
|
||||
static void DPMSResetProc();
|
||||
static int ProcDPMSGetVersion(), SProcDPMSGetVersion();
|
||||
static int ProcDPMSGetTimeouts(), SProcDPMSGetTimeouts();
|
||||
static int ProcDPMSSetTimeouts(), ProcDPMSSetTimeouts();
|
||||
static int ProcDPMSEnable(), ProcDPMSEnable();
|
||||
static int ProcDPMSDisable(), ProcDPMSDisable();
|
||||
static int ProcDPMSForceLevel(), ProcDPMSForceLevel();
|
||||
|
||||
extern void Swap32Write(); /* XXX should be in header file */
|
||||
extern CARD32 ScreenSaverTime;
|
||||
extern CARD32 DPMSStandbyTime;
|
||||
extern CARD32 DPMSSuspendTime;
|
||||
extern CARD32 DPMSOffTime;
|
||||
extern BOOL DPMSCapableFlag;
|
||||
extern BOOL DPMSEnabled;
|
||||
extern CARD16 DPMSPowerLevel;
|
||||
|
||||
void
|
||||
DPMSExtensionInit()
|
||||
{
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
|
||||
if (extEntry = AddExtension(DPMSExtensionName, 0, 0,
|
||||
ProcDPMSDispatch, SProcDPMSDispatch,
|
||||
DPMSResetProc, StandardMinorOpcode))
|
||||
DPMSCode = (unsigned char)extEntry->base;
|
||||
return;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
DPMSResetProc (extEntry)
|
||||
ExtensionEntry *extEntry;
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSGetVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSGetVersionReq);
|
||||
xDPMSGetVersionReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = DPMSMajorVersion;
|
||||
rep.minorVersion = DPMSMinorVersion;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.majorVersion, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSCapable(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSCapableReq);
|
||||
xDPMSCapableReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.capable = DPMSCapableFlag;
|
||||
|
||||
WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSGetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSGetTimeoutsReq);
|
||||
xDPMSGetTimeoutsReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
|
||||
rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
|
||||
rep.off = DPMSOffTime / MILLI_PER_SECOND;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.standby, n);
|
||||
swaps(&rep.suspend, n);
|
||||
swaps(&rep.off, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSSetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSSetTimeoutsReq);
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
||||
|
||||
if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
|
||||
{
|
||||
client->errorValue = stuff->off;
|
||||
return BadValue;
|
||||
}
|
||||
if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
|
||||
{
|
||||
client->errorValue = stuff->suspend;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
|
||||
DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
|
||||
DPMSOffTime = stuff->off * MILLI_PER_SECOND;
|
||||
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSEnable(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSEnableReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||
|
||||
if (DPMSCapableFlag)
|
||||
DPMSEnabled = TRUE;
|
||||
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSDisable(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSDisableReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSDisableReq);
|
||||
|
||||
#ifdef DPMSExtension
|
||||
DPMSSet(DPMSModeOn);
|
||||
#endif
|
||||
|
||||
DPMSEnabled = FALSE;
|
||||
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSForceLevel(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSForceLevelReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
|
||||
|
||||
if (!DPMSEnabled)
|
||||
return BadMatch;
|
||||
|
||||
if (stuff->level == DPMSModeOn) {
|
||||
lastDeviceEventTime.milliseconds =
|
||||
GetTimeInMillis();
|
||||
}
|
||||
#if 0
|
||||
else if (stuff->level == DPMSModeStandby) {
|
||||
lastDeviceEventTime.milliseconds =
|
||||
GetTimeInMillis() - DPMSStandbyTime;
|
||||
} else if (stuff->level == DPMSModeSuspend) {
|
||||
lastDeviceEventTime.milliseconds =
|
||||
GetTimeInMillis() - DPMSSuspendTime;
|
||||
} else if (stuff->level == DPMSModeOff) {
|
||||
lastDeviceEventTime.milliseconds =
|
||||
GetTimeInMillis() - DPMSOffTime;
|
||||
} else {
|
||||
client->errorValue = stuff->level;
|
||||
return BadValue;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DPMSExtension
|
||||
DPMSSet(stuff->level);
|
||||
#endif
|
||||
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSInfo(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSInfoReq);
|
||||
xDPMSInfoReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSInfoReq);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.power_level = DPMSPowerLevel;
|
||||
rep.state = DPMSEnabled;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.power_level, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_DPMSGetVersion:
|
||||
return ProcDPMSGetVersion(client);
|
||||
case X_DPMSCapable:
|
||||
return ProcDPMSCapable(client);
|
||||
case X_DPMSGetTimeouts:
|
||||
return ProcDPMSGetTimeouts(client);
|
||||
case X_DPMSSetTimeouts:
|
||||
return ProcDPMSSetTimeouts(client);
|
||||
case X_DPMSEnable:
|
||||
return ProcDPMSEnable(client);
|
||||
case X_DPMSDisable:
|
||||
return ProcDPMSDisable(client);
|
||||
case X_DPMSForceLevel:
|
||||
return ProcDPMSForceLevel(client);
|
||||
case X_DPMSInfo:
|
||||
return ProcDPMSInfo(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSGetVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xDPMSGetVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
|
||||
swaps(&stuff->majorVersion, n);
|
||||
swaps(&stuff->minorVersion, n);
|
||||
return ProcDPMSGetVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSCapable(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSCapableReq);
|
||||
register int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||
|
||||
return ProcDPMSCapable(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSGetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSGetTimeoutsReq);
|
||||
register int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
|
||||
|
||||
return ProcDPMSGetTimeouts(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSSetTimeouts(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSSetTimeoutsReq);
|
||||
register int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
||||
|
||||
swaps(&stuff->standby, n);
|
||||
swaps(&stuff->suspend, n);
|
||||
swaps(&stuff->off, n);
|
||||
return ProcDPMSSetTimeouts(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSEnable(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSEnableReq);
|
||||
register int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||
|
||||
return ProcDPMSEnable(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSDisable(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSDisableReq);
|
||||
register int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSDisableReq);
|
||||
|
||||
return ProcDPMSDisable(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSForceLevel(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSForceLevelReq);
|
||||
register int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
|
||||
|
||||
swaps(&stuff->level, n);
|
||||
|
||||
return ProcDPMSForceLevel(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSInfo(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xDPMSInfoReq);
|
||||
register int n;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xDPMSInfoReq);
|
||||
|
||||
return ProcDPMSInfo(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_DPMSGetVersion:
|
||||
return SProcDPMSGetVersion(client);
|
||||
case X_DPMSCapable:
|
||||
return SProcDPMSCapable(client);
|
||||
case X_DPMSGetTimeouts:
|
||||
return SProcDPMSGetTimeouts(client);
|
||||
case X_DPMSSetTimeouts:
|
||||
return SProcDPMSSetTimeouts(client);
|
||||
case X_DPMSEnable:
|
||||
return SProcDPMSEnable(client);
|
||||
case X_DPMSDisable:
|
||||
return SProcDPMSDisable(client);
|
||||
case X_DPMSForceLevel:
|
||||
return SProcDPMSForceLevel(client);
|
||||
case X_DPMSInfo:
|
||||
return SProcDPMSInfo(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
48
Xext/dpmsstubs.c
Normal file
48
Xext/dpmsstubs.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* $Xorg: dpmsstubs.c,v 1.3 2000/08/17 19:47:56 cpqbld Exp $ */
|
||||
/*****************************************************************
|
||||
|
||||
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software.
|
||||
|
||||
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
|
||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization from Digital
|
||||
Equipment Corporation.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
typedef int Bool;
|
||||
|
||||
#define FALSE 0
|
||||
|
||||
Bool DPMSSupported()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int DPSMGet(level)
|
||||
int *level;
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DPMSSet(level)
|
||||
{
|
||||
|
||||
}
|
2041
Xext/mbuf.c
Normal file
2041
Xext/mbuf.c
Normal file
File diff suppressed because it is too large
Load Diff
1052
Xext/mbufbf.c
Normal file
1052
Xext/mbufbf.c
Normal file
File diff suppressed because it is too large
Load Diff
646
Xext/mbufpx.c
Normal file
646
Xext/mbufpx.c
Normal file
|
@ -0,0 +1,646 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/* $Xorg: mbufpx.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include <stdio.h>
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "opaque.h"
|
||||
#include "regionstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "inputstr.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
|
||||
#define _MULTIBUF_PIXMAP_
|
||||
#include "multibufst.h"
|
||||
|
||||
|
||||
static Bool NoopDDA_True() { return TRUE; }
|
||||
|
||||
static Bool pixPositionWindow();
|
||||
static int pixCreateImageBuffers();
|
||||
static void pixDisplayImageBuffers();
|
||||
static void pixClearImageBufferArea();
|
||||
static void pixDeleteBufferDrawable();
|
||||
static void pixWrapScreenFuncs();
|
||||
static void pixResetProc();
|
||||
|
||||
Bool
|
||||
pixMultibufferInit(pScreen, pMBScreen)
|
||||
ScreenPtr pScreen;
|
||||
mbufScreenPtr pMBScreen;
|
||||
{
|
||||
int i, j, k;
|
||||
xMbufBufferInfo *pInfo;
|
||||
int nInfo;
|
||||
DepthPtr pDepth;
|
||||
mbufPixmapPrivPtr pMBPriv;
|
||||
|
||||
pMBScreen->CreateImageBuffers = pixCreateImageBuffers;
|
||||
pMBScreen->DestroyImageBuffers = (void (*)())NoopDDA;
|
||||
pMBScreen->DisplayImageBuffers = pixDisplayImageBuffers;
|
||||
pMBScreen->ClearImageBufferArea = pixClearImageBufferArea;
|
||||
pMBScreen->ChangeMBufferAttributes = NoopDDA_True;
|
||||
pMBScreen->ChangeBufferAttributes = NoopDDA_True;
|
||||
pMBScreen->DeleteBufferDrawable = pixDeleteBufferDrawable;
|
||||
pMBScreen->WrapScreenFuncs = pixWrapScreenFuncs;
|
||||
pMBScreen->ResetProc = pixResetProc;
|
||||
|
||||
/* Support every depth and visual combination that the screen does */
|
||||
|
||||
nInfo = 0;
|
||||
for (i = 0; i < pScreen->numDepths; i++)
|
||||
{
|
||||
pDepth = &pScreen->allowedDepths[i];
|
||||
nInfo += pDepth->numVids;
|
||||
}
|
||||
|
||||
pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo));
|
||||
if (!pInfo)
|
||||
return FALSE;
|
||||
|
||||
k = 0;
|
||||
for (i = 0; i < pScreen->numDepths; i++)
|
||||
{
|
||||
pDepth = &pScreen->allowedDepths[i];
|
||||
for (j = 0; j < pDepth->numVids; j++)
|
||||
{
|
||||
pInfo[k].visualID = pDepth->vids[j];
|
||||
pInfo[k].maxBuffers = 0;
|
||||
pInfo[k].depth = pDepth->depth;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
pMBScreen->nInfo = nInfo;
|
||||
pMBScreen->pInfo = pInfo;
|
||||
|
||||
/*
|
||||
* Setup the devPrivate to mbufScreenRec
|
||||
*/
|
||||
|
||||
pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv));
|
||||
if (!pMBPriv)
|
||||
{
|
||||
xfree(pInfo);
|
||||
return (FALSE);
|
||||
}
|
||||
pMBScreen->devPrivate.ptr = (pointer) pMBPriv;
|
||||
pMBPriv->PositionWindow = NULL;
|
||||
pMBPriv->funcsWrapped = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
pixCreateImageBuffers (pWin, nbuf, ids, action, hint)
|
||||
WindowPtr pWin;
|
||||
int nbuf;
|
||||
XID *ids;
|
||||
int action;
|
||||
int hint;
|
||||
{
|
||||
mbufWindowPtr pMBWindow;
|
||||
mbufBufferPtr pMBBuffer;
|
||||
ScreenPtr pScreen;
|
||||
int width, height, depth;
|
||||
int i;
|
||||
|
||||
pMBWindow = MB_WINDOW_PRIV(pWin);
|
||||
|
||||
width = pWin->drawable.width;
|
||||
height = pWin->drawable.height;
|
||||
depth = pWin->drawable.depth;
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
|
||||
for (i = 0; i < nbuf; i++)
|
||||
{
|
||||
pMBBuffer = &pMBWindow->buffers[i];
|
||||
pMBBuffer->pDrawable = (DrawablePtr)
|
||||
(*pScreen->CreatePixmap) (pScreen, width, height, depth);
|
||||
if (!pMBBuffer->pDrawable)
|
||||
break;
|
||||
|
||||
if (!AddResource (ids[i], MultibufferDrawableResType,
|
||||
(pointer) pMBBuffer->pDrawable))
|
||||
{
|
||||
(*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
|
||||
break;
|
||||
}
|
||||
pMBBuffer->pDrawable->id = ids[i];
|
||||
|
||||
/*
|
||||
* In the description of the CreateImageBuffers request:
|
||||
* "If the window is mapped, or if these image buffers have
|
||||
* backing store, their contents will be tiled with the window
|
||||
* background, and zero or more expose events will be generated
|
||||
* for each of these buffers."
|
||||
*/
|
||||
|
||||
(* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea)
|
||||
(pMBBuffer, 0,0, 0,0, TRUE);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* set up the gc to clear the pixmaps;
|
||||
*/
|
||||
static Bool
|
||||
SetupBackgroundPainter (pWin, pGC)
|
||||
WindowPtr pWin;
|
||||
GCPtr pGC;
|
||||
{
|
||||
XID gcvalues[4];
|
||||
int ts_x_origin, ts_y_origin;
|
||||
PixUnion background;
|
||||
int backgroundState;
|
||||
Mask gcmask;
|
||||
|
||||
/*
|
||||
* First take care of any ParentRelative stuff by altering the
|
||||
* tile/stipple origin to match the coordinates of the upper-left
|
||||
* corner of the first ancestor without a ParentRelative background.
|
||||
* This coordinate is, of course, negative.
|
||||
*/
|
||||
|
||||
ts_x_origin = ts_y_origin = 0;
|
||||
while (pWin->backgroundState == ParentRelative) {
|
||||
ts_x_origin -= pWin->origin.x;
|
||||
ts_y_origin -= pWin->origin.y;
|
||||
pWin = pWin->parent;
|
||||
}
|
||||
backgroundState = pWin->backgroundState;
|
||||
background = pWin->background;
|
||||
|
||||
switch (backgroundState)
|
||||
{
|
||||
case BackgroundPixel:
|
||||
gcvalues[0] = (XID) background.pixel;
|
||||
gcvalues[1] = FillSolid;
|
||||
gcmask = GCForeground|GCFillStyle;
|
||||
break;
|
||||
|
||||
case BackgroundPixmap:
|
||||
gcvalues[0] = FillTiled;
|
||||
gcvalues[1] = (XID) background.pixmap;
|
||||
gcvalues[2] = ts_x_origin;
|
||||
gcvalues[3] = ts_y_origin;
|
||||
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
DoChangeGC(pGC, gcmask, gcvalues, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects)
|
||||
WindowPtr pWin;
|
||||
DrawablePtr pDrawable;
|
||||
int nrects;
|
||||
xRectangle *pRects;
|
||||
{
|
||||
GCPtr pGC;
|
||||
|
||||
pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
|
||||
if (SetupBackgroundPainter(pWin, pGC))
|
||||
{
|
||||
ValidateGC(pDrawable, pGC);
|
||||
(*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, pRects);
|
||||
}
|
||||
FreeScratchGC(pGC);
|
||||
}
|
||||
|
||||
static void
|
||||
MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion)
|
||||
WindowPtr pWin;
|
||||
DrawablePtr pDrawable;
|
||||
RegionPtr pRegion;
|
||||
{
|
||||
xRectangle *pRects;
|
||||
int nrects = REGION_NUM_RECTS(pRegion);
|
||||
BoxPtr pbox = REGION_RECTS(pRegion);
|
||||
|
||||
pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
|
||||
if (pRects)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nrects; i++)
|
||||
{
|
||||
pRects[i].x = pbox->x1;
|
||||
pRects[i].y = pbox->y1;
|
||||
pRects[i].width = pbox->x2 - pbox->x1;
|
||||
pRects[i].height = pbox->y2 - pbox->y1;
|
||||
}
|
||||
MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects);
|
||||
DEALLOCATE_LOCAL(pRects);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pixDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf)
|
||||
mbufBufferPtr *ppMBBuffer;
|
||||
mbufWindowPtr *ppMBWindow;
|
||||
int nbuf;
|
||||
{
|
||||
GCPtr pGC = NULL;
|
||||
PixmapPtr pPrevPixmap, pNewPixmap;
|
||||
WindowPtr pWin;
|
||||
RegionPtr pExposed;
|
||||
int i;
|
||||
mbufBufferPtr pPrevMBBuffer;
|
||||
XID bool;
|
||||
xRectangle r;
|
||||
|
||||
UpdateCurrentTime ();
|
||||
for (i = 0; i < nbuf; i++)
|
||||
{
|
||||
pWin = ppMBWindow[i]->pWindow;
|
||||
|
||||
/* Time to get a different scratch GC? */
|
||||
|
||||
if (!pGC
|
||||
|| pGC->depth != pWin->drawable.depth
|
||||
|| pGC->pScreen != pWin->drawable.pScreen)
|
||||
{
|
||||
if (pGC) FreeScratchGC(pGC);
|
||||
pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen);
|
||||
}
|
||||
pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]);
|
||||
pPrevPixmap = (PixmapPtr) pPrevMBBuffer->pDrawable;
|
||||
pNewPixmap = (PixmapPtr) ppMBBuffer[i]->pDrawable;
|
||||
|
||||
if (pPrevPixmap == pNewPixmap)
|
||||
{
|
||||
/* "If a specified buffer is already displayed, any delays and
|
||||
* update action will still be performed for that buffer."
|
||||
*
|
||||
* We special-case this because applications do occasionally
|
||||
* request a redundant DisplayImageBuffers, and we can save
|
||||
* strokes by recognizing that the only update action that will
|
||||
* change the buffer contents in this case is Background.
|
||||
*/
|
||||
if (ppMBWindow[i]->updateAction == MultibufferUpdateActionBackground)
|
||||
{
|
||||
r.x = r.y = 0;
|
||||
r.width = pWin->drawable.width;
|
||||
r.height = pWin->drawable.height;
|
||||
MultibufferPaintBackgroundRectangles(pWin, (DrawablePtr)pWin,
|
||||
1, &r);
|
||||
}
|
||||
}
|
||||
else /* different buffer is being displayed */
|
||||
{
|
||||
/* perform update action */
|
||||
|
||||
switch (ppMBWindow[i]->updateAction)
|
||||
{
|
||||
case MultibufferUpdateActionUndefined:
|
||||
break;
|
||||
|
||||
case MultibufferUpdateActionBackground:
|
||||
|
||||
r.x = r.y = 0;
|
||||
r.width = pPrevPixmap->drawable.width;
|
||||
r.height = pPrevPixmap->drawable.height;
|
||||
MultibufferPaintBackgroundRectangles(pWin,
|
||||
(DrawablePtr)pPrevPixmap,
|
||||
1, &r);
|
||||
break;
|
||||
|
||||
case MultibufferUpdateActionUntouched:
|
||||
|
||||
/* copy the window to the pixmap that represents the
|
||||
* currently displayed buffer
|
||||
*/
|
||||
|
||||
if (pPrevMBBuffer->eventMask & ExposureMask)
|
||||
{
|
||||
bool = TRUE;
|
||||
DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
|
||||
}
|
||||
ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
|
||||
pExposed = (*pGC->ops->CopyArea)((DrawablePtr) pWin,
|
||||
(DrawablePtr) pPrevPixmap,
|
||||
pGC,
|
||||
0, 0,
|
||||
pWin->drawable.width,
|
||||
pWin->drawable.height,
|
||||
0, 0);
|
||||
|
||||
/* if we couldn't copy the whole window to the buffer,
|
||||
* send expose events (if any client wants them)
|
||||
*/
|
||||
|
||||
if (pPrevMBBuffer->eventMask & ExposureMask)
|
||||
{ /* some client wants expose events */
|
||||
if (pExposed)
|
||||
{
|
||||
RegionPtr pWinSize;
|
||||
extern RegionPtr CreateUnclippedWinSize();
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
pWinSize = CreateUnclippedWinSize (pWin);
|
||||
/*
|
||||
* pExposed is window-relative, but at this point
|
||||
* pWinSize is screen-relative. Make pWinSize be
|
||||
* window-relative so that region ops involving
|
||||
* pExposed and pWinSize behave sensibly.
|
||||
*/
|
||||
REGION_TRANSLATE(pScreen, pWinSize,
|
||||
-pWin->drawable.x,
|
||||
-pWin->drawable.y);
|
||||
REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
|
||||
REGION_DESTROY(pScreen, pWinSize);
|
||||
MultibufferExpose (pPrevMBBuffer, pExposed);
|
||||
REGION_DESTROY(pScreen, pExposed);
|
||||
}
|
||||
bool = FALSE;
|
||||
DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE);
|
||||
} /* end some client wants expose events */
|
||||
|
||||
break; /* end case MultibufferUpdateActionUntouched */
|
||||
|
||||
case MultibufferUpdateActionCopied:
|
||||
|
||||
ValidateGC ((DrawablePtr)pPrevPixmap, pGC);
|
||||
(*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap,
|
||||
(DrawablePtr)pPrevPixmap, pGC,
|
||||
0, 0, pWin->drawable.width,
|
||||
pWin->drawable.height, 0, 0);
|
||||
break;
|
||||
|
||||
} /* end switch on update action */
|
||||
|
||||
/* display the new buffer */
|
||||
|
||||
ValidateGC ((DrawablePtr)pWin, pGC);
|
||||
(*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin,
|
||||
pGC, 0, 0,
|
||||
pWin->drawable.width, pWin->drawable.height,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
ppMBWindow[i]->lastUpdate = currentTime;
|
||||
}
|
||||
|
||||
if (pGC) FreeScratchGC (pGC);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* resize the buffers when the window is resized
|
||||
*/
|
||||
|
||||
static Bool
|
||||
pixPositionWindow (pWin, x, y)
|
||||
WindowPtr pWin;
|
||||
int x, y;
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
mbufPixmapPrivPtr pMBPriv;
|
||||
mbufWindowPtr pMBWindow;
|
||||
mbufBufferPtr pMBBuffer;
|
||||
int width, height;
|
||||
int i;
|
||||
int dx, dy, dw, dh;
|
||||
int sourcex, sourcey;
|
||||
int destx, desty;
|
||||
PixmapPtr pPixmap;
|
||||
GCPtr pGC;
|
||||
int savewidth, saveheight;
|
||||
Bool clear;
|
||||
RegionRec exposedRegion;
|
||||
Bool ret;
|
||||
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
|
||||
|
||||
UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
|
||||
ret = (* pScreen->PositionWindow) (pWin, x, y);
|
||||
REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow);
|
||||
|
||||
if (!(pMBWindow = MB_WINDOW_PRIV(pWin)))
|
||||
return ret;
|
||||
|
||||
/* if new size is same as old, we're done */
|
||||
|
||||
if (pMBWindow->width == pWin->drawable.width &&
|
||||
pMBWindow->height == pWin->drawable.height)
|
||||
return ret;
|
||||
|
||||
width = pWin->drawable.width;
|
||||
height = pWin->drawable.height;
|
||||
dx = pWin->drawable.x - pMBWindow->x;
|
||||
dy = pWin->drawable.x - pMBWindow->y;
|
||||
dw = width - pMBWindow->width;
|
||||
dh = height - pMBWindow->height;
|
||||
GravityTranslate (0, 0, -dx, -dy, dw, dh,
|
||||
pWin->bitGravity, &destx, &desty);
|
||||
|
||||
/* if the window grew, remember to paint the window background,
|
||||
* and maybe send expose events, for the new areas of the buffers
|
||||
*/
|
||||
|
||||
clear = pMBWindow->width < width || pMBWindow->height < height ||
|
||||
pWin->bitGravity == ForgetGravity;
|
||||
|
||||
sourcex = 0;
|
||||
sourcey = 0;
|
||||
savewidth = pMBWindow->width;
|
||||
saveheight = pMBWindow->height;
|
||||
/* clip rectangle to source and destination */
|
||||
if (destx < 0)
|
||||
{
|
||||
savewidth += destx;
|
||||
sourcex -= destx;
|
||||
destx = 0;
|
||||
}
|
||||
if (destx + savewidth > width)
|
||||
savewidth = width - destx;
|
||||
if (desty < 0)
|
||||
{
|
||||
saveheight += desty;
|
||||
sourcey -= desty;
|
||||
desty = 0;
|
||||
}
|
||||
if (desty + saveheight > height)
|
||||
saveheight = height - desty;
|
||||
|
||||
pMBWindow->width = width;
|
||||
pMBWindow->height = height;
|
||||
pMBWindow->x = pWin->drawable.x;
|
||||
pMBWindow->y = pWin->drawable.y;
|
||||
|
||||
if (clear)
|
||||
{
|
||||
BoxRec box;
|
||||
|
||||
box.x1 = box.y1 = 0;
|
||||
box.x2 = width;
|
||||
box.y2 = height;
|
||||
REGION_INIT(pScreen, &exposedRegion, &box, 1);
|
||||
if (pWin->bitGravity != ForgetGravity)
|
||||
{
|
||||
RegionRec preservedRegion;
|
||||
box.x1 = destx;
|
||||
box.y1 = desty;
|
||||
box.x2 = destx + savewidth;
|
||||
box.y2 = desty + saveheight;
|
||||
REGION_INIT(pScreen, &preservedRegion, &box, 1);
|
||||
REGION_SUBTRACT(pScreen, &exposedRegion, &exposedRegion, &preservedRegion);
|
||||
REGION_UNINIT(pScreen, &preservedRegion);
|
||||
}
|
||||
|
||||
} /* end if (clear) */
|
||||
|
||||
pGC = GetScratchGC (pWin->drawable.depth, pScreen);
|
||||
|
||||
/* create buffers with new window size */
|
||||
|
||||
for (i = 0; i < pMBWindow->numMultibuffer; i++)
|
||||
{
|
||||
pMBBuffer = &pMBWindow->buffers[i];
|
||||
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth);
|
||||
if (!pPixmap)
|
||||
{
|
||||
(* MB_SCREEN_PRIV(pScreen)->DestroyImageBuffers)(pWin);
|
||||
break;
|
||||
}
|
||||
if (clear)
|
||||
{
|
||||
MultibufferPaintBackgroundRegion(pWin, (DrawablePtr)pPixmap, &exposedRegion);
|
||||
MultibufferExpose(pMBBuffer, &exposedRegion);
|
||||
}
|
||||
if (pWin->bitGravity != ForgetGravity)
|
||||
{
|
||||
ValidateGC ((DrawablePtr)pPixmap, pGC);
|
||||
(*pGC->ops->CopyArea) (pMBBuffer->pDrawable, (DrawablePtr)pPixmap,
|
||||
pGC,
|
||||
sourcex, sourcey, savewidth, saveheight,
|
||||
destx, desty);
|
||||
}
|
||||
pPixmap->drawable.id = pMBBuffer->pDrawable->id;
|
||||
(*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable);
|
||||
pMBBuffer->pDrawable = (DrawablePtr) pPixmap;
|
||||
if (i != pMBWindow->displayedMultibuffer)
|
||||
{
|
||||
ChangeResourceValue (pPixmap->drawable.id,
|
||||
MultibufferDrawableResType,
|
||||
(pointer) pPixmap);
|
||||
}
|
||||
}
|
||||
FreeScratchGC (pGC);
|
||||
if (clear)
|
||||
REGION_UNINIT(pScreen, &exposedRegion);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
pixWrapScreenFuncs(pScreen)
|
||||
ScreenPtr pScreen;
|
||||
{
|
||||
mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
|
||||
WRAP_SCREEN_FUNC(pScreen, pMBPriv, PositionWindow, pixPositionWindow);
|
||||
}
|
||||
|
||||
static void
|
||||
pixResetProc(pScreen)
|
||||
ScreenPtr pScreen;
|
||||
{
|
||||
mbufScreenPtr pMBScreen = MB_SCREEN_PRIV(pScreen);
|
||||
mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen);
|
||||
|
||||
xfree(pMBScreen->pInfo);
|
||||
xfree(pMBPriv);
|
||||
}
|
||||
|
||||
static void
|
||||
pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures)
|
||||
mbufBufferPtr pMBBuffer;
|
||||
short x, y;
|
||||
unsigned short width, height;
|
||||
Bool exposures;
|
||||
{
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
BoxRec box;
|
||||
RegionRec region;
|
||||
int w_width, w_height;
|
||||
DrawablePtr pDrawable;
|
||||
|
||||
pWin = pMBBuffer->pMBWindow->pWindow;
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
|
||||
w_width = pWin->drawable.width;
|
||||
w_height = pWin->drawable.height;
|
||||
|
||||
box.x1 = x;
|
||||
box.y1 = y;
|
||||
box.x2 = width ? (box.x1 + width) : w_width;
|
||||
box.y2 = height ? (box.y1 + height) : w_height;
|
||||
|
||||
if (box.x1 < 0) box.x1 = 0;
|
||||
if (box.y1 < 0) box.y1 = 0;
|
||||
if (box.x2 > w_width) box.x2 = w_width;
|
||||
if (box.y2 > w_height) box.y2 = w_height;
|
||||
|
||||
REGION_INIT(pScreen, ®ion, &box, 1);
|
||||
|
||||
if (pMBBuffer->number == pMBBuffer->pMBWindow->displayedMultibuffer)
|
||||
pDrawable = (DrawablePtr) pWin;
|
||||
else
|
||||
pDrawable = pMBBuffer->pDrawable;
|
||||
|
||||
MultibufferPaintBackgroundRegion(pWin, pDrawable, ®ion);
|
||||
|
||||
if (exposures)
|
||||
MultibufferExpose(pMBBuffer, ®ion);
|
||||
|
||||
REGION_UNINIT(pScreen, ®ion);
|
||||
}
|
||||
|
||||
static void
|
||||
pixDeleteBufferDrawable(pDrawable)
|
||||
DrawablePtr pDrawable;
|
||||
{
|
||||
(* pDrawable->pScreen->DestroyPixmap)((PixmapPtr) pDrawable);
|
||||
}
|
153
Xext/mitmisc.c
Normal file
153
Xext/mitmisc.c
Normal file
|
@ -0,0 +1,153 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
|
||||
|
||||
/* $Xorg: mitmisc.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
|
||||
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#define _MITMISC_SERVER_
|
||||
#include "mitmiscstr.h"
|
||||
|
||||
extern Bool permitOldBugs;
|
||||
|
||||
static unsigned char MITReqCode;
|
||||
static int ProcMITDispatch(), SProcMITDispatch();
|
||||
static void MITResetProc();
|
||||
|
||||
void
|
||||
MITMiscExtensionInit()
|
||||
{
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
|
||||
if (extEntry = AddExtension(MITMISCNAME, 0, 0,
|
||||
ProcMITDispatch, SProcMITDispatch,
|
||||
MITResetProc, StandardMinorOpcode))
|
||||
MITReqCode = (unsigned char)extEntry->base;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
MITResetProc (extEntry)
|
||||
ExtensionEntry *extEntry;
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ProcMITSetBugMode(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xMITSetBugModeReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xMITSetBugModeReq);
|
||||
if ((stuff->onOff != xTrue) && (stuff->onOff != xFalse))
|
||||
{
|
||||
client->errorValue = stuff->onOff;
|
||||
return BadValue;
|
||||
}
|
||||
permitOldBugs = stuff->onOff;
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcMITGetBugMode(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xMITGetBugModeReq);
|
||||
xMITGetBugModeReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xMITGetBugModeReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.onOff = permitOldBugs;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcMITDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_MITSetBugMode:
|
||||
return ProcMITSetBugMode(client);
|
||||
case X_MITGetBugMode:
|
||||
return ProcMITGetBugMode(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SProcMITSetBugMode(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xMITSetBugModeReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcMITSetBugMode(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcMITGetBugMode(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xMITGetBugModeReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcMITGetBugMode(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcMITDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_MITSetBugMode:
|
||||
return SProcMITSetBugMode(client);
|
||||
case X_MITGetBugMode:
|
||||
return SProcMITGetBugMode(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
780
Xext/panoramiX.c
Normal file
780
Xext/panoramiX.c
Normal file
|
@ -0,0 +1,780 @@
|
|||
/* $Xorg: panoramiX.c,v 1.5 2000/08/17 19:47:57 cpqbld Exp $ */
|
||||
/*****************************************************************
|
||||
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software.
|
||||
|
||||
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
|
||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization from Digital
|
||||
Equipment Corporation.
|
||||
******************************************************************/
|
||||
|
||||
#define NEED_REPLIES
|
||||
#include <stdio.h>
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "cursor.h"
|
||||
#include "cursorstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "dixstruct.h"
|
||||
#include "gc.h"
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "window.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#if 0
|
||||
#include <sys/workstation.h>
|
||||
#include <X11/Xserver/ws.h>
|
||||
#endif
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXproto.h"
|
||||
|
||||
static unsigned char PanoramiXReqCode = 0;
|
||||
/*
|
||||
* PanoramiX data declarations
|
||||
*/
|
||||
|
||||
int PanoramiXPixWidth;
|
||||
int PanoramiXPixHeight;
|
||||
int PanoramiXNumScreens;
|
||||
|
||||
PanoramiXData *panoramiXdataPtr;
|
||||
PanoramiXWindow *PanoramiXWinRoot;
|
||||
PanoramiXGC *PanoramiXGCRoot;
|
||||
PanoramiXCmap *PanoramiXCmapRoot;
|
||||
PanoramiXPmap *PanoramiXPmapRoot;
|
||||
|
||||
PanoramiXEdge panoramiXEdgePtr[MAXSCREENS];
|
||||
RegionRec PanoramiXScreenRegion[MAXSCREENS];
|
||||
PanoramiXCDT PanoramiXColorDepthTable[MAXSCREENS];
|
||||
PanoramiXDepth PanoramiXLargestScreenDepth;
|
||||
|
||||
int (* SavedProcVector[256]) ();
|
||||
ScreenInfo *GlobalScrInfo;
|
||||
|
||||
static int panoramiXGeneration;
|
||||
static int ProcPanoramiXDispatch();
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
|
||||
static void locate_neighbors(int);
|
||||
static void PanoramiXResetProc(ExtensionEntry*);
|
||||
|
||||
/*
|
||||
* External references for data variables
|
||||
*/
|
||||
|
||||
extern int SProcPanoramiXDispatch();
|
||||
extern Bool noPanoramiXExtension;
|
||||
extern Bool PanoramiXVisibilityNotifySent;
|
||||
extern WindowPtr *WindowTable;
|
||||
#if 0
|
||||
extern ScreenArgsRec screenArgs[MAXSCREENS];
|
||||
#endif
|
||||
extern int defaultBackingStore;
|
||||
extern char *ConnectionInfo;
|
||||
extern int connBlockScreenStart;
|
||||
extern int (* ProcVector[256]) ();
|
||||
|
||||
/*
|
||||
* Server dispatcher function replacements
|
||||
*/
|
||||
|
||||
int PanoramiXCreateWindow(), PanoramiXChangeWindowAttributes();
|
||||
int PanoramiXDestroyWindow(), PanoramiXDestroySubwindows();
|
||||
int PanoramiXChangeSaveSet(), PanoramiXReparentWindow();
|
||||
int PanoramiXMapWindow(), PanoramiXMapSubwindows();
|
||||
int PanoramiXUnmapWindow(), PanoramiXUnmapSubwindows();
|
||||
int PanoramiXConfigureWindow(), PanoramiXCirculateWindow();
|
||||
int PanoramiXGetGeometry(), PanoramiXChangeProperty();
|
||||
int PanoramiXDeleteProperty(), PanoramiXSendEvent();
|
||||
int PanoramiXCreatePixmap(), PanoramiXFreePixmap();
|
||||
int PanoramiXCreateGC(), PanoramiXChangeGC();
|
||||
int PanoramiXCopyGC();
|
||||
int PanoramiXSetDashes(), PanoramiXSetClipRectangles();
|
||||
int PanoramiXFreeGC(), PanoramiXClearToBackground();
|
||||
int PanoramiXCopyArea(), PanoramiXCopyPlane();
|
||||
int PanoramiXPolyPoint(), PanoramiXPolyLine();
|
||||
int PanoramiXPolySegment(), PanoramiXPolyRectangle();
|
||||
int PanoramiXPolyArc(), PanoramiXFillPoly();
|
||||
int PanoramiXPolyFillArc(), PanoramiXPolyFillRectangle();
|
||||
int PanoramiXPutImage(), PanoramiXGetImage();
|
||||
int PanoramiXPolyText8(), PanoramiXPolyText16();
|
||||
int PanoramiXImageText8(), PanoramiXImageText16();
|
||||
int PanoramiXCreateColormap(), PanoramiXFreeColormap();
|
||||
int PanoramiXInstallColormap(), PanoramiXUninstallColormap();
|
||||
int PanoramiXAllocColor(), PanoramiXAllocNamedColor();
|
||||
int PanoramiXAllocColorCells();
|
||||
int PanoramiXFreeColors(), PanoramiXStoreColors();
|
||||
|
||||
/*
|
||||
* PanoramiXExtensionInit():
|
||||
* Called from InitExtensions in main().
|
||||
* Register PanoramiXeen Extension
|
||||
* Initialize global variables.
|
||||
*/
|
||||
|
||||
void PanoramiXExtensionInit(int argc, char *argv[])
|
||||
{
|
||||
int i, j, PhyScrNum, ArgScrNum;
|
||||
Bool success = FALSE;
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
PanoramiXData *panoramiXtempPtr;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
if (!noPanoramiXExtension)
|
||||
{
|
||||
GlobalScrInfo = &screenInfo; /* For debug visibility */
|
||||
PanoramiXNumScreens = screenInfo.numScreens;
|
||||
if (PanoramiXNumScreens == 1) { /* Only 1 screen */
|
||||
noPanoramiXExtension = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
while (panoramiXGeneration != serverGeneration) {
|
||||
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
|
||||
ProcPanoramiXDispatch,
|
||||
SProcPanoramiXDispatch, PanoramiXResetProc,
|
||||
StandardMinorOpcode);
|
||||
if (!extEntry) {
|
||||
ErrorF("PanoramiXExtensionInit(): failed to AddExtension\n");
|
||||
break;
|
||||
}
|
||||
PanoramiXReqCode = (unsigned char)extEntry->base;
|
||||
|
||||
/*
|
||||
* First make sure all the basic allocations succeed. If not,
|
||||
* run in non-PanoramiXeen mode.
|
||||
*/
|
||||
|
||||
panoramiXdataPtr = (PanoramiXData *) Xcalloc(PanoramiXNumScreens * sizeof(PanoramiXData));
|
||||
PanoramiXWinRoot = (PanoramiXWindow *) Xcalloc(sizeof(PanoramiXWindow));
|
||||
PanoramiXGCRoot = (PanoramiXGC *) Xcalloc(sizeof(PanoramiXGC));
|
||||
PanoramiXCmapRoot = (PanoramiXCmap *) Xcalloc(sizeof(PanoramiXCmap));
|
||||
PanoramiXPmapRoot = (PanoramiXPmap *) Xcalloc(sizeof(PanoramiXPmap));
|
||||
BREAK_IF(!(panoramiXdataPtr && PanoramiXWinRoot && PanoramiXGCRoot &&
|
||||
PanoramiXCmapRoot && PanoramiXPmapRoot));
|
||||
|
||||
panoramiXGeneration = serverGeneration;
|
||||
success = TRUE;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
noPanoramiXExtension = TRUE;
|
||||
ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set up a default configuration base on horizontal ordering */
|
||||
for (i = PanoramiXNumScreens -1; i >= 0 ; i--) {
|
||||
panoramiXdataPtr[i].above = panoramiXdataPtr[i].below = -1;
|
||||
panoramiXdataPtr[i].left = panoramiXdataPtr[i].right = -1;
|
||||
panoramiXEdgePtr[i].no_edges = TRUE;
|
||||
}
|
||||
for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
|
||||
panoramiXdataPtr[i].left = i - 1;
|
||||
panoramiXdataPtr[i].right = i + 1;
|
||||
}
|
||||
panoramiXdataPtr[PanoramiXNumScreens - 1].right = -1;
|
||||
|
||||
/*
|
||||
* Position the screens relative to each other based on
|
||||
* command line options.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
|
||||
if (wsRemapPhysToLogScreens)
|
||||
i = wsPhysToLogScreens[PhyScrNum];
|
||||
else
|
||||
i = PhyScrNum;
|
||||
if (i < 0)
|
||||
continue;
|
||||
panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
|
||||
panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
|
||||
if (screenArgs[i].flags & ARG_EDGE_L) {
|
||||
ArgScrNum = screenArgs[PhyScrNum].edge_left;
|
||||
if (ArgScrNum < 0)
|
||||
j = -1;
|
||||
else {
|
||||
if (wsRemapPhysToLogScreens)
|
||||
j = wsPhysToLogScreens[ArgScrNum];
|
||||
else
|
||||
j = ArgScrNum;
|
||||
}
|
||||
panoramiXdataPtr[i].left = j;
|
||||
panoramiXEdgePtr[i].no_edges = FALSE;
|
||||
if ( j >= 0)
|
||||
panoramiXdataPtr[j].right = i;
|
||||
else {
|
||||
if ( i >= 1 )
|
||||
panoramiXdataPtr[i - 1].right = -1;
|
||||
}
|
||||
}
|
||||
if (screenArgs[i].flags & ARG_EDGE_R) {
|
||||
ArgScrNum = screenArgs[PhyScrNum].edge_right;
|
||||
if (ArgScrNum < 0)
|
||||
j = -1;
|
||||
else {
|
||||
if (wsRemapPhysToLogScreens)
|
||||
j = wsPhysToLogScreens[ArgScrNum];
|
||||
else
|
||||
j = ArgScrNum;
|
||||
}
|
||||
panoramiXdataPtr[i].right = j;
|
||||
panoramiXEdgePtr[i].no_edges = FALSE;
|
||||
if ( j >= 0)
|
||||
panoramiXdataPtr[j].left = i;
|
||||
}
|
||||
if (screenArgs[i].flags & ARG_EDGE_T) {
|
||||
ArgScrNum = screenArgs[PhyScrNum].edge_top;
|
||||
if (ArgScrNum < 0)
|
||||
j = -1;
|
||||
else {
|
||||
if (wsRemapPhysToLogScreens)
|
||||
j = wsPhysToLogScreens[ArgScrNum];
|
||||
else
|
||||
j = ArgScrNum;
|
||||
}
|
||||
panoramiXdataPtr[i].above = j;
|
||||
panoramiXEdgePtr[i].no_edges = FALSE;
|
||||
if ( j >= 0)
|
||||
panoramiXdataPtr[j].below = i;
|
||||
}
|
||||
if (screenArgs[i].flags & ARG_EDGE_B) {
|
||||
ArgScrNum = screenArgs[PhyScrNum].edge_bottom;
|
||||
if (ArgScrNum < 0)
|
||||
j = -1;
|
||||
else {
|
||||
if (wsRemapPhysToLogScreens)
|
||||
j = wsPhysToLogScreens[ArgScrNum];
|
||||
else
|
||||
j = ArgScrNum;
|
||||
}
|
||||
panoramiXdataPtr[i].below = j;
|
||||
panoramiXEdgePtr[i].no_edges = FALSE;
|
||||
if ( j >= 0)
|
||||
panoramiXdataPtr[j].above = i;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
|
||||
i = PhyScrNum;
|
||||
if (i < 0)
|
||||
continue;
|
||||
panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
|
||||
panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find the upper-left screen and then locate all the others
|
||||
*/
|
||||
panoramiXtempPtr = panoramiXdataPtr;
|
||||
for (i = PanoramiXNumScreens; i; i--, panoramiXtempPtr++)
|
||||
if (panoramiXtempPtr->above == -1 && panoramiXtempPtr->left == -1)
|
||||
break;
|
||||
locate_neighbors(PanoramiXNumScreens - i);
|
||||
|
||||
/*
|
||||
* Put our processes into the ProcVector
|
||||
*/
|
||||
|
||||
for (i = 256; i--; )
|
||||
SavedProcVector[i] = ProcVector[i];
|
||||
|
||||
ProcVector[X_CreateWindow] = PanoramiXCreateWindow;
|
||||
ProcVector[X_ChangeWindowAttributes] = PanoramiXChangeWindowAttributes;
|
||||
ProcVector[X_DestroyWindow] = PanoramiXDestroyWindow;
|
||||
ProcVector[X_DestroySubwindows] = PanoramiXDestroySubwindows;
|
||||
ProcVector[X_ChangeSaveSet] = PanoramiXChangeSaveSet;
|
||||
ProcVector[X_ReparentWindow] = PanoramiXReparentWindow;
|
||||
ProcVector[X_MapWindow] = PanoramiXMapWindow;
|
||||
ProcVector[X_MapSubwindows] = PanoramiXMapSubwindows;
|
||||
ProcVector[X_UnmapWindow] = PanoramiXUnmapWindow;
|
||||
ProcVector[X_UnmapSubwindows] = PanoramiXUnmapSubwindows;
|
||||
ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow;
|
||||
ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow;
|
||||
ProcVector[X_GetGeometry] = PanoramiXGetGeometry;
|
||||
ProcVector[X_ChangeProperty] = PanoramiXChangeProperty;
|
||||
ProcVector[X_DeleteProperty] = PanoramiXDeleteProperty;
|
||||
ProcVector[X_SendEvent] = PanoramiXSendEvent;
|
||||
ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap;
|
||||
ProcVector[X_FreePixmap] = PanoramiXFreePixmap;
|
||||
ProcVector[X_CreateGC] = PanoramiXCreateGC;
|
||||
ProcVector[X_ChangeGC] = PanoramiXChangeGC;
|
||||
ProcVector[X_CopyGC] = PanoramiXCopyGC;
|
||||
ProcVector[X_SetDashes] = PanoramiXSetDashes;
|
||||
ProcVector[X_SetClipRectangles] = PanoramiXSetClipRectangles;
|
||||
ProcVector[X_FreeGC] = PanoramiXFreeGC;
|
||||
ProcVector[X_ClearArea] = PanoramiXClearToBackground;
|
||||
ProcVector[X_CopyArea] = PanoramiXCopyArea;;
|
||||
ProcVector[X_CopyPlane] = PanoramiXCopyPlane;;
|
||||
ProcVector[X_PolyPoint] = PanoramiXPolyPoint;
|
||||
ProcVector[X_PolyLine] = PanoramiXPolyLine;
|
||||
ProcVector[X_PolySegment] = PanoramiXPolySegment;
|
||||
ProcVector[X_PolyRectangle] = PanoramiXPolyRectangle;
|
||||
ProcVector[X_PolyArc] = PanoramiXPolyArc;
|
||||
ProcVector[X_FillPoly] = PanoramiXFillPoly;
|
||||
ProcVector[X_PolyFillRectangle] = PanoramiXPolyFillRectangle;
|
||||
ProcVector[X_PolyFillArc] = PanoramiXPolyFillArc;
|
||||
ProcVector[X_PutImage] = PanoramiXPutImage;
|
||||
ProcVector[X_GetImage] = PanoramiXGetImage;
|
||||
ProcVector[X_PolyText8] = PanoramiXPolyText8;
|
||||
ProcVector[X_PolyText16] = PanoramiXPolyText16;
|
||||
ProcVector[X_ImageText8] = PanoramiXImageText8;
|
||||
ProcVector[X_ImageText16] = PanoramiXImageText16;
|
||||
ProcVector[X_CreateColormap] = PanoramiXCreateColormap;
|
||||
ProcVector[X_FreeColormap] = PanoramiXFreeColormap;
|
||||
ProcVector[X_InstallColormap] = PanoramiXInstallColormap;
|
||||
ProcVector[X_UninstallColormap] = PanoramiXUninstallColormap;
|
||||
ProcVector[X_AllocColor] = PanoramiXAllocColor;
|
||||
ProcVector[X_AllocNamedColor] = PanoramiXAllocNamedColor;
|
||||
ProcVector[X_AllocColorCells] = PanoramiXAllocColorCells;
|
||||
ProcVector[X_FreeColors] = PanoramiXFreeColors;
|
||||
ProcVector[X_StoreColors] = PanoramiXStoreColors;
|
||||
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
extern
|
||||
Bool PanoramiXCreateConnectionBlock(void)
|
||||
{
|
||||
int i;
|
||||
int old_width, old_height;
|
||||
int width_mult, height_mult;
|
||||
xWindowRoot *root;
|
||||
xConnSetup *setup;
|
||||
|
||||
/*
|
||||
* Do normal CreateConnectionBlock but faking it for only one screen
|
||||
*/
|
||||
|
||||
if (!CreateConnectionBlock()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* OK, change some dimensions so it looks as if it were one big screen
|
||||
*/
|
||||
|
||||
setup = (xConnSetup *) ConnectionInfo;
|
||||
setup->numRoots = 1;
|
||||
root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
|
||||
|
||||
old_width = root->pixWidth;
|
||||
old_height = root->pixHeight;
|
||||
for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
|
||||
if (panoramiXdataPtr[i].right == -1 )
|
||||
root->pixWidth = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
|
||||
if (panoramiXdataPtr[i].below == -1)
|
||||
root->pixHeight = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
|
||||
}
|
||||
PanoramiXPixWidth = root->pixWidth;
|
||||
PanoramiXPixHeight = root->pixHeight;
|
||||
width_mult = root->pixWidth / old_width;
|
||||
height_mult = root->pixHeight / old_height;
|
||||
root->mmWidth *= width_mult;
|
||||
root->mmHeight *= height_mult;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern
|
||||
Bool PanoramiXCreateScreenRegion(pWin)
|
||||
WindowPtr pWin;
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
BoxRec box;
|
||||
int i;
|
||||
Bool ret;
|
||||
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
for (i = 0; i < PanoramiXNumScreens; i++) {
|
||||
box.x1 = 0 - panoramiXdataPtr[i].x;
|
||||
box.x2 = box.x1 + PanoramiXPixWidth;
|
||||
box.y1 = 0 - panoramiXdataPtr[i].y;
|
||||
box.y2 = box.y1 + PanoramiXPixHeight;
|
||||
REGION_INIT(pScreen, &PanoramiXScreenRegion[i], &box, 1);
|
||||
ret = REGION_NOTEMPTY(pScreen, &PanoramiXScreenRegion[i]);
|
||||
if (!ret)
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern
|
||||
void PanoramiXDestroyScreenRegion(pWin)
|
||||
WindowPtr pWin;
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
int i;
|
||||
Bool ret;
|
||||
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
for (i = 0; i < PanoramiXNumScreens; i++)
|
||||
REGION_DESTROY(pScreen, &PanoramiXScreenRegion[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Assign the Root window and colormap ID's in the PanoramiXScreen Root
|
||||
* linked lists. Note: WindowTable gets setup in dix_main by
|
||||
* InitRootWindow, and GlobalScrInfo is screenInfo which gets setup
|
||||
* by InitOutput.
|
||||
*/
|
||||
extern
|
||||
void PanoramiXConsolidate(void)
|
||||
{
|
||||
int i,j,k,v,d,n, thisMaxDepth;
|
||||
int depthIndex;
|
||||
DepthPtr pDepth, pLargeDepth;
|
||||
VisualPtr pVisual;
|
||||
VisualID it;
|
||||
register WindowPtr pWin, pLargeWin;
|
||||
Bool SameDepth;
|
||||
|
||||
PanoramiXLargestScreenDepth.numDepths = (screenInfo.screens[PanoramiXNumScreens -1])->numDepths;
|
||||
PanoramiXLargestScreenDepth.screenNum = PanoramiXNumScreens - 1;
|
||||
SameDepth = TRUE;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
for (j =0; j < 6; j++)
|
||||
{
|
||||
PanoramiXColorDepthTable[i].panoramiXScreenMap[j].numDepths=0;
|
||||
for (n = 0; n < 6; n++)
|
||||
{
|
||||
PanoramiXColorDepthTable[i].panoramiXScreenMap[j].listDepths[n]=0;
|
||||
}
|
||||
for (k = 0; k < 33; k++)
|
||||
{
|
||||
PanoramiXColorDepthTable[i].panoramiXScreenMap[j].vmap[k].numVids=0;
|
||||
for (v = 0; v < 10; v++)
|
||||
{
|
||||
PanoramiXColorDepthTable[i].panoramiXScreenMap[j].vmap[k].vid[v]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = PanoramiXNumScreens - 1; i >= 0; i--)
|
||||
{
|
||||
PanoramiXWinRoot->info[i].id = WindowTable[i]->drawable.id;
|
||||
PanoramiXCmapRoot->info[i].id = (screenInfo.screens[i])->defColormap;
|
||||
|
||||
/* Create a Color-Depth-Table, this will help us deal
|
||||
with mixing graphics boards and visuals, of course
|
||||
given that the boards support multi-screen to begin
|
||||
with. Fill the panoramiXCDT table by screen, then
|
||||
visual type and allowable depths.
|
||||
*/
|
||||
pWin = WindowTable[i];
|
||||
if ( (screenInfo.screens[i])->numDepths >
|
||||
PanoramiXLargestScreenDepth.numDepths )
|
||||
{
|
||||
PanoramiXLargestScreenDepth.numDepths = (screenInfo.screens[i])->numDepths;
|
||||
PanoramiXLargestScreenDepth.screenNum = i;
|
||||
SameDepth = FALSE;
|
||||
}
|
||||
for (v = 0, pVisual = pWin->drawable.pScreen->visuals;
|
||||
v < pWin->drawable.pScreen->numVisuals; v++, pVisual++)
|
||||
{
|
||||
PanoramiXColorDepthTable[i].panoramiXScreenMap[pVisual->class].numDepths = (screenInfo.screens[i])->numDepths;
|
||||
for ( j = 0; j < (screenInfo.screens[i])->numDepths; j++)
|
||||
{
|
||||
pDepth = (DepthPtr) &pWin->drawable.pScreen->allowedDepths[j];
|
||||
PanoramiXColorDepthTable[i].panoramiXScreenMap[pVisual->class].listDepths[j] = pDepth->depth;
|
||||
for (d = 0; d < pDepth->numVids; d++)
|
||||
{
|
||||
if (pVisual->vid == pDepth->vids[d])
|
||||
{
|
||||
PanoramiXColorDepthTable[i].
|
||||
panoramiXScreenMap[pVisual->class].vmap[pDepth->depth].
|
||||
vid[
|
||||
PanoramiXColorDepthTable[i].
|
||||
panoramiXScreenMap[pVisual->class].
|
||||
vmap[pDepth->depth].numVids++
|
||||
]
|
||||
= pDepth->vids[d];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PanoramiXColorDepthTable[i].numVisuals = 6;
|
||||
} /* for each screen */
|
||||
/* Fill in ColorDepthTable for mixed visuals with varying depth.
|
||||
Can't do that until we figure out how to handle mixed visuals
|
||||
and varying card visual/depth initialization. If we can decide
|
||||
how to map the relationship, then we can use this table to
|
||||
shove the information into and use for cross-referencing when
|
||||
necessary.
|
||||
|
||||
In the meantime, check to see if the screens are the same,
|
||||
if they don't then disable panoramiX, print out a message,
|
||||
don't support this mode.
|
||||
*/
|
||||
}
|
||||
|
||||
/* Since locate_neighbors is recursive, a quick simple example
|
||||
is in order.This mostly so you can see what the initial values are.
|
||||
|
||||
Given 3 screens:
|
||||
upperleft screen[0]
|
||||
panoramiXdataPtr[0].x = 0
|
||||
panoramiXdataPtr[0].y = 0
|
||||
panoramiXdataPtr[0].width = 640
|
||||
panoramiXdataPtr[0].height = 480
|
||||
panoramiXdataPtr[0].below = -1
|
||||
panoramiXdataPtr[0].right = 1
|
||||
panoramiXdataPtr[0].above = -1
|
||||
panoramiXdataPtr[0].left = -1
|
||||
middle screen[1]
|
||||
panoramiXdataPtr[1].x = 0
|
||||
panoramiXdataPtr[1].y = 0
|
||||
panoramiXdataPtr[1].width = 640
|
||||
panoramiXdataPtr[1].height = 480
|
||||
panoramiXdataPtr[1].below = -1
|
||||
panoramiXdataPtr[1].right = 2
|
||||
panoramiXdataPtr[1].above = -1
|
||||
panoramiXdataPtr[1].left = 0
|
||||
last right screen[2]
|
||||
panoramiXdataPtr[2].x = 0
|
||||
panoramiXdataPtr[2].y = 0
|
||||
panoramiXdataPtr[2].width = 640
|
||||
panoramiXdataPtr[2].height = 480
|
||||
panoramiXdataPtr[2].below = -1
|
||||
panoramiXdataPtr[2].right = -1
|
||||
panoramiXdataPtr[2].above = -1
|
||||
panoramiXdataPtr[2].left = 1
|
||||
|
||||
Calling locate_neighbors(0) results in:
|
||||
panoramiXdataPtr[0].x = 0
|
||||
panoramiXdataPtr[0].y = 0
|
||||
panoramiXdataPtr[1].x = 640
|
||||
panoramiXdataPtr[1].y = 0
|
||||
panoramiXdataPtr[2].x = 1280
|
||||
panoramiXdataPtr[2].y = 0
|
||||
*/
|
||||
|
||||
static void locate_neighbors(int i)
|
||||
{
|
||||
int j;
|
||||
|
||||
j = panoramiXdataPtr[i].right;
|
||||
if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
|
||||
panoramiXdataPtr[j].x = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
|
||||
panoramiXdataPtr[j].y = panoramiXdataPtr[i].y;
|
||||
locate_neighbors(j);
|
||||
}
|
||||
j = panoramiXdataPtr[i].below;
|
||||
if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
|
||||
panoramiXdataPtr[j].y = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
|
||||
panoramiXdataPtr[j].x = panoramiXdataPtr[i].x;
|
||||
locate_neighbors(j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* PanoramiXResetProc()
|
||||
* Exit, deallocating as needed.
|
||||
*/
|
||||
|
||||
static void PanoramiXResetProc(extEntry)
|
||||
ExtensionEntry* extEntry;
|
||||
{
|
||||
int i;
|
||||
PanoramiXList *pPanoramiXList;
|
||||
PanoramiXList *tempList;
|
||||
|
||||
for (pPanoramiXList = PanoramiXPmapRoot; pPanoramiXList; pPanoramiXList = tempList){
|
||||
tempList = pPanoramiXList->next;
|
||||
Xfree(pPanoramiXList);
|
||||
}
|
||||
for (pPanoramiXList = PanoramiXCmapRoot; pPanoramiXList; pPanoramiXList = tempList){
|
||||
tempList = pPanoramiXList->next;
|
||||
Xfree(pPanoramiXList);
|
||||
}
|
||||
for (pPanoramiXList = PanoramiXGCRoot; pPanoramiXList; pPanoramiXList = tempList) {
|
||||
tempList = pPanoramiXList->next;
|
||||
Xfree(pPanoramiXList);
|
||||
}
|
||||
for (pPanoramiXList = PanoramiXWinRoot; pPanoramiXList; pPanoramiXList = tempList) {
|
||||
tempList = pPanoramiXList->next;
|
||||
Xfree(pPanoramiXList);
|
||||
}
|
||||
screenInfo.numScreens = PanoramiXNumScreens;
|
||||
for (i = 256; i--; )
|
||||
ProcVector[i] = SavedProcVector[i];
|
||||
Xfree(panoramiXdataPtr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
ProcPanoramiXQueryVersion (ClientPtr client)
|
||||
#else
|
||||
ProcPanoramiXQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xPanoramiXQueryVersionReq);
|
||||
xPanoramiXQueryVersionReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = PANORAMIX_MAJOR_VERSION;
|
||||
rep.minorVersion = PANORAMIX_MINOR_VERSION;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
}
|
||||
WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), (char *)&rep);
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
ProcPanoramiXGetState(ClientPtr client)
|
||||
#else
|
||||
ProcPanoramiXGetState(client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xPanoramiXGetStateReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetStateReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
||||
pWin = LookupWindow (stuff->window, client);
|
||||
if (!pWin)
|
||||
return BadWindow;
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.state = !noPanoramiXExtension;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequenceNumber, n);
|
||||
swapl (&rep.length, n);
|
||||
swaps (&rep.state, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep);
|
||||
return client->noClientException;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
ProcPanoramiXGetScreenCount(ClientPtr client)
|
||||
#else
|
||||
ProcPanoramiXGetScreenCount(client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenCountReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetScreenCountReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
||||
pWin = LookupWindow (stuff->window, client);
|
||||
if (!pWin)
|
||||
return BadWindow;
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.ScreenCount = PanoramiXNumScreens;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequenceNumber, n);
|
||||
swapl (&rep.length, n);
|
||||
swaps (&rep.ScreenCount, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xPanoramiXGetScreenCountReply), (char *) &rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
ProcPanoramiXGetScreenSize(ClientPtr client)
|
||||
#else
|
||||
ProcPanoramiXGetScreenSize(client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenSizeReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetScreenSizeReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
pWin = LookupWindow (stuff->window, client);
|
||||
if (!pWin)
|
||||
return BadWindow;
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
/* screen dimensions */
|
||||
rep.width = panoramiXdataPtr[stuff->screen].width;
|
||||
rep.height = panoramiXdataPtr[stuff->screen].height;
|
||||
if (client->swapped) {
|
||||
swaps (&rep.sequenceNumber, n);
|
||||
swapl (&rep.length, n);
|
||||
swaps (rep.width, n);
|
||||
swaps (rep.height, n);
|
||||
}
|
||||
WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), (char *) &rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
|
||||
void PrintList(PanoramiXList *head)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (; head; i++, head = head->next)
|
||||
fprintf(stderr, "%2d next = 0x%010lx, id[0] = 0x%08x, id[1] = 0x%08x\n",
|
||||
i, head->next, head->info[0].id, head->info[1].id);
|
||||
}
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
ProcPanoramiXDispatch (ClientPtr client)
|
||||
#else
|
||||
ProcPanoramiXDispatch (client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{ REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_PanoramiXQueryVersion:
|
||||
return ProcPanoramiXQueryVersion(client);
|
||||
case X_PanoramiXGetState:
|
||||
return ProcPanoramiXGetState(client);
|
||||
case X_PanoramiXGetScreenCount:
|
||||
return ProcPanoramiXGetScreenCount(client);
|
||||
case X_PanoramiXGetScreenSize:
|
||||
return ProcPanoramiXGetScreenSize(client);
|
||||
}
|
||||
return BadRequest;
|
||||
}
|
158
Xext/panoramiXSwap.c
Normal file
158
Xext/panoramiXSwap.c
Normal file
|
@ -0,0 +1,158 @@
|
|||
/* $Xorg: panoramiXSwap.c,v 1.4 2000/08/17 19:47:57 cpqbld Exp $ */
|
||||
/*****************************************************************
|
||||
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software.
|
||||
|
||||
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
|
||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization from Digital
|
||||
Equipment Corporation.
|
||||
******************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "cursor.h"
|
||||
#include "cursorstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "dixstruct.h"
|
||||
#include "gc.h"
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "window.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#if 0
|
||||
#include <sys/workstation.h>
|
||||
#include <X11/Xserver/ws.h>
|
||||
#endif
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXproto.h"
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* External references for data variables
|
||||
*/
|
||||
|
||||
extern Bool noPanoramiXExtension;
|
||||
extern Bool PanoramiXVisibilityNotifySent;
|
||||
extern WindowPtr *WindowTable;
|
||||
extern int defaultBackingStore;
|
||||
extern char *ConnectionInfo;
|
||||
extern int connBlockScreenStart;
|
||||
extern int (* ProcVector[256]) ();
|
||||
|
||||
#if NeedFunctionPrototypes
|
||||
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
|
||||
#else
|
||||
#define PROC_EXTERN(pfunc) extern int pfunc()
|
||||
#endif
|
||||
|
||||
PROC_EXTERN(ProcPanoramiXQueryVersion);
|
||||
PROC_EXTERN(ProcPanoramiXGetState);
|
||||
PROC_EXTERN(ProcPanoramiXGetScreenCount);
|
||||
PROC_EXTERN(PropPanoramiXGetScreenSize);
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcPanoramiXQueryVersion (ClientPtr client)
|
||||
#else
|
||||
SProcPanoramiXQueryVersion (client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xPanoramiXQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
|
||||
return ProcPanoramiXQueryVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcPanoramiXGetState(ClientPtr client)
|
||||
#else
|
||||
SProcPanoramiXGetState(client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xPanoramiXGetStateReq);
|
||||
register int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcPanoramiXGetScreenCount(ClientPtr client)
|
||||
#else
|
||||
SProcPanoramixGetScreenCount(client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenCountReq);
|
||||
register int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
||||
return ProcPanoramiXGetScreenCount(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcPanoramiXGetScreenSize(ClientPtr client)
|
||||
#else
|
||||
SProcPanoramiXGetScreenSize(client)
|
||||
register ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenSizeReq);
|
||||
WindowPtr pWin;
|
||||
register int n;
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
return ProcPanoramiXGetScreenSize(client);
|
||||
}
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcPanoramiXDispatch (ClientPtr client)
|
||||
#else
|
||||
SProcPanoramiXDispatch (client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{ REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_PanoramiXQueryVersion:
|
||||
return SProcPanoramiXQueryVersion(client);
|
||||
case X_PanoramiXGetState:
|
||||
return SProcPanoramiXGetState(client);
|
||||
case X_PanoramiXGetScreenCount:
|
||||
return SProcPanoramiXGetScreenCount(client);
|
||||
case X_PanoramiXGetScreenSize:
|
||||
return SProcPanoramiXGetScreenSize(client);
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
3034
Xext/panoramiXprocs.c
Normal file
3034
Xext/panoramiXprocs.c
Normal file
File diff suppressed because it is too large
Load Diff
97
Xext/sampleEVI.c
Normal file
97
Xext/sampleEVI.c
Normal file
|
@ -0,0 +1,97 @@
|
|||
/* $Xorg: sampleEVI.c,v 1.3 2000/08/17 19:47:58 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
|
||||
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 Silicon Graphics not be
|
||||
used in advertising or publicity pertaining to distribution
|
||||
of the software without specific prior written permission.
|
||||
Silicon Graphics makes no representation about the suitability
|
||||
of this software for any purpose. It is provided "as is"
|
||||
without any express or implied warranty.
|
||||
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
GRAPHICS 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.
|
||||
********************************************************/
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "dix.h"
|
||||
#define _XEVI_SERVER_
|
||||
#include "XEVIstr.h"
|
||||
#include "EVIstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
static int sampleGetVisualInfo(
|
||||
VisualID32 *visual,
|
||||
int n_visual,
|
||||
xExtendedVisualInfo **evi_rn,
|
||||
int *n_info_rn,
|
||||
VisualID32 **conflict_rn,
|
||||
int *n_conflict_rn)
|
||||
{
|
||||
int max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens;
|
||||
VisualID32 *temp_conflict;
|
||||
xExtendedVisualInfo *evi;
|
||||
int max_visuals = 0, max_sz_conflict, sz_conflict = 0;
|
||||
register int visualI, scrI, sz_evi = 0, conflictI, n_conflict;
|
||||
*evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi);
|
||||
if (!*evi_rn)
|
||||
return BadAlloc;
|
||||
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
|
||||
if (screenInfo.screens[scrI]->numVisuals > max_visuals)
|
||||
max_visuals = screenInfo.screens[scrI]->numVisuals;
|
||||
}
|
||||
max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals;
|
||||
temp_conflict = (VisualID32 *)xalloc(max_sz_conflict);
|
||||
if (!temp_conflict) {
|
||||
xfree(*evi_rn);
|
||||
return BadAlloc;
|
||||
}
|
||||
for (scrI = 0; scrI < screenInfo.numScreens; scrI++) {
|
||||
for (visualI = 0; visualI < n_visual; visualI++) {
|
||||
evi[sz_evi].core_visual_id = visual[visualI];
|
||||
evi[sz_evi].screen = scrI;
|
||||
evi[sz_evi].level = 0;
|
||||
evi[sz_evi].transparency_type = XEVI_TRANSPARENCY_NONE;
|
||||
evi[sz_evi].transparency_value = 0;
|
||||
evi[sz_evi].min_hw_colormaps = 1;
|
||||
evi[sz_evi].max_hw_colormaps = 1;
|
||||
evi[sz_evi].num_colormap_conflicts = n_conflict = 0;
|
||||
for (conflictI = 0; conflictI < n_conflict; conflictI++)
|
||||
temp_conflict[sz_conflict++] = visual[visualI];
|
||||
sz_evi++;
|
||||
}
|
||||
}
|
||||
*conflict_rn = temp_conflict;
|
||||
*n_conflict_rn = sz_conflict;
|
||||
*n_info_rn = sz_evi;
|
||||
return Success;
|
||||
}
|
||||
static void sampleFreeVisualInfo(
|
||||
xExtendedVisualInfo *evi,
|
||||
VisualID32 *conflict)
|
||||
{
|
||||
if (evi)
|
||||
xfree(evi);
|
||||
if (conflict)
|
||||
xfree(conflict);
|
||||
}
|
||||
EviPrivPtr eviDDXInit()
|
||||
{
|
||||
static EviPrivRec eviPriv;
|
||||
eviPriv.getVisualInfo = sampleGetVisualInfo;
|
||||
eviPriv.freeVisualInfo = sampleFreeVisualInfo;
|
||||
return &eviPriv;
|
||||
}
|
||||
void eviDDXReset()
|
||||
{
|
||||
}
|
1995
Xext/security.c
Normal file
1995
Xext/security.c
Normal file
File diff suppressed because it is too large
Load Diff
1217
Xext/shape.c
Normal file
1217
Xext/shape.c
Normal file
File diff suppressed because it is too large
Load Diff
1010
Xext/shm.c
Normal file
1010
Xext/shm.c
Normal file
File diff suppressed because it is too large
Load Diff
211
Xext/sleepuntil.c
Normal file
211
Xext/sleepuntil.c
Normal file
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* $Xorg: sleepuntil.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $
|
||||
*
|
||||
Copyright 1992, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
*
|
||||
* Author: Keith Packard, MIT X Consortium
|
||||
*/
|
||||
|
||||
/* dixsleep.c - implement millisecond timeouts for X clients */
|
||||
|
||||
#include "X.h"
|
||||
#include "Xmd.h"
|
||||
#include "misc.h"
|
||||
#include "windowstr.h"
|
||||
#include "dixstruct.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
||||
typedef struct _Sertafied {
|
||||
struct _Sertafied *next;
|
||||
TimeStamp revive;
|
||||
ClientPtr pClient;
|
||||
XID id;
|
||||
void (*notifyFunc)();
|
||||
pointer closure;
|
||||
} SertafiedRec, *SertafiedPtr;
|
||||
|
||||
static SertafiedPtr pPending;
|
||||
static RESTYPE SertafiedResType;
|
||||
static Bool BlockHandlerRegistered;
|
||||
static int SertafiedGeneration;
|
||||
static void ClientAwaken();
|
||||
static int SertafiedDelete();
|
||||
static void SertafiedBlockHandler();
|
||||
static void SertafiedWakeupHandler();
|
||||
|
||||
ClientSleepUntil (client, revive, notifyFunc, closure)
|
||||
ClientPtr client;
|
||||
TimeStamp *revive;
|
||||
void (*notifyFunc)();
|
||||
pointer closure;
|
||||
{
|
||||
SertafiedPtr pRequest, pReq, pPrev;
|
||||
|
||||
if (SertafiedGeneration != serverGeneration)
|
||||
{
|
||||
SertafiedResType = CreateNewResourceType (SertafiedDelete);
|
||||
if (!SertafiedResType)
|
||||
return FALSE;
|
||||
SertafiedGeneration = serverGeneration;
|
||||
BlockHandlerRegistered = FALSE;
|
||||
}
|
||||
pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec));
|
||||
if (!pRequest)
|
||||
return FALSE;
|
||||
pRequest->pClient = client;
|
||||
pRequest->revive = *revive;
|
||||
pRequest->id = FakeClientID (client->index);
|
||||
pRequest->closure = closure;
|
||||
if (!BlockHandlerRegistered)
|
||||
{
|
||||
if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler,
|
||||
SertafiedWakeupHandler,
|
||||
(pointer) 0))
|
||||
{
|
||||
xfree (pRequest);
|
||||
return FALSE;
|
||||
}
|
||||
BlockHandlerRegistered = TRUE;
|
||||
}
|
||||
pRequest->notifyFunc = 0;
|
||||
if (!AddResource (pRequest->id, SertafiedResType, (pointer) pRequest))
|
||||
return FALSE;
|
||||
if (!notifyFunc)
|
||||
notifyFunc = ClientAwaken;
|
||||
pRequest->notifyFunc = notifyFunc;
|
||||
/* Insert into time-ordered queue, with earliest activation time coming first. */
|
||||
pPrev = 0;
|
||||
for (pReq = pPending; pReq; pReq = pReq->next)
|
||||
{
|
||||
if (CompareTimeStamps (pReq->revive, *revive) == LATER)
|
||||
break;
|
||||
pPrev = pReq;
|
||||
}
|
||||
if (pPrev)
|
||||
pPrev->next = pRequest;
|
||||
else
|
||||
pPending = pRequest;
|
||||
pRequest->next = pReq;
|
||||
IgnoreClient (client);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ClientAwaken (client, closure)
|
||||
ClientPtr client;
|
||||
pointer closure;
|
||||
{
|
||||
if (!client->clientGone)
|
||||
AttendClient (client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SertafiedDelete (value, id)
|
||||
pointer value;
|
||||
XID id;
|
||||
{
|
||||
SertafiedPtr pRequest = (SertafiedPtr)value;
|
||||
SertafiedPtr pReq, pPrev;
|
||||
|
||||
pPrev = 0;
|
||||
for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
|
||||
if (pReq == pRequest)
|
||||
{
|
||||
if (pPrev)
|
||||
pPrev->next = pReq->next;
|
||||
else
|
||||
pPending = pReq->next;
|
||||
break;
|
||||
}
|
||||
if (pRequest->notifyFunc)
|
||||
(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
|
||||
xfree (pRequest);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
SertafiedBlockHandler (data, wt, LastSelectMask)
|
||||
pointer data; /* unused */
|
||||
OSTimePtr wt; /* wait time */
|
||||
pointer LastSelectMask;
|
||||
{
|
||||
SertafiedPtr pReq, pNext;
|
||||
unsigned long newdelay, olddelay;
|
||||
TimeStamp now;
|
||||
|
||||
if (!pPending)
|
||||
return;
|
||||
now.milliseconds = GetTimeInMillis ();
|
||||
now.months = currentTime.months;
|
||||
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
||||
now.months++;
|
||||
for (pReq = pPending; pReq; pReq = pNext)
|
||||
{
|
||||
pNext = pReq->next;
|
||||
if (CompareTimeStamps (pReq->revive, now) == LATER)
|
||||
break;
|
||||
FreeResource (pReq->id, RT_NONE);
|
||||
|
||||
/* AttendClient() may have been called via the resource delete
|
||||
* function so a client may have input to be processed and so
|
||||
* set delay to 0 to prevent blocking in WaitForSomething().
|
||||
*/
|
||||
AdjustWaitForDelay (wt, 0);
|
||||
}
|
||||
pReq = pPending;
|
||||
if (!pReq)
|
||||
return;
|
||||
newdelay = pReq->revive.milliseconds - now.milliseconds;
|
||||
AdjustWaitForDelay (wt, newdelay);
|
||||
}
|
||||
|
||||
static void
|
||||
SertafiedWakeupHandler (data, i, LastSelectMask)
|
||||
pointer data;
|
||||
int i;
|
||||
pointer LastSelectMask;
|
||||
{
|
||||
SertafiedPtr pReq, pNext;
|
||||
TimeStamp now;
|
||||
|
||||
now.milliseconds = GetTimeInMillis ();
|
||||
now.months = currentTime.months;
|
||||
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
||||
now.months++;
|
||||
for (pReq = pPending; pReq; pReq = pNext)
|
||||
{
|
||||
pNext = pReq->next;
|
||||
if (CompareTimeStamps (pReq->revive, now) == LATER)
|
||||
break;
|
||||
FreeResource (pReq->id, RT_NONE);
|
||||
}
|
||||
if (!pPending)
|
||||
{
|
||||
RemoveBlockAndWakeupHandlers (SertafiedBlockHandler,
|
||||
SertafiedWakeupHandler,
|
||||
(pointer) 0);
|
||||
BlockHandlerRegistered = FALSE;
|
||||
}
|
||||
}
|
2322
Xext/sync.c
Normal file
2322
Xext/sync.c
Normal file
File diff suppressed because it is too large
Load Diff
218
Xext/xcmisc.c
Normal file
218
Xext/xcmisc.c
Normal file
|
@ -0,0 +1,218 @@
|
|||
/* $Xorg: xcmisc.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1993, 1998 The Open Group
|
||||
|
||||
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 OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
*/
|
||||
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "xcmiscstr.h"
|
||||
|
||||
static unsigned char XCMiscCode;
|
||||
static int ProcXCMiscDispatch(), SProcXCMiscDispatch();
|
||||
static void XCMiscResetProc();
|
||||
extern void Swap32Write(); /* XXX should be in header file */
|
||||
|
||||
void
|
||||
XCMiscExtensionInit()
|
||||
{
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
|
||||
if (extEntry = AddExtension(XCMiscExtensionName, 0, 0,
|
||||
ProcXCMiscDispatch, SProcXCMiscDispatch,
|
||||
XCMiscResetProc, StandardMinorOpcode))
|
||||
XCMiscCode = (unsigned char)extEntry->base;
|
||||
DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
XCMiscResetProc (extEntry)
|
||||
ExtensionEntry *extEntry;
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXCMiscGetVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xXCMiscGetVersionReq);
|
||||
xXCMiscGetVersionReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = XCMiscMajorVersion;
|
||||
rep.minorVersion = XCMiscMinorVersion;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.majorVersion, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXCMiscGetXIDRange(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xXCMiscGetXIDRangeReq);
|
||||
xXCMiscGetXIDRangeReply rep;
|
||||
register int n;
|
||||
XID min_id, max_id;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
|
||||
GetXIDRange(client->index, FALSE, &min_id, &max_id);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.start_id = min_id;
|
||||
rep.count = max_id - min_id + 1;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.start_id, n);
|
||||
swapl(&rep.count, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXCMiscGetXIDList(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xXCMiscGetXIDListReq);
|
||||
xXCMiscGetXIDListReply rep;
|
||||
register int n;
|
||||
XID *pids;
|
||||
unsigned int count;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
|
||||
|
||||
pids = (XID *)ALLOCATE_LOCAL(stuff->count * sizeof(XID));
|
||||
if (!pids)
|
||||
{
|
||||
return BadAlloc;
|
||||
}
|
||||
count = GetXIDList(client, stuff->count, pids);
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = count;
|
||||
rep.count = count;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.count, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
|
||||
if (count)
|
||||
{
|
||||
client->pSwapReplyFunc = Swap32Write;
|
||||
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
||||
}
|
||||
DEALLOCATE_LOCAL(pids);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXCMiscDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XCMiscGetVersion:
|
||||
return ProcXCMiscGetVersion(client);
|
||||
case X_XCMiscGetXIDRange:
|
||||
return ProcXCMiscGetXIDRange(client);
|
||||
case X_XCMiscGetXIDList:
|
||||
return ProcXCMiscGetXIDList(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXCMiscGetVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xXCMiscGetVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
|
||||
swaps(&stuff->majorVersion, n);
|
||||
swaps(&stuff->minorVersion, n);
|
||||
return ProcXCMiscGetVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXCMiscGetXIDRange(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcXCMiscGetXIDRange(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXCMiscGetXIDList(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xXCMiscGetXIDListReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->count, n);
|
||||
return ProcXCMiscGetXIDList(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXCMiscDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XCMiscGetVersion:
|
||||
return SProcXCMiscGetVersion(client);
|
||||
case X_XCMiscGetXIDRange:
|
||||
return SProcXCMiscGetXIDRange(client);
|
||||
case X_XCMiscGetXIDList:
|
||||
return SProcXCMiscGetXIDList(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
2873
Xext/xprint.c
Normal file
2873
Xext/xprint.c
Normal file
File diff suppressed because it is too large
Load Diff
533
Xext/xtest.c
Normal file
533
Xext/xtest.c
Normal file
|
@ -0,0 +1,533 @@
|
|||
/* $Xorg: xtest.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1992, 1998 The Open Group
|
||||
|
||||
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 OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
*/
|
||||
|
||||
#include "X.h"
|
||||
#define NEED_EVENTS
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "windowstr.h"
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#define _XTEST_SERVER_
|
||||
#include "XTest.h"
|
||||
#include "xteststr.h"
|
||||
#ifdef XINPUT
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
#define EXTENSION_EVENT_BASE 64
|
||||
#endif /* XINPUT */
|
||||
|
||||
static unsigned char XTestReqCode;
|
||||
static int ProcXTestDispatch(), SProcXTestDispatch();
|
||||
static void XTestResetProc();
|
||||
static int XTestSwapFakeInput();
|
||||
CursorPtr GetSpriteCursor();
|
||||
WindowPtr GetCurrentRootWindow();
|
||||
#ifdef XINPUT
|
||||
extern int DeviceValuator;
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
#endif /* XINPUT */
|
||||
|
||||
void
|
||||
XTestExtensionInit()
|
||||
{
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
|
||||
if (extEntry = AddExtension(XTestExtensionName, 0, 0,
|
||||
ProcXTestDispatch, SProcXTestDispatch,
|
||||
XTestResetProc, StandardMinorOpcode))
|
||||
XTestReqCode = (unsigned char)extEntry->base;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
XTestResetProc (extEntry)
|
||||
ExtensionEntry *extEntry;
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestGetVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xXTestGetVersionReq);
|
||||
xXTestGetVersionReply rep;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = XTestMajorVersion;
|
||||
rep.minorVersion = XTestMinorVersion;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swaps(&rep.minorVersion, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestCompareCursor(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xXTestCompareCursorReq);
|
||||
xXTestCompareCursorReply rep;
|
||||
WindowPtr pWin;
|
||||
CursorPtr pCursor;
|
||||
register int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
|
||||
pWin = (WindowPtr)LookupWindow(stuff->window, client);
|
||||
if (!pWin)
|
||||
return(BadWindow);
|
||||
if (stuff->cursor == None)
|
||||
pCursor = NullCursor;
|
||||
else if (stuff->cursor == XTestCurrentCursor)
|
||||
pCursor = GetSpriteCursor();
|
||||
else {
|
||||
pCursor = (CursorPtr)LookupIDByType(stuff->cursor, RT_CURSOR);
|
||||
if (!pCursor)
|
||||
{
|
||||
client->errorValue = stuff->cursor;
|
||||
return (BadCursor);
|
||||
}
|
||||
}
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.same = (wCursor(pWin) == pCursor);
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestFakeInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xXTestFakeInputReq);
|
||||
int nev;
|
||||
int n;
|
||||
xEvent *ev;
|
||||
DeviceIntPtr dev;
|
||||
WindowPtr root;
|
||||
int type;
|
||||
#ifdef XINPUT
|
||||
Bool extension = FALSE;
|
||||
deviceValuator *dv;
|
||||
int base;
|
||||
int *values;
|
||||
#endif /* XINPUT */
|
||||
|
||||
nev = (stuff->length << 2) - sizeof(xReq);
|
||||
if ((nev % sizeof(xEvent)) || !nev)
|
||||
return BadLength;
|
||||
nev /= sizeof(xEvent);
|
||||
UpdateCurrentTime();
|
||||
ev = (xEvent *)&((xReq *)stuff)[1];
|
||||
type = ev->u.u.type & 0177;
|
||||
#ifdef XINPUT
|
||||
if (type >= EXTENSION_EVENT_BASE)
|
||||
{
|
||||
type -= DeviceValuator;
|
||||
switch (type) {
|
||||
case XI_DeviceKeyPress:
|
||||
case XI_DeviceKeyRelease:
|
||||
case XI_DeviceButtonPress:
|
||||
case XI_DeviceButtonRelease:
|
||||
case XI_DeviceMotionNotify:
|
||||
case XI_ProximityIn:
|
||||
case XI_ProximityOut:
|
||||
break;
|
||||
default:
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
if (nev == 1 && type == XI_DeviceMotionNotify)
|
||||
return BadLength;
|
||||
if (type == XI_DeviceMotionNotify)
|
||||
base = ((deviceValuator *)(ev+1))->first_valuator;
|
||||
else
|
||||
base = 0;
|
||||
for (n = 1; n < nev; n++)
|
||||
{
|
||||
dv = (deviceValuator *)(ev + n);
|
||||
if (dv->type != DeviceValuator)
|
||||
{
|
||||
client->errorValue = dv->type;
|
||||
return BadValue;
|
||||
}
|
||||
if (dv->first_valuator != base)
|
||||
{
|
||||
client->errorValue = dv->first_valuator;
|
||||
return BadValue;
|
||||
}
|
||||
if (!dv->num_valuators || dv->num_valuators > 6)
|
||||
{
|
||||
client->errorValue = dv->num_valuators;
|
||||
return BadValue;
|
||||
}
|
||||
base += dv->num_valuators;
|
||||
}
|
||||
type = type - XI_DeviceKeyPress + KeyPress;
|
||||
extension = TRUE;
|
||||
}
|
||||
else
|
||||
#endif /* XINPUT */
|
||||
{
|
||||
if (nev != 1)
|
||||
return BadLength;
|
||||
switch (type)
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
case MotionNotify:
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
break;
|
||||
default:
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
if (ev->u.keyButtonPointer.time)
|
||||
{
|
||||
TimeStamp activateTime;
|
||||
CARD32 ms;
|
||||
|
||||
activateTime = currentTime;
|
||||
ms = activateTime.milliseconds + ev->u.keyButtonPointer.time;
|
||||
if (ms < activateTime.milliseconds)
|
||||
activateTime.months++;
|
||||
activateTime.milliseconds = ms;
|
||||
ev->u.keyButtonPointer.time = 0;
|
||||
|
||||
/* see mbuf.c:QueueDisplayRequest for code similar to this */
|
||||
|
||||
if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
|
||||
{
|
||||
return BadAlloc;
|
||||
}
|
||||
/* swap the request back so we can simply re-execute it */
|
||||
if (client->swapped)
|
||||
{
|
||||
(void) XTestSwapFakeInput(client, (xReq *)stuff);
|
||||
swaps(&stuff->length, n);
|
||||
}
|
||||
ResetCurrentRequest (client);
|
||||
client->sequence--;
|
||||
return Success;
|
||||
}
|
||||
#ifdef XINPUT
|
||||
if (extension)
|
||||
{
|
||||
dev = LookupDeviceIntRec(stuff->deviceid & 0177);
|
||||
if (!dev)
|
||||
{
|
||||
client->errorValue = stuff->deviceid & 0177;
|
||||
return BadValue;
|
||||
}
|
||||
if (nev > 1)
|
||||
{
|
||||
dv = (deviceValuator *)(ev + 1);
|
||||
if (!dev->valuator || dv->first_valuator >= dev->valuator->numAxes)
|
||||
{
|
||||
client->errorValue = dv->first_valuator;
|
||||
return BadValue;
|
||||
}
|
||||
if (dv->first_valuator + dv->num_valuators >
|
||||
dev->valuator->numAxes)
|
||||
{
|
||||
client->errorValue = dv->num_valuators;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* XINPUT */
|
||||
switch (type)
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
#ifdef XINPUT
|
||||
if (!extension)
|
||||
#endif /* XINPUT */
|
||||
dev = (DeviceIntPtr)LookupKeyboardDevice();
|
||||
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
|
||||
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
case MotionNotify:
|
||||
#ifdef XINPUT
|
||||
if (extension)
|
||||
{
|
||||
if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute)
|
||||
{
|
||||
values = dev->valuator->axisVal + dv->first_valuator;
|
||||
for (n = 1; n < nev; n++)
|
||||
{
|
||||
dv = (deviceValuator *)(ev + n);
|
||||
switch (dv->num_valuators)
|
||||
{
|
||||
case 6:
|
||||
dv->valuator5 += values[5];
|
||||
case 5:
|
||||
dv->valuator4 += values[4];
|
||||
case 4:
|
||||
dv->valuator3 += values[3];
|
||||
case 3:
|
||||
dv->valuator2 += values[2];
|
||||
case 2:
|
||||
dv->valuator1 += values[1];
|
||||
case 1:
|
||||
dv->valuator0 += values[0];
|
||||
}
|
||||
values += 6;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* XINPUT */
|
||||
dev = (DeviceIntPtr)LookupPointerDevice();
|
||||
if (ev->u.keyButtonPointer.root == None)
|
||||
root = GetCurrentRootWindow();
|
||||
else
|
||||
{
|
||||
root = LookupWindow(ev->u.keyButtonPointer.root, client);
|
||||
if (!root)
|
||||
return BadWindow;
|
||||
if (root->parent)
|
||||
{
|
||||
client->errorValue = ev->u.keyButtonPointer.root;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
if (ev->u.u.detail == xTrue)
|
||||
{
|
||||
int x, y;
|
||||
GetSpritePosition(&x, &y);
|
||||
ev->u.keyButtonPointer.rootX += x;
|
||||
ev->u.keyButtonPointer.rootY += y;
|
||||
}
|
||||
else if (ev->u.u.detail != xFalse)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
if (ev->u.keyButtonPointer.rootX < 0)
|
||||
ev->u.keyButtonPointer.rootX = 0;
|
||||
else if (ev->u.keyButtonPointer.rootX >= root->drawable.width)
|
||||
ev->u.keyButtonPointer.rootX = root->drawable.width - 1;
|
||||
if (ev->u.keyButtonPointer.rootY < 0)
|
||||
ev->u.keyButtonPointer.rootY = 0;
|
||||
else if (ev->u.keyButtonPointer.rootY >= root->drawable.height)
|
||||
ev->u.keyButtonPointer.rootY = root->drawable.height - 1;
|
||||
if (root != GetCurrentRootWindow())
|
||||
{
|
||||
NewCurrentScreen(root->drawable.pScreen,
|
||||
ev->u.keyButtonPointer.rootX,
|
||||
ev->u.keyButtonPointer.rootY);
|
||||
return client->noClientException;
|
||||
}
|
||||
(*root->drawable.pScreen->SetCursorPosition)
|
||||
(root->drawable.pScreen,
|
||||
ev->u.keyButtonPointer.rootX,
|
||||
ev->u.keyButtonPointer.rootY, FALSE);
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
#ifdef XINPUT
|
||||
if (!extension)
|
||||
#endif /* XINPUT */
|
||||
dev = (DeviceIntPtr)LookupPointerDevice();
|
||||
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
|
||||
{
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (screenIsSaved == SCREEN_SAVER_ON)
|
||||
SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
|
||||
ev->u.keyButtonPointer.time = currentTime.milliseconds;
|
||||
(*dev->public.processInputProc)(ev, dev, nev);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestGrabControl(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xXTestGrabControlReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
|
||||
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
|
||||
{
|
||||
client->errorValue = stuff->impervious;
|
||||
return(BadValue);
|
||||
}
|
||||
if (stuff->impervious)
|
||||
MakeClientGrabImpervious(client);
|
||||
else
|
||||
MakeClientGrabPervious(client);
|
||||
return(client->noClientException);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XTestGetVersion:
|
||||
return ProcXTestGetVersion(client);
|
||||
case X_XTestCompareCursor:
|
||||
return ProcXTestCompareCursor(client);
|
||||
case X_XTestFakeInput:
|
||||
return ProcXTestFakeInput(client);
|
||||
case X_XTestGrabControl:
|
||||
return ProcXTestGrabControl(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestGetVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xXTestGetVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
|
||||
swaps(&stuff->minorVersion, n);
|
||||
return ProcXTestGetVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestCompareCursor(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xXTestCompareCursorReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->cursor, n);
|
||||
return ProcXTestCompareCursor(client);
|
||||
}
|
||||
|
||||
static int
|
||||
XTestSwapFakeInput(client, req)
|
||||
register ClientPtr client;
|
||||
xReq *req;
|
||||
{
|
||||
register int nev;
|
||||
register xEvent *ev;
|
||||
xEvent sev;
|
||||
void (*proc)(), NotImplemented();
|
||||
|
||||
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
|
||||
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
|
||||
{
|
||||
/* Swap event */
|
||||
proc = EventSwapVector[ev->u.u.type & 0177];
|
||||
/* no swapping proc; invalid event type? */
|
||||
if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
(*proc)(ev, &sev);
|
||||
*ev = sev;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestFakeInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
n = XTestSwapFakeInput(client, stuff);
|
||||
if (n != Success)
|
||||
return n;
|
||||
return ProcXTestFakeInput(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestGrabControl(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
REQUEST(xXTestGrabControlReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
|
||||
return ProcXTestGrabControl(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_XTestGetVersion:
|
||||
return SProcXTestGetVersion(client);
|
||||
case X_XTestCompareCursor:
|
||||
return SProcXTestCompareCursor(client);
|
||||
case X_XTestFakeInput:
|
||||
return SProcXTestFakeInput(client);
|
||||
case X_XTestGrabControl:
|
||||
return SProcXTestGrabControl(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
1613
Xext/xtest1dd.c
Normal file
1613
Xext/xtest1dd.c
Normal file
File diff suppressed because it is too large
Load Diff
966
Xext/xtest1di.c
Normal file
966
Xext/xtest1di.c
Normal file
|
@ -0,0 +1,966 @@
|
|||
/* $Xorg: xtest1di.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
/*
|
||||
* File: xtest1di.c
|
||||
*
|
||||
* This file contains the device independent parts of the input
|
||||
* synthesis extension.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
Copyright 1986, 1987, 1988, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
|
||||
Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
|
||||
|
||||
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 Hewlett-Packard not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
Hewlett-Packard makes no representations about the
|
||||
suitability of this software for any purpose. It is provided
|
||||
"as is" without express or implied warranty.
|
||||
|
||||
This software is not subject to any license of the American
|
||||
Telephone and Telegraph Company or of the Regents of the
|
||||
University of California.
|
||||
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* include files
|
||||
****************************************************************************/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
|
||||
#include <stdio.h>
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "gcstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "dixstruct.h"
|
||||
#include "opaque.h"
|
||||
#define XTestSERVER_SIDE
|
||||
#include "xtestext1.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* defines
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* externals
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* holds the addresses of the routines that handle byte-swapping of replys
|
||||
*/
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
/*
|
||||
* id of client using XTestGetInput
|
||||
*
|
||||
* defined in xtest1dd.c
|
||||
*/
|
||||
extern ClientPtr current_xtest_client;
|
||||
/*
|
||||
* id of client using XTestFakeInput
|
||||
*
|
||||
* defined in xtest1dd.c
|
||||
*/
|
||||
extern ClientPtr playback_client;
|
||||
|
||||
/*****************************************************************************
|
||||
* variables
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* Holds the request type code for this extension. The request type code
|
||||
* for this extension may vary depending on how many extensions are installed
|
||||
* already, so the initial value given below will be added to the base request
|
||||
* code that is aquired when this extension is installed.
|
||||
*/
|
||||
static int XTestReqCode = 0;
|
||||
/*
|
||||
* Holds the two event type codes for this extension. The event type codes
|
||||
* for this extension may vary depending on how many extensions are installed
|
||||
* already, so the initial values given below will be added to the base event
|
||||
* code that is aquired when this extension is installed.
|
||||
*/
|
||||
int XTestInputActionType = 0;
|
||||
int XTestFakeAckType = 1;
|
||||
/*
|
||||
* true => monitor stealing input
|
||||
*/
|
||||
int on_steal_input = FALSE;
|
||||
/*
|
||||
* true => monitor alone getting input
|
||||
*/
|
||||
int exclusive_steal = FALSE;
|
||||
/*
|
||||
* holds the resource type assigned to this extension
|
||||
*/
|
||||
static RESTYPE XTestType;
|
||||
/*
|
||||
* holds the resource ID for the client currently using XTestGetInput
|
||||
*/
|
||||
static XID current_client_id;
|
||||
|
||||
/*****************************************************************************
|
||||
* function declarations
|
||||
****************************************************************************/
|
||||
|
||||
static int ProcXTestDispatch();
|
||||
static int SProcXTestDispatch();
|
||||
static void XTestResetProc();
|
||||
static int ProcTestFakeInput();
|
||||
static int SProcTestFakeInput();
|
||||
static int ProcTestGetInput();
|
||||
static int SProcTestGetInput();
|
||||
static int ProcTestStopInput();
|
||||
static int SProcTestStopInput();
|
||||
static int ProcTestReset();
|
||||
static int SProcTestReset();
|
||||
static int ProcTestQueryInputSize();
|
||||
static int SProcTestQueryInputSize();
|
||||
static void SReplyXTestDispatch();
|
||||
static void SEventXTestDispatch();
|
||||
void NotImplemented();
|
||||
|
||||
void abort_play_back();
|
||||
void return_input_array_size();
|
||||
void steal_input();
|
||||
void stop_stealing_input();
|
||||
void flush_input_actions();
|
||||
void parse_fake_input();
|
||||
|
||||
static int XTestCurrentClientGone();
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* XTestExtension1Init
|
||||
*
|
||||
* Called from InitExtensions in main() or from QueryExtension() if the
|
||||
* extension is dynamically loaded.
|
||||
*
|
||||
* XTestExtension1Init has no events or errors
|
||||
* (other than the core errors).
|
||||
*/
|
||||
void
|
||||
XTestExtension1Init()
|
||||
{
|
||||
/*
|
||||
* holds the pointer to the extension entry structure
|
||||
*/
|
||||
ExtensionEntry *extEntry;
|
||||
/*
|
||||
* This routine adds the extension to the server extension table.
|
||||
*/
|
||||
ExtensionEntry *AddExtension();
|
||||
|
||||
extEntry = AddExtension(XTestEXTENSION_NAME,
|
||||
XTestEVENT_COUNT,
|
||||
0,
|
||||
ProcXTestDispatch,
|
||||
SProcXTestDispatch,
|
||||
XTestResetProc,
|
||||
StandardMinorOpcode);
|
||||
if (extEntry)
|
||||
{
|
||||
/*
|
||||
* remember the request code assigned to this extension
|
||||
*/
|
||||
XTestReqCode = extEntry->base;
|
||||
/*
|
||||
* make an atom saying that this extension is present
|
||||
*/
|
||||
(void) MakeAtom(XTestEXTENSION_NAME,
|
||||
strlen(XTestEXTENSION_NAME),
|
||||
TRUE);
|
||||
/*
|
||||
* remember the event codes assigned to this extension
|
||||
*/
|
||||
XTestInputActionType += extEntry->eventBase;
|
||||
XTestFakeAckType += extEntry->eventBase;
|
||||
/*
|
||||
* install the routine to handle byte-swapping the replies
|
||||
* for this extension in the ReplySwapVector table
|
||||
*/
|
||||
ReplySwapVector[XTestReqCode] = SReplyXTestDispatch;
|
||||
/*
|
||||
* install the routine to handle byte-swapping the events
|
||||
* for this extension in the EventSwapVector table
|
||||
*/
|
||||
EventSwapVector[XTestInputActionType] = SEventXTestDispatch;
|
||||
EventSwapVector[XTestFakeAckType] = SEventXTestDispatch;
|
||||
/*
|
||||
* get the resource type for this extension
|
||||
*/
|
||||
XTestType = CreateNewResourceType(XTestCurrentClientGone);
|
||||
if (XTestType == 0)
|
||||
{
|
||||
FatalError("XTestExtension1Init: CreateNewResourceType failed\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError("XTestExtension1Init: AddExtensions failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ProcXTestDispatch
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ProcXTestDispatch(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
if (stuff->data == X_TestFakeInput)
|
||||
{
|
||||
return(ProcTestFakeInput(client));
|
||||
}
|
||||
else if (stuff->data == X_TestGetInput)
|
||||
{
|
||||
return(ProcTestGetInput(client));
|
||||
}
|
||||
else if (stuff->data == X_TestStopInput)
|
||||
{
|
||||
return(ProcTestStopInput(client));
|
||||
}
|
||||
else if (stuff->data == X_TestReset)
|
||||
{
|
||||
return(ProcTestReset(client));
|
||||
}
|
||||
else if (stuff->data == X_TestQueryInputSize)
|
||||
{
|
||||
return(ProcTestQueryInputSize(client));
|
||||
}
|
||||
else
|
||||
{
|
||||
SendErrorToClient(client,
|
||||
XTestReqCode,
|
||||
stuff->data,
|
||||
None,
|
||||
BadRequest);
|
||||
return(BadRequest);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SProcXTestDispatch
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
SProcXTestDispatch(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
if (stuff->data == X_TestFakeInput)
|
||||
{
|
||||
return(SProcTestFakeInput(client));
|
||||
}
|
||||
else if (stuff->data == X_TestGetInput)
|
||||
{
|
||||
return(SProcTestGetInput(client));
|
||||
}
|
||||
else if (stuff->data == X_TestStopInput)
|
||||
{
|
||||
return(SProcTestStopInput(client));
|
||||
}
|
||||
else if (stuff->data == X_TestReset)
|
||||
{
|
||||
return(SProcTestReset(client));
|
||||
}
|
||||
else if (stuff->data == X_TestQueryInputSize)
|
||||
{
|
||||
return(SProcTestQueryInputSize(client));
|
||||
}
|
||||
else
|
||||
{
|
||||
SendErrorToClient(client,
|
||||
XTestReqCode,
|
||||
stuff->data,
|
||||
None,
|
||||
BadRequest);
|
||||
return(BadRequest);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SProcTestFakeInput
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
SProcTestFakeInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
/*
|
||||
* used in the swaps and swapl macros for temporary storage space
|
||||
*/
|
||||
register char n;
|
||||
/*
|
||||
* index counter
|
||||
*/
|
||||
int i;
|
||||
/*
|
||||
* pointer to the next input action in the request
|
||||
*/
|
||||
CARD8 *input_action_ptr;
|
||||
/*
|
||||
* holds the type of the next input action in the request
|
||||
*/
|
||||
int input_action_type;
|
||||
|
||||
REQUEST(xTestFakeInputReq);
|
||||
/*
|
||||
* byte-swap the fields in the request
|
||||
*/
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->ack, n);
|
||||
/*
|
||||
* have to parse and then byte-swap the input action list here
|
||||
*/
|
||||
for (i = 0; i < XTestMAX_ACTION_LIST_SIZE;)
|
||||
{
|
||||
/*
|
||||
* point to the next input action in the request
|
||||
*/
|
||||
input_action_ptr = &(((xTestFakeInputReq *) stuff)->action_list[i]);
|
||||
/*
|
||||
* figure out what type of input action it is
|
||||
*/
|
||||
input_action_type = (*input_action_ptr) & XTestACTION_TYPE_MASK;
|
||||
/*
|
||||
* byte-swap the input action according to it's type
|
||||
*/
|
||||
switch (input_action_type)
|
||||
{
|
||||
case XTestKEY_ACTION:
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestKeyInfo);
|
||||
break;
|
||||
case XTestMOTION_ACTION:
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestMotionInfo);
|
||||
break;
|
||||
case XTestJUMP_ACTION:
|
||||
/*
|
||||
* byte-swap the jumpx field
|
||||
*/
|
||||
swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n);
|
||||
/*
|
||||
* byte-swap the jumpy field
|
||||
*/
|
||||
swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n);
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestJumpInfo);
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* if this is a delay input action, then byte-swap it,
|
||||
* otherwise we have reached the end of the input
|
||||
* actions in this request
|
||||
*/
|
||||
if (XTestUnpackDeviceID(*input_action_ptr) ==
|
||||
XTestDELAY_DEVICE_ID)
|
||||
{
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestDelayInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* if the input action header byte is 0 or
|
||||
* ill-formed, then there are no more input
|
||||
* actions in this request
|
||||
*/
|
||||
i = XTestMAX_ACTION_LIST_SIZE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(ProcTestFakeInput(client));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SProcTestGetInput
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
SProcTestGetInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
/*
|
||||
* used in the swaps and swapl macros for temporary storage space
|
||||
*/
|
||||
register char n;
|
||||
|
||||
REQUEST(xTestGetInputReq);
|
||||
/*
|
||||
* byte-swap the fields in the request
|
||||
*/
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->mode, n);
|
||||
return(ProcTestGetInput(client));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SProcTestStopInput
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
SProcTestStopInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
/*
|
||||
* used in the swaps and swapl macros for temporary storage space
|
||||
*/
|
||||
register char n;
|
||||
|
||||
REQUEST(xTestStopInputReq);
|
||||
/*
|
||||
* byte-swap the length field in the request
|
||||
*/
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcTestStopInput(client));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SProcTestReset
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
SProcTestReset(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
/*
|
||||
* used in the swaps and swapl macros for temporary storage space
|
||||
*/
|
||||
register char n;
|
||||
|
||||
REQUEST(xTestResetReq);
|
||||
/*
|
||||
* byte-swap the length field in the request
|
||||
*/
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcTestReset(client));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SProcTestQueryInputSize
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
SProcTestQueryInputSize(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
/*
|
||||
* used in the swaps and swapl macros for temporary storage space
|
||||
*/
|
||||
register char n;
|
||||
|
||||
REQUEST(xTestQueryInputSizeReq);
|
||||
/*
|
||||
* byte-swap the length field in the request
|
||||
*/
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcTestQueryInputSize(client));
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ProcTestFakeInput
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ProcTestFakeInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xTestFakeInputReq);
|
||||
REQUEST_SIZE_MATCH(xTestFakeInputReq);
|
||||
|
||||
if (playback_client == NULL)
|
||||
{
|
||||
playback_client = client;
|
||||
current_client_id = FakeClientID(client->index);
|
||||
AddResource(current_client_id,
|
||||
XTestType,
|
||||
0);
|
||||
MakeClientGrabImpervious(client);
|
||||
}
|
||||
if (playback_client == client)
|
||||
{
|
||||
/*
|
||||
* This extension does not need to clean up any
|
||||
* server state when a client using this function
|
||||
* "goes away". The server will just process any
|
||||
* input actions that have already been sent to it,
|
||||
* and will then reset its association with a client.
|
||||
*/
|
||||
parse_fake_input(client, (char *)stuff);
|
||||
return(Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* this is a request by another client to send fake
|
||||
* input while the server is still being used
|
||||
*/
|
||||
SendErrorToClient(client,
|
||||
XTestReqCode,
|
||||
X_TestFakeInput,
|
||||
None,
|
||||
BadAccess);
|
||||
return(BadAccess);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ProcTestGetInput
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ProcTestGetInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xTestGetInputReq);
|
||||
REQUEST_SIZE_MATCH(xTestGetInputReq);
|
||||
if (on_steal_input)
|
||||
{
|
||||
/*
|
||||
* this is a request by another client to get fake input
|
||||
* while the server is still sending input to the first client
|
||||
*/
|
||||
SendErrorToClient(client,
|
||||
XTestReqCode,
|
||||
X_TestGetInput,
|
||||
None,
|
||||
BadAccess);
|
||||
return(BadAccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Set up a resource associated with the client using this
|
||||
* function so that this extension gets called when the
|
||||
* client "goes away". This allows this extension to
|
||||
* clean up the server state.
|
||||
*/
|
||||
current_client_id = FakeClientID(client->index);
|
||||
AddResource(current_client_id,
|
||||
XTestType,
|
||||
0);
|
||||
/*
|
||||
* indicate that a client is stealing input
|
||||
*/
|
||||
on_steal_input = TRUE;
|
||||
if ((stuff->mode & XTestEXCLUSIVE) == 0)
|
||||
{
|
||||
exclusive_steal = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
exclusive_steal = TRUE;
|
||||
}
|
||||
steal_input(client, stuff->mode);
|
||||
return(Success);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ProcTestStopInput
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ProcTestStopInput(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xTestStopInputReq);
|
||||
REQUEST_SIZE_MATCH(xTestStopInputReq);
|
||||
if (on_steal_input && (current_xtest_client == client))
|
||||
{
|
||||
on_steal_input = FALSE;
|
||||
exclusive_steal = FALSE;
|
||||
stop_stealing_input();
|
||||
/*
|
||||
* remove the resource associated with this client
|
||||
*/
|
||||
FreeResource(current_client_id, RT_NONE);
|
||||
return(Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* this is a request to stop fake input when fake input has
|
||||
* never been started or from a client that hasn't started
|
||||
* fake input
|
||||
*/
|
||||
SendErrorToClient(client,
|
||||
XTestReqCode,
|
||||
X_TestStopInput,
|
||||
None,
|
||||
BadAccess);
|
||||
return(BadAccess);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ProcTestReset
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ProcTestReset(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xTestResetReq);
|
||||
REQUEST_SIZE_MATCH(xTestResetReq);
|
||||
on_steal_input = FALSE;
|
||||
exclusive_steal = FALSE;
|
||||
/*
|
||||
* defined in xtest1dd.c
|
||||
*/
|
||||
stop_stealing_input();
|
||||
/*
|
||||
* defined in xtest1dd.c
|
||||
*/
|
||||
abort_play_back();
|
||||
return(Success);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ProcTestQueryInputSize
|
||||
*
|
||||
*
|
||||
*/
|
||||
static int
|
||||
ProcTestQueryInputSize(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xTestQueryInputSizeReq);
|
||||
REQUEST_SIZE_MATCH(xTestQueryInputSizeReq);
|
||||
/*
|
||||
* defined in xtest1dd.c
|
||||
*/
|
||||
return_input_array_size(client);
|
||||
return(Success);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* XTestResetProc
|
||||
*
|
||||
* This function is called by the server when the server has no clients
|
||||
* connected to it. It must put eveything back the way it was before
|
||||
* this extension was installed.
|
||||
*/
|
||||
static void
|
||||
XTestResetProc()
|
||||
{
|
||||
/*
|
||||
* remove the routine to handle byte-swapping the replies
|
||||
* for this extension in the ReplySwapVector table
|
||||
*/
|
||||
ReplySwapVector[XTestReqCode] = NotImplemented;
|
||||
/*
|
||||
* remove the routine to handle byte-swapping the events
|
||||
* for this extension in the EventSwapVector table
|
||||
*/
|
||||
EventSwapVector[XTestInputActionType] = NotImplemented;
|
||||
EventSwapVector[XTestFakeAckType] = NotImplemented;
|
||||
/*
|
||||
* reset the variables initialized just once at load time
|
||||
*/
|
||||
XTestReqCode = 0;
|
||||
XTestInputActionType = 0;
|
||||
XTestFakeAckType = 1;
|
||||
on_steal_input = FALSE;
|
||||
exclusive_steal = FALSE;
|
||||
playback_client = 0; /* Don't really need this but it looks nice */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ProcTestQueryInputSize
|
||||
*
|
||||
* This routine is called when a client that has asked for input actions
|
||||
* to be sent to it "goes away". This routine must clean up the
|
||||
* server state.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
XTestCurrentClientGone(value, id)
|
||||
pointer value;
|
||||
XID id;
|
||||
{
|
||||
/*
|
||||
* defined in xtest1dd.c
|
||||
*/
|
||||
on_steal_input = FALSE;
|
||||
exclusive_steal = FALSE;
|
||||
/*
|
||||
* defined in xtestdd.c
|
||||
*/
|
||||
playback_client = 0;
|
||||
abort_play_back();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SReplyXTestDispatch
|
||||
*
|
||||
* Swap any replies defined in this extension.
|
||||
*/
|
||||
static void
|
||||
SReplyXTestDispatch(client_ptr, size, reply_ptr)
|
||||
ClientPtr client_ptr;
|
||||
int size;
|
||||
char *reply_ptr;
|
||||
{
|
||||
/*
|
||||
* used in the swaps and swapl macros for temporary storage space
|
||||
*/
|
||||
register char n;
|
||||
/*
|
||||
* pointer to xTestQueryInputSizeReply
|
||||
*/
|
||||
xTestQueryInputSizeReply *rep_ptr;
|
||||
|
||||
/*
|
||||
* there is only one reply in this extension, so byte-swap it
|
||||
*/
|
||||
rep_ptr = (xTestQueryInputSizeReply *) reply_ptr;
|
||||
swaps(&(rep_ptr->sequenceNumber), n);
|
||||
swapl(&(rep_ptr->length), n);
|
||||
swapl(&(rep_ptr->size_return), n);
|
||||
/*
|
||||
* now write the swapped reply to the client
|
||||
*/
|
||||
WriteToClient(client_ptr, size, reply_ptr);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SEventXTestDispatch
|
||||
*
|
||||
* Swap any events defined in this extension.
|
||||
*/
|
||||
static void
|
||||
SEventXTestDispatch(from, to)
|
||||
xEvent *from;
|
||||
xEvent *to;
|
||||
{
|
||||
/*
|
||||
* used in the swaps and swapl macros for temporary storage space
|
||||
*/
|
||||
register char n;
|
||||
/*
|
||||
* index counter
|
||||
*/
|
||||
int i;
|
||||
/*
|
||||
* pointer to the next input action in the event
|
||||
*/
|
||||
CARD8 *input_action_ptr;
|
||||
/*
|
||||
* holds the type of the next input action in the event
|
||||
*/
|
||||
int input_action_type;
|
||||
|
||||
|
||||
/*
|
||||
* copy the type information from the "from" event to the "to" event
|
||||
*/
|
||||
((xTestInputActionEvent *) to)->type =
|
||||
((xTestInputActionEvent *) from)->type;
|
||||
/*
|
||||
* copy the sequence number information from the "from" event to the
|
||||
* "to" event
|
||||
*/
|
||||
((xTestInputActionEvent *) to)->sequenceNumber =
|
||||
((xTestInputActionEvent *) from)->sequenceNumber;
|
||||
/*
|
||||
* byte-swap the sequence number in the "to" event
|
||||
*/
|
||||
swaps(&(((xTestInputActionEvent *) to)->sequenceNumber), n);
|
||||
/*
|
||||
* If the event is an xTestInputActionEvent, then it needs more
|
||||
* processing. Otherwise, it is an xTestFakeAckEvent, which
|
||||
* has no other information in it.
|
||||
*/
|
||||
if ((((xTestInputActionEvent *) to)->type & 0x7f) ==
|
||||
XTestInputActionType)
|
||||
{
|
||||
/*
|
||||
* copy the input actions from the "from" event
|
||||
* to the "to" event
|
||||
*/
|
||||
for (i = 0; i < XTestACTIONS_SIZE; i++)
|
||||
{
|
||||
((xTestInputActionEvent *) to)->actions[i] =
|
||||
((xTestInputActionEvent *) from)->actions[i];
|
||||
}
|
||||
/*
|
||||
* byte-swap the input actions in the "to" event
|
||||
*/
|
||||
for (i = 0; i < XTestACTIONS_SIZE; i++)
|
||||
{
|
||||
/*
|
||||
* point to the next input action in the event
|
||||
*/
|
||||
input_action_ptr = &(((xTestInputActionEvent *) to)->actions[i]);
|
||||
/*
|
||||
* figure out what type of input action it is
|
||||
*/
|
||||
input_action_type = (*input_action_ptr) &
|
||||
XTestACTION_TYPE_MASK;
|
||||
/*
|
||||
* byte-swap the input action according to it's type
|
||||
*/
|
||||
switch (input_action_type)
|
||||
{
|
||||
case XTestKEY_ACTION:
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestKeyInfo);
|
||||
break;
|
||||
case XTestMOTION_ACTION:
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestMotionInfo);
|
||||
break;
|
||||
case XTestJUMP_ACTION:
|
||||
/*
|
||||
* byte-swap the jumpx field
|
||||
*/
|
||||
swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n);
|
||||
/*
|
||||
* byte-swap the jumpy field
|
||||
*/
|
||||
swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n);
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestJumpInfo);
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* if this is a delay input action, then
|
||||
* byte-swap it, otherwise we have reached the
|
||||
* end of the input actions in this event
|
||||
*/
|
||||
if (XTestUnpackDeviceID(*input_action_ptr) ==
|
||||
XTestDELAY_DEVICE_ID)
|
||||
{
|
||||
/*
|
||||
* byte-swap the delay_time field
|
||||
*/
|
||||
swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n);
|
||||
/*
|
||||
* advance to the next input action
|
||||
*/
|
||||
i += sizeof(XTestDelayInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* if the input action header byte is 0
|
||||
* or ill-formed, then there are no
|
||||
* more input actions in this event
|
||||
*/
|
||||
i = XTestACTIONS_SIZE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
139
Xi/allowev.c
Normal file
139
Xi/allowev.c
Normal file
|
@ -0,0 +1,139 @@
|
|||
/* $Xorg: allowev.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Function to allow frozen events to be routed from extension input devices.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows frozen events to be routed.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXAllowDeviceEvents(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xAllowDeviceEventsReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
|
||||
swapl(&stuff->time, n);
|
||||
return(ProcXAllowDeviceEvents(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows frozen events to be routed.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXAllowDeviceEvents(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
TimeStamp time;
|
||||
DeviceIntPtr thisdev;
|
||||
void AllowSome ();
|
||||
|
||||
REQUEST(xAllowDeviceEventsReq);
|
||||
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
|
||||
|
||||
thisdev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (thisdev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
|
||||
switch (stuff->mode)
|
||||
{
|
||||
case ReplayThisDevice:
|
||||
AllowSome(client, time, thisdev, NOT_GRABBED);
|
||||
break;
|
||||
case SyncThisDevice:
|
||||
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
|
||||
break;
|
||||
case AsyncThisDevice:
|
||||
AllowSome(client, time, thisdev, THAWED);
|
||||
break;
|
||||
case AsyncOtherDevices:
|
||||
AllowSome(client, time, thisdev, THAW_OTHERS);
|
||||
break;
|
||||
case SyncAll:
|
||||
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
|
||||
break;
|
||||
case AsyncAll:
|
||||
AllowSome(client, time, thisdev, THAWED_BOTH);
|
||||
break;
|
||||
default:
|
||||
SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0,
|
||||
BadValue);
|
||||
client->errorValue = stuff->mode;
|
||||
return Success;
|
||||
}
|
||||
return Success;
|
||||
}
|
209
Xi/chgdctl.c
Normal file
209
Xi/chgdctl.c
Normal file
|
@ -0,0 +1,209 @@
|
|||
/* $Xorg: chgdctl.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Change Device control attributes for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h" /* control constants */
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice, DeviceBusy;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the control attributes for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeDeviceControl(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xChangeDeviceControlReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
|
||||
swaps(&stuff->control, n);
|
||||
return(ProcXChangeDeviceControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Change the control attributes.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXChangeDeviceControl(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int i, len, status;
|
||||
DeviceIntPtr dev;
|
||||
xDeviceResolutionCtl *r;
|
||||
xChangeDeviceControlReply rep;
|
||||
AxisInfoPtr a;
|
||||
CARD32 *resolution;
|
||||
|
||||
REQUEST(xChangeDeviceControlReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
|
||||
|
||||
len = stuff->length - (sizeof(xChangeDeviceControlReq) >>2);
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_ChangeDeviceControl;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
switch (stuff->control)
|
||||
{
|
||||
case DEVICE_RESOLUTION:
|
||||
r = (xDeviceResolutionCtl *) &stuff[1];
|
||||
if ((len < (sizeof(xDeviceResolutionCtl)>>2)) ||
|
||||
(len != (sizeof(xDeviceResolutionCtl)>>2) +
|
||||
r->num_valuators))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
if (!dev->valuator)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if ((dev->grab) && !SameClient(dev->grab, client))
|
||||
{
|
||||
rep.status = AlreadyGrabbed;
|
||||
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
|
||||
&rep);
|
||||
return Success;
|
||||
}
|
||||
resolution = (CARD32 *) (r + 1);
|
||||
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
status = ChangeDeviceControl(client, dev, r);
|
||||
if (status == Success)
|
||||
{
|
||||
a = &dev->valuator->axes[r->first_valuator];
|
||||
for (i=0; i<r->num_valuators; i++)
|
||||
if (*(resolution+i) < (a+i)->min_resolution ||
|
||||
*(resolution+i) > (a+i)->max_resolution)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode,
|
||||
X_ChangeDeviceControl, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
for (i=0; i<r->num_valuators; i++)
|
||||
(a++)->resolution = *resolution++;
|
||||
}
|
||||
else if (status == DeviceBusy)
|
||||
{
|
||||
rep.status = DeviceBusy;
|
||||
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
|
||||
&rep);
|
||||
return Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the xChangeDeviceControl function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXChangeDeviceControl (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xChangeDeviceControlReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
649
Xi/chgfctl.c
Normal file
649
Xi/chgfctl.c
Normal file
|
@ -0,0 +1,649 @@
|
|||
/* $Xorg: chgfctl.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Change feedback control attributes for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h" /* control constants */
|
||||
|
||||
#define DO_ALL (-1)
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the control attributes for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeFeedbackControl(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xChangeFeedbackControlReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
||||
swapl(&stuff->mask, n);
|
||||
return(ProcXChangeFeedbackControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Change the control attributes.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXChangeFeedbackControl(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int len;
|
||||
DeviceIntPtr dev;
|
||||
KbdFeedbackPtr k;
|
||||
PtrFeedbackPtr p;
|
||||
IntegerFeedbackPtr i;
|
||||
StringFeedbackPtr s;
|
||||
BellFeedbackPtr b;
|
||||
LedFeedbackPtr l;
|
||||
|
||||
REQUEST(xChangeFeedbackControlReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
||||
|
||||
len = stuff->length - (sizeof(xChangeFeedbackControlReq) >>2);
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
switch (stuff->feedbackid)
|
||||
{
|
||||
case KbdFeedbackClass:
|
||||
if (len != (sizeof(xKbdFeedbackCtl)>>2))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (k=dev->kbdfeed; k; k=k->next)
|
||||
if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
|
||||
{
|
||||
ChangeKbdFeedback (client, dev, stuff->mask, k, &stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case PtrFeedbackClass:
|
||||
if (len != (sizeof(xPtrFeedbackCtl)>>2))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (p=dev->ptrfeed; p; p=p->next)
|
||||
if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
|
||||
{
|
||||
ChangePtrFeedback (client, dev, stuff->mask, p, &stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case StringFeedbackClass:
|
||||
{
|
||||
register char n;
|
||||
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&f->num_keysyms,n);
|
||||
}
|
||||
if (len != ((sizeof(xStringFeedbackCtl)>>2) + f->num_keysyms))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (s=dev->stringfeed; s; s=s->next)
|
||||
if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
|
||||
{
|
||||
ChangeStringFeedback (client, dev, stuff->mask,s,&stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IntegerFeedbackClass:
|
||||
if (len != (sizeof(xIntegerFeedbackCtl)>>2))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (i=dev->intfeed; i; i=i->next)
|
||||
if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
|
||||
{
|
||||
ChangeIntegerFeedback (client, dev,stuff->mask,i,&stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case LedFeedbackClass:
|
||||
if (len != (sizeof(xLedFeedbackCtl)>>2))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (l=dev->leds; l; l=l->next)
|
||||
if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
|
||||
{
|
||||
ChangeLedFeedback (client, dev, stuff->mask, l, &stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
case BellFeedbackClass:
|
||||
if (len != (sizeof(xBellFeedbackCtl)>>2))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl,
|
||||
0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
for (b=dev->bell; b; b=b->next)
|
||||
if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
|
||||
{
|
||||
ChangeBellFeedback (client, dev, stuff->mask, b, &stuff[1]);
|
||||
return Success;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This procedure changes KbdFeedbackClass data.
|
||||
*
|
||||
*/
|
||||
|
||||
ChangeKbdFeedback (client, dev, mask, k, f)
|
||||
ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
unsigned long mask;
|
||||
KbdFeedbackPtr k;
|
||||
xKbdFeedbackCtl *f;
|
||||
{
|
||||
register char n;
|
||||
KeybdCtrl kctrl;
|
||||
int t;
|
||||
int key = DO_ALL;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&f->length,n);
|
||||
swaps(&f->pitch,n);
|
||||
swaps(&f->duration,n);
|
||||
swapl(&f->led_mask,n);
|
||||
swapl(&f->led_values,n);
|
||||
}
|
||||
|
||||
kctrl = k->ctrl;
|
||||
if (mask & DvKeyClickPercent)
|
||||
{
|
||||
t = f->click;
|
||||
if (t == -1)
|
||||
t = defaultKeyboardControl.click;
|
||||
else if (t < 0 || t > 100)
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
kctrl.click = t;
|
||||
}
|
||||
|
||||
if (mask & DvPercent)
|
||||
{
|
||||
t = f->percent;
|
||||
if (t == -1)
|
||||
t = defaultKeyboardControl.bell;
|
||||
else if (t < 0 || t > 100)
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
kctrl.bell = t;
|
||||
}
|
||||
|
||||
if (mask & DvPitch)
|
||||
{
|
||||
t = f->pitch;
|
||||
if (t == -1)
|
||||
t = defaultKeyboardControl.bell_pitch;
|
||||
else if (t < 0)
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
kctrl.bell_pitch = t;
|
||||
}
|
||||
|
||||
if (mask & DvDuration)
|
||||
{
|
||||
t = f->duration;
|
||||
if (t == -1)
|
||||
t = defaultKeyboardControl.bell_duration;
|
||||
else if (t < 0)
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
kctrl.bell_duration = t;
|
||||
}
|
||||
|
||||
if (mask & DvLed)
|
||||
{
|
||||
kctrl.leds &= ~(f->led_mask);
|
||||
kctrl.leds |= (f->led_mask & f->led_values);
|
||||
}
|
||||
|
||||
if (mask & DvKey)
|
||||
{
|
||||
key = (KeyCode) f->key;
|
||||
if (key < 8 || key > 255)
|
||||
{
|
||||
client->errorValue = key;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
if (!(mask & DvAutoRepeatMode))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & DvAutoRepeatMode)
|
||||
{
|
||||
int index = (key >> 3);
|
||||
int kmask = (1 << (key & 7));
|
||||
t = (CARD8) f->auto_repeat_mode;
|
||||
if (t == AutoRepeatModeOff)
|
||||
{
|
||||
if (key == DO_ALL)
|
||||
kctrl.autoRepeat = FALSE;
|
||||
else
|
||||
kctrl.autoRepeats[index] &= ~kmask;
|
||||
}
|
||||
else if (t == AutoRepeatModeOn)
|
||||
{
|
||||
if (key == DO_ALL)
|
||||
kctrl.autoRepeat = TRUE;
|
||||
else
|
||||
kctrl.autoRepeats[index] |= kmask;
|
||||
}
|
||||
else if (t == AutoRepeatModeDefault)
|
||||
{
|
||||
if (key == DO_ALL)
|
||||
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
|
||||
else
|
||||
kctrl.autoRepeats[index] &= ~kmask;
|
||||
kctrl.autoRepeats[index] =
|
||||
(kctrl.autoRepeats[index] & ~kmask) |
|
||||
(defaultKeyboardControl.autoRepeats[index] & kmask);
|
||||
}
|
||||
else
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
||||
k->ctrl = kctrl;
|
||||
(*k->CtrlProc)(dev, &k->ctrl);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This procedure changes PtrFeedbackClass data.
|
||||
*
|
||||
*/
|
||||
|
||||
ChangePtrFeedback (client, dev, mask, p, f)
|
||||
ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
unsigned long mask;
|
||||
PtrFeedbackPtr p;
|
||||
xPtrFeedbackCtl *f;
|
||||
{
|
||||
register char n;
|
||||
PtrCtrl pctrl; /* might get BadValue part way through */
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&f->length,n);
|
||||
swaps(&f->num,n);
|
||||
swaps(&f->denom,n);
|
||||
swaps(&f->thresh,n);
|
||||
}
|
||||
|
||||
pctrl = p->ctrl;
|
||||
if (mask & DvAccelNum)
|
||||
{
|
||||
int accelNum;
|
||||
|
||||
accelNum = f->num;
|
||||
if (accelNum == -1)
|
||||
pctrl.num = defaultPointerControl.num;
|
||||
else if (accelNum < 0)
|
||||
{
|
||||
client->errorValue = accelNum;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
else pctrl.num = accelNum;
|
||||
}
|
||||
|
||||
if (mask & DvAccelDenom)
|
||||
{
|
||||
int accelDenom;
|
||||
|
||||
accelDenom = f->denom;
|
||||
if (accelDenom == -1)
|
||||
pctrl.den = defaultPointerControl.den;
|
||||
else if (accelDenom <= 0)
|
||||
{
|
||||
client->errorValue = accelDenom;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
else pctrl.den = accelDenom;
|
||||
}
|
||||
|
||||
if (mask & DvThreshold)
|
||||
{
|
||||
int threshold;
|
||||
|
||||
threshold = f->thresh;
|
||||
if (threshold == -1)
|
||||
pctrl.threshold = defaultPointerControl.threshold;
|
||||
else if (threshold < 0)
|
||||
{
|
||||
client->errorValue = threshold;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
else pctrl.threshold = threshold;
|
||||
}
|
||||
|
||||
p->ctrl = pctrl;
|
||||
(*p->CtrlProc)(dev, &p->ctrl);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This procedure changes IntegerFeedbackClass data.
|
||||
*
|
||||
*/
|
||||
|
||||
ChangeIntegerFeedback (client, dev, mask, i, f)
|
||||
ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
unsigned long mask;
|
||||
IntegerFeedbackPtr i;
|
||||
xIntegerFeedbackCtl *f;
|
||||
{
|
||||
register char n;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&f->length,n);
|
||||
swapl(&f->int_to_display,n);
|
||||
}
|
||||
|
||||
i->ctrl.integer_displayed = f->int_to_display;
|
||||
(*i->CtrlProc)(dev, &i->ctrl);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This procedure changes StringFeedbackClass data.
|
||||
*
|
||||
*/
|
||||
|
||||
ChangeStringFeedback (client, dev, mask, s, f)
|
||||
ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
unsigned long mask;
|
||||
StringFeedbackPtr s;
|
||||
xStringFeedbackCtl *f;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
int i, j, len;
|
||||
KeySym *syms, *sup_syms;
|
||||
|
||||
syms = (KeySym *) (f+1);
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&f->length,n); /* swapped num_keysyms in calling proc */
|
||||
p = (long *) (syms);
|
||||
for (i=0; i<f->num_keysyms; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
if (f->num_keysyms > s->ctrl.max_symbols)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
sup_syms = s->ctrl.symbols_supported;
|
||||
for (i=0; i<f->num_keysyms; i++)
|
||||
{
|
||||
for (j=0; j<s->ctrl.num_symbols_supported; j++)
|
||||
if (*(syms+i) == *(sup_syms+j))
|
||||
break;
|
||||
if (j==s->ctrl.num_symbols_supported)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
||||
s->ctrl.num_symbols_displayed = f->num_keysyms;
|
||||
for (i=0; i<f->num_keysyms; i++)
|
||||
*(s->ctrl.symbols_displayed+i) = *(syms+i);
|
||||
(*s->CtrlProc)(dev, &s->ctrl);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This procedure changes BellFeedbackClass data.
|
||||
*
|
||||
*/
|
||||
|
||||
ChangeBellFeedback (client, dev, mask, b, f)
|
||||
ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
unsigned long mask;
|
||||
BellFeedbackPtr b;
|
||||
xBellFeedbackCtl *f;
|
||||
{
|
||||
register char n;
|
||||
int t;
|
||||
BellCtrl bctrl; /* might get BadValue part way through */
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&f->length,n);
|
||||
swaps(&f->pitch,n);
|
||||
swaps(&f->duration,n);
|
||||
}
|
||||
|
||||
bctrl = b->ctrl;
|
||||
if (mask & DvPercent)
|
||||
{
|
||||
t = f->percent;
|
||||
if (t == -1)
|
||||
t = defaultKeyboardControl.bell;
|
||||
else if (t < 0 || t > 100)
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
bctrl.percent = t;
|
||||
}
|
||||
|
||||
if (mask & DvPitch)
|
||||
{
|
||||
t = f->pitch;
|
||||
if (t == -1)
|
||||
t = defaultKeyboardControl.bell_pitch;
|
||||
else if (t < 0)
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
bctrl.pitch = t;
|
||||
}
|
||||
|
||||
if (mask & DvDuration)
|
||||
{
|
||||
t = f->duration;
|
||||
if (t == -1)
|
||||
t = defaultKeyboardControl.bell_duration;
|
||||
else if (t < 0)
|
||||
{
|
||||
client->errorValue = t;
|
||||
SendErrorToClient (client, IReqCode, X_ChangeFeedbackControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
bctrl.duration = t;
|
||||
}
|
||||
b->ctrl = bctrl;
|
||||
(*b->CtrlProc)(dev, &b->ctrl);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This procedure changes LedFeedbackClass data.
|
||||
*
|
||||
*/
|
||||
|
||||
ChangeLedFeedback (client, dev, mask, l, f)
|
||||
ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
unsigned long mask;
|
||||
LedFeedbackPtr l;
|
||||
xLedFeedbackCtl *f;
|
||||
{
|
||||
register char n;
|
||||
LedCtrl lctrl; /* might get BadValue part way through */
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&f->length,n);
|
||||
swapl(&f->led_values,n);
|
||||
swapl(&f->led_mask,n);
|
||||
}
|
||||
|
||||
f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
|
||||
f->led_values &= l->ctrl.led_mask; /* set only supported leds */
|
||||
if (mask & DvLed)
|
||||
{
|
||||
lctrl.led_mask = f->led_mask;
|
||||
lctrl.led_values = f->led_values;
|
||||
(*l->CtrlProc)(dev, &lctrl);
|
||||
l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */
|
||||
l->ctrl.led_values |= (f->led_mask & f->led_values);/* OR in set leds*/
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
208
Xi/chgkbd.c
Normal file
208
Xi/chgkbd.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
/* $Xorg: chgkbd.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to change the keyboard device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern int ChangeDeviceNotify;
|
||||
extern Mask ChangeDeviceNotifyMask;
|
||||
extern InputInfo inputInfo;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the keyboard device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeKeyboardDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xChangeKeyboardDeviceReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
|
||||
return(ProcXChangeKeyboardDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure is invoked to swap the request bytes if the server and
|
||||
* client have a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXChangeKeyboardDevice (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int i;
|
||||
DeviceIntPtr xkbd = inputInfo.keyboard;
|
||||
DeviceIntPtr dev;
|
||||
FocusClassPtr xf = xkbd->focus;
|
||||
FocusClassPtr df;
|
||||
KeyClassPtr k;
|
||||
xChangeKeyboardDeviceReply rep;
|
||||
changeDeviceNotify ev;
|
||||
extern Bool Must_have_memory;
|
||||
|
||||
REQUEST(xChangeKeyboardDeviceReq);
|
||||
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_ChangeKeyboardDevice;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
rep.status = -1;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
k = dev->key;
|
||||
if (k == NULL)
|
||||
{
|
||||
rep.status = -1;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (((dev->grab) && !SameClient(dev->grab, client)) ||
|
||||
((xkbd->grab) && !SameClient(xkbd->grab, client)))
|
||||
rep.status = AlreadyGrabbed;
|
||||
else if ((dev->sync.frozen &&
|
||||
dev->sync.other && !SameClient(dev->sync.other, client)) ||
|
||||
(xkbd->sync.frozen &&
|
||||
xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
|
||||
rep.status = GrabFrozen;
|
||||
else
|
||||
{
|
||||
if (ChangeKeyboardDevice (xkbd, dev) != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (!dev->focus)
|
||||
InitFocusClassDeviceStruct (dev);
|
||||
if (!dev->kbdfeed)
|
||||
InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr)NoopDDA,
|
||||
(KbdCtrlProcPtr)NoopDDA);
|
||||
df = dev->focus;
|
||||
df->win = xf->win;
|
||||
df->revert = xf->revert;
|
||||
df->time = xf->time;
|
||||
df->traceGood = xf->traceGood;
|
||||
if (df->traceSize != xf->traceSize)
|
||||
{
|
||||
Must_have_memory = TRUE; /* XXX */
|
||||
df->trace = (WindowPtr *) xrealloc(df->trace,
|
||||
xf->traceSize * sizeof(WindowPtr));
|
||||
Must_have_memory = FALSE; /* XXX */
|
||||
}
|
||||
df->traceSize = xf->traceSize;
|
||||
for (i=0; i<df->traceSize; i++)
|
||||
df->trace[i] = xf->trace[i];
|
||||
RegisterOtherDevice (xkbd);
|
||||
RegisterKeyboardDevice ((DevicePtr)dev);
|
||||
|
||||
ev.type = ChangeDeviceNotify;
|
||||
ev.deviceid = stuff->deviceid;
|
||||
ev.time = currentTime.milliseconds;
|
||||
ev.request = NewKeyboard;
|
||||
|
||||
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1);
|
||||
SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode,
|
||||
k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client);
|
||||
|
||||
rep.status = 0;
|
||||
}
|
||||
|
||||
WriteReplyToClient (client, sizeof (xChangeKeyboardDeviceReply),
|
||||
&rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XChangeKeyboardDevice
|
||||
* function, if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXChangeKeyboardDevice (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xChangeKeyboardDeviceReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
129
Xi/chgkmap.c
Normal file
129
Xi/chgkmap.c
Normal file
|
@ -0,0 +1,129 @@
|
|||
/* $Xorg: chgkmap.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Change key mapping for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern int DeviceMappingNotify;
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure swaps the request when the client and
|
||||
* server have different byte orderings.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeDeviceKeyMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
register int i, count;
|
||||
|
||||
REQUEST(xChangeDeviceKeyMappingReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
||||
p = (long *) &stuff[1];
|
||||
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
return(ProcXChangeDeviceKeyMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Change the device key mapping.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXChangeDeviceKeyMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
unsigned len;
|
||||
DeviceIntPtr dev;
|
||||
|
||||
REQUEST(xChangeDeviceKeyMappingReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
|
||||
|
||||
ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify,
|
||||
stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode,
|
||||
&stuff[1]);
|
||||
|
||||
if (ret != Success)
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
|
||||
ret);
|
||||
return Success;
|
||||
}
|
165
Xi/chgprop.c
Normal file
165
Xi/chgprop.c
Normal file
|
@ -0,0 +1,165 @@
|
|||
/* $Xorg: chgprop.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Function to modify the dont-propagate-list for an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h"
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int BadMode;
|
||||
extern int BadClass;
|
||||
extern int IReqCode;
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure returns the extension version.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeDeviceDontPropagateList(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
register int i;
|
||||
|
||||
REQUEST(xChangeDeviceDontPropagateListReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||
swapl(&stuff->window, n);
|
||||
swaps(&stuff->count, n);
|
||||
p = (long *) &stuff[1];
|
||||
for (i=0; i<stuff->count; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
return(ProcXChangeDeviceDontPropagateList(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the dont-propagate list for the specified window.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXChangeDeviceDontPropagateList (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int i;
|
||||
WindowPtr pWin;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
OtherInputMasks *others;
|
||||
|
||||
REQUEST(xChangeDeviceDontPropagateListReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||
|
||||
if (stuff->length !=(sizeof(xChangeDeviceDontPropagateListReq)>>2) +
|
||||
stuff->count)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
pWin = (WindowPtr) LookupWindow (stuff->window, client);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
|
||||
BadWindow);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (stuff->mode != AddToList && stuff->mode != DeleteFromList)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
|
||||
BadMode);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (CreateMaskFromList (client, (XEventClass *)&stuff[1],
|
||||
stuff->count, tmp, NULL, X_ChangeDeviceDontPropagateList) != Success)
|
||||
return Success;
|
||||
|
||||
others = wOtherInputMasks(pWin);
|
||||
if (!others && stuff->mode == DeleteFromList)
|
||||
return Success;
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
{
|
||||
if (tmp[i].mask == 0)
|
||||
continue;
|
||||
|
||||
if (stuff->mode == DeleteFromList)
|
||||
tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask);
|
||||
else if (others)
|
||||
tmp[i].mask |= others->dontPropagateMask[i];
|
||||
|
||||
if (DeviceEventSuppressForWindow (pWin,client,tmp[i].mask,i) != Success)
|
||||
{
|
||||
SendErrorToClient ( client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
|
||||
BadClass);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
252
Xi/chgptr.c
Normal file
252
Xi/chgptr.c
Normal file
|
@ -0,0 +1,252 @@
|
|||
/* $Xorg: chgptr.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to change the pointer device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "scrnintstr.h" /* screen structure */
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern int ChangeDeviceNotify;
|
||||
extern Mask ChangeDeviceNotifyMask;
|
||||
extern InputInfo inputInfo;
|
||||
extern ScreenInfo screenInfo;
|
||||
extern WindowPtr *WindowTable;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure is invoked to swap the request bytes if the server and
|
||||
* client have a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangePointerDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xChangePointerDeviceReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
|
||||
return(ProcXChangePointerDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the device used as the X pointer.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXChangePointerDevice (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr xptr = inputInfo.pointer;
|
||||
DeviceIntPtr dev;
|
||||
ValuatorClassPtr v;
|
||||
xChangePointerDeviceReply rep;
|
||||
changeDeviceNotify ev;
|
||||
|
||||
REQUEST(xChangePointerDeviceReq);
|
||||
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_ChangePointerDevice;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
rep.status = -1;
|
||||
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
v = dev->valuator;
|
||||
if (v == NULL || v->numAxes < 2 ||
|
||||
stuff->xaxis >= v->numAxes ||
|
||||
stuff->yaxis >= v->numAxes)
|
||||
{
|
||||
rep.status = -1;
|
||||
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (((dev->grab) && !SameClient(dev->grab, client)) ||
|
||||
((xptr->grab) && !SameClient(xptr->grab, client)))
|
||||
rep.status = AlreadyGrabbed;
|
||||
else if ((dev->sync.frozen &&
|
||||
dev->sync.other && !SameClient(dev->sync.other, client)) ||
|
||||
(xptr->sync.frozen &&
|
||||
xptr->sync.other && !SameClient(xptr->sync.other, client)))
|
||||
rep.status = GrabFrozen;
|
||||
else
|
||||
{
|
||||
if (ChangePointerDevice (
|
||||
xptr, dev, stuff->xaxis, stuff->yaxis) != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->focus)
|
||||
DeleteFocusClassDeviceStruct(dev);
|
||||
if (!dev->button)
|
||||
InitButtonClassDeviceStruct (dev, 0, NULL);
|
||||
if (!dev->ptrfeed)
|
||||
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA);
|
||||
RegisterOtherDevice (xptr);
|
||||
RegisterPointerDevice ((DevicePtr)dev);
|
||||
|
||||
ev.type = ChangeDeviceNotify;
|
||||
ev.deviceid = stuff->deviceid;
|
||||
ev.time = currentTime.milliseconds;
|
||||
ev.request = NewPointer;
|
||||
|
||||
SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1);
|
||||
SendMappingNotify (MappingPointer, 0, 0, client);
|
||||
|
||||
rep.status = 0;
|
||||
}
|
||||
|
||||
WriteReplyToClient (client, sizeof (xChangePointerDeviceReply),
|
||||
&rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
DeleteFocusClassDeviceStruct(dev)
|
||||
DeviceIntPtr dev;
|
||||
{
|
||||
xfree(dev->focus->trace);
|
||||
xfree(dev->focus);
|
||||
dev->focus = NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Send an event to interested clients in all windows on all screens.
|
||||
*
|
||||
*/
|
||||
|
||||
SendEventToAllWindows (dev, mask, ev, count)
|
||||
DeviceIntPtr dev;
|
||||
Mask mask;
|
||||
xEvent *ev;
|
||||
int count;
|
||||
{
|
||||
int i;
|
||||
WindowPtr pWin, p1;
|
||||
|
||||
for (i=0; i<screenInfo.numScreens; i++)
|
||||
{
|
||||
pWin = WindowTable[i];
|
||||
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
|
||||
p1 = pWin->firstChild;
|
||||
FindInterestedChildren (dev, p1, mask, ev, count);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Walk through the window tree, finding all clients that want to know
|
||||
* about the ChangeDeviceNotify Event.
|
||||
*
|
||||
*/
|
||||
|
||||
FindInterestedChildren (dev, p1, mask, ev, count)
|
||||
DeviceIntPtr dev;
|
||||
WindowPtr p1;
|
||||
Mask mask;
|
||||
xEvent *ev;
|
||||
int count;
|
||||
{
|
||||
WindowPtr p2;
|
||||
|
||||
while (p1)
|
||||
{
|
||||
p2 = p1->firstChild;
|
||||
(void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
|
||||
FindInterestedChildren (dev, p2, mask, ev, count);
|
||||
p1 = p1->nextSib;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XChangePointerDevice
|
||||
* function, if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXChangePointerDevice (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xChangePointerDeviceReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
185
Xi/closedev.c
Normal file
185
Xi/closedev.c
Normal file
|
@ -0,0 +1,185 @@
|
|||
/* $Xorg: closedev.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to close an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "scrnintstr.h" /* screen structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern ScreenInfo screenInfo;
|
||||
extern WindowPtr *WindowTable;
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure closes an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXCloseDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xCloseDeviceReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xCloseDeviceReq);
|
||||
return(ProcXCloseDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure closes an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXCloseDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int i;
|
||||
WindowPtr pWin, p1;
|
||||
DeviceIntPtr d;
|
||||
|
||||
REQUEST(xCloseDeviceReq);
|
||||
REQUEST_SIZE_MATCH(xCloseDeviceReq);
|
||||
|
||||
d = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (d == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (d->grab && SameClient(d->grab, client))
|
||||
(*d->DeactivateGrab)(d); /* release active grab */
|
||||
|
||||
/* Remove event selections from all windows for events from this device
|
||||
and selected by this client.
|
||||
Delete passive grabs from all windows for this device. */
|
||||
|
||||
for (i=0; i<screenInfo.numScreens; i++)
|
||||
{
|
||||
pWin = WindowTable[i];
|
||||
DeleteDeviceEvents (d, pWin, client);
|
||||
p1 = pWin->firstChild;
|
||||
DeleteEventsFromChildren (d, p1, client);
|
||||
}
|
||||
|
||||
CloseInputDevice (d, client);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Walk througth the window tree, deleting event selections for this client
|
||||
* from this device from all windows.
|
||||
*
|
||||
*/
|
||||
|
||||
DeleteEventsFromChildren(dev, p1, client)
|
||||
DeviceIntPtr dev;
|
||||
WindowPtr p1;
|
||||
ClientPtr client;
|
||||
{
|
||||
WindowPtr p2;
|
||||
|
||||
while (p1)
|
||||
{
|
||||
p2 = p1->firstChild;
|
||||
DeleteDeviceEvents (dev, p1, client);
|
||||
DeleteEventsFromChildren(dev, p2, client);
|
||||
p1 = p1->nextSib;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Clear out event selections and passive grabs from a window for the
|
||||
* specified device.
|
||||
*
|
||||
*/
|
||||
|
||||
DeleteDeviceEvents (dev, pWin, client)
|
||||
DeviceIntPtr dev;
|
||||
WindowPtr pWin;
|
||||
ClientPtr client;
|
||||
{
|
||||
InputClientsPtr others;
|
||||
OtherInputMasks *pOthers;
|
||||
GrabPtr grab, next;
|
||||
|
||||
if (pOthers=wOtherInputMasks(pWin))
|
||||
for (others=pOthers->inputClients; others;
|
||||
others = others->next)
|
||||
if (SameClient(others,client))
|
||||
others->mask[dev->id] = NoEventMask;
|
||||
|
||||
for (grab = wPassiveGrabs(pWin); grab; grab=next)
|
||||
{
|
||||
next = grab->next;
|
||||
if ((grab->device == dev) &&
|
||||
(client->clientAsMask == CLIENT_BITS(grab->resource)))
|
||||
FreeResource (grab->resource, RT_NONE);
|
||||
}
|
||||
}
|
167
Xi/devbell.c
Normal file
167
Xi/devbell.c
Normal file
|
@ -0,0 +1,167 @@
|
|||
/* $Xorg: devbell.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to change the keyboard device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure is invoked to swap the request bytes if the server and
|
||||
* client have a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXDeviceBell(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xDeviceBellReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXDeviceBell(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure rings a bell on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXDeviceBell (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
KbdFeedbackPtr k;
|
||||
BellFeedbackPtr b;
|
||||
int base;
|
||||
int newpercent;
|
||||
CARD8 class;
|
||||
pointer ctrl;
|
||||
void (*proc)();
|
||||
|
||||
REQUEST(xDeviceBellReq);
|
||||
REQUEST_SIZE_MATCH(xDeviceBellReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
client->errorValue = stuff->deviceid;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (stuff->percent < -100 || stuff->percent > 100)
|
||||
{
|
||||
client->errorValue = stuff->percent;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
if (stuff->feedbackclass == KbdFeedbackClass)
|
||||
{
|
||||
for (k=dev->kbdfeed; k; k=k->next)
|
||||
if (k->ctrl.id == stuff->feedbackid)
|
||||
break;
|
||||
if (!k)
|
||||
{
|
||||
client->errorValue = stuff->feedbackid;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
base = k->ctrl.bell;
|
||||
proc = k->BellProc;
|
||||
ctrl = (pointer) &(k->ctrl);
|
||||
class = KbdFeedbackClass;
|
||||
}
|
||||
else if (stuff->feedbackclass == BellFeedbackClass)
|
||||
{
|
||||
for (b=dev->bell; b; b=b->next)
|
||||
if (b->ctrl.id == stuff->feedbackid)
|
||||
break;
|
||||
if (!b)
|
||||
{
|
||||
client->errorValue = stuff->feedbackid;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
base = b->ctrl.percent;
|
||||
proc = b->BellProc;
|
||||
ctrl = (pointer) &(b->ctrl);
|
||||
class = BellFeedbackClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
client->errorValue = stuff->feedbackclass;
|
||||
SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue);
|
||||
return Success;
|
||||
}
|
||||
newpercent = (base * stuff->percent) / 100;
|
||||
if (stuff->percent < 0)
|
||||
newpercent = base + newpercent;
|
||||
else
|
||||
newpercent = base - newpercent + stuff->percent;
|
||||
(*proc)(newpercent, dev, ctrl, class);
|
||||
|
||||
return Success;
|
||||
}
|
1388
Xi/exevents.c
Normal file
1388
Xi/exevents.c
Normal file
File diff suppressed because it is too large
Load Diff
962
Xi/extinit.c
Normal file
962
Xi/extinit.c
Normal file
|
@ -0,0 +1,962 @@
|
|||
/* $Xorg: extinit.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Dispatch routines and initialization routines for the X input extension.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NUMTYPES 15
|
||||
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "inputstr.h"
|
||||
#include "gcstruct.h" /* pointer for extnsionst.h*/
|
||||
#include "extnsionst.h" /* extension entry */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
static Mask lastExtEventMask = 1;
|
||||
int ExtEventIndex;
|
||||
Mask ExtValidMasks[EMASKSIZE];
|
||||
Mask ExtExclusiveMasks[EMASKSIZE];
|
||||
|
||||
struct dev_type
|
||||
{
|
||||
Atom type;
|
||||
char *name;
|
||||
}dev_type [] = {{0,XI_KEYBOARD},
|
||||
{0,XI_MOUSE},
|
||||
{0,XI_TABLET},
|
||||
{0,XI_TOUCHSCREEN},
|
||||
{0,XI_TOUCHPAD},
|
||||
{0,XI_BARCODE},
|
||||
{0,XI_BUTTONBOX},
|
||||
{0,XI_KNOB_BOX},
|
||||
{0,XI_ONE_KNOB},
|
||||
{0,XI_NINE_KNOB},
|
||||
{0,XI_TRACKBALL},
|
||||
{0,XI_QUADRATURE},
|
||||
{0,XI_ID_MODULE},
|
||||
{0,XI_SPACEBALL},
|
||||
{0,XI_DATAGLOVE},
|
||||
{0,XI_EYETRACKER},
|
||||
{0,XI_CURSORKEYS},
|
||||
{0,XI_FOOTMOUSE}};
|
||||
|
||||
CARD8 event_base [numInputClasses];
|
||||
XExtEventInfo EventInfo[32];
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Globals referenced elsewhere in the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int IReqCode = 0;
|
||||
int BadDevice = 0;
|
||||
int BadEvent = 1;
|
||||
int BadMode = 2;
|
||||
int DeviceBusy = 3;
|
||||
int BadClass = 4;
|
||||
|
||||
Mask DevicePointerMotionMask;
|
||||
Mask DevicePointerMotionHintMask;
|
||||
Mask DeviceFocusChangeMask;
|
||||
Mask DeviceStateNotifyMask;
|
||||
Mask ChangeDeviceNotifyMask;
|
||||
Mask DeviceMappingNotifyMask;
|
||||
Mask DeviceOwnerGrabButtonMask;
|
||||
Mask DeviceButtonGrabMask;
|
||||
Mask DeviceButtonMotionMask;
|
||||
|
||||
int DeviceValuator;
|
||||
int DeviceKeyPress;
|
||||
int DeviceKeyRelease;
|
||||
int DeviceButtonPress;
|
||||
int DeviceButtonRelease;
|
||||
int DeviceMotionNotify;
|
||||
int DeviceFocusIn;
|
||||
int DeviceFocusOut;
|
||||
int ProximityIn;
|
||||
int ProximityOut;
|
||||
int DeviceStateNotify;
|
||||
int DeviceKeyStateNotify;
|
||||
int DeviceButtonStateNotify;
|
||||
int DeviceMappingNotify;
|
||||
int ChangeDeviceNotify;
|
||||
|
||||
int RT_INPUTCLIENT;
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Externs defined elsewhere in the X server.
|
||||
*
|
||||
*/
|
||||
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
extern void (* EventSwapVector[128]) ();
|
||||
extern XExtensionVersion AllExtensionVersions[];
|
||||
extern InputInfo inputInfo;
|
||||
Mask PropagateMask[MAX_DEVICES];
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Declarations of local routines.
|
||||
*
|
||||
*/
|
||||
|
||||
int ProcIDispatch();
|
||||
int SProcIDispatch();
|
||||
void SReplyIDispatch();
|
||||
void IResetProc();
|
||||
void SEventIDispatch();
|
||||
void NotImplemented();
|
||||
static XExtensionVersion thisversion =
|
||||
{XI_Present,
|
||||
XI_Add_XChangeDeviceControl_Major,
|
||||
XI_Add_XChangeDeviceControl_Minor};
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* IExtensionInit - initialize the input extension.
|
||||
*
|
||||
* Called from InitExtensions in main() or from QueryExtension() if the
|
||||
* extension is dynamically loaded.
|
||||
*
|
||||
* This extension has several events and errors.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
XInputExtensionInit()
|
||||
{
|
||||
ExtensionEntry *extEntry, *AddExtension();
|
||||
int XShutDownDevice();
|
||||
int InputClientGone();
|
||||
|
||||
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
|
||||
SProcIDispatch, IResetProc, StandardMinorOpcode);
|
||||
if (extEntry)
|
||||
{
|
||||
IReqCode = extEntry->base;
|
||||
AllExtensionVersions[IReqCode-128] = thisversion;
|
||||
MakeDeviceTypeAtoms ();
|
||||
RT_INPUTCLIENT = CreateNewResourceType(InputClientGone);
|
||||
FixExtensionEvents (extEntry);
|
||||
ReplySwapVector[IReqCode] = SReplyIDispatch;
|
||||
EventSwapVector[DeviceValuator] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonPress] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
|
||||
EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceFocusIn] = SEventIDispatch;
|
||||
EventSwapVector[DeviceFocusOut] = SEventIDispatch;
|
||||
EventSwapVector[ProximityIn] = SEventIDispatch;
|
||||
EventSwapVector[ProximityOut] = SEventIDispatch;
|
||||
EventSwapVector[DeviceStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
|
||||
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
|
||||
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError("IExtensionInit: AddExtensions failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* ProcIDispatch - main dispatch routine for requests to this extension.
|
||||
* This routine is used if server and client have the same byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcIDispatch (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
if (stuff->data == X_GetExtensionVersion)
|
||||
return(ProcXGetExtensionVersion(client));
|
||||
if (stuff->data == X_ListInputDevices)
|
||||
return(ProcXListInputDevices(client));
|
||||
else if (stuff->data == X_OpenDevice)
|
||||
return(ProcXOpenDevice(client));
|
||||
else if (stuff->data == X_CloseDevice)
|
||||
return(ProcXCloseDevice(client));
|
||||
else if (stuff->data == X_SetDeviceMode)
|
||||
return(ProcXSetDeviceMode(client));
|
||||
else if (stuff->data == X_SelectExtensionEvent)
|
||||
return(ProcXSelectExtensionEvent(client));
|
||||
else if (stuff->data == X_GetSelectedExtensionEvents)
|
||||
return(ProcXGetSelectedExtensionEvents(client));
|
||||
else if (stuff->data == X_ChangeDeviceDontPropagateList)
|
||||
return(ProcXChangeDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceDontPropagateList)
|
||||
return(ProcXGetDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceMotionEvents)
|
||||
return(ProcXGetDeviceMotionEvents(client));
|
||||
else if (stuff->data == X_ChangeKeyboardDevice)
|
||||
return(ProcXChangeKeyboardDevice(client));
|
||||
else if (stuff->data == X_ChangePointerDevice)
|
||||
return(ProcXChangePointerDevice(client));
|
||||
else if (stuff->data == X_GrabDevice)
|
||||
return(ProcXGrabDevice(client));
|
||||
else if (stuff->data == X_UngrabDevice)
|
||||
return(ProcXUngrabDevice(client));
|
||||
else if (stuff->data == X_GrabDeviceKey)
|
||||
return(ProcXGrabDeviceKey(client));
|
||||
else if (stuff->data == X_UngrabDeviceKey)
|
||||
return(ProcXUngrabDeviceKey(client));
|
||||
else if (stuff->data == X_GrabDeviceButton)
|
||||
return(ProcXGrabDeviceButton(client));
|
||||
else if (stuff->data == X_UngrabDeviceButton)
|
||||
return(ProcXUngrabDeviceButton(client));
|
||||
else if (stuff->data == X_AllowDeviceEvents)
|
||||
return(ProcXAllowDeviceEvents(client));
|
||||
else if (stuff->data == X_GetDeviceFocus)
|
||||
return(ProcXGetDeviceFocus(client));
|
||||
else if (stuff->data == X_SetDeviceFocus)
|
||||
return(ProcXSetDeviceFocus(client));
|
||||
else if (stuff->data == X_GetFeedbackControl)
|
||||
return(ProcXGetFeedbackControl(client));
|
||||
else if (stuff->data == X_ChangeFeedbackControl)
|
||||
return(ProcXChangeFeedbackControl(client));
|
||||
else if (stuff->data == X_GetDeviceKeyMapping)
|
||||
return(ProcXGetDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_ChangeDeviceKeyMapping)
|
||||
return(ProcXChangeDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_GetDeviceModifierMapping)
|
||||
return(ProcXGetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_SetDeviceModifierMapping)
|
||||
return(ProcXSetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_GetDeviceButtonMapping)
|
||||
return(ProcXGetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_SetDeviceButtonMapping)
|
||||
return(ProcXSetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_QueryDeviceState)
|
||||
return(ProcXQueryDeviceState(client));
|
||||
else if (stuff->data == X_SendExtensionEvent)
|
||||
return(ProcXSendExtensionEvent(client));
|
||||
else if (stuff->data == X_DeviceBell)
|
||||
return(ProcXDeviceBell(client));
|
||||
else if (stuff->data == X_SetDeviceValuators)
|
||||
return(ProcXSetDeviceValuators(client));
|
||||
else if (stuff->data == X_GetDeviceControl)
|
||||
return(ProcXGetDeviceControl(client));
|
||||
else if (stuff->data == X_ChangeDeviceControl)
|
||||
return(ProcXChangeDeviceControl(client));
|
||||
else
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
|
||||
}
|
||||
return(BadRequest);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SProcXDispatch
|
||||
*
|
||||
* Main swapped dispatch routine for requests to this extension.
|
||||
* This routine is used if server and client do not have the same byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcIDispatch(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
if (stuff->data == X_GetExtensionVersion)
|
||||
return(SProcXGetExtensionVersion(client));
|
||||
if (stuff->data == X_ListInputDevices)
|
||||
return(SProcXListInputDevices(client));
|
||||
else if (stuff->data == X_OpenDevice)
|
||||
return(SProcXOpenDevice(client));
|
||||
else if (stuff->data == X_CloseDevice)
|
||||
return(SProcXCloseDevice(client));
|
||||
else if (stuff->data == X_SetDeviceMode)
|
||||
return(SProcXSetDeviceMode(client));
|
||||
else if (stuff->data == X_SelectExtensionEvent)
|
||||
return(SProcXSelectExtensionEvent(client));
|
||||
else if (stuff->data == X_GetSelectedExtensionEvents)
|
||||
return(SProcXGetSelectedExtensionEvents(client));
|
||||
else if (stuff->data == X_ChangeDeviceDontPropagateList)
|
||||
return(SProcXChangeDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceDontPropagateList)
|
||||
return(SProcXGetDeviceDontPropagateList(client));
|
||||
else if (stuff->data == X_GetDeviceMotionEvents)
|
||||
return(SProcXGetDeviceMotionEvents(client));
|
||||
else if (stuff->data == X_ChangeKeyboardDevice)
|
||||
return(SProcXChangeKeyboardDevice(client));
|
||||
else if (stuff->data == X_ChangePointerDevice)
|
||||
return(SProcXChangePointerDevice(client));
|
||||
else if (stuff->data == X_GrabDevice)
|
||||
return(SProcXGrabDevice(client));
|
||||
else if (stuff->data == X_UngrabDevice)
|
||||
return(SProcXUngrabDevice(client));
|
||||
else if (stuff->data == X_GrabDeviceKey)
|
||||
return(SProcXGrabDeviceKey(client));
|
||||
else if (stuff->data == X_UngrabDeviceKey)
|
||||
return(SProcXUngrabDeviceKey(client));
|
||||
else if (stuff->data == X_GrabDeviceButton)
|
||||
return(SProcXGrabDeviceButton(client));
|
||||
else if (stuff->data == X_UngrabDeviceButton)
|
||||
return(SProcXUngrabDeviceButton(client));
|
||||
else if (stuff->data == X_AllowDeviceEvents)
|
||||
return(SProcXAllowDeviceEvents(client));
|
||||
else if (stuff->data == X_GetDeviceFocus)
|
||||
return(SProcXGetDeviceFocus(client));
|
||||
else if (stuff->data == X_SetDeviceFocus)
|
||||
return(SProcXSetDeviceFocus(client));
|
||||
else if (stuff->data == X_GetFeedbackControl)
|
||||
return(SProcXGetFeedbackControl(client));
|
||||
else if (stuff->data == X_ChangeFeedbackControl)
|
||||
return(SProcXChangeFeedbackControl(client));
|
||||
else if (stuff->data == X_GetDeviceKeyMapping)
|
||||
return(SProcXGetDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_ChangeDeviceKeyMapping)
|
||||
return(SProcXChangeDeviceKeyMapping(client));
|
||||
else if (stuff->data == X_GetDeviceModifierMapping)
|
||||
return(SProcXGetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_SetDeviceModifierMapping)
|
||||
return(SProcXSetDeviceModifierMapping(client));
|
||||
else if (stuff->data == X_GetDeviceButtonMapping)
|
||||
return(SProcXGetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_SetDeviceButtonMapping)
|
||||
return(SProcXSetDeviceButtonMapping(client));
|
||||
else if (stuff->data == X_QueryDeviceState)
|
||||
return(SProcXQueryDeviceState(client));
|
||||
else if (stuff->data == X_SendExtensionEvent)
|
||||
return(SProcXSendExtensionEvent(client));
|
||||
else if (stuff->data == X_DeviceBell)
|
||||
return(SProcXDeviceBell(client));
|
||||
else if (stuff->data == X_SetDeviceValuators)
|
||||
return(SProcXSetDeviceValuators(client));
|
||||
else if (stuff->data == X_GetDeviceControl)
|
||||
return(SProcXGetDeviceControl(client));
|
||||
else if (stuff->data == X_ChangeDeviceControl)
|
||||
return(SProcXChangeDeviceControl(client));
|
||||
else
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
|
||||
}
|
||||
return(BadRequest);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* SReplyIDispatch
|
||||
* Swap any replies defined in this extension.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SReplyIDispatch (client, len, rep)
|
||||
ClientPtr client;
|
||||
int len;
|
||||
xGrabDeviceReply *rep; /* All we look at is the type field */
|
||||
{ /* This is common to all replies */
|
||||
if (rep->RepType == X_GetExtensionVersion)
|
||||
SRepXGetExtensionVersion (client, len, rep);
|
||||
else if (rep->RepType == X_ListInputDevices)
|
||||
SRepXListInputDevices (client, len, rep);
|
||||
else if (rep->RepType == X_OpenDevice)
|
||||
SRepXOpenDevice (client, len, rep);
|
||||
else if (rep->RepType == X_SetDeviceMode)
|
||||
SRepXSetDeviceMode (client, len, rep);
|
||||
else if (rep->RepType == X_GetSelectedExtensionEvents)
|
||||
SRepXGetSelectedExtensionEvents (client, len, rep);
|
||||
else if (rep->RepType == X_GetDeviceDontPropagateList)
|
||||
SRepXGetDeviceDontPropagateList (client, len, rep);
|
||||
else if (rep->RepType == X_GetDeviceMotionEvents)
|
||||
SRepXGetDeviceMotionEvents (client, len, rep);
|
||||
else if (rep->RepType == X_ChangeKeyboardDevice)
|
||||
SRepXChangeKeyboardDevice (client, len, rep);
|
||||
else if (rep->RepType == X_ChangePointerDevice)
|
||||
SRepXChangePointerDevice (client, len, rep);
|
||||
else if (rep->RepType == X_GrabDevice)
|
||||
SRepXGrabDevice (client, len, rep);
|
||||
else if (rep->RepType == X_GetDeviceFocus)
|
||||
SRepXGetDeviceFocus (client, len, rep);
|
||||
else if (rep->RepType == X_GetFeedbackControl)
|
||||
SRepXGetFeedbackControl (client, len, rep);
|
||||
else if (rep->RepType == X_GetDeviceKeyMapping)
|
||||
SRepXGetDeviceKeyMapping (client, len, rep);
|
||||
else if (rep->RepType == X_GetDeviceModifierMapping)
|
||||
SRepXGetDeviceModifierMapping (client, len, rep);
|
||||
else if (rep->RepType == X_SetDeviceModifierMapping)
|
||||
SRepXSetDeviceModifierMapping (client, len, rep);
|
||||
else if (rep->RepType == X_GetDeviceButtonMapping)
|
||||
SRepXGetDeviceButtonMapping (client, len, rep);
|
||||
else if (rep->RepType == X_SetDeviceButtonMapping)
|
||||
SRepXSetDeviceButtonMapping (client, len, rep);
|
||||
else if (rep->RepType == X_QueryDeviceState)
|
||||
SRepXQueryDeviceState (client, len, rep);
|
||||
else if (rep->RepType == X_SetDeviceValuators)
|
||||
SRepXSetDeviceValuators (client, len, rep);
|
||||
else if (rep->RepType == X_GetDeviceControl)
|
||||
SRepXGetDeviceControl (client, len, rep);
|
||||
else if (rep->RepType == X_ChangeDeviceControl)
|
||||
SRepXChangeDeviceControl (client, len, rep);
|
||||
else
|
||||
{
|
||||
FatalError("XINPUT confused sending swapped reply");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SEventIDispatch
|
||||
*
|
||||
* Swap any events defined in this extension.
|
||||
*/
|
||||
void
|
||||
SEventIDispatch (from, to)
|
||||
xEvent *from;
|
||||
xEvent *to;
|
||||
{
|
||||
int type = from->u.u.type & 0177;
|
||||
|
||||
if (type == DeviceValuator)
|
||||
SEventDeviceValuator (from, to);
|
||||
else if (type == DeviceKeyPress)
|
||||
{
|
||||
SKeyButtonPtrEvent (from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
}
|
||||
else if (type == DeviceKeyRelease)
|
||||
{
|
||||
SKeyButtonPtrEvent (from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
}
|
||||
else if (type == DeviceButtonPress)
|
||||
{
|
||||
SKeyButtonPtrEvent (from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
}
|
||||
else if (type == DeviceButtonRelease)
|
||||
{
|
||||
SKeyButtonPtrEvent (from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
}
|
||||
else if (type == DeviceMotionNotify)
|
||||
{
|
||||
SKeyButtonPtrEvent (from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
}
|
||||
else if (type == DeviceFocusIn)
|
||||
SEventFocus (from, to);
|
||||
else if (type == DeviceFocusOut)
|
||||
SEventFocus (from, to);
|
||||
else if (type == ProximityIn)
|
||||
{
|
||||
SKeyButtonPtrEvent (from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
}
|
||||
else if (type == ProximityOut)
|
||||
{
|
||||
SKeyButtonPtrEvent (from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
}
|
||||
else if (type == DeviceStateNotify)
|
||||
SDeviceStateNotifyEvent (from, to);
|
||||
else if (type == DeviceKeyStateNotify)
|
||||
SDeviceKeyStateNotifyEvent (from, to);
|
||||
else if (type == DeviceButtonStateNotify)
|
||||
SDeviceButtonStateNotifyEvent (from, to);
|
||||
else if (type == DeviceMappingNotify)
|
||||
SDeviceMappingNotifyEvent (from, to);
|
||||
else if (type == ChangeDeviceNotify)
|
||||
SChangeDeviceNotifyEvent (from, to);
|
||||
else
|
||||
{
|
||||
FatalError("XInputExtension: Impossible event!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* This function swaps the DeviceValuator event.
|
||||
*
|
||||
*/
|
||||
|
||||
SEventDeviceValuator (from, to)
|
||||
deviceValuator *from;
|
||||
deviceValuator *to;
|
||||
{
|
||||
register char n;
|
||||
register int i;
|
||||
INT32 *ip B32;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
swaps(&to->device_state,n);
|
||||
ip = &to->valuator0;
|
||||
for (i=0; i<6; i++)
|
||||
{
|
||||
swapl((ip+i),n); /* macro - braces are required */
|
||||
}
|
||||
}
|
||||
|
||||
SEventFocus (from, to)
|
||||
deviceFocus *from;
|
||||
deviceFocus *to;
|
||||
{
|
||||
register char n;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
swapl(&to->time, n);
|
||||
swapl(&to->window, n);
|
||||
}
|
||||
|
||||
SDeviceStateNotifyEvent (from, to)
|
||||
deviceStateNotify *from;
|
||||
deviceStateNotify *to;
|
||||
{
|
||||
register int i;
|
||||
register char n;
|
||||
INT32 *ip B32;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
swapl(&to->time, n);
|
||||
ip = &to->valuator0;
|
||||
for (i=0; i<3; i++)
|
||||
{
|
||||
swapl((ip+i),n); /* macro - braces are required */
|
||||
}
|
||||
}
|
||||
|
||||
SDeviceKeyStateNotifyEvent (from, to)
|
||||
deviceKeyStateNotify *from;
|
||||
deviceKeyStateNotify *to;
|
||||
{
|
||||
register char n;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
}
|
||||
|
||||
SDeviceButtonStateNotifyEvent (from, to)
|
||||
deviceButtonStateNotify *from;
|
||||
deviceButtonStateNotify *to;
|
||||
{
|
||||
register char n;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
}
|
||||
|
||||
SChangeDeviceNotifyEvent (from, to)
|
||||
changeDeviceNotify *from;
|
||||
changeDeviceNotify *to;
|
||||
{
|
||||
register char n;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
swapl(&to->time, n);
|
||||
}
|
||||
|
||||
SDeviceMappingNotifyEvent (from, to)
|
||||
deviceMappingNotify *from;
|
||||
deviceMappingNotify *to;
|
||||
{
|
||||
register char n;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber,n);
|
||||
swapl(&to->time, n);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* This function sets up extension event types and masks.
|
||||
*
|
||||
*/
|
||||
|
||||
FixExtensionEvents (extEntry)
|
||||
ExtensionEntry *extEntry;
|
||||
{
|
||||
Mask mask, GetNextExtEventMask();
|
||||
void SetMaskForExtEvent();
|
||||
void SetEventInfo();
|
||||
void AllowPropagateSuppress();
|
||||
void SetExclusiveAccess();
|
||||
|
||||
DeviceValuator = extEntry->eventBase;
|
||||
DeviceKeyPress = DeviceValuator + 1;
|
||||
DeviceKeyRelease = DeviceKeyPress + 1;
|
||||
DeviceButtonPress = DeviceKeyRelease + 1;
|
||||
DeviceButtonRelease = DeviceButtonPress + 1;
|
||||
DeviceMotionNotify = DeviceButtonRelease + 1;
|
||||
DeviceFocusIn = DeviceMotionNotify + 1;
|
||||
DeviceFocusOut = DeviceFocusIn + 1;
|
||||
ProximityIn = DeviceFocusOut + 1;
|
||||
ProximityOut = ProximityIn + 1;
|
||||
DeviceStateNotify = ProximityOut + 1;
|
||||
DeviceMappingNotify = DeviceStateNotify + 1;
|
||||
ChangeDeviceNotify = DeviceMappingNotify + 1;
|
||||
DeviceKeyStateNotify = ChangeDeviceNotify + 1;
|
||||
DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
|
||||
|
||||
event_base[KeyClass] = DeviceKeyPress;
|
||||
event_base[ButtonClass] = DeviceButtonPress;
|
||||
event_base[ValuatorClass] = DeviceMotionNotify;
|
||||
event_base[ProximityClass] = ProximityIn;
|
||||
event_base[FocusClass] = DeviceFocusIn;
|
||||
event_base[OtherClass] = DeviceStateNotify;
|
||||
|
||||
BadDevice += extEntry->errorBase;
|
||||
BadEvent += extEntry->errorBase;
|
||||
BadMode += extEntry->errorBase;
|
||||
DeviceBusy += extEntry->errorBase;
|
||||
BadClass += extEntry->errorBase;
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (mask, DeviceKeyPress);
|
||||
AllowPropagateSuppress (mask);
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (mask, DeviceKeyRelease);
|
||||
AllowPropagateSuppress (mask);
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (mask, DeviceButtonPress);
|
||||
AllowPropagateSuppress (mask);
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (mask, DeviceButtonRelease);
|
||||
AllowPropagateSuppress (mask);
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (mask, ProximityIn);
|
||||
SetMaskForExtEvent (mask, ProximityOut);
|
||||
AllowPropagateSuppress (mask);
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
DeviceStateNotifyMask = mask;
|
||||
SetMaskForExtEvent (mask, DeviceStateNotify);
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
DevicePointerMotionMask = mask;
|
||||
SetMaskForExtEvent (mask, DeviceMotionNotify);
|
||||
AllowPropagateSuppress (mask);
|
||||
|
||||
DevicePointerMotionHintMask = GetNextExtEventMask();
|
||||
SetEventInfo (DevicePointerMotionHintMask, _devicePointerMotionHint);
|
||||
SetEventInfo (GetNextExtEventMask(), _deviceButton1Motion);
|
||||
SetEventInfo (GetNextExtEventMask(), _deviceButton2Motion);
|
||||
SetEventInfo (GetNextExtEventMask(), _deviceButton3Motion);
|
||||
SetEventInfo (GetNextExtEventMask(), _deviceButton4Motion);
|
||||
SetEventInfo (GetNextExtEventMask(), _deviceButton5Motion);
|
||||
DeviceButtonMotionMask = GetNextExtEventMask();
|
||||
SetEventInfo (DeviceButtonMotionMask, _deviceButtonMotion);
|
||||
|
||||
DeviceFocusChangeMask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusIn);
|
||||
SetMaskForExtEvent (DeviceFocusChangeMask, DeviceFocusOut);
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (mask, DeviceMappingNotify);
|
||||
DeviceMappingNotifyMask = mask;
|
||||
|
||||
mask = GetNextExtEventMask ();
|
||||
SetMaskForExtEvent (mask, ChangeDeviceNotify);
|
||||
ChangeDeviceNotifyMask = mask;
|
||||
|
||||
DeviceButtonGrabMask = GetNextExtEventMask();
|
||||
SetEventInfo (DeviceButtonGrabMask, _deviceButtonGrab);
|
||||
SetExclusiveAccess (DeviceButtonGrabMask);
|
||||
|
||||
DeviceOwnerGrabButtonMask = GetNextExtEventMask();
|
||||
SetEventInfo (DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
|
||||
SetEventInfo (0, _noExtensionEvent);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* This function restores extension event types and masks to their
|
||||
* initial state.
|
||||
*
|
||||
*/
|
||||
|
||||
RestoreExtensionEvents ()
|
||||
{
|
||||
int i;
|
||||
|
||||
IReqCode = 0;
|
||||
|
||||
for (i=0; i<ExtEventIndex-1; i++)
|
||||
{
|
||||
if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
|
||||
SetMaskForEvent(0,EventInfo[i].type);
|
||||
EventInfo[i].mask = 0;
|
||||
EventInfo[i].type = 0;
|
||||
}
|
||||
ExtEventIndex = 0;
|
||||
lastExtEventMask = 1;
|
||||
DeviceValuator = 0;
|
||||
DeviceKeyPress = 1;
|
||||
DeviceKeyRelease = 2;
|
||||
DeviceButtonPress = 3;
|
||||
DeviceButtonRelease = 4;
|
||||
DeviceMotionNotify = 5;
|
||||
DeviceFocusIn = 6;
|
||||
DeviceFocusOut = 7;
|
||||
ProximityIn = 8;
|
||||
ProximityOut = 9;
|
||||
DeviceStateNotify = 10;
|
||||
DeviceMappingNotify = 11;
|
||||
ChangeDeviceNotify = 12;
|
||||
DeviceKeyStateNotify = 13;
|
||||
DeviceButtonStateNotify = 13;
|
||||
|
||||
BadDevice = 0;
|
||||
BadEvent = 1;
|
||||
BadMode = 2;
|
||||
DeviceBusy = 3;
|
||||
BadClass = 4;
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* IResetProc.
|
||||
* Remove reply-swapping routine.
|
||||
* Remove event-swapping routine.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
IResetProc()
|
||||
{
|
||||
|
||||
ReplySwapVector[IReqCode] = NotImplemented;
|
||||
EventSwapVector[DeviceValuator] = NotImplemented;
|
||||
EventSwapVector[DeviceKeyPress] = NotImplemented;
|
||||
EventSwapVector[DeviceKeyRelease] = NotImplemented;
|
||||
EventSwapVector[DeviceButtonPress] = NotImplemented;
|
||||
EventSwapVector[DeviceButtonRelease] = NotImplemented;
|
||||
EventSwapVector[DeviceMotionNotify] = NotImplemented;
|
||||
EventSwapVector[DeviceFocusIn] = NotImplemented;
|
||||
EventSwapVector[DeviceFocusOut] = NotImplemented;
|
||||
EventSwapVector[ProximityIn] = NotImplemented;
|
||||
EventSwapVector[ProximityOut] = NotImplemented;
|
||||
EventSwapVector[DeviceStateNotify] = NotImplemented;
|
||||
EventSwapVector[DeviceKeyStateNotify] = NotImplemented;
|
||||
EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
|
||||
EventSwapVector[DeviceMappingNotify] = NotImplemented;
|
||||
EventSwapVector[ChangeDeviceNotify] = NotImplemented;
|
||||
RestoreExtensionEvents ();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Assign an id and type to an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
AssignTypeAndName (dev, type, name)
|
||||
DeviceIntPtr dev;
|
||||
Atom type;
|
||||
char *name;
|
||||
{
|
||||
dev->type = type;
|
||||
dev->name = (char *) xalloc(strlen(name)+1);
|
||||
strcpy (dev->name, name);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Make device type atoms.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
MakeDeviceTypeAtoms ()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<NUMTYPES; i++)
|
||||
dev_type[i].type =
|
||||
MakeAtom (dev_type[i].name, strlen(dev_type[i].name), 1);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Return a DeviceIntPtr corresponding to a specified device id.
|
||||
* This will not return the pointer or keyboard, or devices that are not on.
|
||||
*
|
||||
*/
|
||||
|
||||
DeviceIntPtr
|
||||
LookupDeviceIntRec (id)
|
||||
CARD8 id;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
|
||||
for (dev=inputInfo.devices; dev; dev=dev->next)
|
||||
{
|
||||
if (dev->id == id)
|
||||
{
|
||||
if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id)
|
||||
return (NULL);
|
||||
return (dev);
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to be restricted to being selected by one
|
||||
* client at a time.
|
||||
* The default is to allow more than one client to select the event.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SetExclusiveAccess (mask)
|
||||
Mask mask;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_DEVICES; i++)
|
||||
ExtExclusiveMasks[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to have its propagation suppressed.
|
||||
* The default is to not allow suppression of propagation.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
AllowPropagateSuppress (mask)
|
||||
Mask mask;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_DEVICES; i++)
|
||||
PropagateMask[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Return the next available extension event mask.
|
||||
*
|
||||
*/
|
||||
|
||||
Mask
|
||||
GetNextExtEventMask ()
|
||||
{
|
||||
int i;
|
||||
Mask mask = lastExtEventMask;
|
||||
|
||||
if (lastExtEventMask == 0)
|
||||
{
|
||||
FatalError("GetNextExtEventMask: no more events are available.");
|
||||
}
|
||||
lastExtEventMask <<= 1;
|
||||
|
||||
for (i=0; i<MAX_DEVICES; i++)
|
||||
ExtValidMasks[i] |= mask;
|
||||
return mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Assign the specified mask to the specified event.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SetMaskForExtEvent(mask, event)
|
||||
Mask mask;
|
||||
int event;
|
||||
{
|
||||
|
||||
EventInfo[ExtEventIndex].mask = mask;
|
||||
EventInfo[ExtEventIndex++].type = event;
|
||||
|
||||
if ((event < LASTEvent) || (event >= 128))
|
||||
FatalError("MaskForExtensionEvent: bogus event number");
|
||||
SetMaskForEvent(mask,event);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Record an event mask where there is no unique corresponding event type.
|
||||
* We can't call SetMaskForEvent, since that would clobber the existing
|
||||
* mask for that event. MotionHint and ButtonMotion are examples.
|
||||
*
|
||||
* Since extension event types will never be less than 64, we can use
|
||||
* 0-63 in the EventInfo array as the "type" to be used to look up this
|
||||
* mask. This means that the corresponding macros such as
|
||||
* DevicePointerMotionHint must have access to the same constants.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SetEventInfo(mask, constant)
|
||||
Mask mask;
|
||||
int constant;
|
||||
{
|
||||
EventInfo[ExtEventIndex].mask = mask;
|
||||
EventInfo[ExtEventIndex++].type = constant;
|
||||
}
|
147
Xi/getbmap.c
Normal file
147
Xi/getbmap.c
Normal file
|
@ -0,0 +1,147 @@
|
|||
/* $Xorg: getbmap.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to return the version of the extension.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the button mapping for the specified device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceButtonMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetDeviceButtonMappingReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXGetDeviceButtonMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the button mapping for the specified device.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXGetDeviceButtonMapping (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xGetDeviceButtonMappingReply rep;
|
||||
ButtonClassPtr b;
|
||||
|
||||
REQUEST(xGetDeviceButtonMappingReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceButtonMapping;
|
||||
rep.nElts = 0;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
b = dev->button;
|
||||
if (b == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
rep.nElts = b->numButtons;
|
||||
rep.length = (rep.nElts + (4-1))/4;
|
||||
WriteReplyToClient (client, sizeof (xGetDeviceButtonMappingReply), &rep);
|
||||
(void)WriteToClient(client, rep.nElts,
|
||||
(char *)&b->map[1]);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetDeviceButtonMapping function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetDeviceButtonMapping (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetDeviceButtonMappingReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
224
Xi/getdctl.c
Normal file
224
Xi/getdctl.c
Normal file
|
@ -0,0 +1,224 @@
|
|||
/* $Xorg: getdctl.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Get Device control attributes for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
void CopySwapDeviceResolution();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the control attributes for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceControl(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetDeviceControlReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
|
||||
swaps(&stuff->control, n);
|
||||
return(ProcXGetDeviceControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the state of the specified device control.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXGetDeviceControl(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int total_length = 0;
|
||||
char *buf, *savbuf;
|
||||
register DeviceIntPtr dev;
|
||||
xGetDeviceControlReply rep;
|
||||
|
||||
REQUEST(xGetDeviceControlReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceControl;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
switch (stuff->control)
|
||||
{
|
||||
case DEVICE_RESOLUTION:
|
||||
if (!dev->valuator)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
total_length = sizeof (xDeviceResolutionState) +
|
||||
(3 * sizeof(int) * dev->valuator->numAxes);
|
||||
break;
|
||||
default:
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceControl, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
|
||||
buf = (char *) Xalloc (total_length);
|
||||
if (!buf)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
|
||||
BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
savbuf=buf;
|
||||
|
||||
switch (stuff->control)
|
||||
{
|
||||
case DEVICE_RESOLUTION:
|
||||
CopySwapDeviceResolution(client, dev->valuator, buf,
|
||||
total_length);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
rep.length = (total_length+3) >> 2;
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
|
||||
WriteToClient(client, total_length, savbuf);
|
||||
Xfree (savbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies DeviceResolution data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapDeviceResolution (client, v, buf, length)
|
||||
ClientPtr client;
|
||||
ValuatorClassPtr v;
|
||||
char *buf;
|
||||
int length;
|
||||
{
|
||||
register char n;
|
||||
AxisInfoPtr a;
|
||||
xDeviceResolutionState *r;
|
||||
int i, *iptr;
|
||||
|
||||
r = (xDeviceResolutionState *) buf;
|
||||
r->control = DEVICE_RESOLUTION;
|
||||
r->length = length;
|
||||
r->num_valuators = v->numAxes;
|
||||
buf += sizeof (xDeviceResolutionState);
|
||||
iptr = (int *) buf;
|
||||
for (i=0,a=v->axes; i<v->numAxes; i++,a++)
|
||||
*iptr++ = a->resolution;
|
||||
for (i=0,a=v->axes; i<v->numAxes; i++,a++)
|
||||
*iptr++ = a->min_resolution;
|
||||
for (i=0,a=v->axes; i<v->numAxes; i++,a++)
|
||||
*iptr++ = a->max_resolution;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps (&r->control,n);
|
||||
swaps (&r->length,n);
|
||||
swapl (&r->num_valuators,n);
|
||||
iptr = (int *) buf;
|
||||
for (i=0; i < (3 * v->numAxes); i++,iptr++)
|
||||
{
|
||||
swapl (iptr,n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the xGetDeviceControl function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetDeviceControl (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetDeviceControlReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
421
Xi/getfctl.c
Normal file
421
Xi/getfctl.c
Normal file
|
@ -0,0 +1,421 @@
|
|||
/* $Xorg: getfctl.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Get feedback control attributes for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
void CopySwapKbdFeedback();
|
||||
void CopySwapPtrFeedback();
|
||||
void CopySwapIntegerFeedback();
|
||||
void CopySwapStringFeedback();
|
||||
void CopySwapLedFeedback();
|
||||
void CopySwapBellFeedback();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the control attributes for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetFeedbackControl(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetFeedbackControlReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXGetFeedbackControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the feedback control state.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXGetFeedbackControl(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int total_length = 0;
|
||||
char *buf, *savbuf;
|
||||
register DeviceIntPtr dev;
|
||||
KbdFeedbackPtr k;
|
||||
PtrFeedbackPtr p;
|
||||
IntegerFeedbackPtr i;
|
||||
StringFeedbackPtr s;
|
||||
BellFeedbackPtr b;
|
||||
LedFeedbackPtr l;
|
||||
xGetFeedbackControlReply rep;
|
||||
|
||||
REQUEST(xGetFeedbackControlReq);
|
||||
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GetFeedbackControl, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetFeedbackControl;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.num_feedbacks = 0;
|
||||
|
||||
for (k=dev->kbdfeed; k; k=k->next)
|
||||
{
|
||||
rep.num_feedbacks++;
|
||||
total_length += sizeof(xKbdFeedbackState);
|
||||
}
|
||||
for (p=dev->ptrfeed; p; p=p->next)
|
||||
{
|
||||
rep.num_feedbacks++;
|
||||
total_length += sizeof(xPtrFeedbackState);
|
||||
}
|
||||
for (s=dev->stringfeed; s; s=s->next)
|
||||
{
|
||||
rep.num_feedbacks++;
|
||||
total_length += sizeof(xStringFeedbackState) +
|
||||
(s->ctrl.num_symbols_supported * sizeof (KeySym));
|
||||
}
|
||||
for (i=dev->intfeed; i; i=i->next)
|
||||
{
|
||||
rep.num_feedbacks++;
|
||||
total_length += sizeof(xIntegerFeedbackState);
|
||||
}
|
||||
for (l=dev->leds; l; l=l->next)
|
||||
{
|
||||
rep.num_feedbacks++;
|
||||
total_length += sizeof(xLedFeedbackState);
|
||||
}
|
||||
for (b=dev->bell; b; b=b->next)
|
||||
{
|
||||
rep.num_feedbacks++;
|
||||
total_length += sizeof(xBellFeedbackState);
|
||||
}
|
||||
|
||||
if (total_length == 0)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
buf = (char *) Xalloc (total_length);
|
||||
if (!buf)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
|
||||
BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
savbuf=buf;
|
||||
|
||||
for (k=dev->kbdfeed; k; k=k->next)
|
||||
CopySwapKbdFeedback (client, k, &buf);
|
||||
for (p=dev->ptrfeed; p; p=p->next)
|
||||
CopySwapPtrFeedback (client, p, &buf);
|
||||
for (s=dev->stringfeed; s; s=s->next)
|
||||
CopySwapStringFeedback (client, s, &buf);
|
||||
for (i=dev->intfeed; i; i=i->next)
|
||||
CopySwapIntegerFeedback (client, i, &buf);
|
||||
for (l=dev->leds; l; l=l->next)
|
||||
CopySwapLedFeedback (client, l, &buf);
|
||||
for (b=dev->bell; b; b=b->next)
|
||||
CopySwapBellFeedback (client, b, &buf);
|
||||
|
||||
rep.length = (total_length+3) >> 2;
|
||||
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
|
||||
WriteToClient(client, total_length, savbuf);
|
||||
Xfree (savbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies KbdFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapKbdFeedback (client, k, buf)
|
||||
ClientPtr client;
|
||||
KbdFeedbackPtr k;
|
||||
char **buf;
|
||||
{
|
||||
int i;
|
||||
register char n;
|
||||
xKbdFeedbackState *k2;
|
||||
|
||||
k2 = (xKbdFeedbackState *) *buf;
|
||||
k2->class = KbdFeedbackClass;
|
||||
k2->length = sizeof (xKbdFeedbackState);
|
||||
k2->id = k->ctrl.id;
|
||||
k2->click = k->ctrl.click;
|
||||
k2->percent = k->ctrl.bell;
|
||||
k2->pitch = k->ctrl.bell_pitch;
|
||||
k2->duration = k->ctrl.bell_duration;
|
||||
k2->led_mask = k->ctrl.leds;
|
||||
k2->global_auto_repeat = k->ctrl.autoRepeat;
|
||||
for (i=0; i<32; i++)
|
||||
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&k2->length,n);
|
||||
swaps(&k2->pitch,n);
|
||||
swaps(&k2->duration,n);
|
||||
swapl(&k2->led_mask,n);
|
||||
swapl(&k2->led_values,n);
|
||||
}
|
||||
*buf += sizeof (xKbdFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies PtrFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapPtrFeedback (client, p, buf)
|
||||
ClientPtr client;
|
||||
PtrFeedbackPtr p;
|
||||
char **buf;
|
||||
{
|
||||
register char n;
|
||||
xPtrFeedbackState *p2;
|
||||
|
||||
p2 = (xPtrFeedbackState *) *buf;
|
||||
p2->class = PtrFeedbackClass;
|
||||
p2->length = sizeof (xPtrFeedbackState);
|
||||
p2->id = p->ctrl.id;
|
||||
p2->accelNum = p->ctrl.num;
|
||||
p2->accelDenom = p->ctrl.den;
|
||||
p2->threshold = p->ctrl.threshold;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&p2->length,n);
|
||||
swaps(&p2->accelNum,n);
|
||||
swaps(&p2->accelDenom,n);
|
||||
swaps(&p2->threshold,n);
|
||||
}
|
||||
*buf += sizeof (xPtrFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies IntegerFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapIntegerFeedback (client, i, buf)
|
||||
ClientPtr client;
|
||||
IntegerFeedbackPtr i;
|
||||
char **buf;
|
||||
{
|
||||
register char n;
|
||||
xIntegerFeedbackState *i2;
|
||||
|
||||
i2 = (xIntegerFeedbackState *) *buf;
|
||||
i2->class = IntegerFeedbackClass;
|
||||
i2->length = sizeof (xIntegerFeedbackState);
|
||||
i2->id = i->ctrl.id;
|
||||
i2->resolution = i->ctrl.resolution;
|
||||
i2->min_value = i->ctrl.min_value;
|
||||
i2->max_value = i->ctrl.max_value;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&i2->length,n);
|
||||
swapl(&i2->resolution,n);
|
||||
swapl(&i2->min_value,n);
|
||||
swapl(&i2->max_value,n);
|
||||
}
|
||||
*buf += sizeof (xIntegerFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies StringFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapStringFeedback (client, s, buf)
|
||||
ClientPtr client;
|
||||
StringFeedbackPtr s;
|
||||
char **buf;
|
||||
{
|
||||
int i;
|
||||
register char n;
|
||||
xStringFeedbackState *s2;
|
||||
KeySym *kptr;
|
||||
|
||||
s2 = (xStringFeedbackState *) *buf;
|
||||
s2->class = StringFeedbackClass;
|
||||
s2->length = sizeof (xStringFeedbackState) +
|
||||
s->ctrl.num_symbols_supported * sizeof (KeySym);
|
||||
s2->id = s->ctrl.id;
|
||||
s2->max_symbols = s->ctrl.max_symbols;
|
||||
s2->num_syms_supported = s->ctrl.num_symbols_supported;
|
||||
*buf += sizeof (xStringFeedbackState);
|
||||
kptr = (KeySym *) (*buf);
|
||||
for (i=0; i<s->ctrl.num_symbols_supported; i++)
|
||||
*kptr++ = *(s->ctrl.symbols_supported+i);
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&s2->length,n);
|
||||
swaps(&s2->max_symbols,n);
|
||||
swaps(&s2->num_syms_supported,n);
|
||||
kptr = (KeySym *) (*buf);
|
||||
for (i=0; i<s->ctrl.num_symbols_supported; i++,kptr++)
|
||||
{
|
||||
swapl(kptr,n);
|
||||
}
|
||||
}
|
||||
*buf += (s->ctrl.num_symbols_supported * sizeof (KeySym));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies LedFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapLedFeedback (client, l, buf)
|
||||
ClientPtr client;
|
||||
LedFeedbackPtr l;
|
||||
char **buf;
|
||||
{
|
||||
register char n;
|
||||
xLedFeedbackState *l2;
|
||||
|
||||
l2 = (xLedFeedbackState *) *buf;
|
||||
l2->class = LedFeedbackClass;
|
||||
l2->length = sizeof (xLedFeedbackState);
|
||||
l2->id = l->ctrl.id;
|
||||
l2->led_values = l->ctrl.led_values;
|
||||
l2->led_mask = l->ctrl.led_mask;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&l2->length,n);
|
||||
swapl(&l2->led_values,n);
|
||||
swapl(&l2->led_mask,n);
|
||||
}
|
||||
*buf += sizeof (xLedFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies BellFeedbackClass data, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapBellFeedback (client, b, buf)
|
||||
ClientPtr client;
|
||||
BellFeedbackPtr b;
|
||||
char **buf;
|
||||
{
|
||||
register char n;
|
||||
xBellFeedbackState *b2;
|
||||
|
||||
b2 = (xBellFeedbackState *) *buf;
|
||||
b2->class = BellFeedbackClass;
|
||||
b2->length = sizeof (xBellFeedbackState);
|
||||
b2->id = b->ctrl.id;
|
||||
b2->percent = b->ctrl.percent;
|
||||
b2->pitch = b->ctrl.pitch;
|
||||
b2->duration = b->ctrl.duration;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&b2->length,n);
|
||||
swaps(&b2->pitch,n);
|
||||
swaps(&b2->duration,n);
|
||||
}
|
||||
*buf += sizeof (xBellFeedbackState);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the xGetFeedbackControl function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetFeedbackControl (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetFeedbackControlReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swaps(&rep->num_feedbacks, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
151
Xi/getfocus.c
Normal file
151
Xi/getfocus.c
Normal file
|
@ -0,0 +1,151 @@
|
|||
/* $Xorg: getfocus.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to get the focus for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "windowstr.h" /* focus struct */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the focus for a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceFocus(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetDeviceFocusReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXGetDeviceFocus(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the focus for a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXGetDeviceFocus(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
FocusClassPtr focus;
|
||||
xGetDeviceFocusReply rep;
|
||||
|
||||
REQUEST(xGetDeviceFocusReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL || !dev->focus)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceFocus;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
focus = dev->focus;
|
||||
|
||||
if (focus->win == NoneWin)
|
||||
rep.focus = None;
|
||||
else if (focus->win == PointerRootWin)
|
||||
rep.focus = PointerRoot;
|
||||
else if (focus->win == FollowKeyboardWin)
|
||||
rep.focus = FollowKeyboard;
|
||||
else
|
||||
rep.focus = focus->win->drawable.id;
|
||||
|
||||
rep.time = focus->time.milliseconds;
|
||||
rep.revertTo = focus->revert;
|
||||
WriteReplyToClient (client, sizeof(xGetDeviceFocusReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the GetDeviceFocus function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetDeviceFocus (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetDeviceFocusReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swapl(&rep->focus, n);
|
||||
swapl(&rep->time, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
171
Xi/getkmap.c
Normal file
171
Xi/getkmap.c
Normal file
|
@ -0,0 +1,171 @@
|
|||
/* $Xorg: getkmap.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Get the key mapping for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the key mapping for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceKeyMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetDeviceKeyMappingReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXGetDeviceKeyMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the device key mapping.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXGetDeviceKeyMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
extern void CopySwap32Write();
|
||||
xGetDeviceKeyMappingReply rep;
|
||||
DeviceIntPtr dev;
|
||||
KeySymsPtr k;
|
||||
|
||||
REQUEST(xGetDeviceKeyMappingReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (dev->key == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
k = &dev->key->curKeySyms;
|
||||
|
||||
if ((stuff->firstKeyCode < k->minKeyCode) ||
|
||||
(stuff->firstKeyCode > k->maxKeyCode))
|
||||
{
|
||||
client->errorValue = stuff->firstKeyCode;
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1)
|
||||
{
|
||||
client->errorValue = stuff->count;
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceKeyMapping, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceKeyMapping;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.keySymsPerKeyCode = k->mapWidth;
|
||||
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
|
||||
|
||||
client->pSwapReplyFunc = CopySwap32Write;
|
||||
WriteSwappedDataToClient(
|
||||
client,
|
||||
k->mapWidth * stuff->count * sizeof(KeySym),
|
||||
&k->map[(stuff->firstKeyCode - k->minKeyCode) *
|
||||
k->mapWidth]);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetDeviceKeyMapping function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetDeviceKeyMapping (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetDeviceKeyMappingReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
151
Xi/getmmap.c
Normal file
151
Xi/getmmap.c
Normal file
|
@ -0,0 +1,151 @@
|
|||
/* $Xorg: getmmap.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Get the modifier mapping for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h" /* Request macro */
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the modifier mapping for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceModifierMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetDeviceModifierMappingReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXGetDeviceModifierMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the device Modifier mapping.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXGetDeviceModifierMapping(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
CARD8 maxkeys;
|
||||
DeviceIntPtr dev;
|
||||
xGetDeviceModifierMappingReply rep;
|
||||
KeyClassPtr kp;
|
||||
|
||||
REQUEST(xGetDeviceModifierMappingReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
kp = dev->key;
|
||||
if (kp == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GetDeviceModifierMapping, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
maxkeys = kp->maxKeysPerModifier;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceModifierMapping;
|
||||
rep.numKeyPerModifier = maxkeys;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
|
||||
rep.length = 2*maxkeys;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
|
||||
|
||||
/* Reply with the (modified by DDX) map that SetModifierMapping passed in */
|
||||
WriteToClient(client, 8*maxkeys, (char *)kp->modifierKeyMap);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetDeviceModifierMapping function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetDeviceModifierMapping (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetDeviceModifierMappingReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
207
Xi/getprop.c
Normal file
207
Xi/getprop.c
Normal file
|
@ -0,0 +1,207 @@
|
|||
/* $Xorg: getprop.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Function to return the dont-propagate-list for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structs */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
extern XExtEventInfo EventInfo[];
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle a request from a client with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceDontPropagateList(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetDeviceDontPropagateListReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
|
||||
swapl(&stuff->window, n);
|
||||
return(ProcXGetDeviceDontPropagateList(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXGetDeviceDontPropagateList (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
CARD16 count = 0;
|
||||
int i;
|
||||
XEventClass *buf, *tbuf;
|
||||
WindowPtr pWin;
|
||||
xGetDeviceDontPropagateListReply rep;
|
||||
XEventClass *ClassFromMask ();
|
||||
void Swap32Write();
|
||||
OtherInputMasks *others;
|
||||
|
||||
REQUEST(xGetDeviceDontPropagateListReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceDontPropagateList;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = 0;
|
||||
rep.count = 0;
|
||||
|
||||
pWin = (WindowPtr) LookupWindow (stuff->window, client);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
|
||||
BadWindow);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (others = wOtherInputMasks(pWin))
|
||||
{
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i,
|
||||
&count, COUNT);
|
||||
if (count)
|
||||
{
|
||||
rep.count = count;
|
||||
buf = (XEventClass *) Xalloc (rep.count * sizeof(XEventClass));
|
||||
rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2;
|
||||
|
||||
tbuf = buf;
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
tbuf = ClassFromMask (tbuf, others->dontPropagateMask[i], i,
|
||||
NULL, CREATE);
|
||||
}
|
||||
}
|
||||
|
||||
WriteReplyToClient (client, sizeof (xGetDeviceDontPropagateListReply),
|
||||
&rep);
|
||||
|
||||
if (count)
|
||||
{
|
||||
client->pSwapReplyFunc = Swap32Write;
|
||||
WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
|
||||
Xfree (buf);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets a list of event classes from a mask word.
|
||||
* A single mask may translate to more than one event class.
|
||||
*
|
||||
*/
|
||||
|
||||
XEventClass
|
||||
*ClassFromMask (buf, mask, maskndx, count, mode)
|
||||
XEventClass *buf;
|
||||
Mask mask;
|
||||
int maskndx;
|
||||
CARD16 *count;
|
||||
int mode;
|
||||
{
|
||||
int i,j;
|
||||
int id = maskndx;
|
||||
Mask tmask = 0x80000000;
|
||||
extern int ExtEventIndex;
|
||||
|
||||
for (i=0; i<32; i++,tmask>>=1)
|
||||
if (tmask & mask)
|
||||
{
|
||||
for (j=0; j<ExtEventIndex; j++)
|
||||
if (EventInfo[j].mask == tmask)
|
||||
{
|
||||
if (mode == COUNT)
|
||||
(*count)++;
|
||||
else
|
||||
*buf++ = (id << 8) | EventInfo[j].type;
|
||||
}
|
||||
}
|
||||
return (buf);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetDeviceDontPropagateList function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetDeviceDontPropagateList (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetDeviceDontPropagateListReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swaps(&rep->count, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
189
Xi/getselev.c
Normal file
189
Xi/getselev.c
Normal file
|
@ -0,0 +1,189 @@
|
|||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/* $Xorg: getselev.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to get the current selected events for a given window.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window struct */
|
||||
|
||||
extern int IReqCode;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the current selected extension events.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetSelectedExtensionEvents(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetSelectedExtensionEventsReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
|
||||
swapl(&stuff->window, n);
|
||||
return(ProcXGetSelectedExtensionEvents(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the current device select mask,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXGetSelectedExtensionEvents(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int i;
|
||||
int total_length = 0;
|
||||
xGetSelectedExtensionEventsReply rep;
|
||||
WindowPtr pWin;
|
||||
XEventClass *buf;
|
||||
XEventClass *tclient;
|
||||
XEventClass *aclient;
|
||||
XEventClass *ClassFromMask ();
|
||||
void Swap32Write();
|
||||
OtherInputMasks *pOthers;
|
||||
InputClientsPtr others;
|
||||
|
||||
REQUEST(xGetSelectedExtensionEventsReq);
|
||||
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetSelectedExtensionEvents;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.this_client_count = 0;
|
||||
rep.all_clients_count = 0;
|
||||
|
||||
if (!(pWin = LookupWindow(stuff->window, client)))
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
|
||||
BadWindow);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (pOthers=wOtherInputMasks(pWin))
|
||||
{
|
||||
for (others = pOthers->inputClients; others; others=others->next)
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
tclient = ClassFromMask (NULL, others->mask[i], i,
|
||||
&rep.all_clients_count, COUNT);
|
||||
|
||||
for (others = pOthers->inputClients; others; others=others->next)
|
||||
if (SameClient(others, client))
|
||||
{
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
tclient = ClassFromMask (NULL, others->mask[i], i,
|
||||
&rep.this_client_count, COUNT);
|
||||
break;
|
||||
}
|
||||
|
||||
total_length = (rep.all_clients_count + rep.this_client_count) *
|
||||
sizeof (XEventClass);
|
||||
rep.length = (total_length + 3) >> 2;
|
||||
buf = (XEventClass *) Xalloc (total_length);
|
||||
|
||||
tclient = buf;
|
||||
aclient = buf + rep.this_client_count;
|
||||
if (others)
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
tclient = ClassFromMask (tclient, others->mask[i], i, NULL, CREATE);
|
||||
|
||||
for (others = pOthers->inputClients; others; others=others->next)
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
aclient = ClassFromMask (aclient, others->mask[i], i, NULL, CREATE);
|
||||
}
|
||||
|
||||
WriteReplyToClient (client, sizeof(xGetSelectedExtensionEventsReply), &rep);
|
||||
|
||||
if (total_length)
|
||||
{
|
||||
client->pSwapReplyFunc = Swap32Write;
|
||||
WriteSwappedDataToClient( client, total_length, buf);
|
||||
Xfree (buf);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetSelectedExtensionEvents function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetSelectedExtensionEvents (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetSelectedExtensionEventsReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swaps(&rep->this_client_count, n);
|
||||
swaps(&rep->all_clients_count, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
148
Xi/getvers.c
Normal file
148
Xi/getvers.c
Normal file
|
@ -0,0 +1,148 @@
|
|||
/* $Xorg: getvers.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to return the version of the extension.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
XExtensionVersion AllExtensionVersions[128];
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle a request from a client with a different byte order than us.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetExtensionVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetExtensionVersionReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
|
||||
swaps(&stuff->nbytes, n);
|
||||
return(ProcXGetExtensionVersion(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXGetExtensionVersion (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
xGetExtensionVersionReply rep;
|
||||
|
||||
REQUEST(xGetExtensionVersionReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
|
||||
|
||||
if (stuff->length != (sizeof(xGetExtensionVersionReq) +
|
||||
stuff->nbytes + 3)>>2)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetExtensionVersion;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.major_version = 0;
|
||||
rep.minor_version = 0;
|
||||
|
||||
rep.present = TRUE;
|
||||
if (rep.present)
|
||||
{
|
||||
rep.major_version =
|
||||
AllExtensionVersions[IReqCode-128].major_version;
|
||||
rep.minor_version =
|
||||
AllExtensionVersions[IReqCode-128].minor_version;
|
||||
}
|
||||
WriteReplyToClient (client, sizeof (xGetExtensionVersionReply), &rep);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetExtensionVersion function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetExtensionVersion (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetExtensionVersionReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swaps(&rep->major_version, n);
|
||||
swaps(&rep->minor_version, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
225
Xi/grabdev.c
Normal file
225
Xi/grabdev.c
Normal file
|
@ -0,0 +1,225 @@
|
|||
/* $Xorg: grabdev.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to grab an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern int BadClass;
|
||||
extern XExtEventInfo EventInfo[];
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Swap the request if the requestor has a different byte order than us.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGrabDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
register int i;
|
||||
|
||||
REQUEST(xGrabDeviceReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
|
||||
swapl(&stuff->grabWindow, n);
|
||||
swapl(&stuff->time, n);
|
||||
swaps(&stuff->event_count, n);
|
||||
p = (long *) &stuff[1];
|
||||
for (i=0; i<stuff->event_count; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
|
||||
return(ProcXGrabDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Grab an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXGrabDevice(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int error;
|
||||
xGrabDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
||||
REQUEST(xGrabDeviceReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
|
||||
|
||||
if (stuff->length !=(sizeof(xGrabDeviceReq)>>2) + stuff->event_count)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GrabDevice, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GrabDevice;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = 0;
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (CreateMaskFromList (client, (XEventClass *)&stuff[1],
|
||||
stuff->event_count, tmp, dev, X_GrabDevice) != Success)
|
||||
return Success;
|
||||
|
||||
error = GrabDevice (client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->grabWindow, stuff->ownerEvents,
|
||||
stuff->time, tmp[stuff->deviceid].mask, &rep.status);
|
||||
|
||||
if (error != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error);
|
||||
return Success;
|
||||
}
|
||||
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure creates an event mask from a list of XEventClasses.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
CreateMaskFromList (client, list, count, mask, dev, req)
|
||||
ClientPtr client;
|
||||
XEventClass *list;
|
||||
int count;
|
||||
struct tmask mask[];
|
||||
DeviceIntPtr dev;
|
||||
int req;
|
||||
{
|
||||
int i,j;
|
||||
int device;
|
||||
DeviceIntPtr tdev;
|
||||
extern int ExtEventIndex;
|
||||
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
{
|
||||
mask[i].mask = 0;
|
||||
mask[i].dev = NULL;
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++, list++)
|
||||
{
|
||||
device = *list >> 8;
|
||||
if (device > 255)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, req, 0, BadClass);
|
||||
return BadClass;
|
||||
}
|
||||
tdev = LookupDeviceIntRec (device);
|
||||
if (tdev==NULL || (dev != NULL && tdev != dev))
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, req, 0, BadClass);
|
||||
return BadClass;
|
||||
}
|
||||
|
||||
for (j=0; j<ExtEventIndex; j++)
|
||||
if (EventInfo[j].type == (*list & 0xff))
|
||||
{
|
||||
mask[device].mask |= EventInfo[j].mask;
|
||||
mask[device].dev = (Pointer) tdev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGrabDevice function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGrabDevice (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGrabDeviceReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
163
Xi/grabdevb.c
Normal file
163
Xi/grabdevb.c
Normal file
|
@ -0,0 +1,163 @@
|
|||
/* $Xorg: grabdevb.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to grab a button on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from clients with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGrabDeviceButton(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
register int i;
|
||||
|
||||
REQUEST(xGrabDeviceButtonReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
|
||||
swapl(&stuff->grabWindow, n);
|
||||
swaps(&stuff->modifiers, n);
|
||||
swaps(&stuff->event_count, n);
|
||||
p = (long *) &stuff[1];
|
||||
for (i=0; i<stuff->event_count; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
|
||||
return(ProcXGrabDeviceButton(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Grab a button on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXGrabDeviceButton(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
DeviceIntPtr dev;
|
||||
DeviceIntPtr mdev;
|
||||
XEventClass *class;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
||||
REQUEST(xGrabDeviceButtonReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
|
||||
|
||||
if (stuff->length !=(sizeof(xGrabDeviceButtonReq)>>2) + stuff->event_count)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GrabDeviceButton, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->grabbed_device);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (stuff->modifier_device != UseXKeyboard)
|
||||
{
|
||||
mdev = LookupDeviceIntRec (stuff->modifier_device);
|
||||
if (mdev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
class = (XEventClass *) (&stuff[1]); /* first word of values */
|
||||
|
||||
if ((ret = CreateMaskFromList (client, class,
|
||||
stuff->event_count, tmp, dev, X_GrabDeviceButton)) != Success)
|
||||
return Success;
|
||||
ret = GrabButton(client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button,
|
||||
stuff->grabWindow, stuff->ownerEvents, NullCursor, NullWindow,
|
||||
tmp[stuff->grabbed_device].mask);
|
||||
|
||||
if (ret != Success)
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret);
|
||||
return(Success);
|
||||
}
|
169
Xi/grabdevk.c
Normal file
169
Xi/grabdevk.c
Normal file
|
@ -0,0 +1,169 @@
|
|||
/* $Xorg: grabdevk.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to grab a key on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadClass;
|
||||
extern int BadDevice;
|
||||
extern InputInfo inputInfo;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from clients with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGrabDeviceKey(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
register int i;
|
||||
|
||||
REQUEST(xGrabDeviceKeyReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
|
||||
swapl(&stuff->grabWindow, n);
|
||||
swaps(&stuff->modifiers, n);
|
||||
swaps(&stuff->event_count, n);
|
||||
p = (long *) &stuff[1];
|
||||
for (i=0; i<stuff->event_count; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
return(ProcXGrabDeviceKey(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Grab a key on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXGrabDeviceKey(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
DeviceIntPtr dev;
|
||||
DeviceIntPtr mdev;
|
||||
XEventClass *class;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
||||
REQUEST(xGrabDeviceKeyReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
|
||||
|
||||
if (stuff->length !=(sizeof(xGrabDeviceKeyReq)>>2) + stuff->event_count)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_GrabDeviceKey, 0, BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->grabbed_device);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (stuff->modifier_device != UseXKeyboard)
|
||||
{
|
||||
mdev = LookupDeviceIntRec (stuff->modifier_device);
|
||||
if (mdev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
class = (XEventClass *) (&stuff[1]); /* first word of values */
|
||||
|
||||
if ((ret = CreateMaskFromList (client, class,
|
||||
stuff->event_count, tmp, dev, X_GrabDeviceKey)) != Success)
|
||||
return Success;
|
||||
|
||||
ret = GrabKey(client, dev, stuff->this_device_mode,
|
||||
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->key,
|
||||
stuff->grabWindow, stuff->ownerEvents, tmp[stuff->grabbed_device].mask);
|
||||
|
||||
if (ret != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret);
|
||||
return Success;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
206
Xi/gtmotion.c
Normal file
206
Xi/gtmotion.c
Normal file
|
@ -0,0 +1,206 @@
|
|||
/* $Xorg: gtmotion.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to get the motion history from an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Swap the request if server and client have different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceMotionEvents(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xGetDeviceMotionEventsReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
|
||||
swapl(&stuff->start, n);
|
||||
swapl(&stuff->stop, n);
|
||||
return(ProcXGetDeviceMotionEvents(client));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Get the motion history for an extension pointer devices.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXGetDeviceMotionEvents(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
INT32 *coords = NULL, *bufptr;
|
||||
xGetDeviceMotionEventsReply rep;
|
||||
int i, j, num_events, axes, size, tsize;
|
||||
unsigned long nEvents;
|
||||
DeviceIntPtr dev;
|
||||
TimeStamp start, stop;
|
||||
void XSwapTimeCoordWrite();
|
||||
int length = 0;
|
||||
ValuatorClassPtr v;
|
||||
|
||||
REQUEST(xGetDeviceMotionEventsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
v = dev->valuator;
|
||||
if (v==NULL || v->numAxes == 0)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if (dev->valuator->motionHintWindow)
|
||||
MaybeStopDeviceHint(dev, client);
|
||||
axes = v->numAxes;
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_GetDeviceMotionEvents;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.nEvents = 0;
|
||||
rep.axes = axes;
|
||||
rep.mode = v->mode & DeviceMode;
|
||||
rep.length = 0;
|
||||
start = ClientTimeToServerTime(stuff->start);
|
||||
stop = ClientTimeToServerTime(stuff->stop);
|
||||
if (CompareTimeStamps(start, stop) == LATER ||
|
||||
CompareTimeStamps(start, currentTime) == LATER)
|
||||
{
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
if (CompareTimeStamps(stop, currentTime) == LATER)
|
||||
stop = currentTime;
|
||||
num_events = v->numMotionEvents;
|
||||
if (num_events)
|
||||
{
|
||||
size = sizeof(Time) + (axes * sizeof (INT32));
|
||||
tsize = num_events * size;
|
||||
coords = (INT32 *) ALLOCATE_LOCAL(tsize);
|
||||
if (!coords)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0,
|
||||
BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
rep.nEvents = (v->GetMotionProc) (
|
||||
dev, (xTimecoord *)coords, /* XXX */
|
||||
start.milliseconds, stop.milliseconds, (ScreenPtr)NULL);
|
||||
}
|
||||
if (rep.nEvents > 0)
|
||||
{
|
||||
length = (rep.nEvents * size +3) >> 2;
|
||||
rep.length = length;
|
||||
}
|
||||
nEvents = rep.nEvents;
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
|
||||
if (nEvents)
|
||||
{
|
||||
if (client->swapped)
|
||||
{
|
||||
register char n;
|
||||
|
||||
bufptr = coords;
|
||||
for (i=0; i<nEvents * (axes+1); i++)
|
||||
{
|
||||
swapl(bufptr, n);
|
||||
bufptr++;
|
||||
}
|
||||
}
|
||||
WriteToClient(client, length * 4, (char *)coords);
|
||||
}
|
||||
if (coords)
|
||||
DEALLOCATE_LOCAL(coords);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XGetDeviceMotionEvents function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXGetDeviceMotionEvents (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xGetDeviceMotionEventsReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swapl(&rep->nEvents, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
409
Xi/listdev.c
Normal file
409
Xi/listdev.c
Normal file
|
@ -0,0 +1,409 @@
|
|||
/* $Xorg: listdev.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Extension function to list the available input devices.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
#define VPC 20 /* Max # valuators per chunk */
|
||||
extern InputInfo inputInfo;
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (*ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
void CopySwapKeyClass ();
|
||||
void CopySwapButtonClass ();
|
||||
int CopySwapValuatorClass ();
|
||||
void SizeDeviceInfo ();
|
||||
void ListDeviceInfo ();
|
||||
void AddOtherInputDevices ();
|
||||
void CopyDeviceName ();
|
||||
void CopySwapDevice ();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXListInputDevices(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xListInputDevicesReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXListInputDevices(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXListInputDevices (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
xListInputDevicesReply rep;
|
||||
int numdevs;
|
||||
int namesize = 1; /* need 1 extra byte for strcpy */
|
||||
int size = 0;
|
||||
int total_length;
|
||||
char *devbuf;
|
||||
char *classbuf;
|
||||
char *namebuf;
|
||||
char *savbuf;
|
||||
xDeviceInfo *dev;
|
||||
DeviceIntPtr d;
|
||||
|
||||
REQUEST(xListInputDevicesReq);
|
||||
REQUEST_SIZE_MATCH(xListInputDevicesReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_ListInputDevices;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
AddOtherInputDevices ();
|
||||
numdevs = inputInfo.numDevices;
|
||||
|
||||
for (d=inputInfo.devices; d; d=d->next)
|
||||
SizeDeviceInfo (d, &namesize, &size);
|
||||
for (d=inputInfo.off_devices; d; d=d->next)
|
||||
SizeDeviceInfo (d, &namesize, &size);
|
||||
|
||||
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
|
||||
devbuf = (char *) Xalloc (total_length);
|
||||
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
|
||||
namebuf = classbuf + size;
|
||||
savbuf = devbuf;
|
||||
|
||||
dev = (xDeviceInfoPtr) devbuf;
|
||||
for (d=inputInfo.devices; d; d=d->next,dev++)
|
||||
ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf);
|
||||
for (d=inputInfo.off_devices; d; d=d->next,dev++)
|
||||
ListDeviceInfo (client, d, dev, &devbuf, &classbuf, &namebuf);
|
||||
|
||||
rep.ndevices = numdevs;
|
||||
rep.length = (total_length + 3) >> 2;
|
||||
WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep);
|
||||
WriteToClient(client, total_length, savbuf);
|
||||
Xfree (savbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure calculates the size of the information to be returned
|
||||
* for an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
SizeDeviceInfo (d, namesize, size)
|
||||
DeviceIntPtr d;
|
||||
int *namesize;
|
||||
int *size;
|
||||
{
|
||||
int chunks;
|
||||
|
||||
*namesize += 1;
|
||||
if (d->name)
|
||||
*namesize += strlen (d->name);
|
||||
if (d->key != NULL)
|
||||
*size += sizeof (xKeyInfo);
|
||||
if (d->button != NULL)
|
||||
*size += sizeof (xButtonInfo);
|
||||
if (d->valuator != NULL)
|
||||
{
|
||||
chunks = ((int) d->valuator->numAxes + 19) / VPC;
|
||||
*size += (chunks * sizeof(xValuatorInfo) +
|
||||
d->valuator->numAxes * sizeof(xAxisInfo));
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists information to be returned for an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
ListDeviceInfo (client, d, dev, devbuf, classbuf, namebuf)
|
||||
ClientPtr client;
|
||||
DeviceIntPtr d;
|
||||
xDeviceInfoPtr dev;
|
||||
char **devbuf;
|
||||
char **classbuf;
|
||||
char **namebuf;
|
||||
{
|
||||
CopyDeviceName (namebuf, d->name);
|
||||
CopySwapDevice (client, d, 0, devbuf);
|
||||
if (d->key != NULL)
|
||||
{
|
||||
CopySwapKeyClass(client, d->key, classbuf);
|
||||
dev->num_classes++;
|
||||
}
|
||||
if (d->button != NULL)
|
||||
{
|
||||
CopySwapButtonClass(client, d->button, classbuf);
|
||||
dev->num_classes++;
|
||||
}
|
||||
if (d->valuator != NULL)
|
||||
{
|
||||
dev->num_classes += CopySwapValuatorClass(client, d->valuator, classbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
||||
*
|
||||
* We need the extra byte in the allocated buffer, because the trailing null
|
||||
* hammers one extra byte, which is overwritten by the next name except for
|
||||
* the last name copied.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopyDeviceName (namebuf, name)
|
||||
char **namebuf;
|
||||
char *name;
|
||||
{
|
||||
char *nameptr = (char *) *namebuf;
|
||||
|
||||
if (name)
|
||||
{
|
||||
*nameptr++ = strlen (name);
|
||||
strcpy (nameptr, name);
|
||||
*namebuf += (strlen (name)+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
*nameptr++ = 0;
|
||||
*namebuf += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapDevice (client, d, num_classes, buf)
|
||||
register ClientPtr client;
|
||||
DeviceIntPtr d;
|
||||
int num_classes;
|
||||
char **buf;
|
||||
{
|
||||
register char n;
|
||||
xDeviceInfoPtr dev;
|
||||
|
||||
dev = (xDeviceInfoPtr) *buf;
|
||||
|
||||
dev->id = d->id;
|
||||
dev->type = d->type;
|
||||
dev->num_classes = num_classes;
|
||||
if (d == inputInfo.keyboard)
|
||||
dev->use = IsXKeyboard;
|
||||
else if (d == inputInfo.pointer)
|
||||
dev->use = IsXPointer;
|
||||
else
|
||||
dev->use = IsXExtensionDevice;
|
||||
if (client->swapped)
|
||||
{
|
||||
swapl(&dev->type, n); /* macro - braces are required */
|
||||
}
|
||||
*buf += sizeof (xDeviceInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies KeyClass information, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapKeyClass (client, k, buf)
|
||||
register ClientPtr client;
|
||||
KeyClassPtr k;
|
||||
char **buf;
|
||||
{
|
||||
register char n;
|
||||
xKeyInfoPtr k2;
|
||||
|
||||
k2 = (xKeyInfoPtr) *buf;
|
||||
k2->class = KeyClass;
|
||||
k2->length = sizeof (xKeyInfo);
|
||||
k2->min_keycode = k->curKeySyms.minKeyCode;
|
||||
k2->max_keycode = k->curKeySyms.maxKeyCode;
|
||||
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&k2->num_keys,n);
|
||||
}
|
||||
*buf += sizeof (xKeyInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies ButtonClass information, swapping if necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CopySwapButtonClass (client, b, buf)
|
||||
register ClientPtr client;
|
||||
ButtonClassPtr b;
|
||||
char **buf;
|
||||
{
|
||||
register char n;
|
||||
xButtonInfoPtr b2;
|
||||
|
||||
b2 = (xButtonInfoPtr) *buf;
|
||||
b2->class = ButtonClass;
|
||||
b2->length = sizeof (xButtonInfo);
|
||||
b2->num_buttons = b->numButtons;
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps(&b2->num_buttons,n); /* macro - braces are required */
|
||||
}
|
||||
*buf += sizeof (xButtonInfo);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies ValuatorClass information, swapping if necessary.
|
||||
*
|
||||
* Devices may have up to 255 valuators. The length of a ValuatorClass is
|
||||
* defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
|
||||
* The maximum length is therefore (8 + 255 * 12) = 3068. However, the
|
||||
* length field is one byte. If a device has more than 20 valuators, we
|
||||
* must therefore return multiple valuator classes to the client.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
CopySwapValuatorClass (client, v, buf)
|
||||
register ClientPtr client;
|
||||
ValuatorClassPtr v;
|
||||
char **buf;
|
||||
{
|
||||
int i, j, axes, t_axes;
|
||||
register char n;
|
||||
xValuatorInfoPtr v2;
|
||||
AxisInfo *a;
|
||||
xAxisInfoPtr a2;
|
||||
|
||||
for (i=0,axes=v->numAxes; i < ((v->numAxes+19)/VPC); i++, axes-=VPC) {
|
||||
t_axes = axes < VPC ? axes : VPC;
|
||||
if (t_axes < 0)
|
||||
t_axes = v->numAxes % VPC;
|
||||
v2 = (xValuatorInfoPtr) *buf;
|
||||
v2->class = ValuatorClass;
|
||||
v2->length = sizeof (xValuatorInfo) + t_axes * sizeof (xAxisInfo);
|
||||
v2->num_axes = t_axes;
|
||||
v2->mode = v->mode & DeviceMode;
|
||||
v2->motion_buffer_size = v->numMotionEvents;
|
||||
if (client->swapped)
|
||||
{
|
||||
swapl(&v2->motion_buffer_size,n);
|
||||
}
|
||||
*buf += sizeof (xValuatorInfo);
|
||||
a = v->axes + (VPC * i);
|
||||
a2 = (xAxisInfoPtr) *buf;
|
||||
for (j=0; j<t_axes; j++) {
|
||||
a2->min_value = a->min_value;
|
||||
a2->max_value = a->max_value;
|
||||
a2->resolution = a->resolution;
|
||||
if (client->swapped) {
|
||||
swapl(&a2->min_value,n);
|
||||
swapl(&a2->max_value,n);
|
||||
swapl(&a2->resolution,n);
|
||||
}
|
||||
a2++;
|
||||
a++;
|
||||
*buf += sizeof (xAxisInfo);
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XListInputDevices function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXListInputDevices (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xListInputDevicesReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
199
Xi/opendev.c
Normal file
199
Xi/opendev.c
Normal file
|
@ -0,0 +1,199 @@
|
|||
/* $Xorg: opendev.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to open an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern CARD8 event_base [];
|
||||
extern InputInfo inputInfo;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure swaps the request if the server and client have different
|
||||
* byte orderings.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXOpenDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xOpenDeviceReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXOpenDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure causes the server to open an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXOpenDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
xInputClassInfo evbase [numInputClasses];
|
||||
Bool enableit = FALSE;
|
||||
int j=0;
|
||||
int status = Success;
|
||||
xOpenDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
void OpenInputDevice();
|
||||
|
||||
REQUEST(xOpenDeviceReq);
|
||||
REQUEST_SIZE_MATCH(xOpenDeviceReq);
|
||||
|
||||
if (stuff->deviceid == inputInfo.pointer->id ||
|
||||
stuff->deviceid == inputInfo.keyboard->id)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) /* not open */
|
||||
{
|
||||
for (dev=inputInfo.off_devices; dev; dev=dev->next)
|
||||
if (dev->id == stuff->deviceid)
|
||||
break;
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
enableit = TRUE;
|
||||
}
|
||||
|
||||
OpenInputDevice (dev, client, &status);
|
||||
if (status != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status);
|
||||
return Success;
|
||||
}
|
||||
if (enableit && dev->inited && dev->startup)
|
||||
(void)EnableDevice(dev);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_OpenDevice;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
if (dev->key != NULL)
|
||||
{
|
||||
evbase[j].class = KeyClass;
|
||||
evbase[j++].event_type_base = event_base[KeyClass];
|
||||
}
|
||||
if (dev->button != NULL)
|
||||
{
|
||||
evbase[j].class = ButtonClass;
|
||||
evbase[j++].event_type_base = event_base[ButtonClass];
|
||||
}
|
||||
if (dev->valuator != NULL)
|
||||
{
|
||||
evbase[j].class = ValuatorClass;
|
||||
evbase[j++].event_type_base = event_base[ValuatorClass];
|
||||
}
|
||||
if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL ||
|
||||
dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL)
|
||||
{
|
||||
evbase[j].class = FeedbackClass;
|
||||
evbase[j++].event_type_base = event_base[FeedbackClass];
|
||||
}
|
||||
if (dev->focus != NULL)
|
||||
{
|
||||
evbase[j].class = FocusClass;
|
||||
evbase[j++].event_type_base = event_base[FocusClass];
|
||||
}
|
||||
if (dev->proximity != NULL)
|
||||
{
|
||||
evbase[j].class = ProximityClass;
|
||||
evbase[j++].event_type_base = event_base[ProximityClass];
|
||||
}
|
||||
evbase[j].class = OtherClass;
|
||||
evbase[j++].event_type_base = event_base[OtherClass];
|
||||
rep.length = (j * sizeof (xInputClassInfo) + 3) >> 2;
|
||||
rep.num_classes = j;
|
||||
WriteReplyToClient (client, sizeof (xOpenDeviceReply), &rep);
|
||||
WriteToClient(client, j * sizeof (xInputClassInfo), (char *)evbase);
|
||||
return (Success);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XOpenDevice function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXOpenDevice (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xOpenDeviceReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
208
Xi/queryst.c
Normal file
208
Xi/queryst.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
/* $Xorg: queryst.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1998, 1998 The Open Group
|
||||
|
||||
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 OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to query the state of an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to query the state of a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXQueryDeviceState(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xQueryDeviceStateReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXQueryDeviceState(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows frozen events to be routed.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXQueryDeviceState(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
int i;
|
||||
int num_classes = 0;
|
||||
int total_length = 0;
|
||||
char *buf, *savbuf;
|
||||
KeyClassPtr k;
|
||||
xKeyState *tk;
|
||||
ButtonClassPtr b;
|
||||
xButtonState *tb;
|
||||
ValuatorClassPtr v;
|
||||
xValuatorState *tv;
|
||||
xQueryDeviceStateReply rep;
|
||||
DeviceIntPtr dev;
|
||||
int *values;
|
||||
|
||||
REQUEST(xQueryDeviceStateReq);
|
||||
REQUEST_SIZE_MATCH(xQueryDeviceStateReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_QueryDeviceState;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
v = dev->valuator;
|
||||
if (v != NULL && v->motionHintWindow != NULL)
|
||||
MaybeStopDeviceHint(dev, client);
|
||||
|
||||
k = dev->key;
|
||||
if (k != NULL)
|
||||
{
|
||||
total_length += sizeof (xKeyState);
|
||||
num_classes++;
|
||||
}
|
||||
|
||||
b = dev->button;
|
||||
if (b != NULL)
|
||||
{
|
||||
total_length += sizeof (xButtonState);
|
||||
num_classes++;
|
||||
}
|
||||
|
||||
if (v != NULL)
|
||||
{
|
||||
total_length += (sizeof(xValuatorState) +
|
||||
(v->numAxes * sizeof(int)));
|
||||
num_classes++;
|
||||
}
|
||||
buf = (char *) Xalloc (total_length);
|
||||
if (!buf)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
|
||||
BadAlloc);
|
||||
return Success;
|
||||
}
|
||||
savbuf = buf;
|
||||
|
||||
if (k != NULL)
|
||||
{
|
||||
tk = (xKeyState *) buf;
|
||||
tk->class = KeyClass;
|
||||
tk->length = sizeof (xKeyState);
|
||||
tk->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1;
|
||||
for (i = 0; i<32; i++)
|
||||
tk->keys[i] = k->down[i];
|
||||
buf += sizeof (xKeyState);
|
||||
}
|
||||
|
||||
if (b != NULL)
|
||||
{
|
||||
tb = (xButtonState *) buf;
|
||||
tb->class = ButtonClass;
|
||||
tb->length = sizeof (xButtonState);
|
||||
tb->num_buttons = b->numButtons;
|
||||
for (i = 0; i<32; i++)
|
||||
tb->buttons[i] = b->down[i];
|
||||
buf += sizeof (xButtonState);
|
||||
}
|
||||
|
||||
if (v != NULL)
|
||||
{
|
||||
tv = (xValuatorState *) buf;
|
||||
tv->class = ValuatorClass;
|
||||
tv->length = sizeof (xValuatorState);
|
||||
tv->num_valuators = v->numAxes;
|
||||
tv->mode = v->mode;
|
||||
buf += sizeof(xValuatorState);
|
||||
for (i=0, values=v->axisVal; i<v->numAxes; i++)
|
||||
{
|
||||
*((int *) buf) = *values++;
|
||||
if (client->swapped)
|
||||
{
|
||||
swapl ((int *) buf, n);/* macro - braces needed */
|
||||
}
|
||||
buf += sizeof(int);
|
||||
}
|
||||
}
|
||||
|
||||
rep.num_classes = num_classes;
|
||||
rep.length = (total_length + 3) >> 2;
|
||||
WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep);
|
||||
if (total_length > 0)
|
||||
WriteToClient (client, total_length, savbuf);
|
||||
Xfree (savbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XQueryDeviceState function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXQueryDeviceState (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xQueryDeviceStateReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
150
Xi/selectev.c
Normal file
150
Xi/selectev.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* $Xorg: selectev.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to select input from an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern Mask ExtExclusiveMasks[];
|
||||
extern Mask ExtValidMasks[];
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from clients with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSelectExtensionEvent (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
register int i;
|
||||
|
||||
REQUEST(xSelectExtensionEventReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||
swapl(&stuff->window, n);
|
||||
swaps(&stuff->count, n);
|
||||
p = (long *) &stuff[1];
|
||||
for (i=0; i<stuff->count; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
return(ProcXSelectExtensionEvent(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure selects input from an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXSelectExtensionEvent (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
WindowPtr pWin;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
||||
REQUEST(xSelectExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||
|
||||
if (stuff->length !=(sizeof(xSelectExtensionEventReq)>>2) + stuff->count)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_SelectExtensionEvent, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
pWin = (WindowPtr) LookupWindow (stuff->window, client);
|
||||
if (!pWin)
|
||||
{
|
||||
client->errorValue = stuff->window;
|
||||
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
|
||||
BadWindow);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if ((ret = CreateMaskFromList (client, (XEventClass *)&stuff[1],
|
||||
stuff->count, tmp, NULL, X_SelectExtensionEvent)) != Success)
|
||||
return Success;
|
||||
|
||||
for (i=0; i<EMASKSIZE; i++)
|
||||
if (tmp[i].dev != NULL)
|
||||
{
|
||||
if ((ret = SelectForWindow(tmp[i].dev, pWin, client, tmp[i].mask,
|
||||
ExtExclusiveMasks[i], ExtValidMasks[i])) != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
|
||||
ret);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
173
Xi/sendexev.c
Normal file
173
Xi/sendexev.c
Normal file
|
@ -0,0 +1,173 @@
|
|||
/* $Xorg: sendexev.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to send an extension event.
|
||||
*
|
||||
*/
|
||||
|
||||
#define EXTENSION_EVENT_BASE 64
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* Window */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
extern void (* EventSwapVector[128]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from clients with a different byte order than us.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSendExtensionEvent(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
register long *p;
|
||||
register int i;
|
||||
xEvent eventT;
|
||||
xEvent *eventP;
|
||||
void (*proc)(), NotImplemented();
|
||||
|
||||
REQUEST(xSendExtensionEventReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
swapl(&stuff->destination, n);
|
||||
swaps(&stuff->count, n);
|
||||
eventP = (xEvent *) &stuff[1];
|
||||
for (i=0; i<stuff->num_events; i++,eventP++)
|
||||
{
|
||||
proc = EventSwapVector[eventP->u.u.type & 0177];
|
||||
if (proc == NotImplemented) /* no swapping proc; invalid event type? */
|
||||
return (BadValue);
|
||||
(*proc)(eventP, &eventT);
|
||||
*eventP = eventT;
|
||||
}
|
||||
|
||||
p = (long *) (((xEvent *) &stuff[1]) + stuff->num_events);
|
||||
for (i=0; i<stuff->count; i++)
|
||||
{
|
||||
swapl(p, n);
|
||||
p++;
|
||||
}
|
||||
return(ProcXSendExtensionEvent(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Send an event to some client, as if it had come from an extension input
|
||||
* device.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXSendExtensionEvent (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
extern int lastEvent; /* Defined in extension.c */
|
||||
DeviceIntPtr dev;
|
||||
xEvent *first;
|
||||
XEventClass *list;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
|
||||
REQUEST(xSendExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
|
||||
if (stuff->length !=(sizeof(xSendExtensionEventReq)>>2) + stuff->count +
|
||||
(stuff->num_events * (sizeof (xEvent) >> 2)))
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_SendExtensionEvent, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/* The client's event type must be one defined by an extension. */
|
||||
|
||||
first = ((xEvent *) &stuff[1]);
|
||||
if ( ! ((EXTENSION_EVENT_BASE <= first->u.u.type) &&
|
||||
(first->u.u.type < lastEvent)) )
|
||||
{
|
||||
client->errorValue = first->u.u.type;
|
||||
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
|
||||
list = (XEventClass *) (first + stuff->num_events);
|
||||
if ((ret = CreateMaskFromList (client, list, stuff->count, tmp, dev,
|
||||
X_SendExtensionEvent)) != Success)
|
||||
return Success;
|
||||
|
||||
ret = (SendEvent (client, dev, stuff->destination,
|
||||
stuff->propagate, &stuff[1], tmp[stuff->deviceid].mask,
|
||||
stuff->num_events));
|
||||
|
||||
if (ret != Success)
|
||||
SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret);
|
||||
|
||||
return Success;
|
||||
}
|
163
Xi/setbmap.c
Normal file
163
Xi/setbmap.c
Normal file
|
@ -0,0 +1,163 @@
|
|||
/* $Xorg: setbmap.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to change the button mapping of an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#define IsOn(ptr, bit) \
|
||||
(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
|
||||
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern int DeviceMappingNotify;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the button mapping.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSetDeviceButtonMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xSetDeviceButtonMappingReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXSetDeviceButtonMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXSetDeviceButtonMapping (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
xSetDeviceButtonMappingReply rep;
|
||||
DeviceIntPtr dev;
|
||||
|
||||
REQUEST(xSetDeviceButtonMappingReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
|
||||
|
||||
if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) +
|
||||
stuff->map_length + 3)>>2)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_SetDeviceButtonMapping;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.status = MappingSuccess;
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
ret = SetButtonMapping (client, dev, stuff->map_length, &stuff[1]);
|
||||
|
||||
if (ret == BadValue || ret == BadMatch)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0,
|
||||
ret);
|
||||
return Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep.status = ret;
|
||||
WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep);
|
||||
}
|
||||
|
||||
if (ret != MappingBusy)
|
||||
SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XSetDeviceButtonMapping function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXSetDeviceButtonMapping (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xSetDeviceButtonMappingReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
167
Xi/setdval.c
Normal file
167
Xi/setdval.c
Normal file
|
@ -0,0 +1,167 @@
|
|||
/* $Xorg: setdval.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to change the mode of an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle a request from a client with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSetDeviceValuators(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xSetDeviceValuatorsReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXSetDeviceValuators(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure sets the value of valuators on an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXSetDeviceValuators(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xSetDeviceValuatorsReply rep;
|
||||
|
||||
REQUEST(xSetDeviceValuatorsReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_SetDeviceValuators;
|
||||
rep.length = 0;
|
||||
rep.status = Success;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
if (stuff->length !=(sizeof(xSetDeviceValuatorsReq)>>2) +
|
||||
stuff->num_valuators)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
|
||||
BadLength);
|
||||
return Success;
|
||||
}
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_SetDeviceValuators, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->valuator == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if ((dev->grab) && !SameClient(dev->grab, client))
|
||||
rep.status = AlreadyGrabbed;
|
||||
else
|
||||
rep.status = SetDeviceValuators (client, dev, (int *) &stuff[1],
|
||||
stuff->first_valuator, stuff->num_valuators);
|
||||
|
||||
if (rep.status != Success && rep.status != AlreadyGrabbed)
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0,
|
||||
rep.status);
|
||||
else
|
||||
WriteReplyToClient (client, sizeof (xSetDeviceValuatorsReply), &rep);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XSetDeviceValuators function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXSetDeviceValuators (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xSetDeviceValuatorsReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
119
Xi/setfocus.c
Normal file
119
Xi/setfocus.c
Normal file
|
@ -0,0 +1,119 @@
|
|||
/* $Xorg: setfocus.c,v 1.4 2001/02/09 02:04:34 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to set the focus for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "windowstr.h" /* focus struct */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern InputInfo inputInfo;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure sets the focus for a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSetDeviceFocus(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xSetDeviceFocusReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
|
||||
swapl(&stuff->focus, n);
|
||||
swapl(&stuff->time, n);
|
||||
return(ProcXSetDeviceFocus(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure sets the focus for a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXSetDeviceFocus(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
register DeviceIntPtr dev;
|
||||
|
||||
REQUEST(xSetDeviceFocusReq);
|
||||
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->device);
|
||||
if (dev==NULL || !dev->focus)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
ret = SetInputFocus (client, dev, stuff->focus, stuff->revertTo,
|
||||
stuff->time, TRUE);
|
||||
if (ret != Success)
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret);
|
||||
|
||||
return Success;
|
||||
}
|
157
Xi/setmmap.c
Normal file
157
Xi/setmmap.c
Normal file
|
@ -0,0 +1,157 @@
|
|||
/* $Xorg: setmmap.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* Set modifier mapping for an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS /* for inputstr.h */
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern int DeviceMappingNotify;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure sets the modifier mapping for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSetDeviceModifierMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xSetDeviceModifierMappingReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXSetDeviceModifierMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Set the device Modifier mapping.
|
||||
*
|
||||
*/
|
||||
|
||||
ProcXSetDeviceModifierMapping(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int ret;
|
||||
xSetDeviceModifierMappingReply rep;
|
||||
DeviceIntPtr dev;
|
||||
KeyClassPtr kp;
|
||||
|
||||
REQUEST(xSetDeviceModifierMappingReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_SetDeviceModifierMapping;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
ret = SetModifierMapping(client, dev, stuff->length,
|
||||
(sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier,
|
||||
&stuff[1], &kp);
|
||||
|
||||
if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed)
|
||||
{
|
||||
rep.success = ret;
|
||||
if (ret == MappingSuccess)
|
||||
SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
|
||||
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),&rep);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ret==-1)
|
||||
ret=BadValue;
|
||||
SendErrorToClient (client, IReqCode, X_SetDeviceModifierMapping, 0,ret);
|
||||
}
|
||||
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XSetDeviceModifierMapping function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXSetDeviceModifierMapping (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xSetDeviceModifierMappingReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
||||
|
151
Xi/setmode.c
Normal file
151
Xi/setmode.c
Normal file
|
@ -0,0 +1,151 @@
|
|||
/* $Xorg: setmode.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to change the mode of an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle a request from a client with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSetDeviceMode(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xSetDeviceModeReq);
|
||||
swaps(&stuff->length, n);
|
||||
return(ProcXSetDeviceMode(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure sets the mode of a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXSetDeviceMode(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xSetDeviceModeReply rep;
|
||||
|
||||
REQUEST(xSetDeviceModeReq);
|
||||
REQUEST_SIZE_MATCH(xSetDeviceModeReq);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_SetDeviceMode;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient (client, IReqCode, X_SetDeviceMode, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->valuator == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
if ((dev->grab) && !SameClient(dev->grab, client))
|
||||
rep.status = AlreadyGrabbed;
|
||||
else
|
||||
rep.status = SetDeviceMode (client, dev, stuff->mode);
|
||||
|
||||
if (rep.status == Success)
|
||||
dev->valuator->mode = stuff->mode;
|
||||
else if (rep.status != AlreadyGrabbed)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status);
|
||||
return Success;
|
||||
}
|
||||
|
||||
WriteReplyToClient (client, sizeof (xSetDeviceModeReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure writes the reply for the XSetDeviceMode function,
|
||||
* if the client and server have a different byte ordering.
|
||||
*
|
||||
*/
|
||||
|
||||
SRepXSetDeviceMode (client, size, rep)
|
||||
ClientPtr client;
|
||||
int size;
|
||||
xSetDeviceModeReply *rep;
|
||||
{
|
||||
register char n;
|
||||
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
WriteToClient(client, size, (char *)rep);
|
||||
}
|
307
Xi/stubs.c
Normal file
307
Xi/stubs.c
Normal file
|
@ -0,0 +1,307 @@
|
|||
/* $Xorg: stubs.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/*
|
||||
* stubs.c -- stub routines for the X server side of the XINPUT
|
||||
* extension. This file is mainly to be used only as documentation.
|
||||
* There is not much code here, and you can't get a working XINPUT
|
||||
* server just using this.
|
||||
* The Xvfb server uses this file so it will compile with the same
|
||||
* object files as the real X server for a platform that has XINPUT.
|
||||
* Xnest could do the same thing.
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "inputstr.h"
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Caller: ProcXChangeKeyboardDevice
|
||||
*
|
||||
* This procedure does the implementation-dependent portion of the work
|
||||
* needed to change the keyboard device.
|
||||
*
|
||||
* The X keyboard device has a FocusRec. If the device that has been
|
||||
* made into the new X keyboard did not have a FocusRec,
|
||||
* ProcXChangeKeyboardDevice will allocate one for it.
|
||||
*
|
||||
* If you do not want clients to be able to focus the old X keyboard
|
||||
* device, call DeleteFocusClassDeviceStruct to free the FocusRec.
|
||||
*
|
||||
* If you support input devices with keys that you do not want to be
|
||||
* used as the X keyboard, you need to check for them here and return
|
||||
* a BadDevice error.
|
||||
*
|
||||
* The default implementation is to do nothing (assume you do want
|
||||
* clients to be able to focus the old X keyboard). The commented-out
|
||||
* sample code shows what you might do if you don't want the default.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ChangeKeyboardDevice (old_dev, new_dev)
|
||||
DeviceIntPtr old_dev;
|
||||
DeviceIntPtr new_dev;
|
||||
{
|
||||
/***********************************************************************
|
||||
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
|
||||
**********************************************************************/
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Caller: ProcXChangePointerDevice
|
||||
*
|
||||
* This procedure does the implementation-dependent portion of the work
|
||||
* needed to change the pointer device.
|
||||
*
|
||||
* The X pointer device does not have a FocusRec. If the device that
|
||||
* has been made into the new X pointer had a FocusRec,
|
||||
* ProcXChangePointerDevice will free it.
|
||||
*
|
||||
* If you want clients to be able to focus the old pointer device that
|
||||
* has now become accessible through the input extension, you need to
|
||||
* add a FocusRec to it here.
|
||||
*
|
||||
* The XChangePointerDevice protocol request also allows the client
|
||||
* to choose which axes of the new pointer device are used to move
|
||||
* the X cursor in the X- and Y- directions. If the axes are different
|
||||
* than the default ones, you need to keep track of that here.
|
||||
*
|
||||
* If you support input devices with valuators that you do not want to be
|
||||
* used as the X pointer, you need to check for them here and return a
|
||||
* BadDevice error.
|
||||
*
|
||||
* The default implementation is to do nothing (assume you don't want
|
||||
* clients to be able to focus the old X pointer). The commented-out
|
||||
* sample code shows what you might do if you don't want the default.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ChangePointerDevice (old_dev, new_dev, x, y)
|
||||
DeviceIntPtr old_dev, new_dev;
|
||||
unsigned char x, y;
|
||||
{
|
||||
/***********************************************************************
|
||||
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
|
||||
|
||||
x_axis = x; * keep track of new x-axis*
|
||||
y_axis = y; * keep track of new y-axis*
|
||||
if (x_axis != 0 || y_axis != 1)
|
||||
axes_changed = TRUE; * remember axes have changed*
|
||||
else
|
||||
axes_changed = FALSE;
|
||||
*************************************************************************/
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Caller: ProcXCloseDevice
|
||||
*
|
||||
* Take care of implementation-dependent details of closing a device.
|
||||
* Some implementations may actually close the device, others may just
|
||||
* remove this clients interest in that device.
|
||||
*
|
||||
* The default implementation is to do nothing (assume all input devices
|
||||
* are initialized during X server initialization and kept open).
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
CloseInputDevice (d, client)
|
||||
DeviceIntPtr d;
|
||||
ClientPtr client;
|
||||
{
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Caller: ProcXListInputDevices
|
||||
*
|
||||
* This is the implementation-dependent routine to initialize an input
|
||||
* device to the point that information about it can be listed.
|
||||
* Some implementations open all input devices when the server is first
|
||||
* initialized, and never close them. Other implementations open only
|
||||
* the X pointer and keyboard devices during server initialization,
|
||||
* and only open other input devices when some client makes an
|
||||
* XOpenDevice request. If some other process has the device open, the
|
||||
* server may not be able to get information about the device to list it.
|
||||
*
|
||||
* This procedure should be used by implementations that do not initialize
|
||||
* all input devices at server startup. It should do device-dependent
|
||||
* initialization for any devices not previously initialized, and call
|
||||
* AddInputDevice for each of those devices so that a DeviceIntRec will be
|
||||
* created for them.
|
||||
*
|
||||
* The default implementation is to do nothing (assume all input devices
|
||||
* are initialized during X server initialization and kept open).
|
||||
* The commented-out sample code shows what you might do if you don't want
|
||||
* the default.
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
AddOtherInputDevices ()
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
DeviceProc deviceProc;
|
||||
pointer private;
|
||||
|
||||
/**********************************************************************
|
||||
for each uninitialized device, do something like:
|
||||
|
||||
dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
|
||||
dev->public.devicePrivate = private;
|
||||
RegisterOtherDevice(dev);
|
||||
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
|
||||
************************************************************************/
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Caller: ProcXOpenDevice
|
||||
*
|
||||
* This is the implementation-dependent routine to open an input device.
|
||||
* Some implementations open all input devices when the server is first
|
||||
* initialized, and never close them. Other implementations open only
|
||||
* the X pointer and keyboard devices during server initialization,
|
||||
* and only open other input devices when some client makes an
|
||||
* XOpenDevice request. This entry point is for the latter type of
|
||||
* implementation.
|
||||
*
|
||||
* If the physical device is not already open, do it here. In this case,
|
||||
* you need to keep track of the fact that one or more clients has the
|
||||
* device open, and physically close it when the last client that has
|
||||
* it open does an XCloseDevice.
|
||||
*
|
||||
* The default implementation is to do nothing (assume all input devices
|
||||
* are opened during X server initialization and kept open).
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
OpenInputDevice (dev, client, status)
|
||||
DeviceIntPtr dev;
|
||||
ClientPtr client;
|
||||
int *status;
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Caller: ProcXSetDeviceMode
|
||||
*
|
||||
* Change the mode of an extension device.
|
||||
* This function is used to change the mode of a device from reporting
|
||||
* relative motion to reporting absolute positional information, and
|
||||
* vice versa.
|
||||
* The default implementation below is that no such devices are supported.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SetDeviceMode (client, dev, mode)
|
||||
register ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
int mode;
|
||||
{
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Caller: ProcXSetDeviceValuators
|
||||
*
|
||||
* Set the value of valuators on an extension input device.
|
||||
* This function is used to set the initial value of valuators on
|
||||
* those input devices that are capable of reporting either relative
|
||||
* motion or an absolute position, and allow an initial position to be set.
|
||||
* The default implementation below is that no such devices are supported.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
|
||||
register ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
int *valuators;
|
||||
int first_valuator;
|
||||
int num_valuators;
|
||||
{
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Caller: ProcXChangeDeviceControl
|
||||
*
|
||||
* Change the specified device controls on an extension input device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ChangeDeviceControl (client, dev, control)
|
||||
register ClientPtr client;
|
||||
DeviceIntPtr dev;
|
||||
xDeviceCtl *control;
|
||||
{
|
||||
switch (control->control)
|
||||
{
|
||||
case DEVICE_RESOLUTION:
|
||||
return (BadMatch);
|
||||
default:
|
||||
return (BadMatch);
|
||||
}
|
||||
}
|
118
Xi/ungrdev.c
Normal file
118
Xi/ungrdev.c
Normal file
|
@ -0,0 +1,118 @@
|
|||
/* $Xorg: ungrdev.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to release a grab of an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from a client with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXUngrabDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xUngrabDeviceReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
|
||||
swapl(&stuff->time, n);
|
||||
return(ProcXUngrabDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Release a grab of an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXUngrabDevice(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
GrabPtr grab;
|
||||
TimeStamp time;
|
||||
|
||||
REQUEST(xUngrabDeviceReq);
|
||||
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->deviceid);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice);
|
||||
return Success;
|
||||
}
|
||||
grab = dev->grab;
|
||||
|
||||
time = ClientTimeToServerTime(stuff->time);
|
||||
if ((CompareTimeStamps(time, currentTime) != LATER) &&
|
||||
(CompareTimeStamps(time, dev->grabTime) != EARLIER) &&
|
||||
(grab) && SameClient(grab, client))
|
||||
(*dev->DeactivateGrab)(dev);
|
||||
return Success;
|
||||
}
|
172
Xi/ungrdevb.c
Normal file
172
Xi/ungrdevb.c
Normal file
|
@ -0,0 +1,172 @@
|
|||
/* $Xorg: ungrdevb.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to release a grab of a button on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
#define AllModifiersMask ( \
|
||||
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
||||
Mod3Mask | Mod4Mask | Mod5Mask )
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern int DeviceButtonPress;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from a client with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXUngrabDeviceButton(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xUngrabDeviceButtonReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
|
||||
swapl(&stuff->grabWindow, n);
|
||||
swaps(&stuff->modifiers, n);
|
||||
return(ProcXUngrabDeviceButton(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Release a grab of a button on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXUngrabDeviceButton(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
DeviceIntPtr mdev;
|
||||
WindowPtr pWin;
|
||||
GrabRec temporaryGrab;
|
||||
|
||||
REQUEST(xUngrabDeviceButtonReq);
|
||||
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->grabbed_device);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->button == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (stuff->modifier_device != UseXKeyboard)
|
||||
{
|
||||
mdev = LookupDeviceIntRec (stuff->modifier_device);
|
||||
if (mdev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
pWin = LookupWindow(stuff->grabWindow, client);
|
||||
if (!pWin)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadWindow);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if ((stuff->modifiers != AnyModifier) &&
|
||||
(stuff->modifiers & ~AllModifiersMask))
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
|
||||
temporaryGrab.resource = client->clientAsMask;
|
||||
temporaryGrab.device = dev;
|
||||
temporaryGrab.window = pWin;
|
||||
temporaryGrab.type = DeviceButtonPress;
|
||||
temporaryGrab.modifierDevice = mdev;
|
||||
temporaryGrab.modifiersDetail.exact = stuff->modifiers;
|
||||
temporaryGrab.modifiersDetail.pMask = NULL;
|
||||
temporaryGrab.detail.exact = stuff->button;
|
||||
temporaryGrab.detail.pMask = NULL;
|
||||
|
||||
DeletePassiveGrabFromList(&temporaryGrab);
|
||||
return Success;
|
||||
}
|
178
Xi/ungrdevk.c
Normal file
178
Xi/ungrdevk.c
Normal file
|
@ -0,0 +1,178 @@
|
|||
/* $Xorg: ungrdevk.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */
|
||||
|
||||
/************************************************************
|
||||
|
||||
Copyright 1989, 1998 The Open Group
|
||||
|
||||
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
|
||||
OPEN GROUP 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 Open Group 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 Open Group.
|
||||
|
||||
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
||||
|
||||
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 Hewlett-Packard not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
HEWLETT-PACKARD 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Request to release a grab of a key on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "X.h" /* for inputstr.h */
|
||||
#include "Xproto.h" /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
#define AllModifiersMask ( \
|
||||
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
||||
Mod3Mask | Mod4Mask | Mod5Mask )
|
||||
extern int IReqCode;
|
||||
extern int BadDevice;
|
||||
extern void (* ReplySwapVector[256]) ();
|
||||
extern int DeviceKeyPress;
|
||||
DeviceIntPtr LookupDeviceIntRec();
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle requests from a client with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXUngrabDeviceKey(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register char n;
|
||||
|
||||
REQUEST(xUngrabDeviceKeyReq);
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
|
||||
swapl(&stuff->grabWindow, n);
|
||||
swaps(&stuff->modifiers, n);
|
||||
return(ProcXUngrabDeviceKey(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Release a grab of a key on an extension device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXUngrabDeviceKey(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
DeviceIntPtr mdev;
|
||||
WindowPtr pWin;
|
||||
GrabRec temporaryGrab;
|
||||
|
||||
REQUEST(xUngrabDeviceKeyReq);
|
||||
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
|
||||
|
||||
dev = LookupDeviceIntRec (stuff->grabbed_device);
|
||||
if (dev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (dev->key == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch);
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (stuff->modifier_device != UseXKeyboard)
|
||||
{
|
||||
mdev = LookupDeviceIntRec (stuff->modifier_device);
|
||||
if (mdev == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
|
||||
BadDevice);
|
||||
return Success;
|
||||
}
|
||||
if (mdev->key == NULL)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
|
||||
BadMatch);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
else
|
||||
mdev = (DeviceIntPtr) LookupKeyboardDevice();
|
||||
|
||||
pWin = LookupWindow(stuff->grabWindow, client);
|
||||
if (!pWin)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
|
||||
BadWindow);
|
||||
return Success;
|
||||
}
|
||||
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||
|
||||
(stuff->key < dev->key->curKeySyms.minKeyCode))
|
||||
&& (stuff->key != AnyKey))
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
if ((stuff->modifiers != AnyModifier) &&
|
||||
(stuff->modifiers & ~AllModifiersMask))
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0,
|
||||
BadValue);
|
||||
return Success;
|
||||
}
|
||||
|
||||
temporaryGrab.resource = client->clientAsMask;
|
||||
temporaryGrab.device = dev;
|
||||
temporaryGrab.window = pWin;
|
||||
temporaryGrab.type = DeviceKeyPress;
|
||||
temporaryGrab.modifierDevice = mdev;
|
||||
temporaryGrab.modifiersDetail.exact = stuff->modifiers;
|
||||
temporaryGrab.modifiersDetail.pMask = NULL;
|
||||
temporaryGrab.detail.exact = stuff->key;
|
||||
temporaryGrab.detail.pMask = NULL;
|
||||
|
||||
DeletePassiveGrabFromList(&temporaryGrab);
|
||||
return Success;
|
||||
}
|
43
XpConfig/C/print/Xprinters
Normal file
43
XpConfig/C/print/Xprinters
Normal file
|
@ -0,0 +1,43 @@
|
|||
########################################################################
|
||||
#
|
||||
# $Xorg: Xprinters,v 1.3 2000/08/17 19:48:02 cpqbld Exp $
|
||||
#
|
||||
# X*printers sample configuration file
|
||||
#
|
||||
#
|
||||
# This file belongs in /usr/lib/X11/X*printers, where the "*" is the
|
||||
# display number of the server. For example, if the server is
|
||||
# invoked using the command X :0, then the X0printers file is used.
|
||||
########################################################################
|
||||
|
||||
########################################################################
|
||||
# Use lpstat to augment the list of printers managed by the
|
||||
# server. (This is the default behavior if the X*printers file does
|
||||
# not exist, or if an "Augment_Printer_List" line is not specified.)
|
||||
########################################################################
|
||||
#Augment_Printer_List %(default)%
|
||||
|
||||
########################################################################
|
||||
# Use the specified command pipeline to augment the list of printers
|
||||
# managed by the server.
|
||||
########################################################################
|
||||
#Augment_Printer_List lpstat -a | cut -d " " -f 1 # equivalent to default
|
||||
|
||||
########################################################################
|
||||
# Do not augment the list of printers managed by the server.
|
||||
########################################################################
|
||||
#Augment_Printer_List %none%
|
||||
|
||||
########################################################################
|
||||
# Add individual printers to the list of printers managed by the
|
||||
# server. These are aliases, determined by driver name.
|
||||
########################################################################
|
||||
|
||||
|
||||
# EXAMPLES
|
||||
#
|
||||
# Printer xppspr
|
||||
# Printer xppclpr
|
||||
# Printer xppclmonopr
|
||||
# Printer xprasterpr
|
||||
|
38
XpConfig/C/print/attributes/document
Normal file
38
XpConfig/C/print/attributes/document
Normal file
|
@ -0,0 +1,38 @@
|
|||
# $Xorg: document,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
|
||||
# Document DPA-Object initial attribute values
|
||||
|
||||
# Attribute IDs must be qualified by using one of the following
|
||||
# (listed in order of precedence):
|
||||
#
|
||||
# printer-name
|
||||
# Set this attribute for a specific printer.
|
||||
# Example: "dj_1.plex: duplex"
|
||||
#
|
||||
# printer-model
|
||||
# Set this attribute for all printers of a specific model.
|
||||
# Example: "HPDJ1600C.plex: duplex"
|
||||
#
|
||||
# '*'
|
||||
# Set this attribute for all printers.
|
||||
# Example: "*.plex: duplex"
|
||||
|
||||
|
||||
*content-orientation: portrait
|
||||
*copy-count: 1
|
||||
*default-medium: iso-a4
|
||||
*default-printer-resolution: 300
|
||||
*document-format: {Postscript 2}
|
||||
*plex: duplex
|
||||
|
||||
|
||||
# EXAMPLES
|
||||
#
|
||||
# *content-orientation: landscape
|
||||
# *copy-count: 3
|
||||
# *default-input-tray: main
|
||||
# *default-medium: iso-a4
|
||||
# *default-printer-resolution: 600
|
||||
# *document-format: {PCL 5}
|
||||
# *plex: simplex
|
||||
# *xp-listfonts-modes: xp-list-internal-printer-fonts
|
||||
|
25
XpConfig/C/print/attributes/job
Normal file
25
XpConfig/C/print/attributes/job
Normal file
|
@ -0,0 +1,25 @@
|
|||
# $Xorg: job,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
|
||||
# Job DPA-Object initial attribute values
|
||||
|
||||
# Attribute IDs must be qualified by using one of the following
|
||||
# (listed in order of precedence):
|
||||
#
|
||||
# printer-name
|
||||
# Set this attribute for a specific printer.
|
||||
# Example: "laser_1.job-priority: 1"
|
||||
#
|
||||
# printer-model
|
||||
# Set this attribute for all printers of a specific model.
|
||||
# Example: "HPDJ1600C.job-priority: 1"
|
||||
#
|
||||
# '*'
|
||||
# Set this attribute for all printers.
|
||||
# Example: "*.job-priority: 1"
|
||||
|
||||
*notification-profile: {}
|
||||
|
||||
# EXAMPLES
|
||||
#
|
||||
# *job-name: Example Job Name
|
||||
# *notification-profile: {{event-report-job-completed} electronic-mail}
|
||||
# *xp-spooler-command-options: -onb
|
80
XpConfig/C/print/attributes/printer
Normal file
80
XpConfig/C/print/attributes/printer
Normal file
|
@ -0,0 +1,80 @@
|
|||
# $Xorg: printer,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
|
||||
# Printer DPA-Object initial attribute values
|
||||
|
||||
# Attribute IDs must be qualified by using one of the following
|
||||
# (listed in order of precedence):
|
||||
#
|
||||
# printer-name
|
||||
# Set this attribute for a specific printer.
|
||||
# Example: "dj_1.document-formats-ready: {pcl 5}"
|
||||
#
|
||||
# printer-model
|
||||
# Set this attribute for all printers of a specific model.
|
||||
# Example: "HPDJ1600C.document-formats-ready: {pcl 5}"
|
||||
#
|
||||
# '*'
|
||||
# Set this attribute for all printers.
|
||||
# Example: "*.document-formats-ready: {pcl 5}"
|
||||
|
||||
|
||||
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||
|
||||
|
||||
# IMPORTANT EXAMPLES
|
||||
#
|
||||
# The following are examples of how a printer name is bound
|
||||
# to a model-config file and ddx driver.
|
||||
#
|
||||
# Warning: most X-Servers have a hard limit on the number of ddx
|
||||
# drivers (ie, screens) they can support at runtime (usually 3 or
|
||||
# 4). Whatever the number of printers, they cannot create a
|
||||
# dependency for more than the limit on ddx drivers. Assuming
|
||||
# "Xprinters" listed all four xp*pr printers below, X-Servers
|
||||
# with a limit of 3 would not work.
|
||||
#
|
||||
# xppspr.xp-model-identifier: HPDJ1600C
|
||||
# xppspr.xp-ddx-identifier: XP-POSTSCRIPT
|
||||
# xppspr.document-formats-ready: { PostScript 2 }
|
||||
#
|
||||
# xppclpr.xp-model-identifier: HPDJ1600C
|
||||
# xppclpr.xp-ddx-identifier: XP-PCL-COLOR
|
||||
# xppclpr.document-formats-ready: { PCL 5 }
|
||||
#
|
||||
# xppclmonopr.xp-model-identifier: HPDJ1600C
|
||||
# xppclmonopr.xp-ddx-identifier: XP-PCL-MONO
|
||||
# xppclmonopr.document-formats-ready: { PCL 5 }
|
||||
#
|
||||
# xprasterpr.xp-model-identifier: HPDJ1600C
|
||||
# xprasterpr.xp-ddx-identifier: XP-RASTER
|
||||
|
||||
|
||||
# MORE EXAMPLES of items often configured in this file
|
||||
#
|
||||
# *descriptor: This printer has not been given a name
|
||||
# *dt-pdm-command: dtpdm
|
||||
# *input-trays-medium: {top na-letter} {bottom iso-a4}
|
||||
# *xp-model-identifier: HPDJ1600C
|
||||
# *xp-spooler-command: /opt/mystuff/bin/mylp -p %printer-name% -c %copy-count% \
|
||||
# -j %job-name% -o %options%
|
||||
|
||||
|
||||
# USUALLY SET BY THE ddx driver
|
||||
#
|
||||
# *content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
|
||||
|
||||
|
||||
# USUALLY SET BY THE model-config FILE
|
||||
#
|
||||
# *document-formats-supported: {PCL 5}
|
||||
# *medium-source-sizes-supported: \
|
||||
# { top {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} } \
|
||||
# { bottom {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} }
|
||||
# *plexes-supported: simplex duplex tumble
|
||||
# *printer-model: Hewlett-Packard LaserJet IV
|
||||
# *printer-resolutions-supported: 300
|
||||
# *xp-ddx-identifier: XP-PCL-COLOR
|
||||
# *xp-embedded-formats-supported: {PCL 5} {HPGL 2}
|
||||
# *xp-listfonts-modes-supported: xp-list-internal-printer-fonts
|
||||
# *xp-raw-formats-supported: {PCL 5}
|
||||
# *xp-setup-proviso: xp-setup-optional
|
||||
|
39
XpConfig/C/print/ddx-config/raster/pcl
Normal file
39
XpConfig/C/print/ddx-config/raster/pcl
Normal file
|
@ -0,0 +1,39 @@
|
|||
# $Xorg: pcl,v 1.3 2000/08/17 19:48:03 cpqbld Exp $
|
||||
# This is the file which you should customize to include the printers that
|
||||
# will print through the raster driver. The early part of this file
|
||||
# specifies some commn useful defaults. You can override them when
|
||||
# you list your printers in the second part of this file. This file is
|
||||
# an X Resource file. To learn more about this file format, consult
|
||||
# the functional specification.
|
||||
|
||||
# Note that the reference printer for CDEnext is the HP DeskJet 1600C.
|
||||
# This driver may work for other printers, but the reference printer
|
||||
# is the only officially supported printer.
|
||||
|
||||
|
||||
# DEFAULTS
|
||||
# ========
|
||||
|
||||
# The attributes below apply to all printers unless the section below
|
||||
# specifies something different for the printer.
|
||||
|
||||
# Default printer attributes
|
||||
# --------------------------
|
||||
# Printer attributes control the choices that users will see in the
|
||||
# setup dialog for those printers.
|
||||
|
||||
# The attributes below apply to all printes unless the section below
|
||||
# specifies something different for the printer.
|
||||
|
||||
*.media-ready: na-letter-white
|
||||
*.descriptor: Printer supported by CDEnext DtPrint System.
|
||||
*.printer-model: HPDJ1600C
|
||||
|
||||
# Printer Specifics
|
||||
|
||||
# Use this section to override the defaults listed above or to override the
|
||||
# printer attributes described in the model file.
|
||||
# The lines describing "laser" are just a sample to help you get started.
|
||||
|
||||
# laser.printer-name: laser
|
||||
# laser.spooler-name: laser
|
0
XpConfig/C/print/ddx-config/raster/postscript
Normal file
0
XpConfig/C/print/ddx-config/raster/postscript
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00051.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00052.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00052.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00053.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00053.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00054.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00054.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00055.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00055.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00056.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00056.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00057.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00057.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00058.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00058.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00059.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00059.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00060.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00060.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00061.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00061.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00062.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00062.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00063.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00063.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00064.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00064.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00065.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00065.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00066.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00066.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00067.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00067.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00068.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00068.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00069.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00069.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00070.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00070.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00071.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00071.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00072.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00072.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00073.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00073.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00074.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00074.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00075.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00075.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00076.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00076.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00077.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00077.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00079.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00079.pmf
Normal file
Binary file not shown.
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00080.pmf
Normal file
BIN
XpConfig/C/print/models/HPDJ1600C/fonts/9nb00080.pmf
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user