From 229a84202f3fda6f175e9861208b9fc0b7fb3c34 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 1 Jan 2021 00:49:25 -0800 Subject: *: return MRU object from _mru() funcs minor ergonomic improvement; enables plain wrapping of creates or other relevant object pointers with _mru() calls without requiring an intermediate storage variable. --- src/desktop.c | 4 +++- src/desktop.h | 2 +- src/window.c | 4 +++- src/window.h | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/desktop.c b/src/desktop.c index 6038383..8abc4d6 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -29,10 +29,12 @@ #include "xwindow.h" /* make the specified desktop the most recently used one */ -void vwm_desktop_mru(vwm_t *vwm, vwm_desktop_t *desktop) +vwm_desktop_t * vwm_desktop_mru(vwm_t *vwm, vwm_desktop_t *desktop) { VWM_TRACE("MRU desktop: %p", desktop); list_move(&desktop->desktops_mru, &vwm->desktops_mru); + + return desktop; } diff --git a/src/desktop.h b/src/desktop.h index 5c83a4c..1503407 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -14,7 +14,7 @@ typedef struct _vwm_desktop_t { vwm_window_t *focused_window; /* the focused window on this virtual desktop */ } vwm_desktop_t; -void vwm_desktop_mru(vwm_t *vwm, vwm_desktop_t *desktop); +vwm_desktop_t * vwm_desktop_mru(vwm_t *vwm, vwm_desktop_t *desktop); int vwm_desktop_focus(vwm_t *vwm, vwm_desktop_t *desktop); vwm_desktop_t * vwm_desktop_create(vwm_t *vwm); void vwm_desktop_destroy(vwm_t *vwm, vwm_desktop_t *desktop); diff --git a/src/window.c b/src/window.c index b3e32c1..d1441f3 100644 --- a/src/window.c +++ b/src/window.c @@ -58,9 +58,11 @@ void vwm_win_map(vwm_t *vwm, vwm_window_t *vwin) /* make the specified window the most recently used one */ -void vwm_win_mru(vwm_t *vwm, vwm_window_t *vwin) +vwm_window_t * vwm_win_mru(vwm_t *vwm, vwm_window_t *vwin) { list_move(&vwin->windows_mru, &vwm->windows_mru); + + return vwin; } diff --git a/src/window.h b/src/window.h index 00ebc72..eef639e 100644 --- a/src/window.h +++ b/src/window.h @@ -41,7 +41,7 @@ typedef struct _vwm_window_t { void vwm_win_unmap(vwm_t *vwm, vwm_window_t *vwin); void vwm_win_map(vwm_t *vwm, vwm_window_t *vwin); -void vwm_win_mru(vwm_t *vwm, vwm_window_t *vwin); +vwm_window_t * vwm_win_mru(vwm_t *vwm, vwm_window_t *vwin); vwm_window_t * vwm_win_lookup(vwm_t *vwm, Window win); vwm_window_t * vwm_win_get_focused(vwm_t *vwm); void vwm_win_set_focused(vwm_t *vwm, vwm_window_t *vwin); -- cgit v1.2.3