diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2017-03-08 18:31:29 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2017-03-14 19:41:48 -0700 |
commit | 5bebde59c93312d0cef33b7e62f37dd3bc939ce0 (patch) | |
tree | d2f1b6cca1496a20ce61c5e48df26ae9fafeb8ce /src/vwm.c | |
parent | df9f5f5b92cef88492b647f362c91f281c3b2e3b (diff) |
overlays: encapsulate global overlays state
Introduce vwm_overlays_t and create/destroy functions, use in vwm_startup()
and vwm_shutdown(). Supply to methods operating on the global overlays
state vwm_overlays_update(), vwm_overlays_rate_increase(),
vwm_overlays_rate_decrease().
This is a fairly minimal adoption of these changes with vwm_t still being
supplyed to the overlay functions.
A future commit will further cleanup the interactions and cease all
knowledge of vwm_t in overlays.c, but for now everything overlay-oriented
still accesses the overlays_t instance via vwm_t. Instead of supplying the
vwm_t to vwm_overlays_create() the bare vwm_xserver_t will be supplied, as
this is the future shared component across vmon and vwm (in addition to
overlays).
Diffstat (limited to 'src/vwm.c')
-rw-r--r-- | src/vwm.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -42,6 +42,7 @@ #include "desktop.h" #include "launch.h" #include "logo.h" +#include "overlays.h" #include "vwm.h" #include "xevent.h" #include "xwindow.h" @@ -78,15 +79,20 @@ static vwm_t * vwm_startup(void) goto _err_free; } + if (!(vwm->overlays = vwm_overlays_create(vwm))) { + VWM_ERROR("Failed to create overlays"); + goto _err_xclose; + } + /* query the needed X extensions */ if (!XQueryExtension(VWM_XDISPLAY(vwm), COMPOSITE_NAME, &composite_opcode, &composite_event, &composite_error)) { VWM_ERROR("No composite extension available"); - goto _err_xclose; + goto _err_overlays; } if (!XDamageQueryExtension(VWM_XDISPLAY(vwm), &vwm->damage_event, &vwm->damage_error)) { VWM_ERROR("No damage extension available"); - goto _err_xclose; + goto _err_overlays; } if (XSyncQueryExtension(VWM_XDISPLAY(vwm), &sync_event, &sync_error)) { @@ -105,7 +111,7 @@ static vwm_t * vwm_startup(void) /* get our scheduling priority, clients are launched with a priority LAUNCHED_RELATIVE_PRIORITY nicer than this */ if ((vwm->priority = getpriority(PRIO_PROCESS, getpid())) == -1) { VWM_ERROR("Cannot get scheduling priority"); - goto _err_xclose; + goto _err_overlays; } vwm->wm_delete_atom = XInternAtom(VWM_XDISPLAY(vwm), "WM_DELETE_WINDOW", False); @@ -155,6 +161,8 @@ static vwm_t * vwm_startup(void) return vwm; +_err_overlays: + vwm_overlays_destroy(vwm->overlays); _err_xclose: vwm_xserver_close(vwm->xserver); @@ -172,6 +180,7 @@ void vwm_shutdown(vwm_t *vwm) char *quit_console_args[] = {"/bin/sh", "-c", "screen -dr " CONSOLE_SESSION_STRING " -X quit", NULL}; vwm_launch(vwm, quit_console_args, VWM_LAUNCH_MODE_FG); + vwm_overlays_destroy(vwm->overlays); vwm_xserver_close(vwm->xserver); /* TODO there's more shit to cleanup here, but we're exiting anyways. */ free(vwm); @@ -302,7 +311,8 @@ int main(int argc, char *argv[]) do { int delay; - vwm_overlay_update(vwm, &delay); + vwm_overlays_update(vwm->overlays, &delay); + XFlush(VWM_XDISPLAY(vwm)); if (!XPending(VWM_XDISPLAY(vwm))) { |