2 Copyright (C) 2009 Red Hat, Inc.
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.
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.
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/>.
21 #include "red_drawable.h"
22 #include <X11/Xdefs.h>
23 #include <X11/Xutil.h>
24 #include <X11/extensions/XShm.h>
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();
33 static GLXFBConfig** get_fbconfig();
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);
40 static void on_focus_in();
41 static void on_focus_out();
43 static bool is_x_shm_avail();
44 static XImage *create_x_shm_image(RedDrawable::Format format,
45 int width, int height, int depth,
47 XShmSegmentInfo **shminfo_out);
48 static XImage *create_x_image(RedDrawable::Format format,
49 int width, int height, int depth,
51 XShmSegmentInfo **shminfo_out);
52 static void free_x_image(XImage *image,
53 XShmSegmentInfo *shminfo);