4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _KBTRANS_LOWER_H
28 #define _KBTRANS_LOWER_H
35 * This structure describes the state of the keyboard.
36 * and also specifies the keytables.
38 struct kbtrans_lower
{
39 /* Generating pre-4.1 events? */
42 /* key to repeat in TR_ASCII mode */
43 kbtrans_key_t kbtrans_repeatkey
;
45 /* Current state of the LED's */
46 uchar_t kbtrans_led_state
;
48 /* Pointer to keyboard maps */
49 struct keyboard
*kbtrans_keyboard
;
51 /* Current shift state */
52 uint_t kbtrans_shiftmask
;
54 uchar_t kbtrans_state
; /* compose state */
55 uint_t kbtrans_buckybits
; /* current buckybits */
56 uint_t kbtrans_togglemask
; /* Toggle shifts state */
57 kbtrans_key_t kbtrans_compose_key
; /* first compose key */
58 kbtrans_key_t kbtrans_fltaccent_entry
; /* floating accent entry */
61 * Various mapping tables.
63 signed char *kbtrans_compose_map
;
64 struct compose_sequence_t
*kbtrans_compose_table
;
65 struct fltaccent_sequence_t
*kbtrans_fltaccent_table
;
67 /* Strings sent by various keys */
68 char (*kbtrans_keystringtab
)[KTAB_STRLEN
];
71 unsigned char *kbtrans_numlock_table
;
74 * The kbtrans structure specifies the state of the
77 struct kbtrans
*kbtrans_upper
;
82 * Different functions must be called based upon the type of translation
83 * mode. Each translation mode such as TR_ASCII, TR_EVENT, TR_NONE, etc.
84 * has an instance of this structure.
86 struct keyboard_callback
{
89 * Raw (untranslated) keypress
91 void (*kc_keypressed_raw
)(struct kbtrans
*, kbtrans_key_t
);
94 * Raw (untranslated) keyrelease
96 void (*kc_keyreleased_raw
)(struct kbtrans
*, kbtrans_key_t
);
101 void (*kc_keypressed
)(struct kbtrans
*, uint_t
, kbtrans_key_t
, uint_t
);
106 void (*kc_keyreleased
)(struct kbtrans
*, kbtrans_key_t
);
109 * Initialize a repeat character
111 void (*kc_setup_repeat
)(struct kbtrans
*, uint_t
, kbtrans_key_t
);
114 * Cancel a repeat character
116 void (*kc_cancel_repeat
)(struct kbtrans
*);
119 * Process the led state change
121 void (*kc_setled
)(struct kbtrans
*);
125 * Process a scancode. This routine will call the functions in
126 * keyboard_callback to handle the translated key.
128 void kbtrans_processkey(struct kbtrans_lower
*, struct keyboard_callback
*,
129 kbtrans_key_t
, enum keystate
);
132 * This routine finds the entry for the specified keycode based on the
133 * specified shift mask.
135 keymap_entry_t
*kbtrans_find_entry(struct kbtrans_lower
*, uint_t
,
143 #define DPRINTF(l, m, args) \
144 (((l) >= kbtrans_errlevel) && ((m) & kbtrans_errmask) ? \
145 kbtrans_dprintf args : \
148 #define DPRINTF(l, m, args)
153 * Severity levels for printing
155 #define PRINT_L0 0 /* print every message */
156 #define PRINT_L1 1 /* debug */
157 #define PRINT_L2 2 /* minor errors */
158 #define PRINT_L3 3 /* major errors */
159 #define PRINT_L4 4 /* catastophic errors */
165 #define PRINT_MASK_ALL 0xFFFFFFFF
166 #define PRINT_MASK_OPEN 0x00000002
167 #define PRINT_MASK_PACKET 0x00000008
168 #define PRINT_MASK_CLOSE 0x00000004
171 extern int kbtrans_errmask
;
172 extern int kbtrans_errlevel
;
173 extern void kbtrans_dprintf(void *, const char *fmt
, ...);
180 #endif /* _KBTRANS_LOWER_H */