1 /* xkeycaps, Copyright (c) 1991, 1992, 1993, 1996
2  *  Jamie Zawinski <jwz@jwz.org>
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation.  No representations are made about the suitability of this
9  * software for any purpose.  It is provided "as is" without express or
10  * implied warranty.
11  */
12 
13 #ifndef _KeyWidgetP_H_
14 #define _KeyWidgetP_H_
15 
16 #include <X11/StringDefs.h>
17 #include <X11/IntrinsicP.h>
18 #include <X11/cursorfont.h>
19 #include "KeyWidget.h"
20 #include "xkeycaps.h"
21 
22 typedef struct {
23   void (* highlight_key) P((KeyWidget));
24   void (* dehighlight_key) P((KeyWidget));
25 } KeyClassPart;
26 
27 /* Full class record declaration */
28 typedef struct _KeyClassRec {
29     CoreClassPart	core_class;
30     KeyClassPart	key_class;
31 } KeyClassRec;
32 
33 extern KeyClassRec keyClassRec;
34 
35 /* New fields for the Key widget record */
36 typedef struct {
37   int gutter_width;
38   Pixel highlight_pixel, background_pixel;
39   Pixel keycap_pixel, keycode_pixel;
40   XFontStruct *keycap_font, *keycode_font, *cursor_font;
41   GC keycap_gc, keycode_gc, cursor_gc;
42   String key_name;
43   int highlighted_p;		/* Whether it's drawn highlighted now */
44   unsigned short x, y;		/* Position in keyboard units */
45   int key_highlighted;		/* Whether this key (the real one) is down
46 				 * This is duplicated in kbd->key_state_vector
47 				 */
48   int mouse_highlighted;	/* Whether a button is depressed on this */
49   unsigned long modifier_bits;	/* Which modifiers this key CURRENTLY sets */
50   int auto_repeat_p;		/* Whether this key autorepeats */
51 
52   /* These slots are initialized when a keyboard is selected, and are not
53      changed at run-time.  They are copies of what came from the various
54      keyboard definition files. */
55 
56   unsigned short width;	 /* Width of the key in some arbitrary units */
57   unsigned short height; /* Height of the key in some arbitrary units */
58 
59   const char *keysym_1;
60   const char *keysym_2;
61   const char *keysym_3;
62 
63   KeyCode keycode;		/* This never changes */
64   KeySym default_keysyms[8];	/* This never changes */
65   unsigned long default_mods;	/* never changes, unlike modifier_bits slot */
66 
67 } KeyPart;
68 
69 typedef struct _KeyRec {		/* full instance record */
70     CorePart core;
71     KeyPart key;
72 } KeyRec;
73 
74 
75 struct KeyWidget_row {			/* like keyboard_row_geometry,
76 					   but of KeyWidgets. */
77   unsigned int nkeys;
78   unsigned int height;
79   KeyWidget *keys;
80 };
81 
82 #endif /* _KeyWidgetP_H_ */
83