gfx/gl/GLXLibrary.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef GFX_GLXLIBRARY_H
michael@0 7 #define GFX_GLXLIBRARY_H
michael@0 8
michael@0 9 #include "GLContextTypes.h"
michael@0 10 typedef realGLboolean GLboolean;
michael@0 11
michael@0 12 // stuff from glx.h
michael@0 13 #include "X11/Xlib.h"
michael@0 14 typedef struct __GLXcontextRec *GLXContext;
michael@0 15 typedef XID GLXPixmap;
michael@0 16 typedef XID GLXDrawable;
michael@0 17 /* GLX 1.3 and later */
michael@0 18 typedef struct __GLXFBConfigRec *GLXFBConfig;
michael@0 19 typedef XID GLXFBConfigID;
michael@0 20 typedef XID GLXContextID;
michael@0 21 typedef XID GLXWindow;
michael@0 22 typedef XID GLXPbuffer;
michael@0 23 // end of stuff from glx.h
michael@0 24
michael@0 25 struct PRLibrary;
michael@0 26 class gfxASurface;
michael@0 27
michael@0 28 namespace mozilla {
michael@0 29 namespace gl {
michael@0 30
michael@0 31 class GLXLibrary
michael@0 32 {
michael@0 33 public:
michael@0 34 GLXLibrary() : mInitialized(false), mTriedInitializing(false),
michael@0 35 mUseTextureFromPixmap(false), mDebug(false),
michael@0 36 mHasRobustness(false), mIsATI(false), mIsNVIDIA(false),
michael@0 37 mClientIsMesa(false), mGLXMajorVersion(0),
michael@0 38 mGLXMinorVersion(0),
michael@0 39 mOGLLibrary(nullptr) {}
michael@0 40
michael@0 41 void xDestroyContext(Display* display, GLXContext context);
michael@0 42 Bool xMakeCurrent(Display* display,
michael@0 43 GLXDrawable drawable,
michael@0 44 GLXContext context);
michael@0 45
michael@0 46 GLXContext xGetCurrentContext();
michael@0 47 static void* xGetProcAddress(const char *procName);
michael@0 48 GLXFBConfig* xChooseFBConfig(Display* display,
michael@0 49 int screen,
michael@0 50 const int *attrib_list,
michael@0 51 int *nelements);
michael@0 52 GLXFBConfig* xGetFBConfigs(Display* display,
michael@0 53 int screen,
michael@0 54 int *nelements);
michael@0 55 GLXContext xCreateNewContext(Display* display,
michael@0 56 GLXFBConfig config,
michael@0 57 int render_type,
michael@0 58 GLXContext share_list,
michael@0 59 Bool direct);
michael@0 60 int xGetFBConfigAttrib(Display *display,
michael@0 61 GLXFBConfig config,
michael@0 62 int attribute,
michael@0 63 int *value);
michael@0 64 void xSwapBuffers(Display *display, GLXDrawable drawable);
michael@0 65 const char * xQueryExtensionsString(Display *display,
michael@0 66 int screen);
michael@0 67 const char * xGetClientString(Display *display,
michael@0 68 int screen);
michael@0 69 const char * xQueryServerString(Display *display,
michael@0 70 int screen, int name);
michael@0 71 GLXPixmap xCreatePixmap(Display *display,
michael@0 72 GLXFBConfig config,
michael@0 73 Pixmap pixmap,
michael@0 74 const int *attrib_list);
michael@0 75 GLXPixmap xCreateGLXPixmapWithConfig(Display *display,
michael@0 76 GLXFBConfig config,
michael@0 77 Pixmap pixmap);
michael@0 78 void xDestroyPixmap(Display *display, GLXPixmap pixmap);
michael@0 79 Bool xQueryVersion(Display *display,
michael@0 80 int *major,
michael@0 81 int *minor);
michael@0 82 void xBindTexImage(Display *display,
michael@0 83 GLXDrawable drawable,
michael@0 84 int buffer,
michael@0 85 const int *attrib_list);
michael@0 86 void xReleaseTexImage(Display *display,
michael@0 87 GLXDrawable drawable,
michael@0 88 int buffer);
michael@0 89 void xWaitGL();
michael@0 90 void xWaitX();
michael@0 91
michael@0 92 GLXContext xCreateContextAttribs(Display* display,
michael@0 93 GLXFBConfig config,
michael@0 94 GLXContext share_list,
michael@0 95 Bool direct,
michael@0 96 const int* attrib_list);
michael@0 97
michael@0 98 bool EnsureInitialized();
michael@0 99
michael@0 100 GLXPixmap CreatePixmap(gfxASurface* aSurface);
michael@0 101 void DestroyPixmap(Display* aDisplay, GLXPixmap aPixmap);
michael@0 102 void BindTexImage(Display* aDisplay, GLXPixmap aPixmap);
michael@0 103 void ReleaseTexImage(Display* aDisplay, GLXPixmap aPixmap);
michael@0 104 void UpdateTexImage(Display* aDisplay, GLXPixmap aPixmap);
michael@0 105
michael@0 106 bool UseTextureFromPixmap() { return mUseTextureFromPixmap; }
michael@0 107 bool HasRobustness() { return mHasRobustness; }
michael@0 108 bool SupportsTextureFromPixmap(gfxASurface* aSurface);
michael@0 109 bool IsATI() { return mIsATI; }
michael@0 110 bool GLXVersionCheck(int aMajor, int aMinor);
michael@0 111
michael@0 112 private:
michael@0 113
michael@0 114 typedef void (GLAPIENTRY * PFNGLXDESTROYCONTEXTPROC) (Display*,
michael@0 115 GLXContext);
michael@0 116 PFNGLXDESTROYCONTEXTPROC xDestroyContextInternal;
michael@0 117 typedef Bool (GLAPIENTRY * PFNGLXMAKECURRENTPROC) (Display*,
michael@0 118 GLXDrawable,
michael@0 119 GLXContext);
michael@0 120 PFNGLXMAKECURRENTPROC xMakeCurrentInternal;
michael@0 121 typedef GLXContext (GLAPIENTRY * PFNGLXGETCURRENTCONTEXT) ();
michael@0 122 PFNGLXGETCURRENTCONTEXT xGetCurrentContextInternal;
michael@0 123 typedef void* (GLAPIENTRY * PFNGLXGETPROCADDRESSPROC) (const char *);
michael@0 124 PFNGLXGETPROCADDRESSPROC xGetProcAddressInternal;
michael@0 125 typedef GLXFBConfig* (GLAPIENTRY * PFNGLXCHOOSEFBCONFIG) (Display *,
michael@0 126 int,
michael@0 127 const int *,
michael@0 128 int *);
michael@0 129 PFNGLXCHOOSEFBCONFIG xChooseFBConfigInternal;
michael@0 130 typedef GLXFBConfig* (GLAPIENTRY * PFNGLXGETFBCONFIGS) (Display *,
michael@0 131 int,
michael@0 132 int *);
michael@0 133 PFNGLXGETFBCONFIGS xGetFBConfigsInternal;
michael@0 134 typedef GLXContext (GLAPIENTRY * PFNGLXCREATENEWCONTEXT) (Display *,
michael@0 135 GLXFBConfig,
michael@0 136 int,
michael@0 137 GLXContext,
michael@0 138 Bool);
michael@0 139 PFNGLXCREATENEWCONTEXT xCreateNewContextInternal;
michael@0 140 typedef int (GLAPIENTRY * PFNGLXGETFBCONFIGATTRIB) (Display *,
michael@0 141 GLXFBConfig,
michael@0 142 int,
michael@0 143 int *);
michael@0 144 PFNGLXGETFBCONFIGATTRIB xGetFBConfigAttribInternal;
michael@0 145
michael@0 146 typedef void (GLAPIENTRY * PFNGLXSWAPBUFFERS) (Display *,
michael@0 147 GLXDrawable);
michael@0 148 PFNGLXSWAPBUFFERS xSwapBuffersInternal;
michael@0 149 typedef const char * (GLAPIENTRY * PFNGLXQUERYEXTENSIONSSTRING) (Display *,
michael@0 150 int);
michael@0 151 PFNGLXQUERYEXTENSIONSSTRING xQueryExtensionsStringInternal;
michael@0 152 typedef const char * (GLAPIENTRY * PFNGLXGETCLIENTSTRING) (Display *,
michael@0 153 int);
michael@0 154 PFNGLXGETCLIENTSTRING xGetClientStringInternal;
michael@0 155 typedef const char * (GLAPIENTRY * PFNGLXQUERYSERVERSTRING) (Display *,
michael@0 156 int,
michael@0 157 int);
michael@0 158 PFNGLXQUERYSERVERSTRING xQueryServerStringInternal;
michael@0 159
michael@0 160 typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEPIXMAP) (Display *,
michael@0 161 GLXFBConfig,
michael@0 162 Pixmap,
michael@0 163 const int *);
michael@0 164 PFNGLXCREATEPIXMAP xCreatePixmapInternal;
michael@0 165 typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEGLXPIXMAPWITHCONFIG)
michael@0 166 (Display *,
michael@0 167 GLXFBConfig,
michael@0 168 Pixmap);
michael@0 169 PFNGLXCREATEGLXPIXMAPWITHCONFIG xCreateGLXPixmapWithConfigInternal;
michael@0 170 typedef void (GLAPIENTRY * PFNGLXDESTROYPIXMAP) (Display *,
michael@0 171 GLXPixmap);
michael@0 172 PFNGLXDESTROYPIXMAP xDestroyPixmapInternal;
michael@0 173 typedef Bool (GLAPIENTRY * PFNGLXQUERYVERSION) (Display *,
michael@0 174 int *,
michael@0 175 int *);
michael@0 176 PFNGLXQUERYVERSION xQueryVersionInternal;
michael@0 177
michael@0 178 typedef void (GLAPIENTRY * PFNGLXBINDTEXIMAGE) (Display *,
michael@0 179 GLXDrawable,
michael@0 180 int,
michael@0 181 const int *);
michael@0 182 PFNGLXBINDTEXIMAGE xBindTexImageInternal;
michael@0 183
michael@0 184 typedef void (GLAPIENTRY * PFNGLXRELEASETEXIMAGE) (Display *,
michael@0 185 GLXDrawable,
michael@0 186 int);
michael@0 187 PFNGLXRELEASETEXIMAGE xReleaseTexImageInternal;
michael@0 188
michael@0 189 typedef void (GLAPIENTRY * PFNGLXWAITGL) ();
michael@0 190 PFNGLXWAITGL xWaitGLInternal;
michael@0 191
michael@0 192 typedef void (GLAPIENTRY * PFNGLXWAITX) ();
michael@0 193 PFNGLXWAITGL xWaitXInternal;
michael@0 194
michael@0 195 typedef GLXContext (GLAPIENTRY * PFNGLXCREATECONTEXTATTRIBS) (Display *,
michael@0 196 GLXFBConfig,
michael@0 197 GLXContext,
michael@0 198 Bool,
michael@0 199 const int *);
michael@0 200 PFNGLXCREATECONTEXTATTRIBS xCreateContextAttribsInternal;
michael@0 201
michael@0 202 #ifdef DEBUG
michael@0 203 void BeforeGLXCall();
michael@0 204 void AfterGLXCall();
michael@0 205 #endif
michael@0 206
michael@0 207 bool mInitialized;
michael@0 208 bool mTriedInitializing;
michael@0 209 bool mUseTextureFromPixmap;
michael@0 210 bool mDebug;
michael@0 211 bool mHasRobustness;
michael@0 212 bool mIsATI;
michael@0 213 bool mIsNVIDIA;
michael@0 214 bool mClientIsMesa;
michael@0 215 int mGLXMajorVersion;
michael@0 216 int mGLXMinorVersion;
michael@0 217 PRLibrary *mOGLLibrary;
michael@0 218 };
michael@0 219
michael@0 220 // a global GLXLibrary instance
michael@0 221 extern GLXLibrary sGLXLibrary;
michael@0 222
michael@0 223 } /* namespace gl */
michael@0 224 } /* namespace mozilla */
michael@0 225 #endif /* GFX_GLXLIBRARY_H */
michael@0 226

mercurial