diff options
author | okan | 2017-05-09 13:40:18 +0000 |
---|---|---|
committer | okan | 2017-05-09 13:40:18 +0000 |
commit | c0236e8f1db054489bfaf7f9b517a59a8fbafd70 (patch) | |
tree | f261a3d4ba774136904d337d118587b62611d661 /calmwm.h | |
parent | c44f7f8975b29c13365cb80c54a9b7f26fee3943 (diff) | |
download | cwm-c0236e8f1db054489bfaf7f9b517a59a8fbafd70.tar.gz |
Alter callbacks to take a struct instead of a growing number of arguments;
greatly simplifies upcoming work.
Diffstat (limited to '')
-rw-r--r-- | calmwm.h | 112 |
1 files changed, 51 insertions, 61 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.338 2017/05/01 12:54:55 okan Exp $ + * $OpenBSD: calmwm.h,v 1.339 2017/05/09 13:40:18 okan Exp $ */ #ifndef _CALMWM_H_ @@ -66,7 +66,6 @@ enum cwm_status { CWM_RUNNING, CWM_EXEC_WM }; - enum cursor_font { CF_NORMAL, CF_MOVE, @@ -156,7 +155,6 @@ struct client_ctx { #define CLIENT_FULLSCREEN 0x0800 #define CLIENT_STICKY 0x1000 #define CLIENT_ACTIVE 0x2000 - #define CLIENT_HIGHLIGHT (CLIENT_GROUP | CLIENT_UNGROUP) #define CLIENT_MAXFLAGS (CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED) #define CLIENT_MAXIMIZED (CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED) @@ -219,30 +217,29 @@ struct screen_ctx { }; TAILQ_HEAD(screen_q, screen_ctx); -enum xev { - CWM_XEV_KEY, - CWM_XEV_BTN -}; -union arg { - char *c; - int i; -}; -union press { - KeySym keysym; - unsigned int button; +struct cargs { + char *cmd; + int flag; + enum { + CWM_XEV_KEY, + CWM_XEV_BTN + } xev; }; enum context { - CWM_CONTEXT_NONE, + CWM_CONTEXT_NONE = 0, CWM_CONTEXT_CC, CWM_CONTEXT_SC }; struct bind_ctx { TAILQ_ENTRY(bind_ctx) entry; - void (*callback)(void *, union arg *, enum xev); - union arg argument; - unsigned int modmask; - union press press; + void (*callback)(void *, struct cargs *); + struct cargs *cargs; enum context context; + unsigned int modmask; + union { + KeySym keysym; + unsigned int button; + } press; }; TAILQ_HEAD(keybind_q, bind_ctx); TAILQ_HEAD(mousebind_q, bind_ctx); @@ -462,49 +459,42 @@ void screen_update_geometry(struct screen_ctx *); void screen_updatestackingorder(struct screen_ctx *); void screen_assert_clients_within(struct screen_ctx *); -void kbfunc_cwm_status(void *, union arg *, enum xev); -void kbfunc_ptrmove(void *, union arg *, enum xev); -void kbfunc_client_move(void *, union arg *, enum xev); -void kbfunc_client_resize(void *, union arg *, enum xev); -void kbfunc_client_delete(void *, union arg *, enum xev); -void kbfunc_client_lower(void *, union arg *, enum xev); -void kbfunc_client_raise(void *, union arg *, enum xev); -void kbfunc_client_hide(void *, union arg *, enum xev); -void kbfunc_client_toggle_freeze(void *, - union arg *, enum xev); -void kbfunc_client_toggle_sticky(void *, - union arg *, enum xev); +void kbfunc_cwm_status(void *, struct cargs *); +void kbfunc_ptrmove(void *, struct cargs *); +void kbfunc_client_move(void *, struct cargs *); +void kbfunc_client_resize(void *, struct cargs *); +void kbfunc_client_delete(void *, struct cargs *); +void kbfunc_client_lower(void *, struct cargs *); +void kbfunc_client_raise(void *, struct cargs *); +void kbfunc_client_hide(void *, struct cargs *); +void kbfunc_client_toggle_freeze(void *, struct cargs *); +void kbfunc_client_toggle_sticky(void *, struct cargs *); void kbfunc_client_toggle_fullscreen(void *, - union arg *, enum xev); -void kbfunc_client_toggle_maximize(void *, - union arg *, enum xev); -void kbfunc_client_toggle_hmaximize(void *, - union arg *, enum xev); -void kbfunc_client_toggle_vmaximize(void *, - union arg *, enum xev); -void kbfunc_client_htile(void *, union arg *, enum xev); -void kbfunc_client_vtile(void *, union arg *, enum xev); -void kbfunc_client_cycle(void *, union arg *, enum xev); -void kbfunc_client_toggle_group(void *, - union arg *, enum xev); -void kbfunc_client_movetogroup(void *, - union arg *, enum xev); -void kbfunc_group_toggle(void *, union arg *, enum xev); -void kbfunc_group_only(void *, union arg *, enum xev); -void kbfunc_group_cycle(void *, union arg *, enum xev); -void kbfunc_group_alltoggle(void *, union arg *, enum xev); -void kbfunc_menu_client(void *, union arg *, enum xev); -void kbfunc_menu_cmd(void *, union arg *, enum xev); -void kbfunc_menu_group(void *, union arg *, enum xev); -void kbfunc_menu_exec(void *, union arg *, enum xev); -void kbfunc_menu_ssh(void *, union arg *, enum xev); -void kbfunc_menu_client_label(void *, union arg *, enum xev); -void kbfunc_exec_cmd(void *, union arg *, enum xev); -void kbfunc_exec_lock(void *, union arg *, enum xev); -void kbfunc_exec_term(void *, union arg *, enum xev); - -void mousefunc_client_move(void *, union arg *, enum xev); -void mousefunc_client_resize(void *, union arg *, enum xev); + struct cargs *); +void kbfunc_client_toggle_maximize(void *, struct cargs *); +void kbfunc_client_toggle_hmaximize(void *, struct cargs *); +void kbfunc_client_toggle_vmaximize(void *, struct cargs *); +void kbfunc_client_htile(void *, struct cargs *); +void kbfunc_client_vtile(void *, struct cargs *); +void kbfunc_client_cycle(void *, struct cargs *); +void kbfunc_client_toggle_group(void *, struct cargs *); +void kbfunc_client_movetogroup(void *, struct cargs *); +void kbfunc_group_toggle(void *, struct cargs *); +void kbfunc_group_only(void *, struct cargs *); +void kbfunc_group_cycle(void *, struct cargs *); +void kbfunc_group_alltoggle(void *, struct cargs *); +void kbfunc_menu_client(void *, struct cargs *); +void kbfunc_menu_cmd(void *, struct cargs *); +void kbfunc_menu_group(void *, struct cargs *); +void kbfunc_menu_exec(void *, struct cargs *); +void kbfunc_menu_ssh(void *, struct cargs *); +void kbfunc_menu_client_label(void *, struct cargs *); +void kbfunc_exec_cmd(void *, struct cargs *); +void kbfunc_exec_lock(void *, struct cargs *); +void kbfunc_exec_term(void *, struct cargs *); + +void mousefunc_client_move(void *, struct cargs *); +void mousefunc_client_resize(void *, struct cargs *); void menu_windraw(struct screen_ctx *, Window, const char *, ...); |