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, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GDK_X11_SURFACE__
26#define __GDK_X11_SURFACE__
27
28#include "gdksurfaceprivate.h"
29#include "gdkx11surface.h"
30
31#include <X11/Xlib.h>
32
33#ifdef HAVE_XSYNC
34#include <X11/Xlib.h>
35#include <X11/extensions/sync.h>
36#endif
37
38G_BEGIN_DECLS
39
40typedef struct _GdkToplevelX11 GdkToplevelX11;
41typedef struct _GdkXPositionInfo GdkXPositionInfo;
42
43struct _GdkX11Surface
44{
45 GdkSurface parent_instance;
46
47 Window xid;
48
49 GdkToplevelX11 *toplevel; /* Toplevel-specific information */
50 GdkCursor *cursor;
51
52 guint no_bg : 1; /* Set when the window background is temporarily
53 * unset during resizing and scaling */
54 guint override_redirect : 1;
55 guint frame_clock_connected : 1;
56 guint frame_sync_enabled : 1;
57 guint tracking_damage: 1;
58
59 int surface_scale;
60
61 int shadow_left;
62 int shadow_right;
63 int shadow_top;
64 int shadow_bottom;
65
66 /* Width and height not divided by surface_scale - this matters in the
67 * corner-case where the window manager assigns us a size that isn't
68 * a multiple of surface_scale - for example for a maximized window
69 * with an odd-sized title-bar.
70 */
71 int unscaled_width;
72 int unscaled_height;
73
74 int last_computed_width;
75 int last_computed_height;
76
77 GdkToplevelLayout *toplevel_layout;
78
79 struct {
80 int configured_width;
81 int configured_height;
82 gboolean configure_pending;
83 gboolean surface_geometry_dirty;
84 } next_layout;
85
86 guint compute_size_source_id;
87
88 cairo_surface_t *cairo_surface;
89 /* GLXDrawable */ XID glx_drawable;
90 guint32 glx_frame_counter;
91
92 int abs_x;
93 int abs_y;
94
95 guint64 map_time;
96
97 GList *surface_is_on_monitor;
98};
99
100struct _GdkX11SurfaceClass
101{
102 GdkSurfaceClass parent_class;
103};
104
105struct _GdkToplevelX11
106{
107
108 /* Set if the window, or any descendent of it, is the server's focus window
109 */
110 guint has_focus_window : 1;
111
112 /* Set if window->has_focus_window and the focus isn't grabbed elsewhere.
113 */
114 guint has_focus : 1;
115
116 /* Set if the pointer is inside this window. (This is needed for
117 * for focus tracking)
118 */
119 guint has_pointer : 1;
120
121 /* Set if the window is a descendent of the focus window and the pointer is
122 * inside it. (This is the case where the window will receive keystroke
123 * events even window->has_focus_window is FALSE)
124 */
125 guint has_pointer_focus : 1;
126
127 /* Set if we are requesting these hints */
128 guint skip_taskbar_hint : 1;
129 guint skip_pager_hint : 1;
130 guint urgency_hint : 1;
131
132 guint on_all_desktops : 1; /* _NET_WM_STICKY == 0xFFFFFFFF */
133
134 guint have_maxvert : 1; /* _NET_WM_STATE_MAXIMIZED_VERT */
135 guint have_maxhorz : 1; /* _NET_WM_STATE_MAXIMIZED_HORZ */
136 guint have_fullscreen : 1; /* _NET_WM_STATE_FULLSCREEN */
137 guint have_hidden : 1; /* _NET_WM_STATE_HIDDEN */
138
139 guint is_leader : 1;
140
141 /* Set if the WM is presenting us as focused, i.e. with active decorations
142 */
143 guint have_focused : 1;
144
145 guint in_frame : 1;
146
147 /* If we're waiting for damage from the X server after painting a frame */
148 guint frame_still_painting : 1;
149
150 /* If we're expecting a response from the compositor after painting a frame */
151 guint frame_pending : 1;
152
153 /* Whether pending_counter_value/configure_counter_value are updates
154 * to the extended update counter */
155 guint pending_counter_value_is_extended : 1;
156 guint configure_counter_value_is_extended : 1;
157
158 gulong map_serial; /* Serial of last transition from unmapped */
159
160 cairo_surface_t *icon_pixmap;
161 cairo_surface_t *icon_mask;
162 GdkSurface *group_leader;
163
164 /* Time of most recent user interaction. */
165 gulong user_time;
166
167 /* We use an extra X window for toplevel windows that we XSetInputFocus()
168 * to in order to avoid getting keyboard events redirected to subwindows
169 * that might not even be part of this app
170 */
171 Window focus_window;
172
173 GdkSurfaceHints last_geometry_hints_mask;
174 GdkGeometry last_geometry_hints;
175
176 /* Constrained edge information */
177 guint edge_constraints;
178
179#ifdef HAVE_XSYNC
180 XID update_counter;
181 XID extended_update_counter;
182 gint64 pending_counter_value; /* latest _NET_WM_SYNC_REQUEST value received */
183 gint64 configure_counter_value; /* Latest _NET_WM_SYNC_REQUEST value received
184 * where we have also seen the corresponding
185 * ConfigureNotify
186 */
187 gint64 current_counter_value;
188
189 /* After a _NET_WM_FRAME_DRAWN message, this is the soonest that we think
190 * frame after will be presented */
191 gint64 throttled_presentation_time;
192#endif
193};
194
195GdkToplevelX11 *_gdk_x11_surface_get_toplevel (GdkSurface *window);
196
197GdkCursor *_gdk_x11_surface_get_cursor (GdkSurface *window);
198
199void _gdk_x11_surface_set_surface_scale (GdkSurface *window,
200 int scale);
201gboolean _gdk_x11_surface_syncs_frames (GdkSurface *surface);
202
203void gdk_x11_surface_pre_damage (GdkSurface *surface);
204
205void gdk_x11_surface_move (GdkSurface *surface,
206 int x,
207 int y);
208void gdk_x11_surface_check_monitor (GdkSurface *surface,
209 GdkMonitor *monitor);
210
211
212G_END_DECLS
213
214#endif /* __GDK_X11_SURFACE__ */
215

source code of gtk/gdk/x11/gdksurface-x11.h