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