dixstruct.h revision 4642e01f
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
4005b261ecSmrg#ifdef DEBUG
4105b261ecSmrg#define MAX_REQUEST_LOG 100
4205b261ecSmrg#endif
4305b261ecSmrg
4405b261ecSmrgextern CallbackListPtr ClientStateCallback;
4505b261ecSmrg
4605b261ecSmrgtypedef struct {
4705b261ecSmrg    ClientPtr 		client;
4805b261ecSmrg    xConnSetupPrefix 	*prefix;
4905b261ecSmrg    xConnSetup  	*setup;
5005b261ecSmrg} NewClientInfoRec;
5105b261ecSmrg
5205b261ecSmrgtypedef void (*ReplySwapPtr) (
5305b261ecSmrg		ClientPtr	/* pClient */,
5405b261ecSmrg		int		/* size */,
5505b261ecSmrg		void *		/* pbuf */);
5605b261ecSmrg
5705b261ecSmrgextern void ReplyNotSwappd (
5805b261ecSmrg		ClientPtr	/* pClient */,
5905b261ecSmrg		int		/* size */,
6005b261ecSmrg		void *		/* pbuf */);
6105b261ecSmrg
6205b261ecSmrgtypedef enum {ClientStateInitial,
6305b261ecSmrg	      ClientStateAuthenticating,
6405b261ecSmrg	      ClientStateRunning,
6505b261ecSmrg	      ClientStateRetained,
6605b261ecSmrg	      ClientStateGone,
6705b261ecSmrg	      ClientStateCheckingSecurity,
6805b261ecSmrg	      ClientStateCheckedSecurity} ClientState;
6905b261ecSmrg
7005b261ecSmrg#ifdef XFIXES
7105b261ecSmrgtypedef struct _saveSet {
7205b261ecSmrg    struct _Window  *windowPtr;
7305b261ecSmrg    Bool	    toRoot;
744642e01fSmrg    Bool	    map;
7505b261ecSmrg} SaveSetElt;
7605b261ecSmrg#define SaveSetWindow(ss)   ((ss).windowPtr)
7705b261ecSmrg#define SaveSetToRoot(ss)   ((ss).toRoot)
784642e01fSmrg#define SaveSetShouldMap(ss)	    ((ss).map)
7905b261ecSmrg#define SaveSetAssignWindow(ss,w)   ((ss).windowPtr = (w))
8005b261ecSmrg#define SaveSetAssignToRoot(ss,tr)  ((ss).toRoot = (tr))
814642e01fSmrg#define SaveSetAssignMap(ss,m)      ((ss).map = (m))
8205b261ecSmrg#else
8305b261ecSmrgtypedef struct _Window *SaveSetElt;
8405b261ecSmrg#define SaveSetWindow(ss)   (ss)
8505b261ecSmrg#define SaveSetToRoot(ss)   FALSE
864642e01fSmrg#define SaveSetShouldMap(ss)	    TRUE
8705b261ecSmrg#define SaveSetAssignWindow(ss,w)   ((ss) = (w))
8805b261ecSmrg#define SaveSetAssignToRoot(ss,tr)
894642e01fSmrg#define SaveSetAssignMap(ss,m)
9005b261ecSmrg#endif
9105b261ecSmrg
9205b261ecSmrgtypedef struct _Client {
9305b261ecSmrg    int         index;
9405b261ecSmrg    Mask        clientAsMask;
9505b261ecSmrg    pointer     requestBuffer;
9605b261ecSmrg    pointer     osPrivate;	/* for OS layer, including scheduler */
9705b261ecSmrg    Bool        swapped;
9805b261ecSmrg    ReplySwapPtr pSwapReplyFunc;
9905b261ecSmrg    XID         errorValue;
10005b261ecSmrg    int         sequence;
10105b261ecSmrg    int         closeDownMode;
10205b261ecSmrg    int         clientGone;
10305b261ecSmrg    int         noClientException;	/* this client died or needs to be
10405b261ecSmrg					 * killed */
10505b261ecSmrg    SaveSetElt	*saveSet;
10605b261ecSmrg    int         numSaved;
10705b261ecSmrg    pointer     screenPrivate[MAXSCREENS];
10805b261ecSmrg    int         (**requestVector) (
10905b261ecSmrg		ClientPtr /* pClient */);
11005b261ecSmrg    CARD32	req_len;		/* length of current request */
11105b261ecSmrg    Bool	big_requests;		/* supports large requests */
11205b261ecSmrg    int		priority;
11305b261ecSmrg    ClientState clientState;
1144642e01fSmrg    PrivateRec	*devPrivates;
11505b261ecSmrg#ifdef XKB
11605b261ecSmrg    unsigned short	xkbClientFlags;
11705b261ecSmrg    unsigned short	mapNotifyMask;
11805b261ecSmrg    unsigned short	newKeyboardNotifyMask;
11905b261ecSmrg    unsigned short	vMajor,vMinor;
12005b261ecSmrg    KeyCode		minKC,maxKC;
12105b261ecSmrg#endif
12205b261ecSmrg
12305b261ecSmrg#ifdef DEBUG
12405b261ecSmrg    unsigned char requestLog[MAX_REQUEST_LOG];
12505b261ecSmrg    int         requestLogIndex;
12605b261ecSmrg#endif
12705b261ecSmrg    unsigned long replyBytesRemaining;
1284642e01fSmrg    void *appgroup; /* Can't remove, ABI */
12905b261ecSmrg    struct _FontResolution * (*fontResFunc) (    /* no need for font.h */
13005b261ecSmrg		ClientPtr	/* pClient */,
13105b261ecSmrg		int *		/* num */);
13205b261ecSmrg    int	    smart_priority;
13305b261ecSmrg    long    smart_start_tick;
13405b261ecSmrg    long    smart_stop_tick;
13505b261ecSmrg    long    smart_check_tick;
1364642e01fSmrg
1374642e01fSmrg    DeviceIntPtr clientPtr;
13805b261ecSmrg}           ClientRec;
13905b261ecSmrg
14005b261ecSmrg/*
14105b261ecSmrg * Scheduling interface
14205b261ecSmrg */
14305b261ecSmrgextern long SmartScheduleTime;
14405b261ecSmrgextern long SmartScheduleInterval;
14505b261ecSmrgextern long SmartScheduleSlice;
14605b261ecSmrgextern long SmartScheduleMaxSlice;
14705b261ecSmrgextern Bool SmartScheduleDisable;
1484642e01fSmrgextern void SmartScheduleStartTimer(void);
1494642e01fSmrgextern void SmartScheduleStopTimer(void);
15005b261ecSmrg#define SMART_MAX_PRIORITY  (20)
15105b261ecSmrg#define SMART_MIN_PRIORITY  (-20)
15205b261ecSmrg
15305b261ecSmrgextern Bool SmartScheduleInit(void);
15405b261ecSmrg
15505b261ecSmrg
15605b261ecSmrg/* This prototype is used pervasively in Xext, dix */
15705b261ecSmrg#define DISPATCH_PROC(func) int func(ClientPtr /* client */)
15805b261ecSmrg
15905b261ecSmrgtypedef struct _WorkQueue {
16005b261ecSmrg    struct _WorkQueue *next;
16105b261ecSmrg    Bool        (*function) (
16205b261ecSmrg		ClientPtr	/* pClient */,
16305b261ecSmrg		pointer		/* closure */
16405b261ecSmrg);
16505b261ecSmrg    ClientPtr   client;
16605b261ecSmrg    pointer     closure;
16705b261ecSmrg}           WorkQueueRec;
16805b261ecSmrg
16905b261ecSmrgextern TimeStamp currentTime;
17005b261ecSmrgextern TimeStamp lastDeviceEventTime;
17105b261ecSmrg
17205b261ecSmrgextern int CompareTimeStamps(
17305b261ecSmrg    TimeStamp /*a*/,
17405b261ecSmrg    TimeStamp /*b*/);
17505b261ecSmrg
17605b261ecSmrgextern TimeStamp ClientTimeToServerTime(CARD32 /*c*/);
17705b261ecSmrg
17805b261ecSmrgtypedef struct _CallbackRec {
17905b261ecSmrg  CallbackProcPtr proc;
18005b261ecSmrg  pointer data;
18105b261ecSmrg  Bool deleted;
18205b261ecSmrg  struct _CallbackRec *next;
18305b261ecSmrg} CallbackRec, *CallbackPtr;
18405b261ecSmrg
18505b261ecSmrgtypedef struct _CallbackList {
18605b261ecSmrg  int inCallback;
18705b261ecSmrg  Bool deleted;
18805b261ecSmrg  int numDeleted;
18905b261ecSmrg  CallbackPtr list;
19005b261ecSmrg} CallbackListRec;
19105b261ecSmrg
19205b261ecSmrg/* proc vectors */
19305b261ecSmrg
19405b261ecSmrgextern int (* InitialVector[3]) (ClientPtr /*client*/);
19505b261ecSmrg
19605b261ecSmrgextern int (* ProcVector[256]) (ClientPtr /*client*/);
19705b261ecSmrg
19805b261ecSmrgextern int (* SwappedProcVector[256]) (ClientPtr /*client*/);
19905b261ecSmrg
20005b261ecSmrgextern ReplySwapPtr ReplySwapVector[256];
20105b261ecSmrg
20205b261ecSmrgextern int ProcBadRequest(ClientPtr /*client*/);
20305b261ecSmrg
20405b261ecSmrg#endif				/* DIXSTRUCT_H */
205