1 /* $Id$ 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License as published by 5 the Free Software Foundation; either version 2, or (at your option) 6 any later version. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, 16 MA 02110-1301, USA. 17 18 19 oroborus - (c) 2001 Ken Lynch 20 xfwm4 - (c) 2002-2011 Olivier Fourdan 21 22 */ 23 24 #ifdef HAVE_CONFIG_H 25 #include "config.h" 26 #endif 27 28 #include <X11/Xlib.h> 29 #include <X11/cursorfont.h> 30 #include <gtk/gtk.h> 31 #include <glib.h> 32 #include <xfconf/xfconf.h> 33 #include <libxfce4kbd-private/xfce-shortcuts-provider.h> 34 35 #ifdef HAVE_LIBSTARTUP_NOTIFICATION 36 #define SN_API_NOT_YET_FROZEN 37 #include <libsn/sn.h> 38 #endif 39 40 #ifdef HAVE_COMPOSITOR 41 #ifdef HAVE_EPOXY 42 #include <epoxy/gl.h> 43 #include <epoxy/glx.h> 44 #endif /* HAVE_EPOXY */ 45 #endif /* HAVE_COMPOSITOR */ 46 47 #ifndef INC_SCREEN_H 48 #define INC_SCREEN_H 49 50 #include "display.h" 51 #include "settings.h" 52 #include "mywindow.h" 53 #include "mypixmap.h" 54 #include "client.h" 55 #include "hints.h" 56 57 #define MODIFIER_MASK (ShiftMask | \ 58 ControlMask | \ 59 AltMask | \ 60 MetaMask | \ 61 SuperMask | \ 62 HyperMask) 63 64 65 #ifdef HAVE_COMPOSITOR 66 67 #ifdef HAVE_PRESENT_EXTENSION 68 #define N_BUFFERS 2 69 #else 70 #define N_BUFFERS 1 71 #endif /* HAVE_PRESENT_EXTENSION */ 72 73 struct _gaussian_conv { 74 int size; 75 double *data; 76 }; 77 typedef struct _gaussian_conv gaussian_conv; 78 79 #endif /* HAVE_COMPOSITOR */ 80 81 typedef enum 82 { 83 VBLANK_OFF = 0, 84 VBLANK_AUTO, 85 VBLANK_XPRESENT, 86 VBLANK_GLX, 87 VBLANK_ERROR, 88 } vblankMode; 89 90 struct _ScreenInfo 91 { 92 /* The display this screen belongs to */ 93 DisplayInfo *display_info; 94 95 /* Window stacking, per screen */ 96 GList *windows_stack; 97 Client *last_raise; 98 GList *windows; 99 Client *clients; 100 guint client_count; 101 unsigned long client_serial; 102 gint key_grabs; 103 gint pointer_grabs; 104 105 /* Theme pixmaps and other params, per screen */ 106 GdkRGBA title_colors[2]; 107 GdkRGBA title_shadow_colors[2]; 108 xfwmPixmap buttons[BUTTON_COUNT][STATE_COUNT]; 109 xfwmPixmap corners[CORNER_COUNT][2]; 110 xfwmPixmap sides[SIDE_COUNT][2]; 111 xfwmPixmap title[TITLE_COUNT][2]; 112 xfwmPixmap top[TITLE_COUNT][2]; 113 114 /* Per screen graphic contexts */ 115 GC box_gc; 116 117 /* Title font */ 118 PangoFontDescription *font_desc; 119 PangoAttrList *pango_attr_list; 120 121 /* Screen data */ 122 Colormap cmap; 123 GdkScreen *gscr; 124 Screen *xscreen; 125 gint depth; 126 gint width; /* Size of all output combined */ 127 gint height; /* Size of all output combined */ 128 Visual *visual; 129 130 GtkWidget *gtk_win; 131 xfwmWindow sidewalk[4]; 132 Window xfwm4_win; 133 Window xroot; 134 Window shape_win; 135 136 gint gnome_margins[4]; 137 gint margins[4]; 138 gint screen; 139 guint current_ws; 140 guint previous_ws; 141 142 /* Monitor search caching */ 143 GdkRectangle cache_monitor; 144 gint num_monitors; 145 GArray *monitors_index; 146 147 /* Workspace definitions */ 148 guint workspace_count; 149 gchar **workspace_names; 150 int workspace_names_items; 151 NetWmDesktopLayout desktop_layout; 152 153 /* Button handler for GTK */ 154 gulong button_handler_id; 155 156 /* xfconf */ 157 XfconfChannel *xfwm4_channel; 158 159 /* Shortcuts */ 160 XfceShortcutsProvider *shortcuts_provider; 161 162 /* Per screen parameters */ 163 XfwmParams *params; 164 165 /* show desktop flag */ 166 gboolean show_desktop; 167 168 /* tabwin css provider */ 169 gboolean tabwin_provider_ready; 170 GtkCssProvider *tabwin_provider; 171 172 #ifdef ENABLE_KDE_SYSTRAY_PROXY 173 /* There can be one systray per screen */ 174 Atom net_system_tray_selection; 175 Window systray; 176 #endif 177 178 #ifdef HAVE_LIBSTARTUP_NOTIFICATION 179 /* Startup notification data, per screen */ 180 SnMonitorContext *sn_context; 181 GSList *startup_sequences; 182 guint startup_sequence_timeout; 183 #endif 184 185 #ifdef HAVE_COMPOSITOR 186 #if HAVE_OVERLAYS 187 Window overlay; 188 Window root_overlay; 189 #endif 190 GList *cwindows; 191 GHashTable *cwindow_hash; 192 Window output; 193 194 gaussian_conv *gaussianMap; 195 gint gaussianSize; 196 guchar *shadowCorner; 197 guchar *shadowTop; 198 199 gushort current_buffer; 200 gushort use_n_buffers; 201 Pixmap rootPixmap[N_BUFFERS]; 202 Picture rootBuffer[N_BUFFERS]; 203 Picture zoomBuffer; 204 Picture rootPicture; 205 Picture blackPicture; 206 Picture rootTile; 207 XserverRegion screenRegion; 208 XserverRegion prevDamage; 209 XserverRegion allDamage; 210 unsigned long cursorSerial; 211 Picture cursorPicture; 212 gint cursorOffsetX; 213 gint cursorOffsetY; 214 XRectangle cursorLocation; 215 gboolean cursor_is_zoomed; 216 217 guint wins_unredirected; 218 gboolean compositor_active; 219 gboolean clipChanged; 220 221 gboolean damages_pending; 222 223 guint compositor_timeout_id; 224 225 XTransform transform; 226 gboolean zoomed; 227 guint zoom_timeout_id; 228 gboolean use_glx; 229 gboolean use_present; 230 231 vblankMode vblank_mode; 232 233 #ifdef HAVE_EPOXY 234 gboolean texture_inverted; 235 gboolean has_mesa_swap_control; 236 gboolean has_ext_swap_control; 237 gboolean has_ext_arb_sync; 238 239 GLuint rootTexture; 240 GLenum texture_format; 241 GLenum texture_target; 242 GLenum texture_type; 243 GLfloat texture_filter; 244 GLXDrawable glx_drawable[N_BUFFERS]; 245 GLXFBConfig glx_fbconfig; 246 GLXContext glx_context; 247 GLXWindow glx_window; 248 GLsync gl_sync; 249 #ifdef HAVE_XSYNC 250 XSyncFence fence[N_BUFFERS]; 251 #endif /* HAVE_XSYNC */ 252 #endif /* HAVE_EPOXY */ 253 254 #ifdef HAVE_PRESENT_EXTENSION 255 gboolean present_pending; 256 #endif /* HAVE_PRESENT_EXTENSION */ 257 258 #endif /* HAVE_COMPOSITOR */ 259 }; 260 261 gboolean myScreenCheckWMAtom (ScreenInfo *, 262 Atom atom); 263 ScreenInfo *myScreenInit (DisplayInfo *, 264 GdkScreen *, 265 unsigned long, 266 gboolean); 267 ScreenInfo *myScreenClose (ScreenInfo *); 268 Display *myScreenGetXDisplay (ScreenInfo *); 269 GtkWidget *myScreenGetGtkWidget (ScreenInfo *); 270 GdkWindow *myScreenGetGdkWindow (ScreenInfo *); 271 gboolean myScreenGrabKeyboard (ScreenInfo *, 272 guint, 273 guint32); 274 gboolean myScreenGrabPointer (ScreenInfo *, 275 gboolean, 276 guint, 277 Cursor, 278 guint32); 279 gboolean myScreenChangeGrabPointer (ScreenInfo *, 280 gboolean, 281 guint, 282 Cursor, 283 guint32); 284 unsigned int myScreenUngrabKeyboard (ScreenInfo *, 285 guint32); 286 unsigned int myScreenUngrabPointer (ScreenInfo *, 287 guint32); 288 void myScreenGrabKeys (ScreenInfo *); 289 void myScreenUngrabKeys (ScreenInfo *); 290 gint myScreenGetKeyPressed (ScreenInfo *, 291 XfwmEventKey *); 292 int myScreenGetModifierPressed (ScreenInfo *); 293 Client *myScreenGetClientFromWindow (ScreenInfo *, 294 Window, 295 unsigned short); 296 gboolean myScreenComputeSize (ScreenInfo *); 297 gboolean myScreenHasPrimaryMonitor (ScreenInfo *, 298 Window w); 299 gint myScreenGetNumMonitors (ScreenInfo *); 300 gint myScreenGetMonitorIndex (ScreenInfo *, 301 gint); 302 gboolean myScreenRebuildMonitorIndex (ScreenInfo *); 303 void myScreenInvalidateMonitorCache (ScreenInfo *); 304 void myScreenFindMonitorAtPoint (ScreenInfo *, 305 gint, 306 gint, 307 GdkRectangle *); 308 PangoFontDescription * myScreenGetFontDescription (ScreenInfo *); 309 void myScreenUpdateFontAttr (ScreenInfo *); 310 void myScreenGetXineramaMonitorGeometry (ScreenInfo *, 311 gint, 312 GdkRectangle *); 313 #endif /* INC_SCREEN_H */ 314