uploaded original spice-server-0.12.4 and celt-0.5.1.3
[sdk/emulator/libs/spice-server.git] / client / x11 / x_platform.h
1 /*
2    Copyright (C) 2009 Red Hat, Inc.
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef _H_XPLATFORM
19 #define _H_XPLATFORM
20
21 #include "red_drawable.h"
22 #include <X11/Xdefs.h>
23 #include <X11/Xutil.h>
24 #include <X11/extensions/XShm.h>
25
26 class XPlatform {
27 public:
28     static Display* get_display();
29     static XVisualInfo** get_vinfo();
30     static RedDrawable::Format get_screen_format(int screen);
31     static XIC get_input_context();
32 #ifdef USE_OPENGL
33     static GLXFBConfig** get_fbconfig();
34 #endif // USE_OPENGL
35
36     typedef void (*win_proc_t)(XEvent& event);
37     static void set_win_proc(Window win, win_proc_t proc);
38     static void cleare_win_proc(Window win);
39
40     static void on_focus_in();
41     static void on_focus_out();
42
43     static bool is_x_shm_avail();
44     static XImage *create_x_shm_image(RedDrawable::Format format,
45                                       int width, int height, int depth,
46                                       Visual *visual,
47                                       XShmSegmentInfo **shminfo_out);
48     static XImage *create_x_image(RedDrawable::Format format,
49                                   int width, int height, int depth,
50                                   Visual *visual,
51                                   XShmSegmentInfo **shminfo_out);
52     static void free_x_image(XImage *image,
53                              XShmSegmentInfo *shminfo);
54 };
55
56 #endif