diff options
author | Richard Grenville <[email protected]> | 2013-01-31 22:53:44 +0800 |
---|---|---|
committer | Richard Grenville <[email protected]> | 2013-01-31 22:56:54 +0800 |
commit | d1fb8649a4e5d2ec165bd4226d53703043678eb2 (patch) | |
tree | 79baf4b2e997aca97a748fc6e468a6e50e7773c6 /compton.h | |
parent | 646390149399214ca725b93328e04e71361caa02 (diff) | |
download | tdebase-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.h | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -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); |