Remove ancient trunk folder from svn repository
[synfig.git] / synfig-osx / launcher / darwin.h
1 /*
2  * Copyright (c) 2001 Torrey T. Lyons. All Rights Reserved.
3  * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  *
23  * Except as contained in this notice, the name(s) of the above copyright
24  * holders shall not be used in advertising or otherwise to promote the sale,
25  * use or other dealings in this Software without prior written authorization.
26  */
27 /* $XFree86: xc/programs/Xserver/hw/darwin/darwin.h,v 1.11 2002/03/28 02:21:08 torrey Exp $ */
28
29 #ifndef _DARWIN_H
30 #define _DARWIN_H
31
32 #include "inputstr.h"
33 #include "screenint.h"
34 #include "scrnintstr.h"
35 #include "extensions/XKB.h"
36
37 typedef struct {
38     void                *framebuffer;
39     int                 x;
40     int                 y;
41     int                 width;
42     int                 height;
43     int                 pitch;
44     int                 bitsPerPixel;
45     int                 componentCount;
46     int                 bitsPerComponent;
47     int                 colorBitsPerPixel;
48     unsigned int        redMask, greenMask, blueMask;
49 } DarwinFramebufferRec, *DarwinFramebufferPtr;
50
51 /* From darwinKeyboard.c */
52 int DarwinModifierNXKeyToNXKeycode(int key, int side);
53 void DarwinKeyboardInit(DeviceIntPtr pDev);
54 void DarwinKeyboardReload (DeviceIntPtr pDev);
55
56 /* from darwin-new-keymap.c */
57 unsigned int DarwinSystemKeymapSeed (void);
58
59 /* from darwin-input.c */
60 void DarwinEnqueueEvent (const xEvent *e);
61 Bool DarwinDequeueEvent (xEvent *e);
62 void DarwinInputInit (void);
63 void DarwinInputPreInit (void);
64 int DarwinMouseProc(DeviceIntPtr pPointer, int what);
65 int DarwinKeybdProc(DeviceIntPtr pDev, int onoff);
66
67 #undef assert
68 #define assert(x) { if ((x) == 0) \
69     FatalError("assert failed on line %d of %s!\n", __LINE__, __FILE__); }
70 #define kern_assert(x) { if ((x) != KERN_SUCCESS) \
71     FatalError("assert failed on line %d of %s with kernel return 0x%x!\n", \
72                 __LINE__, __FILE__, x); }
73 #define SCREEN_PRIV(pScreen) \
74     ((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr)
75
76 #define MIN_KEYCODE XkbMinLegalKeyCode     // unfortunately, this isn't 0...
77
78 extern void DarwinEnqueuePointerEvent (xEvent *xe);
79 extern void DarwinAdjustScreenOrigins (ScreenInfo *pScreenInfo);
80
81 /* Global variables from darwin.c */
82 extern int darwinScreenIndex; // index into pScreen.devPrivates
83 extern int darwinScreensFound;
84
85 /* User preferences used by generic Darwin X server code */
86 extern Bool darwinSwapAltMeta;
87 extern int darwinFakeButtons;
88 extern char *darwinKeymapFile;
89 extern Bool darwinSyncKeymap;
90
91 /* location of X11's (0,0) point in global screen coordinates */
92 extern int darwinMainScreenX;
93 extern int darwinMainScreenY;
94
95 /* Client message event type ranges. */
96 enum {
97     kXdarwinFirstEvent = 1,
98     kXdarwinLastEvent = kXdarwinFirstEvent + 99,
99     kXquartzFirstEvent = kXdarwinLastEvent + 1,
100     kXquartzLastEvent = kXquartzFirstEvent + 99,
101 };
102
103 /* "Darwin" client message types */
104 enum {
105     kXdarwinQuit = kXdarwinFirstEvent,
106 };
107
108 extern char *DarwinFindLibraryFile (const char *file, const char *pathext);
109 extern void DarwinForeachLibraryFile (const char *dir,
110                                       void (*callback) (const char *dir,
111                                                         const char *file,
112                                                         void *data),
113                                       void *data);
114
115 extern void DarwinSetFakeButtons (const char *mod2, const char *mod3);
116
117 #endif  /* _DARWIN_H */