dixstruct.h revision 6747b715
105b261ecSmrg/***********************************************************
205b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
305b261ecSmrg
405b261ecSmrg                        All Rights Reserved
505b261ecSmrg
605b261ecSmrgPermission to use, copy, modify, and distribute this software and its
705b261ecSmrgdocumentation for any purpose and without fee is hereby granted,
805b261ecSmrgprovided that the above copyright notice appear in all copies and that
905b261ecSmrgboth that copyright notice and this permission notice appear in
1005b261ecSmrgsupporting documentation, and that the name of Digital not be
1105b261ecSmrgused in advertising or publicity pertaining to distribution of the
1205b261ecSmrgsoftware without specific, written prior permission.
1305b261ecSmrg
1405b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
1505b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
1605b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
1705b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1805b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1905b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2005b261ecSmrgSOFTWARE.
2105b261ecSmrg
2205b261ecSmrg******************************************************************/
2305b261ecSmrg
2405b261ecSmrg#ifndef DIXSTRUCT_H
2505b261ecSmrg#define DIXSTRUCT_H
2605b261ecSmrg
2705b261ecSmrg#include "dix.h"
2805b261ecSmrg#include "resource.h"
2905b261ecSmrg#include "cursor.h"
3005b261ecSmrg#include "gc.h"
3105b261ecSmrg#include "pixmap.h"
324642e01fSmrg#include "privates.h"
3305b261ecSmrg#include <X11/Xmd.h>
3405b261ecSmrg
3505b261ecSmrg/*
3605b261ecSmrg * 	direct-mapped hash table, used by resource manager to store
3705b261ecSmrg *      translation from client ids to server addresses.
3805b261ecSmrg */
3905b261ecSmrg
406747b715Smrgextern _X_EXPORT CallbackListPtr ClientStateCallback;
4105b261ecSmrg
4205b261ecSmrgtypedef struct {
4305b261ecSmrg    ClientPtr 		client;
4405b261ecSmrg    xConnSetupPrefix 	*prefix;
4505b261ecSmrg    xConnSetup  	*setup;
4605b261ecSmrg} NewClientInfoRec;
4705b261ecSmrg
4805b261ecSmrgtypedef void (*ReplySwapPtr) (
4905b261ecSmrg		ClientPtr	/* pClient */,
5005b261ecSmrg		int		/* size */,
5105b261ecSmrg		void *		/* pbuf */);
5205b261ecSmrg
536747b715Smrgextern _X_EXPORT void ReplyNotSwappd (
5405b261ecSmrg		ClientPtr	/* pClient */,
5505b261ecSmrg		int		/* size */,
566747b715Smrg		void *		/* pbuf */) _X_NORETURN;
5705b261ecSmrg
5805b261ecSmrgtypedef enum {ClientStateInitial,
5905b261ecSmrg	      ClientStateAuthenticating,
6005b261ecSmrg	      ClientStateRunning,
6105b261ecSmrg	      ClientStateRetained,
6205b261ecSmrg	      ClientStateGone,
6305b261ecSmrg	      ClientStateCheckingSecurity,
6405b261ecSmrg	      ClientStateCheckedSecurity} ClientState;
6505b261ecSmrg
6605b261ecSmrg#ifdef XFIXES
6705b261ecSmrgtypedef struct _saveSet {
6805b261ecSmrg    struct _Window  *windowPtr;
6905b261ecSmrg    Bool	    toRoot;
704642e01fSmrg    Bool	    map;
7105b261ecSmrg} SaveSetElt;
7205b261ecSmrg#define SaveSetWindow(ss)   ((ss).windowPtr)
7305b261ecSmrg#define SaveSetToRoot(ss)   ((ss).toRoot)
744642e01fSmrg#define SaveSetShouldMap(ss)	    ((ss).map)
7505b261ecSmrg#define SaveSetAssignWindow(ss,w)   ((ss).windowPtr = (w))
7605b261ecSmrg#define SaveSetAssignToRoot(ss,tr)  ((ss).toRoot = (tr))
774642e01fSmrg#define SaveSetAssignMap(ss,m)      ((ss).map = (m))
7805b261ecSmrg#else
7905b261ecSmrgtypedef struct _Window *SaveSetElt;
8005b261ecSmrg#define SaveSetWindow(ss)   (ss)
8105b261ecSmrg#define SaveSetToRoot(ss)   FALSE
824642e01fSmrg#define SaveSetShouldMap(ss)	    TRUE
8305b261ecSmrg#define SaveSetAssignWindow(ss,w)   ((ss) = (w))
8405b261ecSmrg#define SaveSetAssignToRoot(ss,tr)
854642e01fSmrg#define SaveSetAssignMap(ss,m)
8605b261ecSmrg#endif
8705b261ecSmrg
8805b261ecSmrgtypedef struct _Client {
8905b261ecSmrg    int         index;
9005b261ecSmrg    Mask        clientAsMask;
9105b261ecSmrg    pointer     requestBuffer;
9205b261ecSmrg    pointer     osPrivate;	/* for OS layer, including scheduler */
9305b261ecSmrg    Bool        swapped;
9405b261ecSmrg    ReplySwapPtr pSwapReplyFunc;
9505b261ecSmrg    XID         errorValue;
9605b261ecSmrg    int         sequence;
9705b261ecSmrg    int         closeDownMode;
9805b261ecSmrg    int         clientGone;
9905b261ecSmrg    int         noClientException;	/* this client died or needs to be
10005b261ecSmrg					 * killed */
1016747b715Smrg    int         ignoreCount;		/* count for Attend/IgnoreClient */
10205b261ecSmrg    SaveSetElt	*saveSet;
10305b261ecSmrg    int         numSaved;
10405b261ecSmrg    int         (**requestVector) (
10505b261ecSmrg		ClientPtr /* pClient */);
10605b261ecSmrg    CARD32	req_len;		/* length of current request */
10705b261ecSmrg    Bool	big_requests;		/* supports large requests */
10805b261ecSmrg    int		priority;
10905b261ecSmrg    ClientState clientState;
1104642e01fSmrg    PrivateRec	*devPrivates;
11105b261ecSmrg    unsigned short	xkbClientFlags;
11205b261ecSmrg    unsigned short	mapNotifyMask;
11305b261ecSmrg    unsigned short	newKeyboardNotifyMask;
11405b261ecSmrg    unsigned short	vMajor,vMinor;
11505b261ecSmrg    KeyCode		minKC,maxKC;
11605b261ecSmrg
11705b261ecSmrg    unsigned long replyBytesRemaining;
11805b261ecSmrg    int	    smart_priority;
11905b261ecSmrg    long    smart_start_tick;
12005b261ecSmrg    long    smart_stop_tick;
12105b261ecSmrg    long    smart_check_tick;
1224642e01fSmrg
1234642e01fSmrg    DeviceIntPtr clientPtr;
12405b261ecSmrg}           ClientRec;
12505b261ecSmrg
12605b261ecSmrg/*
12705b261ecSmrg * Scheduling interface
12805b261ecSmrg */
1296747b715Smrgextern _X_EXPORT long SmartScheduleTime;
1306747b715Smrgextern _X_EXPORT long SmartScheduleInterval;
1316747b715Smrgextern _X_EXPORT long SmartScheduleSlice;
1326747b715Smrgextern _X_EXPORT long SmartScheduleMaxSlice;
1336747b715Smrgextern _X_EXPORT Bool SmartScheduleDisable;
1346747b715Smrgextern _X_EXPORT void SmartScheduleStartTimer(void);
1356747b715Smrgextern _X_EXPORT void SmartScheduleStopTimer(void);
13605b261ecSmrg#define SMART_MAX_PRIORITY  (20)
13705b261ecSmrg#define SMART_MIN_PRIORITY  (-20)
13805b261ecSmrg
1396747b715Smrgextern _X_EXPORT Bool SmartScheduleInit(void);
14005b261ecSmrg
14105b261ecSmrg
14205b261ecSmrg/* This prototype is used pervasively in Xext, dix */
14305b261ecSmrg#define DISPATCH_PROC(func) int func(ClientPtr /* client */)
14405b261ecSmrg
14505b261ecSmrgtypedef struct _WorkQueue {
14605b261ecSmrg    struct _WorkQueue *next;
14705b261ecSmrg    Bool        (*function) (
14805b261ecSmrg		ClientPtr	/* pClient */,
14905b261ecSmrg		pointer		/* closure */
15005b261ecSmrg);
15105b261ecSmrg    ClientPtr   client;
15205b261ecSmrg    pointer     closure;
15305b261ecSmrg}           WorkQueueRec;
15405b261ecSmrg
1556747b715Smrgextern _X_EXPORT TimeStamp currentTime;
1566747b715Smrgextern _X_EXPORT TimeStamp lastDeviceEventTime;
15705b261ecSmrg
1586747b715Smrgextern _X_EXPORT int CompareTimeStamps(
15905b261ecSmrg    TimeStamp /*a*/,
16005b261ecSmrg    TimeStamp /*b*/);
16105b261ecSmrg
1626747b715Smrgextern _X_EXPORT TimeStamp ClientTimeToServerTime(CARD32 /*c*/);
16305b261ecSmrg
16405b261ecSmrgtypedef struct _CallbackRec {
16505b261ecSmrg  CallbackProcPtr proc;
16605b261ecSmrg  pointer data;
16705b261ecSmrg  Bool deleted;
16805b261ecSmrg  struct _CallbackRec *next;
16905b261ecSmrg} CallbackRec, *CallbackPtr;
17005b261ecSmrg
17105b261ecSmrgtypedef struct _CallbackList {
17205b261ecSmrg  int inCallback;
17305b261ecSmrg  Bool deleted;
17405b261ecSmrg  int numDeleted;
17505b261ecSmrg  CallbackPtr list;
17605b261ecSmrg} CallbackListRec;
17705b261ecSmrg
17805b261ecSmrg/* proc vectors */
17905b261ecSmrg
1806747b715Smrgextern _X_EXPORT int (* InitialVector[3]) (ClientPtr /*client*/);
18105b261ecSmrg
1826747b715Smrgextern _X_EXPORT int (* ProcVector[256]) (ClientPtr /*client*/);
18305b261ecSmrg
1846747b715Smrgextern _X_EXPORT int (* SwappedProcVector[256]) (ClientPtr /*client*/);
18505b261ecSmrg
1866747b715Smrgextern _X_EXPORT ReplySwapPtr ReplySwapVector[256];
18705b261ecSmrg
1886747b715Smrgextern _X_EXPORT int ProcBadRequest(ClientPtr /*client*/);
18905b261ecSmrg
19005b261ecSmrg#endif				/* DIXSTRUCT_H */
191