1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * ©1995 Artsoft Development *
6 * 33659 Bielefeld-Senne *
7 * Telefon: (0521) 493245 *
8 * eMail: aeglos@valinor.owl.de *
9 * aeglos@uni-paderborn.de *
10 * q99492@pbhrzx.uni-paderborn.de *
11 *----------------------------------------------------------*
13 ***********************************************************/
20 #include <X11/Xutil.h>
21 #include <X11/Xatom.h>
23 #include <X11/Intrinsic.h>
24 #include <X11/keysymdef.h>
27 #ifdef USE_SDL_LIBRARY
31 #ifdef USE_SDL_LIBRARY
33 typedef SDL_Surface *Bitmap;
34 typedef SDL_Surface *DrawWindow;
35 typedef SDL_Surface *DrawBuffer;
39 typedef SDL_Event Event;
40 typedef SDL_MouseButtonEvent ButtonEvent;
41 typedef SDL_MouseMotionEvent MotionEvent;
42 typedef SDL_KeyboardEvent KeyEvent;
43 typedef XExposeEvent ExposeEvent;
44 typedef XFocusChangeEvent FocusChangeEvent;
45 typedef XClientMessageEvent ClientMessageEvent;
47 #define EVENT_BUTTONPRESS SDL_MOUSEBUTTONDOWN
48 #define EVENT_BUTTONRELEASE SDL_MOUSEBUTTONUP
49 #define EVENT_MOTIONNOTIFY SDL_MOUSEMOTION
50 #define EVENT_KEYPRESS SDL_KEYDOWN
51 #define EVENT_KEYRELEASE SDL_KEYUP
52 #define EVENT_EXPOSE SDL_USEREVENT + 0
53 #define EVENT_FOCUSIN SDL_USEREVENT + 1
54 #define EVENT_FOCUSOUT SDL_USEREVENT + 2
55 #define EVENT_CLIENTMESSAGE SDL_QUIT
56 #define EVENT_MAPNOTIFY SDL_USEREVENT + 4
57 #define EVENT_UNMAPNOTIFY SDL_USEREVENT + 5
59 #define KEY_UNDEFINED SDLK_UNKNOWN
61 #define KEY_Return SDLK_RETURN
62 #define KEY_Escape SDLK_ESCAPE
64 #define KEY_Left SDLK_LEFT
65 #define KEY_Right SDLK_RIGHT
66 #define KEY_Up SDLK_UP
67 #define KEY_Down SDLK_DOWN
70 #define KEY_KP_Left SDLK_KP_LEFT
71 #define KEY_KP_Right SDLK_KP_RIGHT
72 #define KEY_KP_Up SDLK_KP_UP
73 #define KEY_KP_Down SDLK_KP_DOWN
76 #define KEY_KP_Enter SDLK_KP_ENTER
77 #define KEY_KP_Add SDLK_KP_PLUS
78 #define KEY_KP_Subtract SDLK_KP_MINUS
79 #define KEY_KP_Multiply SDLK_KP_MULTIPLY
80 #define KEY_KP_Divide SDLK_KP_DIVIDE
81 #define KEY_KP_Separator SDLK_KP_PERIOD
83 #define KEY_Shift_L SDLK_LSHIFT
84 #define KEY_Shift_R SDLK_RSHIFT
85 #define KEY_Control_L SDLK_LCTRL
86 #define KEY_Control_R SDLK_RCTRL
87 #define KEY_Meta_L SDLK_LMETA
88 #define KEY_Meta_R SDLK_RMETA
89 #define KEY_Alt_L SDLK_LALT
90 #define KEY_Alt_R SDLK_RALT
91 #define KEY_Mode_switch SDLK_MODE
92 #define KEY_Multi_key KEY_UNDEFINED /* undefined */
94 #define KEY_BackSpace SDLK_BACKSPACE
95 #define KEY_Delete SDLK_DELETE
96 #define KEY_Insert SDLK_INSERT
97 #define KEY_Tab SDLK_TAB
98 #define KEY_Home SDLK_HOME
99 #define KEY_End SDLK_END
100 #define KEY_Page_Up SDLK_PAGEUP
101 #define KEY_Page_Down SDLK_PAGEDOWN
103 #define KEY_space SDLK_SPACE
104 #define KEY_exclam SDLK_EXCLAIM
105 #define KEY_quotedbl SDLK_QUOTEDBL
106 #define KEY_numbersign SDLK_HASH
107 #define KEY_dollar SDLK_DOLLAR
108 #define KEY_percent KEY_UNDEFINED /* undefined */
109 #define KEY_ampersand SDLK_AMPERSAND
110 #define KEY_apostrophe SDLK_QUOTE
111 #define KEY_parenleft SDLK_LEFTPAREN
112 #define KEY_parenright SDLK_RIGHTPAREN
113 #define KEY_asterisk SDLK_ASTERISK
114 #define KEY_plus SDLK_PLUS
115 #define KEY_comma SDLK_COMMA
116 #define KEY_minus SDLK_MINUS
117 #define KEY_period SDLK_PERIOD
118 #define KEY_slash SDLK_SLASH
120 #define KEY_colon SDLK_COLON
121 #define KEY_semicolon SDLK_SEMICOLON
122 #define KEY_less SDLK_LESS
123 #define KEY_equal SDLK_EQUALS
124 #define KEY_greater SDLK_GREATER
125 #define KEY_question SDLK_QUESTION
126 #define KEY_at SDLK_AT
128 #define KEY_bracketleft SDLK_LEFTBRACKET
129 #define KEY_backslash SDLK_BACKSLASH
130 #define KEY_bracketright SDLK_RIGHTBRACKET
131 #define KEY_asciicircum SDLK_CARET
132 #define KEY_underscore SDLK_UNDERSCORE
133 #define KEY_grave SDLK_BACKQUOTE
135 #define KEY_quoteleft KEY_UNDEFINED /* undefined */
136 #define KEY_braceleft KEY_UNDEFINED /* undefined */
137 #define KEY_bar KEY_UNDEFINED /* undefined */
138 #define KEY_braceright KEY_UNDEFINED /* undefined */
139 #define KEY_asciitilde KEY_UNDEFINED /* undefined */
141 #define KEY_Adiaeresis SDLK_WORLD_36
142 #define KEY_Odiaeresis SDLK_WORLD_54
143 #define KEY_Udiaeresis SDLK_WORLD_60
144 #define KEY_adiaeresis SDLK_WORLD_68
145 #define KEY_odiaeresis SDLK_WORLD_86
146 #define KEY_udiaeresis SDLK_WORLD_92
147 #define KEY_ssharp SDLK_WORLD_63
243 #define KEY_KP_0 SDLK_KP0
244 #define KEY_KP_1 SDLK_KP1
245 #define KEY_KP_2 SDLK_KP2
246 #define KEY_KP_3 SDLK_KP3
247 #define KEY_KP_4 SDLK_KP4
248 #define KEY_KP_5 SDLK_KP5
249 #define KEY_KP_6 SDLK_KP6
250 #define KEY_KP_7 SDLK_KP7
251 #define KEY_KP_8 SDLK_KP8
252 #define KEY_KP_9 SDLK_KP9
254 #define KEY_F1 SDLK_F1
255 #define KEY_F2 SDLK_F2
256 #define KEY_F3 SDLK_F3
257 #define KEY_F4 SDLK_F4
258 #define KEY_F5 SDLK_F5
259 #define KEY_F6 SDLK_F6
260 #define KEY_F7 SDLK_F7
261 #define KEY_F8 SDLK_F8
262 #define KEY_F9 SDLK_F9
263 #define KEY_F10 SDLK_F10
264 #define KEY_F11 SDLK_F11
265 #define KEY_F12 SDLK_F12
266 #define KEY_F13 SDLK_F13
267 #define KEY_F14 SDLK_F14
268 #define KEY_F15 SDLK_F15
269 #define KEY_F16 KEY_UNDEFINED
270 #define KEY_F17 KEY_UNDEFINED
271 #define KEY_F18 KEY_UNDEFINED
272 #define KEY_F19 KEY_UNDEFINED
273 #define KEY_F20 KEY_UNDEFINED
274 #define KEY_F21 KEY_UNDEFINED
275 #define KEY_F22 KEY_UNDEFINED
276 #define KEY_F23 KEY_UNDEFINED
277 #define KEY_F24 KEY_UNDEFINED
279 #else /* X11 type definitions */
281 typedef Pixmap Bitmap;
282 typedef Window DrawWindow;
283 typedef Drawable DrawBuffer;
287 typedef XEvent Event;
288 typedef XButtonEvent ButtonEvent;
289 typedef XMotionEvent MotionEvent;
290 typedef XKeyEvent KeyEvent;
291 typedef XExposeEvent ExposeEvent;
292 typedef XFocusChangeEvent FocusChangeEvent;
293 typedef XClientMessageEvent ClientMessageEvent;
295 #define EVENT_BUTTONPRESS ButtonPress
296 #define EVENT_BUTTONRELEASE ButtonRelease
297 #define EVENT_MOTIONNOTIFY MotionNotify
298 #define EVENT_KEYPRESS KeyPress
299 #define EVENT_KEYRELEASE KeyRelease
300 #define EVENT_EXPOSE Expose
301 #define EVENT_FOCUSIN FocusIn
302 #define EVENT_FOCUSOUT FocusOut
303 #define EVENT_CLIENTMESSAGE ClientMessage
304 #define EVENT_MAPNOTIFY MapNotify
305 #define EVENT_UNMAPNOTIFY UnmapNotify
307 #define KEY_UNDEFINED XK_VoidSymbol
309 #define KEY_Return XK_Return
310 #define KEY_Escape XK_Escape
312 #define KEY_Left XK_Left
313 #define KEY_Right XK_Right
315 #define KEY_Down XK_Down
318 #define KEY_KP_Left XK_KP_Left
319 #define KEY_KP_Right XK_KP_Right
320 #define KEY_KP_Up XK_KP_Up
321 #define KEY_KP_Down XK_KP_Down
325 #define KEY_KP_Enter XK_KP_Enter
326 #define KEY_KP_Add XK_KP_Add
327 #define KEY_KP_Subtract XK_KP_Subtract
328 #define KEY_KP_Multiply XK_KP_Multiply
329 #define KEY_KP_Divide XK_KP_Divide
330 #define KEY_KP_Separator XK_KP_Separator
333 #define KEY_Shift_L XK_Shift_L
334 #define KEY_Shift_R XK_Shift_R
335 #define KEY_Control_L XK_Control_L
336 #define KEY_Control_R XK_Control_R
337 #define KEY_Meta_L XK_Meta_L
338 #define KEY_Meta_R XK_Meta_R
339 #define KEY_Alt_L XK_Alt_L
340 #define KEY_Alt_R XK_Alt_R
341 #define KEY_Mode_switch XK_Mode_switch
342 #define KEY_Multi_key XK_Multi_key
344 #define KEY_BackSpace XK_BackSpace
345 #define KEY_Delete XK_Delete
346 #define KEY_Insert XK_Insert
347 #define KEY_Tab XK_Tab
348 #define KEY_Home XK_Home
349 #define KEY_End XK_End
350 #define KEY_Page_Up XK_Page_Up
351 #define KEY_Page_Down XK_Page_Down
353 #define KEY_space XK_space
354 #define KEY_exclam XK_exclam
355 #define KEY_quotedbl XK_quotedbl
356 #define KEY_numbersign XK_numbersign
357 #define KEY_dollar XK_dollar
358 #define KEY_percent XK_percent
359 #define KEY_ampersand XK_ampersand
360 #define KEY_apostrophe XK_apostrophe
361 #define KEY_parenleft XK_parenleft
362 #define KEY_parenright XK_parenright
363 #define KEY_asterisk XK_asterisk
364 #define KEY_plus XK_plus
365 #define KEY_comma XK_comma
366 #define KEY_minus XK_minus
367 #define KEY_period XK_period
368 #define KEY_slash XK_slash
370 #define KEY_colon XK_colon
371 #define KEY_semicolon XK_semicolon
372 #define KEY_less XK_less
373 #define KEY_equal XK_equal
374 #define KEY_greater XK_greater
375 #define KEY_question XK_question
378 #define KEY_bracketleft XK_bracketleft
379 #define KEY_backslash XK_backslash
380 #define KEY_bracketright XK_bracketright
381 #define KEY_asciicircum XK_asciicircum
382 #define KEY_underscore XK_underscore
383 #define KEY_grave XK_grave
385 #define KEY_quoteleft XK_quoteleft
386 #define KEY_braceleft XK_braceleft
387 #define KEY_bar XK_bar
388 #define KEY_braceright XK_braceright
389 #define KEY_asciitilde XK_asciitilde
391 #define KEY_Adiaeresis XK_Adiaeresis
392 #define KEY_Odiaeresis XK_Odiaeresis
393 #define KEY_Udiaeresis XK_Udiaeresis
394 #define KEY_adiaeresis XK_adiaeresis
395 #define KEY_odiaeresis XK_odiaeresis
396 #define KEY_udiaeresis XK_udiaeresis
397 #define KEY_ssharp XK_ssharp
464 #define KEY_KP_0 XK_KP_0
465 #define KEY_KP_1 XK_KP_1
466 #define KEY_KP_2 XK_KP_2
467 #define KEY_KP_3 XK_KP_3
468 #define KEY_KP_4 XK_KP_4
469 #define KEY_KP_5 XK_KP_5
470 #define KEY_KP_6 XK_KP_6
471 #define KEY_KP_7 XK_KP_7
472 #define KEY_KP_8 XK_KP_8
473 #define KEY_KP_9 XK_KP_9
484 #define KEY_F10 XK_F10
485 #define KEY_F11 XK_F11
486 #define KEY_F12 XK_F12
487 #define KEY_F13 XK_F13
488 #define KEY_F14 XK_F14
489 #define KEY_F15 XK_F15
490 #define KEY_F16 XK_F16
491 #define KEY_F17 XK_F17
492 #define KEY_F18 XK_F18
493 #define KEY_F19 XK_F19
494 #define KEY_F20 XK_F20
495 #define KEY_F21 XK_F21
496 #define KEY_F22 XK_F22
497 #define KEY_F23 XK_F23
498 #define KEY_F24 XK_F24
502 inline void ClearRectangle(Bitmap, int, int, int, int);
503 inline void BlitBitmap(Bitmap, Bitmap, int, int, int, int, int, int);
504 inline void SetClipMask(GC, Pixmap);
505 inline void SetClipOrigin(GC, int, int);
506 inline void BlitBitmapMasked(Bitmap, Bitmap, int, int, int, int, int, int);
507 inline void DrawSimpleWhiteLine(Bitmap, int, int, int, int);
509 inline void FlushDisplay();
510 inline void SyncDisplay();
511 inline void KeyboardAutoRepeatOn();
512 inline void KeyboardAutoRepeatOff();
513 inline boolean QueryPointer(DrawWindow, int *, int *);
515 inline boolean PendingEvent();
516 inline void NextEvent(Event *event);
518 inline Key GetEventKey(KeyEvent *, boolean);
520 #endif /* SYSTEM_H */