support app icon by reusing x11 sdl code
[sdl_omap.git] / src / video / omapdss / osdl.h
CommitLineData
f641fccb 1/*
0c7caf2b 2 * (C) GraÅžvydas "notaz" Ignotas, 2010-2012
f641fccb 3 *
4 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
5 * See the COPYING file in the top-level directory.
6 */
b78828bf 7
8#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
9
7b66578c 10#define err(fmt, ...) \
11 fprintf(stderr, "omapsdl: " fmt "\n", ##__VA_ARGS__)
12#define err_perror(fmt, ...) do { \
13 fprintf(stderr, "omapsdl: " fmt ": ", ##__VA_ARGS__); \
14 perror(NULL); \
15} while (0)
16#define log(fmt, ...) \
17 fprintf(stdout, "omapsdl: " fmt "\n", ##__VA_ARGS__)
18#define not_supported() \
19 fprintf(stderr, "omapsdl: %s not supported\n", __FUNCTION__)
0aab059f 20#if 0
b78828bf 21#define trace(fmt, ...) printf(" %s(" fmt ")\n", __FUNCTION__, ##__VA_ARGS__)
22#define dbg err
23#else
24#define trace(...)
25#define dbg(...)
26#endif
27
ee7e6b2d 28struct x11reuse_context;
29
f641fccb 30struct SDL_PrivateVideoData {
31 struct vout_fbdev *fbdev;
5cc6dcb7 32 void *front_buffer;
f641fccb 33 void *saved_layer;
5f4b1fd3 34 /* physical screen size, should match touchscreen */
35 int phys_w, phys_h;
36 /* layer */
37 int layer_x, layer_y, layer_w, layer_h;
455c8c43 38 /* SDL surface borders to hide */
39 int border_l, border_r, border_t, border_b;
5f4b1fd3 40 /* phys -> layer coord multipliers (16.16) */
41 int ts_xmul, ts_ymul;
42 /* misc/config */
ee7e6b2d 43 struct x11reuse_context *x11reuse_context;
f9b3f440 44 unsigned int xenv_up:1;
e1837b2c 45 unsigned int xenv_mouse:1;
9225e894 46 unsigned int app_uses_flip:1;
5f4b1fd3 47 unsigned int cfg_force_vsync:1;
48 unsigned int cfg_force_doublebuf:1;
5cc6dcb7 49 unsigned int cfg_force_directbuf:1;
5f4b1fd3 50 unsigned int cfg_no_ts_translate:1;
e1837b2c 51 unsigned int cfg_ts_force_tslib:1;
ee7e6b2d 52 /* delayed icon surface */
53 struct SDL_Surface *delayed_icon;
54 void *delayed_icon_mask;
f641fccb 55};
56
455c8c43 57void *osdl_video_set_mode(struct SDL_PrivateVideoData *pdata,
58 int border_l, int border_r, int border_t, int border_b,
090bcb85 59 int width, int height, int bpp, int *doublebuf,
60 const char *wm_title);
f641fccb 61void *osdl_video_flip(struct SDL_PrivateVideoData *pdata);
5cc6dcb7 62void *osdl_video_get_active_buffer(struct SDL_PrivateVideoData *pdata);
b9a19b44 63int osdl_video_detect_screen(struct SDL_PrivateVideoData *pdata);
090bcb85 64int osdl_video_pause(struct SDL_PrivateVideoData *pdata, int is_pause);
ee7e6b2d 65int osdl_video_get_window(void **display, int *screen, void **window);
f641fccb 66void osdl_video_finish(struct SDL_PrivateVideoData *pdata);
67
b78828bf 68void omapsdl_input_init(void);
69void omapsdl_input_bind(const char *kname, const char *sdlname);
17e19802 70int omapsdl_input_get_events(int timeout_ms,
b260fb56 71 int (*key_cb)(void *cb_arg, int sdl_kc, int sdl_sc, int is_pressed),
17e19802 72 int (*ts_cb)(void *cb_arg, int x, int y, unsigned int pressure),
73 void *cb_arg);
74void omapsdl_input_finish(void);
b78828bf 75
5f4b1fd3 76void omapsdl_config(struct SDL_PrivateVideoData *pdata);
77void omapsdl_config_from_env(struct SDL_PrivateVideoData *pdata);
b78828bf 78
79/* functions for standalone */
80void do_clut(void *dest, void *src, unsigned short *pal, int count);
0aab059f 81