]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkwindow-x11.h
85d892b283258cf9af8a974acd1a07b492ae6f63
[~andy/gtk] / gdk / x11 / gdkwindow-x11.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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 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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GDK_WINDOW_X11_H__
28 #define __GDK_WINDOW_X11_H__
29
30 #include "gdk/x11/gdkprivate-x11.h"
31 #include "gdk/gdkwindowimpl.h"
32
33 #include <X11/Xlib.h>
34
35 #ifdef HAVE_XDAMAGE
36 #include <X11/extensions/Xdamage.h>
37 #endif
38
39 #ifdef HAVE_XSYNC
40 #include <X11/Xlib.h>
41 #include <X11/extensions/sync.h>
42 #endif
43
44 G_BEGIN_DECLS
45
46 typedef struct _GdkToplevelX11 GdkToplevelX11;
47 typedef struct _GdkWindowImplX11 GdkWindowImplX11;
48 typedef struct _GdkWindowImplX11Class GdkWindowImplX11Class;
49 typedef struct _GdkXPositionInfo GdkXPositionInfo;
50
51 /* Window implementation for X11
52  */
53
54 #define GDK_TYPE_WINDOW_IMPL_X11              (gdk_window_impl_x11_get_type ())
55 #define GDK_WINDOW_IMPL_X11(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11))
56 #define GDK_WINDOW_IMPL_X11_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class))
57 #define GDK_IS_WINDOW_IMPL_X11(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_X11))
58 #define GDK_IS_WINDOW_IMPL_X11_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_X11))
59 #define GDK_WINDOW_IMPL_X11_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class))
60
61 struct _GdkWindowImplX11
62 {
63   GdkWindowImpl parent_instance;
64
65   GdkWindow *wrapper;
66
67   Window xid;
68
69   GdkToplevelX11 *toplevel;     /* Toplevel-specific information */
70   GdkCursor *cursor;
71   GHashTable *device_cursor;
72
73   gint8 toplevel_window_type;
74   guint no_bg : 1;              /* Set when the window background is temporarily
75                                  * unset during resizing and scaling */
76   guint override_redirect : 1;
77   guint use_synchronized_configure : 1;
78   
79   cairo_surface_t *cairo_surface;
80
81 #if defined (HAVE_XCOMPOSITE) && defined(HAVE_XDAMAGE) && defined (HAVE_XFIXES)
82   Damage damage;
83 #endif
84 };
85  
86 struct _GdkWindowImplX11Class 
87 {
88   GdkWindowImplClass parent_class;
89 };
90
91 struct _GdkToplevelX11
92 {
93
94   /* Set if the window, or any descendent of it, is the server's focus window
95    */
96   guint has_focus_window : 1;
97
98   /* Set if window->has_focus_window and the focus isn't grabbed elsewhere.
99    */
100   guint has_focus : 1;
101
102   /* Set if the pointer is inside this window. (This is needed for
103    * for focus tracking)
104    */
105   guint has_pointer : 1;
106   
107   /* Set if the window is a descendent of the focus window and the pointer is
108    * inside it. (This is the case where the window will receive keystroke
109    * events even window->has_focus_window is FALSE)
110    */
111   guint has_pointer_focus : 1;
112
113   /* Set if we are requesting these hints */
114   guint skip_taskbar_hint : 1;
115   guint skip_pager_hint : 1;
116   guint urgency_hint : 1;
117
118   guint on_all_desktops : 1;   /* _NET_WM_STICKY == 0xFFFFFFFF */
119
120   guint have_sticky : 1;        /* _NET_WM_STATE_STICKY */
121   guint have_maxvert : 1;       /* _NET_WM_STATE_MAXIMIZED_VERT */
122   guint have_maxhorz : 1;       /* _NET_WM_STATE_MAXIMIZED_HORZ */
123   guint have_fullscreen : 1;    /* _NET_WM_STATE_FULLSCREEN */
124
125   guint is_leader : 1;
126   
127   gulong map_serial;    /* Serial of last transition from unmapped */
128   
129   cairo_surface_t *icon_pixmap;
130   cairo_surface_t *icon_mask;
131   GdkWindow *group_leader;
132
133   /* Time of most recent user interaction. */
134   gulong user_time;
135
136   /* We use an extra X window for toplevel windows that we XSetInputFocus()
137    * to in order to avoid getting keyboard events redirected to subwindows
138    * that might not even be part of this app
139    */
140   Window focus_window;
141  
142 #ifdef HAVE_XSYNC
143   XID update_counter;
144   XSyncValue pending_counter_value; /* latest _NET_WM_SYNC_REQUEST value received */
145   XSyncValue current_counter_value; /* Latest _NET_WM_SYNC_REQUEST value received
146                                      * where we have also seen the corresponding
147                                      * ConfigureNotify
148                                      */
149 #endif
150 };
151
152 GType gdk_window_impl_x11_get_type (void);
153
154 void            gdk_x11_window_set_user_time        (GdkWindow *window,
155                                                      guint32    timestamp);
156
157 GdkToplevelX11 *_gdk_x11_window_get_toplevel        (GdkWindow *window);
158 void            _gdk_x11_window_tmp_unset_bg        (GdkWindow *window,
159                                                      gboolean   recurse);
160 void            _gdk_x11_window_tmp_reset_bg        (GdkWindow *window,
161                                                      gboolean   recurse);
162 void            _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window);
163 void            _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window);
164
165 GdkCursor      *_gdk_x11_window_get_cursor          (GdkWindow *window);
166 void            _gdk_x11_window_get_offsets         (GdkWindow *window,
167                                                      gint      *x_offset,
168                                                      gint      *y_offset);
169
170 void            _gdk_x11_window_update_size         (GdkWindowImplX11 *impl);
171
172 G_END_DECLS
173
174 #endif /* __GDK_WINDOW_X11_H__ */