uploaded original spice-server-0.12.4 and celt-0.5.1.3
[sdk/emulator/libs/spice-server.git] / client / x11 / red_window_p.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_RED_WINDOW_P
19 #define _H_RED_WINDOW_P
20
21 #ifdef USE_OPENGL
22 #include <GL/glx.h>
23 #endif // USE_OPENGL
24 #include <X11/Xdefs.h>
25 #include <X11/Xlib.h>
26
27 typedef Window Win;
28 #ifdef USE_OPENGL
29 typedef GLXContext RedGlContext;
30 typedef GLXPbuffer RedPbuffer;
31 #endif // USE_OPENGL
32
33 class RedWindow;
34 class Icon;
35 struct PixelsSource_p;
36
37 class RedWindow_p {
38 public:
39     RedWindow_p();
40
41     void migrate(RedWindow& red_window, PixelsSource_p& pix_source, int dest_screen);
42     void create(RedWindow& red_window, PixelsSource_p& pix_source,
43                 int x, int y, int in_screen);
44     void destroy(RedWindow& red_window, PixelsSource_p& pix_source);
45     void set_minmax(PixelsSource_p& pix_source);
46     void wait_for_reparent();
47     void wait_for_map();
48     void wait_for_unmap();
49     void sync(bool shadowed = false);
50     void set_visibale(bool vis) { _visibale = vis;}
51     void move_to_current_desktop();
52     Window get_window() {return _win;}
53
54     static void win_proc(XEvent& event);
55     static Cursor create_invisible_cursor(Window window);
56
57 #ifdef USE_OPENGL
58     void set_glx(int width, int height);
59 #endif // USE_OPENGL
60     static void handle_key_press_event(RedWindow& red_window, XKeyEvent* event);
61
62 protected:
63     int _screen;
64     Window _win;
65     Cursor _invisible_cursor;
66     bool _visibale;
67     bool _expect_parent;
68     SpicePoint _show_pos;
69     bool _show_pos_valid;
70 #ifdef USE_OPENGL
71     GLXContext _glcont_copy;
72 #endif // USE_OPENGL
73     Icon* _icon;
74     bool _focused;
75     bool _ignore_foucs;
76     bool _shadow_foucs_state;
77     XEvent _shadow_focus_event;
78     bool _pointer_in_window;
79     bool _ignore_pointer;
80     bool _shadow_pointer_state;
81     XEvent _shadow_pointer_event;
82     Colormap _colormap;
83     RedWindow *_red_window;
84     int _width;
85     int _height;
86     Time _last_event_time;
87 };
88
89 #endif