1 /* ______ ___ ___
2 * /\ _ \ /\_ \ /\_ \
3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
8 * /\____/
9 * \_/__/
10 *
11 * Video driver for X-Windows.
12 *
13 * By Michael Bukin.
14 *
15 * See readme.txt for copyright information.
16 */
17
18
19 #include "allegro.h"
20 #include "allegro/platform/aintunix.h"
21 #include "xwin.h"
22
23
24 static BITMAP *_xwin_gfxdrv_init(int w, int h, int vw, int vh, int color_depth);
25 static void _xwin_gfxdrv_exit(BITMAP *bmp);
26
27
28 static GFX_DRIVER gfx_xwin =
29 {
30 GFX_XWINDOWS,
31 empty_string,
32 empty_string,
33 "X11 window",
34 _xwin_gfxdrv_init,
35 _xwin_gfxdrv_exit,
36 _xwin_scroll_screen,
37 _xwin_vsync,
38 _xwin_set_palette_range,
39 NULL, NULL, NULL,
40 NULL, NULL, NULL, NULL,
41 NULL, NULL,
42 #ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR
43 _xwin_set_mouse_sprite,
44 _xwin_show_mouse,
45 _xwin_hide_mouse,
46 _xwin_move_mouse,
47 #else
48 NULL, NULL, NULL, NULL,
49 #endif
50 _xwin_drawing_mode,
51 NULL, NULL,
52 NULL, // AL_METHOD(void, set_blender_mode, (int mode, int r, int g, int b, int a));
53 NULL,
54 320, 200,
55 TRUE,
56 0, 0,
57 0x10000,
58 0,
59 TRUE
60 };
61
62
63
64 static BITMAP *_xwin_fullscreen_gfxdrv_init(int w, int h, int vw, int vh, int color_depth);
65
66
67 static GFX_DRIVER gfx_xwin_fullscreen =
68 {
69 GFX_XWINDOWS_FULLSCREEN,
70 empty_string,
71 empty_string,
72 "X11 fullscreen",
73 _xwin_fullscreen_gfxdrv_init,
74 _xwin_gfxdrv_exit,
75 _xwin_scroll_screen,
76 _xwin_vsync,
77 _xwin_set_palette_range,
78 NULL, NULL, NULL,
79 NULL, NULL, NULL, NULL,
80 NULL, NULL,
81 #ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR
82 _xwin_set_mouse_sprite,
83 _xwin_show_mouse,
84 _xwin_hide_mouse,
85 _xwin_move_mouse,
86 #else
87 NULL, NULL, NULL, NULL,
88 #endif
89 _xwin_drawing_mode,
90 NULL, NULL,
91 NULL,
92 _xwin_fetch_mode_list,
93 320, 200,
94 TRUE,
95 0, 0,
96 0x10000,
97 0,
98 FALSE
99 };
100
101
102
103 /* list the available drivers */
104 _DRIVER_INFO _xwin_gfx_driver_list[] =
105 {
106 #if (defined ALLEGRO_XWINDOWS_WITH_XF86DGA2) && (!defined ALLEGRO_WITH_MODULES)
107 { GFX_XDGA2, &gfx_xdga2, FALSE },
108 { GFX_XDGA2_SOFT, &gfx_xdga2_soft, FALSE },
109 #endif
110 { GFX_XWINDOWS_FULLSCREEN, &gfx_xwin_fullscreen, TRUE },
111 { GFX_XWINDOWS, &gfx_xwin, TRUE },
112 { 0, NULL, 0 }
113 };
114
115
116
117 /* _xwin_gfxdrv_init:
118 * Creates screen bitmap.
119 */
_xwin_gfxdrv_init(int w,int h,int vw,int vh,int color_depth)120 static BITMAP *_xwin_gfxdrv_init(int w, int h, int vw, int vh, int color_depth)
121 {
122 return _xwin_create_screen(&gfx_xwin, w, h, vw, vh, color_depth, FALSE);
123 }
124
125
126
127 /* _xwin_gfxdrv_exit:
128 * Shuts down the X-Windows driver.
129 */
_xwin_gfxdrv_exit(BITMAP * bmp)130 static void _xwin_gfxdrv_exit(BITMAP *bmp)
131 {
132 _xwin_destroy_screen();
133 }
134
135
136
137 /* _xwin_fullscreen_gfxdrv_init:
138 * Creates screen bitmap (with video mode extension).
139 */
_xwin_fullscreen_gfxdrv_init(int w,int h,int vw,int vh,int color_depth)140 static BITMAP *_xwin_fullscreen_gfxdrv_init(int w, int h, int vw, int vh, int color_depth)
141 {
142 return _xwin_create_screen(&gfx_xwin_fullscreen, w, h, vw, vh, color_depth, TRUE);
143 }
144