summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2013-01-31 22:53:44 +0800
committerRichard Grenville <[email protected]>2013-01-31 22:56:54 +0800
commitd1fb8649a4e5d2ec165bd4226d53703043678eb2 (patch)
tree79baf4b2e997aca97a748fc6e468a6e50e7773c6 /compton.h
parent646390149399214ca725b93328e04e71361caa02 (diff)
downloadtdebase-d1fb8649a4e5d2ec165bd4226d53703043678eb2.tar.gz
tdebase-d1fb8649a4e5d2ec165bd4226d53703043678eb2.zip
Improvement: Change VSync mode with D-Bus & Makefile update & Misc
- Add on-the-fly VSync option modification via D-Bus, as requested by kunitoki (#80). Expose parse_vsync(), create vsync_init() and ensure_glx_context(). - Change default value of ps->drm_fd to -1. - Update Makefile. Change the install/uninstall rules and add doc installation, requested by hasufell in #85. - Mark window not damaged in map_win(). It helps in reducing flickering with inverted window color, but I'm not completely sure if it's safe. - Avoid modifying w->invert_color when window is unmapped. - Update documentation. Thanks to hasufell for pointing out.
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/compton.h b/compton.h
index ddc17044f..b4f5bfd44 100644
--- a/compton.h
+++ b/compton.h
@@ -707,6 +707,39 @@ usage(void);
static bool
register_cm(session_t *ps, bool glx);
+#ifdef CONFIG_VSYNC_OPENGL
+/**
+ * Ensure we have a GLX context.
+ */
+static inline bool
+ensure_glx_context(session_t *ps) {
+ if (ps->glx_context)
+ return true;
+
+ // Check for GLX extension
+ if (!ps->glx_exists) {
+ if (glXQueryExtension(ps->dpy, &ps->glx_event, &ps->glx_error))
+ ps->glx_exists = true;
+ else {
+ printf_errf("(): No GLX extension.");
+ return false;
+ }
+ }
+
+ // Create GLX context
+ if (ps->reg_win) {
+ XDestroyWindow(ps->dpy, ps->reg_win);
+ ps->reg_win = None;
+ }
+ if (!register_cm(ps, true) || !ps->glx_context) {
+ printf_errf("(): Failed to acquire GLX context.");
+ return false;
+ }
+
+ return true;
+}
+#endif
+
inline static void
ev_focus_in(session_t *ps, XFocusChangeEvent *ev);