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