darwin.h revision 4642e01f
14642e01fSmrg/*
24642e01fSmrg * Copyright (C) 2008 Apple, Inc.
34642e01fSmrg * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
44642e01fSmrg *
54642e01fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
64642e01fSmrg * copy of this software and associated documentation files (the "Software"),
74642e01fSmrg * to deal in the Software without restriction, including without limitation
84642e01fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
94642e01fSmrg * and/or sell copies of the Software, and to permit persons to whom the
104642e01fSmrg * Software is furnished to do so, subject to the following conditions:
114642e01fSmrg *
124642e01fSmrg * The above copyright notice and this permission notice shall be included in
134642e01fSmrg * all copies or substantial portions of the Software.
144642e01fSmrg *
154642e01fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
164642e01fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
174642e01fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
184642e01fSmrg * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
194642e01fSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
204642e01fSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
214642e01fSmrg * DEALINGS IN THE SOFTWARE.
224642e01fSmrg *
234642e01fSmrg * Except as contained in this notice, the name(s) of the above copyright
244642e01fSmrg * holders shall not be used in advertising or otherwise to promote the sale,
254642e01fSmrg * use or other dealings in this Software without prior written authorization.
264642e01fSmrg */
274642e01fSmrg
284642e01fSmrg#ifndef _DARWIN_H
294642e01fSmrg#define _DARWIN_H
304642e01fSmrg
314642e01fSmrg#include <IOKit/IOTypes.h>
324642e01fSmrg#include "inputstr.h"
334642e01fSmrg#include "scrnintstr.h"
344642e01fSmrg#include <X11/extensions/XKB.h>
354642e01fSmrg#include <assert.h>
364642e01fSmrg
374642e01fSmrg#include "threadSafety.h"
384642e01fSmrg
394642e01fSmrgtypedef struct {
404642e01fSmrg    void                *framebuffer;
414642e01fSmrg    int                 x;
424642e01fSmrg    int                 y;
434642e01fSmrg    int                 width;
444642e01fSmrg    int                 height;
454642e01fSmrg    int                 pitch;
464642e01fSmrg    int                 depth;
474642e01fSmrg    int                 visuals;
484642e01fSmrg    int                 bitsPerRGB;
494642e01fSmrg    int                 bitsPerPixel;
504642e01fSmrg    int                 preferredCVC;
514642e01fSmrg    Pixel               redMask;
524642e01fSmrg    Pixel               greenMask;
534642e01fSmrg    Pixel               blueMask;
544642e01fSmrg} DarwinFramebufferRec, *DarwinFramebufferPtr;
554642e01fSmrg
564642e01fSmrg// From darwin.c
574642e01fSmrgvoid DarwinPrintBanner(void);
584642e01fSmrgint DarwinParseModifierList(const char *constmodifiers, int separatelr);
594642e01fSmrgvoid DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
604642e01fSmrgvoid xf86SetRootClip (ScreenPtr pScreen, int enable);
614642e01fSmrg
624642e01fSmrg#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
634642e01fSmrg    dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
644642e01fSmrg
654642e01fSmrg/*
664642e01fSmrg * Global variables from darwin.c
674642e01fSmrg */
684642e01fSmrgextern DevPrivateKey    darwinScreenKey; // index into pScreen.devPrivates
694642e01fSmrgextern int              darwinScreensFound;
704642e01fSmrgextern io_connect_t     darwinParamConnect;
714642e01fSmrgextern int              darwinEventReadFD;
724642e01fSmrgextern int              darwinEventWriteFD;
734642e01fSmrgextern DeviceIntPtr     darwinPointer;
744642e01fSmrgextern DeviceIntPtr     darwinTabletCurrent;
754642e01fSmrgextern DeviceIntPtr     darwinTabletCursor;
764642e01fSmrgextern DeviceIntPtr     darwinTabletStylus;
774642e01fSmrgextern DeviceIntPtr     darwinTabletEraser;
784642e01fSmrgextern DeviceIntPtr     darwinKeyboard;
794642e01fSmrg
804642e01fSmrg// User preferences
814642e01fSmrgextern int              darwinMouseAccelChange;
824642e01fSmrgextern int              darwinFakeButtons;
834642e01fSmrgextern int              darwinFakeMouse2Mask;
844642e01fSmrgextern int              darwinFakeMouse3Mask;
854642e01fSmrgextern unsigned int     darwinAppKitModMask;
864642e01fSmrgextern unsigned int     windowItemModMask;
874642e01fSmrgextern int              darwinSyncKeymap;
884642e01fSmrgextern unsigned int     darwinDesiredWidth, darwinDesiredHeight;
894642e01fSmrgextern int              darwinDesiredDepth;
904642e01fSmrgextern int              darwinDesiredRefresh;
914642e01fSmrg
924642e01fSmrg// location of X11's (0,0) point in global screen coordinates
934642e01fSmrgextern int              darwinMainScreenX;
944642e01fSmrgextern int              darwinMainScreenY;
954642e01fSmrg
964642e01fSmrg#define ENABLE_DEBUG_LOG 1
974642e01fSmrg
984642e01fSmrg#ifdef ENABLE_DEBUG_LOG
994642e01fSmrgextern FILE *debug_log_fp;
1004642e01fSmrg#define DEBUG_LOG_NAME "x11-debug.txt"
1014642e01fSmrg#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%s:%d " msg, threadSafetyID(pthread_self()), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
1024642e01fSmrg#else
1034642e01fSmrg#define DEBUG_LOG(msg, args...)
1044642e01fSmrg#endif
1054642e01fSmrg
1064642e01fSmrg#define TRACE() DEBUG_LOG("\n")
1074642e01fSmrg
1084642e01fSmrg#endif  /* _DARWIN_H */
109