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.
This commit is contained in:
Richard Grenville
2013-01-31 22:53:44 +08:00
parent 1b5273c819
commit 8e34736c19
8 changed files with 154 additions and 69 deletions

View File

@ -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);