diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2017-03-23 22:58:48 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2017-03-24 02:02:37 -0700 |
commit | c8033ae7ca10d45270794795498c813342b8f7b4 (patch) | |
tree | 46c1343680a0c58128dbefeecdcf795a503c9932 /src | |
parent | 6abaa282e45d63909c5a3fce5ee514c8c8f5514b (diff) |
window: cleanup vwm_win_focused()
We can assume (vwm->focused_desktop != NULL), the initial desktop
is created early in startup and the last one can't be destroyed.
Diffstat (limited to 'src')
-rw-r--r-- | src/window.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/window.c b/src/window.c index 177dff9..1f0c6bf 100644 --- a/src/window.c +++ b/src/window.c @@ -18,6 +18,7 @@ /* vwm "managed" windows (vwm_window_t) (which are built upon the "core" X windows (vwm_xwindow_t)) */ #include <X11/Xlib.h> +#include <assert.h> #include <stdlib.h> #include <stdarg.h> @@ -81,24 +82,17 @@ vwm_window_t * vwm_win_lookup(vwm_t *vwm, Window win) /* return the currently focused window (considers current context...), may return NULL */ vwm_window_t * vwm_win_focused(vwm_t *vwm) { - vwm_window_t *vwin = NULL; - switch (vwm->focused_context) { - case VWM_CONTEXT_SHELF: - vwin = vwm->focused_shelf; - break; + case VWM_CONTEXT_SHELF: + return vwm->focused_shelf; - case VWM_CONTEXT_DESKTOP: - if (vwm->focused_desktop) - vwin = vwm->focused_desktop->focused_window; - break; + case VWM_CONTEXT_DESKTOP: + return vwm->focused_desktop->focused_window; - default: - VWM_BUG("Unsupported context"); - break; + default: + VWM_BUG("Unsupported context"); + assert(0); } - - return vwin; } |