1 /* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
2 
3 #ifndef ___UI_H__
4 #define ___UI_H__
5 
6 #if defined(__linux__)
7 #include <linux/fb.h>
8 #include <linux/input.h>
9 #include <stdint.h> /* XXX */
10 #elif defined(__FreeBSD__)
11 #include <osreldate.h>
12 #include <sys/kbio.h>
13 #if __FreeBSD_version >= 410000
14 #include <sys/fbio.h>
15 #else
16 #include <machine/console.h>
17 #endif
18 #elif defined(__NetBSD__) || defined(__OpenBSD__)
19 #include <time.h>
20 #include <dev/wscons/wsconsio.h>
21 #include <dev/wscons/wsksymdef.h>
22 #endif
23 
24 #include <pobl/bl_types.h>
25 
26 #if defined(__FreeBSD__)
27 
28 typedef video_color_palette_t fb_cmap_t;
29 
30 #elif defined(__NetBSD__) || defined(__OpenBSD__)
31 
32 #define FBIOGETCMAP WSDISPLAYIO_GETCMAP
33 #define FBIOPUTCMAP WSDISPLAYIO_PUTCMAP
34 typedef struct wsdisplay_cmap fb_cmap_t;
35 
36 #else
37 
38 typedef struct fb_cmap fb_cmap_t;
39 
40 #endif
41 
42 /* SIXEL_SHAREPALETTE in c_sixel.c reduces the role of COLOR_CACHE_MINIMUM. */
43 #define COLOR_CACHE_MINIMUM
44 
45 typedef struct {
46   int fd;
47 
48   int fb_fd;
49   unsigned char *fb;
50   unsigned char *fb_base;
51   size_t smem_len;
52   unsigned int line_length;
53   unsigned int xoffset;
54   unsigned int yoffset;
55   unsigned int bytes_per_pixel; /* public */
56   unsigned int pixels_per_byte; /* public */
57 
58   /* Actual width, while ui_display_t.width excludes virtual kbd area. */
59   unsigned int width;
60   /* Actual height, while ui_display_t.height excludes virtual kbd area. */
61   unsigned int height;
62 
63   struct rgb_info {
64     unsigned int r_limit;
65     unsigned int g_limit;
66     unsigned int b_limit;
67     unsigned int r_offset;
68     unsigned int g_offset;
69     unsigned int b_offset;
70 
71   } rgbinfo;
72 
73   fb_cmap_t *cmap;
74   fb_cmap_t *cmap_orig;
75 
76   struct {
77 #ifndef COLOR_CACHE_MINIMUM
78     u_int8_t pixels[16384]; /* 2^14 */
79     u_int32_t flags[512];   /* 2^14/8/4 */
80 #else
81     /*
82      * Closest color is searched by 14 bits.
83      *   R(1)G(1)B(1): segment(3bits)
84      *   R(3)G(3)B(2): offset(11bits)
85      */
86 
87     u_int8_t pixels[2048];   /* 2^11 */
88     u_int8_t segments[2048]; /* 2^11 */
89 #endif
90 
91   } * color_cache;
92 
93   int key_state;
94   int lock_state;
95 
96   /* For 1, 2 or 4 bpp */
97   unsigned char *back_fb;
98   int shift_0;
99   int mask;
100 
101   size_t plane_offset[8];
102 
103 } Display;
104 
105 #define PIXEL_RED(pixel, rgbinfo) (((pixel) >> (rgbinfo).r_offset) << (rgbinfo).r_limit)
106 #define PIXEL_BLUE(pixel, rgbinfo) (((pixel) >> (rgbinfo).b_offset) << (rgbinfo).b_limit)
107 #define PIXEL_GREEN(pixel, rgbinfo) (((pixel) >> (rgbinfo).g_offset) << (rgbinfo).g_limit)
108 #define RGB_TO_PIXEL(r, g, b, rgbinfo)                  \
109   ((((r) >> (rgbinfo).r_limit) << (rgbinfo).r_offset) | \
110    (((g) >> (rgbinfo).g_limit) << (rgbinfo).g_offset) | \
111    (((b) >> (rgbinfo).b_limit) << (rgbinfo).b_offset))
112 
113 typedef int XIC;      /* dummy */
114 typedef void *XID;      /* dummy */
115 typedef void *Window;   /* dummy */
116 typedef void *Drawable; /* dummy */
117 
118 typedef struct {
119   unsigned char *image;
120   unsigned int width;
121   unsigned int height;
122 
123 } * Pixmap;
124 
125 typedef unsigned char* PixmapMask;
126 typedef int GC;     /* dummy */
127 typedef int Font;   /* dummy */
128 typedef int Cursor; /* dummy */
129 typedef int KeyCode;
130 typedef int KeySym;
131 
132 typedef struct /* Same as definition in X11/X.h */
133     {
134   int max_keypermod;
135   KeyCode *modifiermap;
136 
137 } XModifierKeymap;
138 
139 typedef struct /* Same as definition in X11/X.h */
140     {
141   unsigned char byte1;
142   unsigned char byte2;
143 
144 } XChar2b;
145 
146 typedef struct {
147   int type;
148   unsigned int state;
149   KeySym ksym;
150   unsigned int keycode;
151 
152 } XKeyEvent;
153 
154 typedef unsigned long Time; /* Same as definition in X11/X.h */
155 typedef unsigned long Atom; /* Same as definition in X11/X.h */
156 
157 typedef struct {
158   int type;
159   Time time;
160   int x;
161   int y;
162   unsigned int state;
163   unsigned int button;
164 
165 } XButtonEvent;
166 
167 typedef struct {
168   int type;
169   Time time;
170   int x;
171   int y;
172   unsigned int state;
173 
174 } XMotionEvent;
175 
176 typedef struct {
177   int type;
178   struct ui_window *target;
179 
180 } XSelectionRequestEvent;
181 
182 typedef union {
183   int type;
184   XKeyEvent xkey;
185   XButtonEvent xbutton;
186   XMotionEvent xmotion;
187   XSelectionRequestEvent xselectionrequest;
188 
189 } XEvent;
190 
191 /*
192  * XFontStruct must be the same in fb, wayland, sdl2 and Android.
193  */
194 typedef struct _XFontStruct {
195   char *file;
196 
197   int32_t num_glyphs;  /* Not used on freetype */
198   unsigned char *glyphs; /* Cast to unsigned char** on FreeType */
199   void *glyph_indeces; /* PCF: int16_t*, decsp: int16_t*, FreeType: u_int32_t* */
200 
201   /* If is_aa is true, don't use glyph_width_bytes except in next_glyph_buf(). */
202   int32_t glyph_width_bytes;
203 
204   u_int16_t width;
205   /* Width of full width characters or max width of half width characters. */
206   u_int16_t width_full;
207   u_int16_t height;
208   u_int16_t ascent;
209   u_int8_t has_each_glyph_width_info;
210 
211   /* for pcf */
212   int16_t min_char_or_byte2;
213   int16_t max_char_or_byte2;
214   int16_t min_byte1;
215   int16_t max_byte1;
216   int32_t *glyph_offsets;
217 
218 #ifdef USE_FREETYPE
219   /*
220    * XXX
221    *
222    * (fontsize|FONT_BOLD|FONT_ITALIC|FONT_ROTATED) on freetype.
223    * fontsize is 0-0x1ff.
224    */
225   int32_t format;
226   void *face;
227   u_int32_t num_indeces;
228   u_int32_t num_glyph_bufs;
229   u_int32_t glyph_buf_left;
230   int is_aa;
231 
232 #ifdef USE_FONTCONFIG
233   struct _XFontStruct **compl_xfonts;
234 #endif
235 #endif
236 
237   unsigned int ref_count;
238 
239 } XFontStruct;
240 
241 typedef int XFontSet; /* dummy */
242 
243 #define None 0L     /* Same as definition in X11/X.h */
244 #define NoSymbol 0L /* Same as definition in X11/X.h */
245 
246 #define CurrentTime 0L /* Same as definition in X11/X.h */
247 
248 /* Same as definition in X11/X.h */
249 #define NoEventMask 0L
250 #define KeyPressMask (1L << 0)
251 #define KeyReleaseMask (1L << 1)
252 #define ButtonPressMask (1L << 2)
253 #define ButtonReleaseMask (1L << 3)
254 #define EnterWindowMask (1L << 4)
255 #define LeaveWindowMask (1L << 5)
256 #define PointerMotionMask (1L << 6)
257 #define PointerMotionHintMask (1L << 7)
258 #define Button1MotionMask (1L << 8)
259 #define Button2MotionMask (1L << 9)
260 #define Button3MotionMask (1L << 10)
261 #define Button4MotionMask (1L << 11)
262 #define Button5MotionMask (1L << 12)
263 #define ButtonMotionMask (1L << 13)
264 #define KeymapStateMask (1L << 14)
265 #define ExposureMask (1L << 15)
266 #define VisibilityChangeMask (1L << 16)
267 #define StructureNotifyMask (1L << 17)
268 #define ResizeRedirectMask (1L << 18)
269 #define SubstructureNotifyMask (1L << 19)
270 #define SubstructureRedirectMask (1L << 20)
271 #define FocusChangeMask (1L << 21)
272 #define PropertyChangeMask (1L << 22)
273 #define ColormapChangeMask (1L << 23)
274 #define OwnerGrabButtonMask (1L << 24)
275 #define ShiftMask (1 << 0)
276 #define LockMask (1 << 1)
277 #define ControlMask (1 << 2)
278 #define Mod1Mask (1 << 3)
279 #define Mod2Mask (1 << 4)
280 #define Mod3Mask (1 << 5)
281 #define Mod4Mask (1 << 6)
282 #define Mod5Mask (1 << 7)
283 #define Button1Mask (1 << 8)
284 #define Button2Mask (1 << 9)
285 #define Button3Mask (1 << 10)
286 #define Button4Mask (1 << 11)
287 #define Button5Mask (1 << 12)
288 #define Button1 1
289 #define Button2 2
290 #define Button3 3
291 #define Button4 4
292 #define Button5 5
293 
294 #if defined(__NetBSD__) || defined(__OpenBSD__)
295 
296 #define XK_Super_L 0xfffe /* dummy */
297 #define XK_Super_R 0xfffd /* dummy */
298 #define XK_Hyper_L 0xfffc /* dummy */
299 #define XK_Hyper_R 0xfffb /* dummy */
300 #define XK_BackSpace 0x08
301 #define XK_Tab 0x09
302 #define XK_Clear KS_Clear
303 #define XK_Linefeed KS_Linefeed
304 #define XK_Return 0x0d
305 
306 #define XK_Shift_L KS_Shift_L
307 #define XK_Control_L KS_Control_L
308 #define XK_Alt_L KS_Alt_L
309 #define XK_Shift_R KS_Shift_R
310 #define XK_Control_R KS_Control_R
311 #define XK_Alt_R KS_Alt_R
312 
313 #define XK_Meta_L KS_Meta_L
314 #define XK_Meta_R KS_Meta_R
315 
316 #define XK_Pause KS_Pause
317 #define XK_Shift_Lock KS_Shift_Lock
318 #define XK_Caps_Lock KS_Caps_Lock
319 #define XK_Escape KS_Escape
320 #define XK_Prior KS_Prior
321 #define XK_Next KS_Next
322 #define XK_End KS_End
323 #define XK_Home KS_Home
324 #define XK_Left KS_Left
325 #define XK_Up KS_Up
326 #define XK_Right KS_Right
327 #define XK_Down KS_Down
328 #define XK_Select KS_Select
329 #define XK_Print KS_Print_Screen
330 #define XK_Execute KS_Execute
331 #define XK_Insert KS_Insert
332 #define XK_Delete KS_Delete
333 #define XK_Help KS_Help
334 #define XK_F1 KS_F1
335 #define XK_F2 KS_F2
336 #define XK_F3 KS_F3
337 #define XK_F4 KS_F4
338 #define XK_F5 KS_F5
339 #define XK_F6 KS_F6
340 #define XK_F7 KS_F7
341 #define XK_F8 KS_F8
342 #define XK_F9 KS_F9
343 #define XK_F10 KS_F10
344 #define XK_F11 KS_F11
345 #define XK_F12 KS_F12
346 #define XK_F13 KS_F13
347 #define XK_F14 KS_F14
348 #define XK_F15 KS_F15
349 #define XK_F16 KS_F16
350 #define XK_F17 KS_F17
351 #define XK_F18 KS_F18
352 #define XK_F19 KS_F19
353 #define XK_F20 KS_F20
354 #define XK_F21 0xfffa /* dummy */
355 #define XK_F22 0xfff9 /* dummy */
356 #define XK_F23 0xfff8 /* dummy */
357 #define XK_F24 0xfff7 /* dummy */
358 #define XK_FMAX KS_F20
359 #define XK_Num_Lock KS_Num_Lock
360 #define XK_Scroll_Lock KS_Scroll_Lock
361 #define XK_Find KS_Find
362 #define XK_Menu KS_Menu
363 #define XK_Begin 0xfff6 /* dummy */
364 #define XK_Muhenkan KS_Muhenkan
365 #define XK_Henkan_Mode KS_Henkan_Mode
366 #define XK_Zenkaku_Hankaku KS_Zenkaku_Hankaku
367 #define XK_Hiragana_Katakana KS_Hiragana_Katakana
368 
369 #define XK_KP_Prior KS_KP_Prior
370 #define XK_KP_Next KS_KP_Next
371 #define XK_KP_End KS_KP_End
372 #define XK_KP_Home KS_KP_Home
373 #define XK_KP_Left KS_KP_Left
374 #define XK_KP_Up KS_KP_Up
375 #define XK_KP_Right KS_KP_Right
376 #define XK_KP_Down KS_KP_Down
377 #define XK_KP_Insert KS_KP_Insert
378 #define XK_KP_Delete KS_KP_Delete
379 #define XK_KP_F1 KS_KP_F1
380 #define XK_KP_F2 KS_KP_F2
381 #define XK_KP_F3 KS_KP_F3
382 #define XK_KP_F4 KS_KP_F4
383 #define XK_KP_Begin KS_KP_Begin
384 #define XK_KP_Multiply KS_KP_Multiply
385 #define XK_KP_Add KS_KP_Add
386 #define XK_KP_Separator KS_KP_Separator
387 #define XK_KP_Subtract KS_KP_Subtract
388 #define XK_KP_Decimal KS_KP_Decimal
389 #define XK_KP_Divide KS_KP_Divide
390 #define XK_KP_0 KS_KP_0
391 #define XK_KP_1 KS_KP_1
392 #define XK_KP_2 KS_KP_2
393 #define XK_KP_3 KS_KP_3
394 #define XK_KP_4 KS_KP_4
395 #define XK_KP_5 KS_KP_5
396 #define XK_KP_6 KS_KP_6
397 #define XK_KP_7 KS_KP_7
398 #define XK_KP_8 KS_KP_8
399 #define XK_KP_9 KS_KP_9
400 
401 #define IsKeypadKey(ksym) (0xf200 <= (ksym) && (ksym) < 0xf300)
402 #define IsModifierKey(ksym) (KS_Shift_L <= (ksym) && (ksym) <= KS_Alt_R)
403 
404 #else /* if __FreeBSD__ || __linux__ */
405 
406 #ifndef __linux__ /* FreeBSD */
407 
408 #define KEY_CLEAR 0xff    /* dummy */
409 #define KEY_LINEFEED 0xfe /* dummy */
410 #define KEY_LEFTSHIFT LSH
411 #define KEY_LEFTCTRL LCTR
412 #define KEY_LEFTALT LALT
413 #define KEY_RIGHTSHIFT RSH
414 #define KEY_RIGHTCTRL RCTR
415 #define KEY_RIGHTALT RALT
416 #define KEY_LEFTMETA 0xfd  /* dummy */
417 #define KEY_RIGHTMETA 0xfc /* dummy */
418 #define KEY_CAPSLOCK CLK
419 #define KEY_PAGEUP 0x4d
420 #define KEY_PAGEDOWN 0x55
421 #define KEY_END 0x53
422 #define KEY_HOME 0x4b
423 #define KEY_LEFT 0x4f
424 #define KEY_UP 0x4c
425 #define KEY_RIGHT 0x51
426 #define KEY_DOWN 0x54
427 #define KEY_SELECT 0xfb /* dummy */
428 #define KEY_PRINT 0x0a /* == NEXT in kbio.h */
429 #define KEY_INSERT 0x56
430 #define KEY_DELETE 0x57
431 #define KEY_HELP 0xfa /* dummy */
432 #define KEY_F1 F(1)
433 #define KEY_F2 F(2)
434 #define KEY_F3 F(3)
435 #define KEY_F4 F(4)
436 #define KEY_F5 F(5)
437 #define KEY_F6 F(6)
438 #define KEY_F7 F(7)
439 #define KEY_F8 F(8)
440 #define KEY_F9 F(9)
441 #define KEY_F10 F(10)
442 #define KEY_F11 F(11)
443 #define KEY_F12 F(12)
444 #define KEY_F13 0xf9 /* dummy */
445 #define KEY_F14 0xf8 /* dummy */
446 #define KEY_F15 0xf7 /* dummy */
447 #define KEY_F16 0xf6 /* dummy */
448 #define KEY_F17 0xf5 /* dummy */
449 #define KEY_F18 0xf4 /* dummy */
450 #define KEY_F19 0xf3 /* dummy */
451 #define KEY_F20 0xf2 /* dummy */
452 #define KEY_F21 0xf1 /* dummy */
453 #define KEY_F22 0xf0 /* dummy */
454 #define KEY_F23 0xef /* dummy */
455 #define KEY_F24 0xee /* dummy */
456 #define KEY_NUMLOCK NLK
457 #define KEY_SCROLLLOCK SLK
458 #define KEY_FIND 0xed             /* dummy */
459 #define KEY_MENU 0xec             /* dummy */
460 #define KEY_MUHENKAN 0xeb         /* dummy */
461 #define KEY_HENKAN 0xea           /* dummy */
462 #define KEY_ZENKAKUHANKAKU 0xe9   /* dummy */
463 #define KEY_KATAKANAHIRAGANA 0xe8 /* dummy */
464 #define KEY_KPASTERISK 0xe7       /* dummy */
465 #define KEY_KPPLUS (0x52 + 0x100)
466 #define KEY_KPCOMMA 0xe6 /* dummy */
467 #define KEY_KPMINUS (0x4e + 0x100)
468 #define KEY_KPDOT (0x7f + 0x100)
469 #define KEY_KPSLASH 0xe5 /* dummy */
470 #define KEY_KP0 (0x56 + 0x100)
471 #define KEY_KP1 (0x53 + 0x100)
472 #define KEY_KP2 (0x54 + 0x100)
473 #define KEY_KP3 (0x55 + 0x100)
474 #define KEY_KP4 (0x4f + 0x100)
475 #define KEY_KP5 (0x50 + 0x100)
476 #define KEY_KP6 (0x51 + 0x100)
477 #define KEY_KP7 (0x4b + 0x100)
478 #define KEY_KP8 (0x4c + 0x100)
479 #define KEY_KP9 (0x4d + 0x100)
480 
481 #endif /* FreeBSD */
482 
483 #define XK_Super_L 0xfffe /* dummy */
484 #define XK_Super_R 0xfffd /* dummy */
485 #define XK_Hyper_L 0xfffc /* dummy */
486 #define XK_Hyper_R 0xfffb /* dummy */
487 #define XK_BackSpace 0x08
488 #define XK_Tab 0x09
489 #define XK_Clear (KEY_CLEAR + 0x100)
490 #define XK_Linefeed (KEY_LINEFEED + 0x100)
491 #define XK_Return 0x0d
492 
493 #define XK_Shift_L (KEY_LEFTSHIFT + 0x100)
494 #define XK_Control_L (KEY_LEFTCTRL + 0x100)
495 #define XK_Alt_L (KEY_LEFTALT + 0x100)
496 #define XK_Shift_R (KEY_RIGHTSHIFT + 0x100)
497 #define XK_Control_R (KEY_RIGHTCTRL + 0x100)
498 #define XK_Alt_R (KEY_RIGHTALT + 0x100)
499 
500 #define XK_Meta_L (KEY_LEFTMETA + 0x100)
501 #define XK_Meta_R (KEY_RIGHTMETA + 0x100)
502 
503 #define XK_Pause 0xfff1      /* dummy */
504 #define XK_Shift_Lock 0xfff0 /* dummy */
505 #define XK_Caps_Lock (KEY_CAPSLOCK + 0x100)
506 #define XK_Escape 0x1b
507 #define XK_Prior (KEY_PAGEUP + 0x100)
508 #define XK_Next (KEY_PAGEDOWN + 0x100)
509 #define XK_End (KEY_END + 0x100)
510 #define XK_Home (KEY_HOME + 0x100)
511 #define XK_Left (KEY_LEFT + 0x100)
512 #define XK_Up (KEY_UP + 0x100)
513 #define XK_Right (KEY_RIGHT + 0x100)
514 #define XK_Down (KEY_DOWN + 0x100)
515 #define XK_Select (KEY_SELECT + 0x100)
516 #define XK_Print (KEY_PRINT + 0x100)
517 #define XK_Execute 0xffef /* dummy */
518 #define XK_Insert (KEY_INSERT + 0x100)
519 #define XK_Delete (KEY_DELETE + 0x100)
520 #define XK_Help (KEY_HELP + 0x100)
521 #define XK_F1 (KEY_F1 + 0x100)
522 #define XK_F2 (KEY_F2 + 0x100)
523 #define XK_F3 (KEY_F3 + 0x100)
524 #define XK_F4 (KEY_F4 + 0x100)
525 #define XK_F5 (KEY_F5 + 0x100)
526 #define XK_F6 (KEY_F6 + 0x100)
527 #define XK_F7 (KEY_F7 + 0x100)
528 #define XK_F8 (KEY_F8 + 0x100)
529 #define XK_F9 (KEY_F9 + 0x100)
530 #define XK_F10 (KEY_F10 + 0x100)
531 #define XK_F11 (KEY_F11 + 0x100)
532 #define XK_F12 (KEY_F12 + 0x100)
533 #define XK_F13 (KEY_F13 + 0x100)
534 #define XK_F14 (KEY_F14 + 0x100)
535 #define XK_F15 (KEY_F15 + 0x100)
536 #define XK_F16 (KEY_F16 + 0x100)
537 #define XK_F17 (KEY_F17 + 0x100)
538 #define XK_F18 (KEY_F18 + 0x100)
539 #define XK_F19 (KEY_F19 + 0x100)
540 #define XK_F20 (KEY_F20 + 0x100)
541 #define XK_F21 (KEY_F21 + 0x100)
542 #define XK_F22 (KEY_F22 + 0x100)
543 #define XK_F23 (KEY_F23 + 0x100)
544 #define XK_F24 (KEY_F24 + 0x100)
545 #ifdef __FreeBSD__
546 #define XK_FMAX XK_F12
547 #else
548 #define XK_FMAX XK_F10 /* F11 or later is not sequential number. */
549 #endif
550 #define XK_Num_Lock (KEY_NUMLOCK + 0x100)
551 #define XK_Scroll_Lock (KEY_SCROLLLOCK + 0x100)
552 #define XK_Find (KEY_FIND + 0x100)
553 #define XK_Menu (KEY_MENU + 0x100)
554 #define XK_Begin 0xffee /* dummy */
555 #define XK_Muhenkan (KEY_MUHENKAN + 0x100)
556 #define XK_Henkan_Mode (KEY_HENKAN + 0x100)
557 #define XK_Zenkaku_Hankaku (KEY_ZENKAKUHANKAKU + 0x100)
558 #define XK_Hiragana_Katakana (KEY_KATAKANAHIRAGANA + 0x100)
559 
560 #define XK_KP_Prior (KEY_KP9 + 0x100)
561 #define XK_KP_Next (KEY_KP3 + 0x100)
562 #define XK_KP_End (KEY_KP1 + 0x100)
563 #define XK_KP_Home (KEY_KP7 + 0x100)
564 #define XK_KP_Left (KEY_KP4 + 0x100)
565 #define XK_KP_Up (KEY_KP8 + 0x100)
566 #define XK_KP_Right (KEY_KP6 + 0x100)
567 #define XK_KP_Down (KEY_KP2 + 0x100)
568 #define XK_KP_Insert (KEY_KP0 + 0x100)
569 #define XK_KP_Delete (KEY_KPDOT + 0x100)
570 #define XK_KP_F1 0xffed               /* dummy */
571 #define XK_KP_F2 0xffec               /* dummy */
572 #define XK_KP_F3 0xffeb               /* dummy */
573 #define XK_KP_F4 0xffea               /* dummy */
574 #define XK_KP_Begin (KEY_KP5 + 0x100) /* dummy */
575 #define XK_KP_Multiply (KEY_KPASTERISK + 0x100)
576 #define XK_KP_Add (KEY_KPPLUS + 0x100)
577 #define XK_KP_Separator (KEY_KPCOMMA + 0x100)
578 #define XK_KP_Subtract (KEY_KPMINUS + 0x100)
579 #define XK_KP_Decimal 0xffe9 /* dummy */
580 #define XK_KP_Divide (KEY_KPSLASH + 0x100)
581 #define XK_KP_0 0xffe8 /* dummy */
582 #define XK_KP_1 0xffe7 /* dummy */
583 #define XK_KP_2 0xffe6 /* dummy */
584 #define XK_KP_3 0xffe5 /* dummy */
585 #define XK_KP_4 0xffe4 /* dummy */
586 #define XK_KP_5 0xffe3 /* dummy */
587 #define XK_KP_6 0xffe1 /* dummy */
588 #define XK_KP_7 0xffe0 /* dummy */
589 #define XK_KP_8 0xffdf /* dummy */
590 #define XK_KP_9 0xffde /* dummy */
591 
592 #define IsKeypadKey(ksym) (1)
593 #define IsModifierKey(ksym) (0)
594 
595 #endif /* FreeBSD/Linux/NetBSD */
596 
597 #define XK_ISO_Left_Tab 0xffa3 /* dummy */
598 
599 /* Same as definition in X11/X.h */
600 typedef struct {
601   short x;
602   short y;
603 
604 } XPoint;
605 
606 /* XXX dummy */
607 #define XKeysymToKeycode(disp, ks) (ks)
608 #define XKeycodeToKeysym(disp, kc, i) (kc)
609 #define XKeysymToString(ks) ""
610 #define DefaultScreen(disp) (0)
611 
612 #define BlackPixel(disp, screen) (0)
613 #define WhitePixel(disp, screen) (-1)
614 
615 /* Same as definition in X11/cursorfont.h */
616 #define XC_xterm 152
617 #define XC_left_ptr 68
618 
619 /* Same as definition in X11/Xutil.h */
620 #define NoValue 0x0000
621 #define XValue 0x0001
622 #define YValue 0x0002
623 #define WidthValue 0x0004
624 #define HeightValue 0x0008
625 #define AllValues 0x000F
626 #define XNegative 0x0010
627 #define YNegative 0x0020
628 
629 int XParseGeometry(char *str, int *x, int *y, unsigned int *width, unsigned int *height);
630 
631 KeySym XStringToKeysym(char *str);
632 
633 /* === Platform dependent options === */
634 
635 #define UI_COLOR_HAS_RGB
636 #undef SUPPORT_TRUE_TRANSPARENT_BG
637 #ifdef USE_FREETYPE
638 /* XXX pcf fonts isn't scalable, though... */
639 #define TYPE_XCORE_SCALABLE
640 #else
641 #undef TYPE_XCORE_SCALABLE
642 #endif
643 #define MANAGE_ROOT_WINDOWS_BY_MYSELF
644 #define MANAGE_SUB_WINDOWS_BY_MYSELF
645 /* See also fb/ui_display.c where ui_picture_display_closed() is never called. */
646 #define INLINE_PICTURE_MOVABLE_BETWEEN_DISPLAYS
647 #undef SUPPORT_POINT_SIZE_FONT
648 #undef XIM_SPOT_IS_LINE_TOP
649 #undef USE_GC
650 #undef CHANGEABLE_CURSOR
651 #define PLUGIN_MODULE_SUFFIX "fb"
652 #if defined(__NetBSD__) && !defined(USE_GRF)
653 #define KEY_REPEAT_BY_MYSELF
654 #else
655 #undef KEY_REPEAT_BY_MYSELF
656 #endif
657 #define ROTATABLE_DISPLAY
658 #define PSEUDO_COLOR_DISPLAY
659 #if defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__FreeBSD__) && defined(PC98))
660 /* for old machines */
661 #define WALL_PICTURE_SIXEL_REPLACES_SYSTEM_PALETTE
662 #else
663 #undef WALL_PICTURE_SIXEL_REPLACES_SYSTEM_PALETTE
664 #endif
665 #undef SUPPORT_URGENT_BELL
666 #undef FORCE_UNICODE
667 #undef NEED_DISPLAY_SYNC_EVERY_TIME
668 #define DRAW_SCREEN_IN_PIXELS
669 #undef NO_DRAW_IMAGE_STRING
670 /*
671  * libpthread is not linked to mlterm explicitly for now.
672  *
673  * Threading is not supported for 8 or less bpp framebuffer imaging
674  * because of ui_display_enable_to_change_cmap() and ui_display_set_cmap().
675  */
676 #undef HAVE_PTHREAD
677 #define COMPOSE_DECSP_FONT
678 #ifdef USE_FREETYPE
679 #define USE_REAL_VERTICAL_FONT
680 #else
681 #undef USE_REAL_VERTICAL_FONT
682 #endif
683 #undef NO_DISPLAY_FD
684 #undef FLICK_SCROLL
685 #undef UIWINDOW_SUPPORTS_PREEDITING
686 
687 #endif
688