b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Permission is hereby granted, free of charge, to any person obtaining a
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * copy of this software and associated documentation files (the "Software"),
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * to deal in the Software without restriction, including without limitation
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * and/or sell copies of the Software, and to permit persons to whom the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Software is furnished to do so, subject to the following conditions:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * The above copyright notice and this permission notice shall be included in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * all copies or substantial portions of the Software.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * DEALINGS IN THE SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Except as contained in this notice, the name(s) of the above copyright
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * holders shall not be used in advertising or otherwise to promote the sale,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * use or other dealings in this Software without prior written authorization.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.h,v 1.20 2003/11/15 00:07:09 torrey Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef _DARWIN_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define _DARWIN_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include <IOKit/IOTypes.h>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include "inputstr.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include "scrnintstr.h"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#include <X11/extensions/XKB.h>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync void *framebuffer;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int x;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int y;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int width;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int height;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int pitch;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int colorType;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int bitsPerPixel;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int colorBitsPerPixel;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int bitsPerComponent;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} DarwinFramebufferRec, *DarwinFramebufferPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync// From darwin.c
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinPrintBanner();
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint DarwinParseModifierList(const char *constmodifiers);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid xf86SetRootClip (ScreenPtr pScreen, BOOL enable);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync// From darwinEvents.c
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncBool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinEQEnqueue(const xEvent *e);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinEQPointerPost(xEvent *e);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync// From darwinKeyboard.c
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint DarwinModifierNXKeyToNXKeycode(int key, int side);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinKeyboardInit(DeviceIntPtr pDev);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint DarwinModifierNXKeyToNXMask(int key);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint DarwinModifierNXMaskToNXKey(int mask);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint DarwinModifierStringToNXKey(const char *string);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync// Mode specific functions
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncBool DarwinModeAddScreen(int index, ScreenPtr pScreen);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncBool DarwinModeSetupScreen(int index, ScreenPtr pScreen);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinModeInitOutput(int argc,char **argv);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinModeInitInput(int argc, char **argv);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncint DarwinModeProcessArgument(int argc, char *argv[], int i);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinModeProcessEvent(xEvent *xe);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinModeGiveUp(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncvoid DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#undef assert
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define assert(x) { if ((x) == 0) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FatalError("assert failed on line %d of %s!\n", __LINE__, __FILE__); }
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define kern_assert(x) { if ((x) != KERN_SUCCESS) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FatalError("assert failed on line %d of %s with kernel return 0x%x!\n", \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync __LINE__, __FILE__, x); }
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define SCREEN_PRIV(pScreen) \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0...
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Global variables from darwin.c
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinScreenIndex; // index into pScreen.devPrivates
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinScreensFound;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern io_connect_t darwinParamConnect;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinEventReadFD;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinEventWriteFD;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern DeviceIntPtr darwinPointer;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern DeviceIntPtr darwinKeyboard;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync// User preferences
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinMouseAccelChange;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinFakeButtons;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinFakeMouse2Mask;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinFakeMouse3Mask;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinSwapAltMeta;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern char *darwinKeymapFile;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinSyncKeymap;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern unsigned int darwinDesiredWidth, darwinDesiredHeight;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinDesiredDepth;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinDesiredRefresh;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync// location of X11's (0,0) point in global screen coordinates
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinMainScreenX;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int darwinMainScreenY;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Special ddx events understood by the X server
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncenum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinUpdateModifiers // update all modifier keys
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync = LASTEvent+1, // (from X.h list of event names)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinUpdateButtons, // update state of mouse buttons 2 and up
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinScrollWheel, // scroll wheel event
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Quartz-specific events -- not used in IOKit mode
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinActivate, // restore X drawing and cursor
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinSetRootClip, // enable or disable drawing to the X screen
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinQuit, // kill the X server and release the display
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * AppleWM events
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinControllerNotify, // send an AppleWMControllerNotify event
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinPasteboardNotify, // notify the WM to copy or paste
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Xplugin notification events
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinDisplayChanged, // display configuration has changed
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinWindowState, // window visibility state has changed
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync kXDarwinWindowMoved // window has moved on screen
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* _DARWIN_H */