1 /*         ______   ___    ___
2  *        /\  _  \ /\_ \  /\_ \
3  *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
4  *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
5  *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
6  *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7  *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8  *                                           /\____/
9  *                                           \_/__/
10  *
11  *      X header file for the Allegro library.
12  *
13  *      This prototypes some things which might be useful to
14  *      the calling application, but you don't need it.
15  */
16 
17 
18 #ifndef X_ALLEGRO_H
19 #define X_ALLEGRO_H
20 
21 #ifndef ALLEGRO_H
22 #error Please include allegro.h before xalleg.h!
23 #endif
24 
25 
26 #include "allegro/internal/aintern.h"
27 #include "allegro/platform/aintunix.h"
28 
29 #include <string.h>
30 #include <X11/Xlib.h>
31 #include <X11/Xutil.h>
32 #include <X11/cursorfont.h>
33 #include <X11/keysym.h>
34 
35 #ifdef ALLEGRO_XWINDOWS_WITH_SHM
36 #include <sys/ipc.h>
37 #include <sys/shm.h>
38 #include <X11/extensions/XShm.h>
39 #endif
40 
41 #ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
42 #include <X11/extensions/xf86vmode.h>
43 #endif
44 
45 #ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR
46 #include <X11/Xcursor/Xcursor.h>
47 #endif
48 
49 
50 
51 #ifdef __cplusplus
52    extern "C" {
53 #endif
54 
55 /* X-Windows resources used by the library.  */
56 extern struct _xwin_type
57 {
58    Display *display;
59    volatile int lock_count;
60    int screen;
61    Window window;
62    GC gc;
63    Visual *visual;
64    Colormap colormap;
65    XImage *ximage;
66 #ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR
67    XcursorImage *xcursor_image;
68    XcursorBool support_argb_cursor;
69 #endif
70    Cursor cursor;
71    int cursor_shape;
72    int hw_cursor_ok;
73 
74    void (*screen_to_buffer)(int sx, int sy, int sw, int sh);
75    void (*set_colors)(AL_CONST PALETTE p, int from, int to);
76 
77    unsigned char *screen_data;
78    unsigned char **screen_line;
79    unsigned char **buffer_line;
80 
81    int scroll_x;
82    int scroll_y;
83 
84    int window_width;
85    int window_height;
86    int window_depth;
87 
88    int screen_width;
89    int screen_height;
90    int screen_depth;
91 
92    int virtual_width;
93    int virtual_height;
94 
95    int mouse_warped;
96    int keycode_to_scancode[256];
97 
98    int matching_formats;
99    int fast_visual_depth;
100    int visual_is_truecolor;
101 
102    int rsize;
103    int gsize;
104    int bsize;
105    int rshift;
106    int gshift;
107    int bshift;
108 
109    unsigned long cmap[0x1000];
110    unsigned long rmap[0x100];
111    unsigned long gmap[0x100];
112    unsigned long bmap[0x100];
113 
114 #ifdef ALLEGRO_XWINDOWS_WITH_SHM
115    XShmSegmentInfo shminfo;
116 #endif
117    int use_shm;
118 
119    int in_dga_mode; /* 0=no, 2=DGA2 */
120 
121    int keyboard_grabbed;
122    int mouse_grabbed;
123 
124 #ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
125    XF86VidModeModeInfo **modesinfo;
126    int num_modes;
127    int mode_switched;       /* only kept around and set for ABI compat */
128    int override_redirected; /* no longer used, kept for ABI compat */
129 #endif
130 
131    char window_title[1024];
132    char application_name[1024];
133    char application_class[1024];
134 
135    int drawing_mode_ok;
136 
137 #ifdef ALLEGRO_MULTITHREADED
138    void *mutex;
139 #endif
140 
141    void (*close_button_callback)(void);
142 
143    /* These are at the end of the struct to maintain ABI compatibility with
144     * allegro-4.2.0 (if and only if compiled with the same configuration).
145     * Notice that IMHO apps really should not be using _xwin, but we export it,
146     * so its fair game.
147     */
148 #ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE
149    XF86VidModeModeInfo *orig_modeinfo;
150 #endif
151    /* Separate fullscreen and managed window id's, see
152     * _xwin_private_create_windo* in src/x/xwin.c for more details.
153     */
154    Window fs_window;
155    Window wm_window;
156 } _xwin;
157 
158 
159 
160 AL_FUNCPTR (int, _xwin_window_creator, (void));
161 AL_FUNCPTR (void, _xwin_window_defaultor, (void));
162 AL_FUNCPTR (void, _xwin_window_redrawer, (int, int, int, int));
163 AL_FUNCPTR (void, _xwin_input_handler, (void));
164 
165 AL_FUNCPTR (void, _xwin_keyboard_callback, (int, int));
166 
167 AL_FUNC(void, xwin_set_window_name, (AL_CONST char *name, AL_CONST char *group));
168 
169 
170 
171 #ifdef __cplusplus
172    }
173 #endif
174 
175 #endif
176 
177