| 1 | /* |
| 2 | * Copyright (c) 2002-2012 Apple Inc. All rights reserved. |
| 3 | * Copyright (c) 2003-2004 Torrey T. Lyons. 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 | |
| 28 | #ifndef QUARTZ_KEYBOARD_H |
| 29 | #define QUARTZ_KEYBOARD_H 1 |
| 30 | |
| 31 | #define XK_TECHNICAL // needed to get XK_Escape |
| 32 | #define XK_PUBLISHING |
| 33 | #include "X11/keysym.h" |
| 34 | #include "inputstr.h" |
| 35 | |
| 36 | // Each key can generate 4 glyphs. They are, in order: |
| 37 | // unshifted, shifted, modeswitch unshifted, modeswitch shifted |
| 38 | #define GLYPHS_PER_KEY 4 |
| 39 | #define NUM_KEYCODES 248 // NX_NUMKEYCODES might be better |
| 40 | #define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0... |
| 41 | #define MAX_KEYCODE NUM_KEYCODES + MIN_KEYCODE - 1 |
| 42 | |
| 43 | /* These functions need to be implemented by Xquartz, XDarwin, etc. */ |
| 44 | Bool |
| 45 | QuartsResyncKeymap(Bool sendDDXEvent); |
| 46 | |
| 47 | /* Provided for darwinEvents.c */ |
| 48 | void |
| 49 | DarwinKeyboardReloadHandler(void); |
| 50 | int |
| 51 | DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); |
| 52 | int |
| 53 | DarwinModifierNXKeyToNXKeycode(int key, int side); |
| 54 | int |
| 55 | DarwinModifierNXKeyToNXMask(int key); |
| 56 | int |
| 57 | DarwinModifierNXMaskToNXKey(int mask); |
| 58 | int |
| 59 | DarwinModifierStringToNXMask(const char *string, int separatelr); |
| 60 | |
| 61 | /* Provided for darwin.c */ |
| 62 | void |
| 63 | DarwinKeyboardInit(DeviceIntPtr pDev); |
| 64 | |
| 65 | #endif /* QUARTZ_KEYBOARD_H */ |