1 /* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
2 
3 #ifndef ___UI_H__
4 #define ___UI_H__
5 
6 #ifndef _INTERFACE_DEFS_H
7 
8 /* InterfaceDefs.h */
9 enum {
10   B_BACKSPACE   = 0x08,
11   B_RETURN      = 0x0a,
12   B_ENTER       = 0x0a,
13   B_SPACE       = 0x20,
14   B_TAB         = 0x09,
15   B_ESCAPE      = 0x1b,
16   B_SUBSTITUTE  = 0x1a,
17 
18   B_LEFT_ARROW  = 0x1c,
19   B_RIGHT_ARROW = 0x1d,
20   B_UP_ARROW    = 0x1e,
21   B_DOWN_ARROW  = 0x1f,
22 
23   B_INSERT      = 0x05,
24   B_DELETE      = 0x7f,
25   B_HOME        = 0x01,
26   B_END         = 0x04,
27   B_PAGE_UP     = 0x0b,
28   B_PAGE_DOWN   = 0x0c,
29 
30   B_FUNCTION_KEY = 0x10,
31 
32   /* for Japanese and Korean keyboards */
33   B_KATAKANA_HIRAGANA = 0xf2,
34   B_HANKAKU_ZENKAKU = 0xf3,
35   B_HANGUL      = 0xf0,
36   B_HANGUL_HANJA = 0xf1
37 };
38 
39 enum {
40   B_F1_KEY      = 0x02,
41   B_F2_KEY      = 0x03,
42   B_F3_KEY      = 0x04,
43   B_F4_KEY      = 0x05,
44   B_F5_KEY      = 0x06,
45   B_F6_KEY      = 0x07,
46   B_F7_KEY      = 0x08,
47   B_F8_KEY      = 0x09,
48   B_F9_KEY      = 0x0a,
49   B_F10_KEY     = 0x0b,
50   B_F11_KEY     = 0x0c,
51   B_F12_KEY     = 0x0d,
52   B_PRINT_KEY   = 0x0e,
53   B_SCROLL_KEY  = 0x0f,
54   B_PAUSE_KEY   = 0x10
55 };
56 
57 enum {
58   B_SHIFT_KEY     = 0x00000001,
59   B_COMMAND_KEY   = 0x00000002,
60   B_CONTROL_KEY   = 0x00000004,
61   B_CAPS_LOCK     = 0x00000008,
62   B_SCROLL_LOCK   = 0x00000010,
63   B_NUM_LOCK      = 0x00000020,
64   B_OPTION_KEY    = 0x00000040,
65   B_MENU_KEY      = 0x00000080,
66   B_LEFT_SHIFT_KEY  = 0x00000100,
67   B_RIGHT_SHIFT_KEY = 0x00000200,
68   B_LEFT_COMMAND_KEY  = 0x00000400,
69   B_RIGHT_COMMAND_KEY = 0x00000800,
70   B_LEFT_CONTROL_KEY  = 0x00001000,
71   B_RIGHT_CONTROL_KEY = 0x00002000,
72   B_LEFT_OPTION_KEY = 0x00004000,
73   B_RIGHT_OPTION_KEY  = 0x00008000
74 };
75 
76 #endif
77 
78 typedef struct { int fd; } Display;
79 
80 typedef int XIC;
81 typedef int XID;
82 typedef void *Window; /* BView/BWindow */
83 typedef void *Drawable;
84 typedef void *Pixmap; /* BBitmap */
85 typedef void *PixmapMask;
86 typedef int GC;
87 typedef void *Font; /* BFont */
88 typedef int Cursor;
89 typedef int KeyCode;
90 typedef int KeySym;
91 
92 typedef struct /* Same as definition in X11/X.h */ {
93   int max_keypermod;
94   KeyCode *modifiermap;
95 
96 } XModifierKeymap;
97 
98 typedef struct /* Same as definition in X11/X.h */ {
99   unsigned char byte1;
100   unsigned char byte2;
101 
102 } XChar2b;
103 
104 #define UI_FOCUS_IN 1
105 #define UI_FOCUS_OUT 2
106 #define UI_BUTTON_PRESS 3
107 #define UI_BUTTON_RELEASE 4
108 #define UI_BUTTON_MOTION 5
109 #define UI_KEY_PRESS 6
110 #define UI_EXPOSE 7
111 #define UI_SELECTION_REQUESTED 8
112 #define UI_CLOSE_WINDOW 9
113 #define UI_KEY_FOCUS_IN 10
114 #define UI_SELECTION_NOTIFIED 11
115 #define UI_POINTER_MOTION 12
116 #define UI_RESIZE 13
117 
118 typedef struct { int type; } XEvent;
119 
120 typedef struct {
121   int type;
122   unsigned int state;
123   KeySym keysym;
124   const char *utf8;
125 
126 } XKeyEvent;
127 
128 typedef unsigned long Time; /* Same as definition in X11/X.h */
129 typedef unsigned long Atom; /* Same as definition in X11/X.h */
130 
131 typedef struct {
132   int type;
133   int time;
134   int x;
135   int y;
136   unsigned int state;
137   unsigned int button;
138   int click_count;
139 
140 } XButtonEvent;
141 
142 typedef struct {
143   int type;
144   int time;
145   int x;
146   int y;
147   unsigned int state;
148 
149 } XMotionEvent;
150 
151 typedef struct {
152   int type;
153   int x;
154   int y;
155   unsigned int width;
156   unsigned int height;
157   int force_expose;
158 
159 } XExposeEvent;
160 
161 typedef struct {
162   int type;
163   void *sender;
164 
165 } XSelectionRequestEvent;
166 
167 typedef struct {
168   int type;
169   char *data;
170   unsigned int len;
171 
172 } XSelectionNotifyEvent;
173 
174 typedef struct {
175   Font fid;
176   unsigned int size;
177 
178 } XFontStruct;
179 
180 typedef int XFontSet; /* dummy */
181 
182 #define None 0L     /* Same as definition in X11/X.h */
183 #define NoSymbol 0L /* Same as definition in X11/X.h */
184 
185 #define CurrentTime 0L /* Same as definition in X11/X.h */
186 
187 /* Same as definition in X11/X.h */
188 #define NoEventMask 0L
189 #define KeyPressMask (1L << 0)
190 #define KeyReleaseMask (1L << 1)
191 #define ButtonPressMask (1L << 2)
192 #define ButtonReleaseMask (1L << 3)
193 #define EnterWindowMask (1L << 4)
194 #define LeaveWindowMask (1L << 5)
195 #define PointerMotionMask (1L << 6)
196 #define PointerMotionHintMask (1L << 7)
197 #define Button1MotionMask (1L << 8)
198 #define Button2MotionMask (1L << 9)
199 #define Button3MotionMask (1L << 10)
200 #define Button4MotionMask (1L << 11)
201 #define Button5MotionMask (1L << 12)
202 #define ButtonMotionMask (1L << 13)
203 #define KeymapStateMask (1L << 14)
204 #define ExposureMask (1L << 15)
205 #define VisibilityChangeMask (1L << 16)
206 #define StructureNotifyMask (1L << 17)
207 #define ResizeRedirectMask (1L << 18)
208 #define SubstructureNotifyMask (1L << 19)
209 #define SubstructureRedirectMask (1L << 20)
210 #define FocusChangeMask (1L << 21)
211 #define PropertyChangeMask (1L << 22)
212 #define ColormapChangeMask (1L << 23)
213 #define OwnerGrabButtonMask (1L << 24)
214 #define ShiftMask B_SHIFT_KEY
215 #define LockMask 0
216 #define ControlMask B_CONTROL_KEY
217 #define Mod1Mask B_MENU_KEY
218 #define Mod2Mask 0
219 #define Mod3Mask 0
220 #define Mod4Mask 0
221 #define Mod5Mask 0
222 #define CommandMask B_COMMAND_KEY
223 #define Button1Mask 0
224 #define Button2Mask 0
225 #define Button3Mask 0
226 #define Button4Mask 0
227 #define Button5Mask 0
228 #define Button1 1
229 #define Button2 2
230 #define Button3 3
231 #define Button4 4
232 #define Button5 5
233 
234 #define XK_Super_L 0xfffe /* dummy */
235 #define XK_Super_R 0xfffd /* dummy */
236 #define XK_Hyper_L 0xfffc /* dummy */
237 #define XK_Hyper_R 0xfffb /* dummy */
238 #define XK_BackSpace B_BACKSPACE
239 #define XK_Tab B_TAB
240 #define XK_Clear 0xfffa /* dummy */
241 #define XK_Linefeed 0xfff9 /* dummy */
242 #define XK_Return B_RETURN
243 
244 #define XK_Shift_L 0xfff8   /* dummy */
245 #define XK_Control_L 0xfff7 /* dummy */
246 #define XK_Alt_L 0xfff6     /* dummy */
247 #define XK_Shift_R 0xfff5   /* dummy */
248 #define XK_Control_R 0xfff4 /* dummy */
249 #define XK_Alt_R 0xfff3     /* dummy */
250 
251 #define XK_Meta_L 0xfff2 /* dummy */
252 #define XK_Meta_R 0xfff1 /* dummy */
253 
254 #define XK_Pause (B_PAUSE_KEY | 0xf000)
255 #define XK_Shift_Lock 0xfff0 /* dummy */
256 #define XK_Caps_Lock 0xffef  /* dummy */
257 #define XK_Escape B_ESCAPE
258 #define XK_Prior (B_PAGE_UP | 0xe000)
259 #define XK_Next (B_PAGE_DOWN | 0xe000)
260 #define XK_End (B_END | 0xe000)
261 #define XK_Home (B_HOME | 0xe000)
262 #define XK_Left (B_LEFT_ARROW | 0xe000)
263 #define XK_Up (B_UP_ARROW | 0xe000)
264 #define XK_Right (B_RIGHT_ARROW | 0xe000)
265 #define XK_Down (B_DOWN_ARROW | 0xe000)
266 #define XK_Select 0xffee /* dummy */
267 #define XK_Print (B_PRINT_KEY | 0xf000)
268 #define XK_Execute 0xffed /* dummy */
269 #define XK_Insert (B_INSERT | 0xe000)
270 #define XK_Delete (B_DELETE | 0xe000)
271 #define XK_Help 0xffec /* dummy */
272 #define XK_F1 (B_F1_KEY | 0xf000)
273 #define XK_F2 (B_F2_KEY | 0xf000)
274 #define XK_F3 (B_F3_KEY | 0xf000)
275 #define XK_F4 (B_F4_KEY | 0xf000)
276 #define XK_F5 (B_F5_KEY | 0xf000)
277 #define XK_F6 (B_F6_KEY | 0xf000)
278 #define XK_F7 (B_F7_KEY | 0xf000)
279 #define XK_F8 (B_F8_KEY | 0xf000)
280 #define XK_F9 (B_F9_KEY | 0xf000)
281 #define XK_F10 (B_F10_KEY | 0xf000)
282 #define XK_F11 (B_F11_KEY | 0xf000)
283 #define XK_F12 (B_F12_KEY | 0xf000)
284 #define XK_F13 0xffeb /* dummy */
285 #define XK_F14 0xffea /* dummy */
286 #define XK_F15 0xffe9 /* dummy */
287 #define XK_F16 0xffe8 /* dummy */
288 #define XK_F17 0xffe7 /* dummy */
289 #define XK_F18 0xffe6 /* dummy */
290 #define XK_F19 0xffe5 /* dummy */
291 #define XK_F20 0xffe4 /* dummy */
292 #define XK_F21 0xffe3 /* dummy */
293 #define XK_F22 0xffe2 /* dummy */
294 #define XK_F23 0xffe1 /* dummy */
295 #define XK_F24 0xffe0 /* dummy */
296 #define XK_FMAX XK_F12
297 #define XK_Num_Lock 0xffdf /* dummy */
298 #define XK_Scroll_Lock 0xffde /* dummy */
299 #define XK_Find 0xffdd /* dummy */
300 #define XK_Menu 0xffdc /* dummy */
301 #define XK_Begin 0xffdb /* dummy */
302 #define XK_Muhenkan 0xffda        /* dummy */
303 #define XK_Henkan_Mode B_KATAKANA_HIRAGANA
304 #define XK_Zenkaku_Hankaku B_HANKAKU_ZENKAKU
305 
306 #define XK_KP_Prior 0xffd9     /* dummy */
307 #define XK_KP_Next 0xffd8      /* dummy */
308 #define XK_KP_End 0xffd7       /* dummy */
309 #define XK_KP_Home 0xffd6      /* dummy */
310 #define XK_KP_Left 0xffd5      /* dummy */
311 #define XK_KP_Up 0xffd4        /* dummy */
312 #define XK_KP_Right 0xffd3     /* dummy */
313 #define XK_KP_Down 0xffd2      /* dummy */
314 #define XK_KP_Insert 0xffd1    /* dummy */
315 #define XK_KP_Delete 0xffd0    /* dummy */
316 #define XK_KP_F1 0xffcf        /* dummy */
317 #define XK_KP_F2 0xffce        /* dummy */
318 #define XK_KP_F3 0xffcd        /* dummy */
319 #define XK_KP_F4 0xffcc        /* dummy */
320 #define XK_KP_Begin 0xffcb     /* dummy */
321 #define XK_KP_Multiply 0xffca  /* dummy */
322 #define XK_KP_Add 0xffc9       /* dummy */
323 #define XK_KP_Separator 0xffc8 /* dummy */
324 #define XK_KP_Subtract 0xffc7  /* dummy */
325 #define XK_KP_Decimal 0xffc6   /* dummy */
326 #define XK_KP_Divide 0xffc5    /* dummy */
327 #define XK_KP_0 0xffc4         /* dummy */
328 #define XK_KP_1 0xffc3         /* dummy */
329 #define XK_KP_2 0xffc2         /* dummy */
330 #define XK_KP_3 0xffc1         /* dummy */
331 #define XK_KP_4 0xffc0         /* dummy */
332 #define XK_KP_5 0xffbf         /* dummy */
333 #define XK_KP_6 0xffbe         /* dummy */
334 #define XK_KP_7 0xffbd         /* dummy */
335 #define XK_KP_8 0xffbc         /* dummy */
336 #define XK_KP_9 0xffbb         /* dummy */
337 
338 #define IsKeypadKey(ksym) (0)
339 #define IsModifierKey(ksym) (0)
340 
341 #define XK_ISO_Left_Tab 0xffba /* dummy */
342 
343 /* XPoint(short x, short y) in Xlib. POINT(float x, float y) in win32. */
344 typedef struct {
345   short x;
346   short y;
347 } XPoint;
348 
349 /* XXX dummy */
350 #define XKeysymToKeycode(disp, ks) (ks)
351 #define XKeycodeToKeysym(disp, kc, i) (kc)
352 #define XKeysymToString(ks) ""
353 #define DefaultScreen(disp) (0)
354 
355 #define BlackPixel(disp, screen) (0xff000000)
356 #define WhitePixel(disp, screen) (0xffffffff)
357 
358 /* Same as definition in X11/cursorfont.h */
359 #define XC_xterm 152
360 #define XC_left_ptr 68
361 
362 /* Same as definition in X11/Xutil.h */
363 #define NoValue 0x0000
364 #define XValue 0x0001
365 #define YValue 0x0002
366 #define WidthValue 0x0004
367 #define HeightValue 0x0008
368 #define AllValues 0x000F
369 #define XNegative 0x0010
370 #define YNegative 0x0020
371 
372 int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height);
373 
374 KeySym XStringToKeysym(char *str);
375 
376 /* === Platform dependent options === */
377 
378 #undef UI_COLOR_HAS_RGB
379 #undef SUPPORT_TRUE_TRANSPARENT_BG
380 #define TYPE_XCORE_SCALABLE
381 #undef MANAGE_ROOT_WINDOWS_BY_MYSELF
382 #undef MANAGE_SUB_WINDOWS_BY_MYSELF
383 #undef INLINE_PICTURE_MOVABLE_BETWEEN_DISPLAYS
384 #define SUPPORT_POINT_SIZE_FONT
385 #define XIM_SPOT_IS_LINE_TOP
386 #undef USE_GC
387 #undef CHANGEABLE_CURSOR
388 #undef PLUGIN_MODULE_SUFFIX
389 #undef KEY_REPEAT_BY_MYSELF
390 #undef ROTATABLE_DISPLAY
391 #undef PSEUDO_COLOR_DISPLAY
392 #undef WALL_PICTURE_SIXEL_REPLACES_SYSTEM_PALETTE
393 #define SUPPORT_URGENT_BELL
394 #define FORCE_UNICODE
395 #undef NEED_DISPLAY_SYNC_EVERY_TIME
396 #undef DRAW_SCREEN_IN_PIXELS
397 #define NO_DRAW_IMAGE_STRING
398 /* libpthread is not linked to mlterm explicitly for now. */
399 #undef HAVE_PTHREAD
400 #undef COMPOSE_DECSP_FONT
401 #undef USE_REAL_VERTICAL_FONT
402 #undef NO_DISPLAY_FD
403 #undef FLICK_SCROLL
404 #define UIWINDOW_SUPPORTS_PREEDITING
405 
406 #endif
407