summaryrefslogtreecommitdiffstats
path: root/opengl.h
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2013-03-15 23:16:23 +0800
committerRichard Grenville <[email protected]>2013-03-15 23:16:23 +0800
commitf9f1e1f228ec21be08833f6aa86fe6ea2c64b625 (patch)
treeaab94bd7d31bc3464e4ddcdee9ee792156231738 /opengl.h
parent690589bb343f25eec4727748a990b0b60972ed8d (diff)
downloadtdebase-f9f1e1f228ec21be08833f6aa86fe6ea2c64b625.tar.gz
tdebase-f9f1e1f228ec21be08833f6aa86fe6ea2c64b625.zip
Feature: OpenGL backend
- Add experimental OpenGL backend (--opengl). --blur-background is currently not possible with this backend, because I'm still trying to find a proper way to do blur with OpenGL. Flipping backend on-the-fly is really hard, so it isn't supported right now. No configuration file option exists to enable this, because it isn't stable enough. - Add `opengl-swc` VSync method that uses SGI_swap_control to control buffer swap, with OpenGL backend. (#7) - Fix a potential read-from-freed-memory issue in paint_all(). - Correctly reattach GLX context after fork. - Dump error text in error(). Add GLX error code handling. - Code clean-up. - Known issues: Region operations take a lot of time in glx_render(). I'm hesitating about what to do.
Diffstat (limited to 'opengl.h')
-rw-r--r--opengl.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/opengl.h b/opengl.h
new file mode 100644
index 000000000..b48b441d0
--- /dev/null
+++ b/opengl.h
@@ -0,0 +1,46 @@
+/*
+ * Compton - a compositor for X11
+ *
+ * Based on `xcompmgr` - Copyright (c) 2003, Keith Packard
+ *
+ * Copyright (c) 2011-2013, Christopher Jeffrey
+ * See LICENSE for more information.
+ *
+ */
+
+#include "common.h"
+
+#include <ctype.h>
+
+/**
+ * Check if a GLX extension exists.
+ */
+static inline bool
+glx_hasext(session_t *ps, const char *ext) {
+ const char *glx_exts = glXQueryExtensionsString(ps->dpy, ps->scr);
+ const char *pos = strstr(glx_exts, ext);
+ // Make sure the extension string is matched as a whole word
+ if (!pos
+ || ((pos - glx_exts) && !isspace(*(pos - 1)))
+ || (strlen(pos) > strlen(ext) && !isspace(pos[strlen(ext)]))) {
+ printf_errf("(): Missing OpenGL extension %s.", ext);
+ return false;
+ }
+
+ return true;
+}
+
+static inline XVisualInfo *
+get_visualinfo_from_visual(session_t *ps, Visual *visual) {
+ XVisualInfo vreq = { .visualid = XVisualIDFromVisual(visual) };
+ int nitems = 0;
+
+ return XGetVisualInfo(ps->dpy, VisualIDMask, &vreq, &nitems);
+}
+
+static bool
+glx_update_fbconfig(session_t *ps);
+
+static int
+glx_cmp_fbconfig(session_t *ps,
+ const glx_fbconfig_t *pfbc_a, const glx_fbconfig_t *pfbc_b);