From 158700c6d76f608c35864a53c77eb9fa19461c5b Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sat, 10 Sep 2022 00:47:55 +0400 Subject: [PATCH] Move types to header --- Makefile | 2 +- src/dwm.c | 58 +-------------------------------------------- src/dwm/types.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 58 deletions(-) create mode 100644 src/dwm/types.h diff --git a/Makefile b/Makefile index 514710d..773170b 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ TEST_SRC = \ MAIN_SRC = $(MODULES_SRC) src/main.c MODULES_HDR = $(MODULES_SRC:.c=.h) $(RUST_APIS) -DWM_HDR = $(DWM_SRC:.c=.h) +DWM_HDR = $(DWM_SRC:.c=.h) src/dwm/types.h MAIN_HDR = $(MODULES_HDR) src/main.h MODULES_OBJ = $(MODULES_SRC:.c=.o) diff --git a/src/dwm.c b/src/dwm.c index b2f6d68..af873a1 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -81,63 +81,7 @@ * types * *********/ -enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel }; /* color schemes */ -enum { ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ - -typedef struct Monitor Monitor; -typedef struct Client Client; - -typedef union { - int i; - unsigned int ui; - float f; - const void *v; -} Arg; - -typedef struct { - unsigned int click; - unsigned int mask; - unsigned int button; - void (*func)(const Arg *arg); - const Arg arg; -} Button; - -struct Client { - struct ClientState state; - struct ClientSizeHints size_hints; - - Client *next; - Client *snext; - Monitor *mon; - Window x_window; -}; - -typedef struct { - unsigned int mod; - KeySym keysym; - void (*func)(const Arg *); - const Arg arg; -} Key; - -typedef struct { - void (*arrange)(Monitor *); -} Layout; - -struct Monitor { - struct BasicGeom screen_geom; - struct BasicGeom window_area_geom; - Unit unit; - - int nmaster; - int num; - unsigned int sellt; - Client *clients; - Client *sel; - Client *stack; - Monitor *next; - const Layout *lt[2]; -}; +#include "dwm/types.h" /************************* * function declarations * diff --git a/src/dwm/types.h b/src/dwm/types.h new file mode 100644 index 0000000..32931c5 --- /dev/null +++ b/src/dwm/types.h @@ -0,0 +1,62 @@ +#ifndef _DWM_TYPES_H +#define _DWM_TYPES_H + +enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ +enum { SchemeNorm, SchemeSel }; /* color schemes */ +enum { ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ + +typedef struct Monitor Monitor; +typedef struct Client Client; + +typedef union { + int i; + unsigned int ui; + float f; + const void *v; +} Arg; + +typedef struct { + unsigned int click; + unsigned int mask; + unsigned int button; + void (*func)(const Arg *arg); + const Arg arg; +} Button; + +struct Client { + struct ClientState state; + struct ClientSizeHints size_hints; + + Client *next; + Client *snext; + Monitor *mon; + Window x_window; +}; + +typedef struct { + unsigned int mod; + KeySym keysym; + void (*func)(const Arg *); + const Arg arg; +} Key; + +typedef struct { + void (*arrange)(Monitor *); +} Layout; + +struct Monitor { + struct BasicGeom screen_geom; + struct BasicGeom window_area_geom; + Unit unit; + + int nmaster; + int num; + unsigned int sellt; + Client *clients; + Client *sel; + Client *stack; + Monitor *next; + const Layout *lt[2]; +}; + +#endif // _DWM_TYPES_H