diff options
Diffstat (limited to 'src/vwm.c')
-rw-r--r-- | src/vwm.c | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -4,7 +4,7 @@ * Copyright (C) 2012-2018 Vito Caputo - <vcaputo@pengaru.com> * * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as published + * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, @@ -82,11 +82,16 @@ static vwm_t * vwm_startup(void) goto _err_free; } - if (!(vwm->charts = vwm_charts_create(vwm->xserver))) { - VWM_ERROR("Failed to create charts"); + if (!(vwm->vcr_backend = vcr_backend_new(VCR_BACKEND_TYPE_XLIB, vwm->xserver))) { + VWM_ERROR("Failed to create vcr backend"); goto _err_xclose; } + if (!(vwm->charts = vwm_charts_create(vwm->vcr_backend, 0))) { + VWM_ERROR("Failed to create charts"); + goto _err_vbe; + } + /* query the needed X extensions */ if (!XQueryExtension(VWM_XDISPLAY(vwm), COMPOSITE_NAME, &composite_opcode, &composite_event, &composite_error)) { VWM_ERROR("No composite extension available"); @@ -173,6 +178,9 @@ static vwm_t * vwm_startup(void) _err_charts: vwm_charts_destroy(vwm->charts); +_err_vbe: + vcr_backend_free(vwm->vcr_backend); + _err_xclose: vwm_xserver_close(vwm->xserver); @@ -313,29 +321,22 @@ void vwm_process_event(vwm_t *vwm) int main(int argc, char *argv[]) { - vwm_t *vwm; - struct pollfd pfd; + vwm_t *vwm; if (!(vwm = vwm_startup())) { VWM_ERROR("Unable to startup vwm"); goto _err; } - pfd.events = POLLIN; - pfd.revents = 0; - pfd.fd = ConnectionNumber(VWM_XDISPLAY(vwm)); - while (!vwm->done) { do { - int delay; + int delay_us; - if (vwm_charts_update(vwm->charts, &delay)) + if (vwm_charts_update(vwm->charts, &delay_us)) vwm_composite_repaint_needed(vwm); - if (!XPending(VWM_XDISPLAY(vwm))) { - if (poll(&pfd, 1, delay) == 0) - break; - } + if (vcr_backend_poll(vwm->vcr_backend, delay_us) == 0) + break; vwm_process_event(vwm); } while (QLength(VWM_XDISPLAY(vwm))); |