1 /* 2 * Cogl 3 * 4 * A Low Level GPU Graphics and Utilities API 5 * 6 * Copyright (C) 2010 Intel Corporation. 7 * 8 * Permission is hereby granted, free of charge, to any person 9 * obtaining a copy of this software and associated documentation 10 * files (the "Software"), to deal in the Software without 11 * restriction, including without limitation the rights to use, copy, 12 * modify, merge, publish, distribute, sublicense, and/or sell copies 13 * of the Software, and to permit persons to whom the Software is 14 * furnished to do so, subject to the following conditions: 15 * 16 * The above copyright notice and this permission notice shall be 17 * included in all copies or substantial portions of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 23 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 24 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 * SOFTWARE. 27 * 28 * 29 */ 30 31 #ifndef __COGL_TEXTURE_PIXMAP_X11_PRIVATE_H 32 #define __COGL_TEXTURE_PIXMAP_X11_PRIVATE_H 33 34 #include <X11/Xlib.h> 35 #include <X11/extensions/XShm.h> 36 #include <X11/extensions/Xdamage.h> 37 38 #include <sys/shm.h> 39 40 #ifdef COGL_HAS_GLX_SUPPORT 41 #include <GL/glx.h> 42 #endif 43 44 #include "cogl-object-private.h" 45 #include "cogl-texture-private.h" 46 #include "cogl-texture-pixmap-x11.h" 47 48 typedef struct _CoglDamageRectangle CoglDamageRectangle; 49 50 struct _CoglDamageRectangle 51 { 52 unsigned int x1; 53 unsigned int y1; 54 unsigned int x2; 55 unsigned int y2; 56 }; 57 58 /* For stereo, there are a pair of textures, but we want to share most 59 * other state (the GLXPixmap, visual, etc.) The way we do this is that 60 * the left-eye texture has all the state (there is in fact, no internal 61 * difference between the a MONO and a LEFT texture ), and the 62 * right-eye texture simply points to the left eye texture, with all 63 * other fields ignored. 64 */ 65 typedef enum 66 { 67 COGL_TEXTURE_PIXMAP_MONO, 68 COGL_TEXTURE_PIXMAP_LEFT, 69 COGL_TEXTURE_PIXMAP_RIGHT 70 } CoglTexturePixmapStereoMode; 71 72 struct _CoglTexturePixmapX11 73 { 74 CoglTexture _parent; 75 76 CoglTexturePixmapStereoMode stereo_mode; 77 CoglTexturePixmapX11 *left; /* Set only if stereo_mode=RIGHT */ 78 79 Pixmap pixmap; 80 CoglTexture *tex; 81 82 unsigned int depth; 83 Visual *visual; 84 85 XImage *image; 86 87 XShmSegmentInfo shm_info; 88 89 Damage damage; 90 CoglTexturePixmapX11ReportLevel damage_report_level; 91 CoglBool damage_owned; 92 CoglDamageRectangle damage_rect; 93 94 void *winsys; 95 96 /* During the pre_paint method, this will be set to TRUE if we 97 should use the winsys texture, otherwise we will use the regular 98 texture */ 99 CoglBool use_winsys_texture; 100 }; 101 102 103 #endif /* __COGL_TEXTURE_PIXMAP_X11_PRIVATE_H */ 104