diff options
Diffstat (limited to '')
| -rw-r--r-- | src/config/config.mk | 40 | ||||
| -rw-r--r-- | src/core/dwm.c | 4 | ||||
| -rw-r--r-- | src/core/dwm.h | 2 | ||||
| -rw-r--r-- | src/core/globals.h | 21 | ||||
| -rw-r--r-- | src/core/types.h | 158 | ||||
| -rw-r--r-- | src/drw/drw.c | 2 | ||||
| -rw-r--r-- | src/drw/drw.h | 1 | ||||
| -rw-r--r-- | src/transient/transient.c | 90 | ||||
| -rw-r--r-- | src/ui/bar.h | 13 | ||||
| -rw-r--r-- | src/ui/input.h | 13 | ||||
| -rw-r--r-- | src/ui/systray.h | 12 | ||||
| -rw-r--r-- | src/util/util.c | 4 | ||||
| -rw-r--r-- | src/util/util.h | 4 | ||||
| -rw-r--r-- | src/wm/client.h | 26 | ||||
| -rw-r--r-- | src/wm/layout.h | 12 | ||||
| -rw-r--r-- | src/wm/monitor.h | 15 | ||||
| -rw-r--r-- | src/x11/xevents.h | 25 | ||||
| -rw-r--r-- | src/x11/xutil.h | 21 |
18 files changed, 325 insertions, 138 deletions
diff --git a/src/config/config.mk b/src/config/config.mk deleted file mode 100644 index f8dab1b..0000000 --- a/src/config/config.mk +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | # dwm version | ||
| 2 | VERSION = 6.4 | ||
| 3 | |||
| 4 | # Customize below to fit your system | ||
| 5 | |||
| 6 | # paths | ||
| 7 | PREFIX = /usr/local | ||
| 8 | MANPREFIX = ${PREFIX}/share/man | ||
| 9 | |||
| 10 | X11INC = /usr/X11R6/include | ||
| 11 | X11LIB = /usr/X11R6/lib | ||
| 12 | |||
| 13 | # Xinerama, comment if you don't want it | ||
| 14 | XINERAMALIBS = -lXinerama | ||
| 15 | XINERAMAFLAGS = -DXINERAMA | ||
| 16 | |||
| 17 | # freetype | ||
| 18 | FREETYPELIBS = -lfontconfig -lXft | ||
| 19 | FREETYPEINC = /usr/include/freetype2 | ||
| 20 | # OpenBSD (uncomment) | ||
| 21 | #FREETYPEINC = ${X11INC}/freetype2 | ||
| 22 | #MANPREFIX = ${PREFIX}/man | ||
| 23 | #KVMLIB = -lkvm | ||
| 24 | |||
| 25 | # includes and libs | ||
| 26 | INCS = -I${X11INC} -I${FREETYPEINC} | ||
| 27 | LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB} | ||
| 28 | |||
| 29 | # flags | ||
| 30 | CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} | ||
| 31 | #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} | ||
| 32 | CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} | ||
| 33 | LDFLAGS = ${LIBS} | ||
| 34 | |||
| 35 | # Solaris | ||
| 36 | #CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" | ||
| 37 | #LDFLAGS = ${LIBS} | ||
| 38 | |||
| 39 | # compiler and linker | ||
| 40 | CC = tcc | ||
diff --git a/src/core/dwm.c b/src/core/dwm.c index cd7fdb0..6d4cdcd 100644 --- a/src/core/dwm.c +++ b/src/core/dwm.c | |||
| @@ -851,7 +851,7 @@ Atom getatomprop(Client *c, Atom prop) | |||
| 851 | return atom; | 851 | return atom; |
| 852 | } | 852 | } |
| 853 | 853 | ||
| 854 | unsigned int getsystraywidth() | 854 | unsigned int getsystraywidth(void) |
| 855 | { | 855 | { |
| 856 | unsigned int w = 0; | 856 | unsigned int w = 0; |
| 857 | Client *i; | 857 | Client *i; |
| @@ -1970,7 +1970,7 @@ void updatebarpos(Monitor *m) | |||
| 1970 | m->by = -bh; | 1970 | m->by = -bh; |
| 1971 | } | 1971 | } |
| 1972 | 1972 | ||
| 1973 | void updateclientlist() | 1973 | void updateclientlist(void) |
| 1974 | { | 1974 | { |
| 1975 | Client *c; | 1975 | Client *c; |
| 1976 | Monitor *m; | 1976 | Monitor *m; |
diff --git a/src/core/dwm.h b/src/core/dwm.h index 273645a..d3bdf5a 100644 --- a/src/core/dwm.h +++ b/src/core/dwm.h | |||
| @@ -153,7 +153,7 @@ static void focusin(XEvent *e); | |||
| 153 | static Atom getatomprop(Client *c, Atom prop); | 153 | static Atom getatomprop(Client *c, Atom prop); |
| 154 | static int getrootptr(int *x, int *y); | 154 | static int getrootptr(int *x, int *y); |
| 155 | static long getstate(Window w); | 155 | static long getstate(Window w); |
| 156 | static unsigned int getsystraywidth(); | 156 | static unsigned int getsystraywidth(void); |
| 157 | static int gettextprop(Window w, Atom atom, char *text, unsigned int size); | 157 | static int gettextprop(Window w, Atom atom, char *text, unsigned int size); |
| 158 | static void grabbuttons(Client *c, int focused); | 158 | static void grabbuttons(Client *c, int focused); |
| 159 | static void grabkeys(void); | 159 | static void grabkeys(void); |
diff --git a/src/core/globals.h b/src/core/globals.h new file mode 100644 index 0000000..4b800fe --- /dev/null +++ b/src/core/globals.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "types.h" | ||
| 5 | |||
| 6 | extern Display *dpy; | ||
| 7 | extern Window root, wmcheckwin; | ||
| 8 | |||
| 9 | extern Monitor *mons, *selmon; | ||
| 10 | |||
| 11 | extern int screen; | ||
| 12 | extern int sw, sh; | ||
| 13 | extern int bh; | ||
| 14 | extern int running; | ||
| 15 | extern unsigned int numlockmask; | ||
| 16 | |||
| 17 | extern Atom wmatom[WMLast]; | ||
| 18 | extern Atom netatom[NetLast]; | ||
| 19 | extern Atom xatom[XLast]; | ||
| 20 | |||
| 21 | extern Systray *systray; | ||
diff --git a/src/core/types.h b/src/core/types.h new file mode 100644 index 0000000..dc10fc0 --- /dev/null +++ b/src/core/types.h | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <X11/Xatom.h> | ||
| 5 | #include <X11/Xlib.h> | ||
| 6 | #include <sys/types.h> | ||
| 7 | |||
| 8 | /* cursors */ | ||
| 9 | enum { CurNormal, CurResize, CurMove, CurLast }; | ||
| 10 | |||
| 11 | /* color schemes */ | ||
| 12 | enum { SchemeNorm, SchemeSel }; | ||
| 13 | |||
| 14 | /* EWMH atoms */ | ||
| 15 | enum { | ||
| 16 | NetSupported, | ||
| 17 | NetWMName, | ||
| 18 | NetWMState, | ||
| 19 | NetWMCheck, | ||
| 20 | NetSystemTray, | ||
| 21 | NetSystemTrayOP, | ||
| 22 | NetSystemTrayOrientation, | ||
| 23 | NetSystemTrayOrientationHorz, | ||
| 24 | NetWMFullscreen, | ||
| 25 | NetActiveWindow, | ||
| 26 | NetWMWindowType, | ||
| 27 | NetWMWindowTypeDialog, | ||
| 28 | NetClientList, | ||
| 29 | NetLast | ||
| 30 | }; | ||
| 31 | |||
| 32 | /* XEmbed */ | ||
| 33 | enum { Manager, Xembed, XembedInfo, XLast }; | ||
| 34 | |||
| 35 | /* ICCCM */ | ||
| 36 | enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; | ||
| 37 | |||
| 38 | /* clicks */ | ||
| 39 | enum { | ||
| 40 | ClkTagBar, | ||
| 41 | ClkLtSymbol, | ||
| 42 | ClkStatusText, | ||
| 43 | ClkWinTitle, | ||
| 44 | ClkClientWin, | ||
| 45 | ClkRootWin, | ||
| 46 | ClkLast | ||
| 47 | }; | ||
| 48 | |||
| 49 | /* generic argument */ | ||
| 50 | typedef union { | ||
| 51 | int i; | ||
| 52 | unsigned int ui; | ||
| 53 | float f; | ||
| 54 | const void *v; | ||
| 55 | } Arg; | ||
| 56 | |||
| 57 | /* input */ | ||
| 58 | typedef struct { | ||
| 59 | unsigned int click; | ||
| 60 | unsigned int mask; | ||
| 61 | unsigned int button; | ||
| 62 | void (*func)(const Arg *arg); | ||
| 63 | const Arg arg; | ||
| 64 | } Button; | ||
| 65 | |||
| 66 | typedef struct { | ||
| 67 | unsigned int mod; | ||
| 68 | KeySym keysym; | ||
| 69 | void (*func)(const Arg *); | ||
| 70 | const Arg arg; | ||
| 71 | } Key; | ||
| 72 | |||
| 73 | /* forward decls */ | ||
| 74 | typedef struct Client Client; | ||
| 75 | typedef struct Monitor Monitor; | ||
| 76 | |||
| 77 | /* layout */ | ||
| 78 | typedef struct { | ||
| 79 | const char *symbol; | ||
| 80 | void (*arrange)(Monitor *); | ||
| 81 | } Layout; | ||
| 82 | |||
| 83 | /* client */ | ||
| 84 | struct Client { | ||
| 85 | char name[256]; | ||
| 86 | |||
| 87 | float mina, maxa; | ||
| 88 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | ||
| 89 | int hintsvalid; | ||
| 90 | |||
| 91 | int x, y, w, h; | ||
| 92 | int oldx, oldy, oldw, oldh; | ||
| 93 | int bw, oldbw; | ||
| 94 | |||
| 95 | unsigned int tags; | ||
| 96 | int isfixed, isfloating, isurgent, neverfocus; | ||
| 97 | int oldstate, isfullscreen; | ||
| 98 | int isterminal, noswallow; | ||
| 99 | |||
| 100 | pid_t pid; | ||
| 101 | |||
| 102 | Client *next; | ||
| 103 | Client *snext; | ||
| 104 | Client *swallowing; | ||
| 105 | |||
| 106 | Monitor *mon; | ||
| 107 | Window win; | ||
| 108 | }; | ||
| 109 | |||
| 110 | /* monitor */ | ||
| 111 | struct Monitor { | ||
| 112 | char ltsymbol[16]; | ||
| 113 | |||
| 114 | float mfact; | ||
| 115 | int nmaster; | ||
| 116 | int num; | ||
| 117 | |||
| 118 | int mx, my, mw, mh; | ||
| 119 | int wx, wy, ww, wh; | ||
| 120 | int by; | ||
| 121 | |||
| 122 | int gappih, gappiv; | ||
| 123 | int gappoh, gappov; | ||
| 124 | |||
| 125 | unsigned int seltags; | ||
| 126 | unsigned int sellt; | ||
| 127 | unsigned int tagset[2]; | ||
| 128 | |||
| 129 | int showbar; | ||
| 130 | int topbar; | ||
| 131 | |||
| 132 | Client *clients; | ||
| 133 | Client *sel; | ||
| 134 | Client *stack; | ||
| 135 | |||
| 136 | Monitor *next; | ||
| 137 | Window barwin; | ||
| 138 | |||
| 139 | const Layout *lt[2]; | ||
| 140 | }; | ||
| 141 | |||
| 142 | /* rules */ | ||
| 143 | typedef struct { | ||
| 144 | const char *class; | ||
| 145 | const char *instance; | ||
| 146 | const char *title; | ||
| 147 | unsigned int tags; | ||
| 148 | int isfloating; | ||
| 149 | int isterminal; | ||
| 150 | int noswallow; | ||
| 151 | int monitor; | ||
| 152 | } Rule; | ||
| 153 | |||
| 154 | /* systray */ | ||
| 155 | typedef struct Systray { | ||
| 156 | Window win; | ||
| 157 | Client *icons; | ||
| 158 | } Systray; | ||
diff --git a/src/drw/drw.c b/src/drw/drw.c index 05420c0..5e90c2c 100644 --- a/src/drw/drw.c +++ b/src/drw/drw.c | |||
| @@ -111,7 +111,7 @@ static Fnt *xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern) | |||
| 111 | /* Using the pattern found at font->xfont->pattern does not | 111 | /* Using the pattern found at font->xfont->pattern does not |
| 112 | * yield the same substitution results as using the pattern | 112 | * yield the same substitution results as using the pattern |
| 113 | * returned by FcNameParse; using the latter results in the | 113 | * returned by FcNameParse; using the latter results in the |
| 114 | * desired fallback behaviour whereas the former just results in | 114 | * desired fallback behavior whereas the former just results in |
| 115 | * missing-character rectangles being drawn, at least with some | 115 | * missing-character rectangles being drawn, at least with some |
| 116 | * fonts. */ | 116 | * fonts. */ |
| 117 | if (!(xfont = | 117 | if (!(xfont = |
diff --git a/src/drw/drw.h b/src/drw/drw.h index 88308ab..e1c91ae 100644 --- a/src/drw/drw.h +++ b/src/drw/drw.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* See LICENSE file for copyright and license details. */ | 1 | /* See LICENSE file for copyright and license details. */ |
| 2 | 2 | ||
| 3 | #include <X11/Xft/Xft.h> | ||
| 3 | typedef struct { | 4 | typedef struct { |
| 4 | Cursor cursor; | 5 | Cursor cursor; |
| 5 | } Cur; | 6 | } Cur; |
diff --git a/src/transient/transient.c b/src/transient/transient.c deleted file mode 100644 index fed0f77..0000000 --- a/src/transient/transient.c +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 1 | #include <X11/Xlib.h> | ||
| 2 | #include <X11/Xutil.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <unistd.h> | ||
| 5 | |||
| 6 | #define FLOATING_WINDOW_WIDTH 400 | ||
| 7 | #define FLOATING_WINDOW_HEIGHT 400 | ||
| 8 | #define FLOATING_WINDOW_X_POS 100 | ||
| 9 | #define FLOATING_WINDOW_Y_POS 100 | ||
| 10 | |||
| 11 | #define TRANSIENT_WINDOW_WIDTH 100 | ||
| 12 | #define TRANSIENT_WINDOW_HEIGHT 100 | ||
| 13 | #define TRANSIENT_WINDOW_X_POS 50 | ||
| 14 | #define TRANSIENT_WINDOW_Y_POS 50 | ||
| 15 | |||
| 16 | #define SLEEP_TIME 5 | ||
| 17 | |||
| 18 | #define WINDOW_BORDER_WIDTH 0 | ||
| 19 | #define WINDOW_BORDER_COLOR 0 | ||
| 20 | #define WINDOW_BACKGROUND_COLOR 0 | ||
| 21 | |||
| 22 | /** | ||
| 23 | * @brief Function that creates and manages floating and transient window. | ||
| 24 | * | ||
| 25 | * This program opens an X display, creates a floating window with specific | ||
| 26 | * size and position, and then creates a transient (child) window after a | ||
| 27 | * specified delay. The transient window is always associated with the | ||
| 28 | * floating window, meaning it will behave as a child of the floating window. | ||
| 29 | * The program uses Xlib to interact with the X server, handle events, and | ||
| 30 | * manage window properties such as size, title, and position. | ||
| 31 | * | ||
| 32 | * The key steps are: | ||
| 33 | * 1. Create the floating window and set its size constraints. | ||
| 34 | * 2. After a delay (5 seconds), create the transient window and associate | ||
| 35 | * it with the floating window. | ||
| 36 | * 3. Display both windows on the screen. | ||
| 37 | * 4. Wait for and process X events in an infinite loop. This allows the | ||
| 38 | * windows to remain open and interact with the X server. | ||
| 39 | * | ||
| 40 | * @return int Exit status (always 0). | ||
| 41 | */ | ||
| 42 | int main(void) | ||
| 43 | { | ||
| 44 | Display *display; | ||
| 45 | Window rootWindow, floatingWindow, transientWindow = None; | ||
| 46 | XSizeHints sizeHints; | ||
| 47 | XEvent event; | ||
| 48 | |||
| 49 | display = XOpenDisplay(NULL); | ||
| 50 | if (!display) | ||
| 51 | exit(1); | ||
| 52 | |||
| 53 | rootWindow = DefaultRootWindow(display); | ||
| 54 | |||
| 55 | floatingWindow = XCreateSimpleWindow( | ||
| 56 | display, rootWindow, FLOATING_WINDOW_X_POS, FLOATING_WINDOW_Y_POS, | ||
| 57 | FLOATING_WINDOW_WIDTH, FLOATING_WINDOW_HEIGHT, WINDOW_BORDER_WIDTH, | ||
| 58 | WINDOW_BORDER_COLOR, WINDOW_BACKGROUND_COLOR); | ||
| 59 | |||
| 60 | sizeHints.min_width = sizeHints.max_width = sizeHints.min_height = | ||
| 61 | sizeHints.max_height = FLOATING_WINDOW_WIDTH; | ||
| 62 | sizeHints.flags = PMinSize | PMaxSize; | ||
| 63 | XSetWMNormalHints(display, floatingWindow, &sizeHints); | ||
| 64 | XStoreName(display, floatingWindow, "floating"); | ||
| 65 | XMapWindow(display, floatingWindow); | ||
| 66 | XSelectInput(display, floatingWindow, ExposureMask); | ||
| 67 | |||
| 68 | while (1) { | ||
| 69 | XNextEvent(display, &event); | ||
| 70 | |||
| 71 | if (transientWindow == None) { | ||
| 72 | sleep(SLEEP_TIME); | ||
| 73 | |||
| 74 | transientWindow = XCreateSimpleWindow( | ||
| 75 | display, rootWindow, TRANSIENT_WINDOW_X_POS, | ||
| 76 | TRANSIENT_WINDOW_Y_POS, TRANSIENT_WINDOW_WIDTH, | ||
| 77 | TRANSIENT_WINDOW_HEIGHT, WINDOW_BORDER_WIDTH, | ||
| 78 | WINDOW_BORDER_COLOR, WINDOW_BACKGROUND_COLOR); | ||
| 79 | |||
| 80 | XSetTransientForHint(display, transientWindow, | ||
| 81 | floatingWindow); | ||
| 82 | XStoreName(display, transientWindow, "transient"); | ||
| 83 | XMapWindow(display, transientWindow); | ||
| 84 | XSelectInput(display, transientWindow, ExposureMask); | ||
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | XCloseDisplay(display); | ||
| 89 | exit(0); | ||
| 90 | } | ||
diff --git a/src/ui/bar.h b/src/ui/bar.h new file mode 100644 index 0000000..79e4912 --- /dev/null +++ b/src/ui/bar.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "../core/types.h" | ||
| 5 | |||
| 6 | void drawbar(Monitor *m); | ||
| 7 | void drawbars(void); | ||
| 8 | void updatebars(void); | ||
| 9 | void updatestatus(void); | ||
| 10 | unsigned int getsystraywidth(void); | ||
| 11 | |||
| 12 | extern char stext[256]; | ||
| 13 | extern int lrpad; | ||
diff --git a/src/ui/input.h b/src/ui/input.h new file mode 100644 index 0000000..54e3c58 --- /dev/null +++ b/src/ui/input.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "../core/types.h" | ||
| 5 | |||
| 6 | void grabkeys(void); | ||
| 7 | void grabbuttons(Client *c, int focused); | ||
| 8 | |||
| 9 | void keypress(XEvent *e); | ||
| 10 | void buttonpress(XEvent *e); | ||
| 11 | |||
| 12 | void movemouse(const Arg *arg); | ||
| 13 | void resizemouse(const Arg *arg); | ||
diff --git a/src/ui/systray.h b/src/ui/systray.h new file mode 100644 index 0000000..ad78f58 --- /dev/null +++ b/src/ui/systray.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "../core/types.h" | ||
| 5 | |||
| 6 | void updatesystray(void); | ||
| 7 | void removesystrayicon(Client *i); | ||
| 8 | void updatesystrayicongeom(Client *i, int w, int h); | ||
| 9 | void updatesystrayiconstate(Client *i, XPropertyEvent *ev); | ||
| 10 | |||
| 11 | Client *wintosystrayicon(Window w); | ||
| 12 | Monitor *systraytomon(Monitor *m); | ||
diff --git a/src/util/util.c b/src/util/util.c index 61c864c..7938f0f 100644 --- a/src/util/util.c +++ b/src/util/util.c | |||
| @@ -54,11 +54,11 @@ void die(const char *format_string, ...) | |||
| 54 | * int *array = ecalloc(10, sizeof(int)); // Allocate memory for an array of | 54 | * int *array = ecalloc(10, sizeof(int)); // Allocate memory for an array of |
| 55 | * 10 integers. | 55 | * 10 integers. |
| 56 | */ | 56 | */ |
| 57 | void *ecalloc(size_t num_elements, size_t element_size) | 57 | void *ecalloc(const size_t num_elements, const size_t element_size) |
| 58 | { | 58 | { |
| 59 | void *allocated_memory; | 59 | void *allocated_memory; |
| 60 | 60 | ||
| 61 | if (!(allocated_memory = calloc(num_elements, element_size))) | 61 | if (!((allocated_memory = calloc(num_elements, element_size)))) |
| 62 | die("calloc:"); | 62 | die("calloc:"); |
| 63 | 63 | ||
| 64 | return allocated_memory; | 64 | return allocated_memory; |
diff --git a/src/util/util.h b/src/util/util.h index 6ef3c86..2c2f773 100644 --- a/src/util/util.h +++ b/src/util/util.h | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | * Usage: | 35 | * Usage: |
| 36 | * die("Error occurred in function %s", __func__); | 36 | * die("Error occurred in function %s", __func__); |
| 37 | */ | 37 | */ |
| 38 | void die(const char *fmt, ...); | 38 | void die(const char *format_string, ...); |
| 39 | 39 | ||
| 40 | /* | 40 | /* |
| 41 | * ecalloc() | 41 | * ecalloc() |
| @@ -56,4 +56,4 @@ void die(const char *fmt, ...); | |||
| 56 | * int *arr = ecalloc(10, sizeof(int)); // Allocate memory for an array of 10 | 56 | * int *arr = ecalloc(10, sizeof(int)); // Allocate memory for an array of 10 |
| 57 | * integers. | 57 | * integers. |
| 58 | */ | 58 | */ |
| 59 | void *ecalloc(size_t nmemb, size_t size); | 59 | void *ecalloc(size_t num_elements, size_t element_size); |
diff --git a/src/wm/client.h b/src/wm/client.h new file mode 100644 index 0000000..8a2a05e --- /dev/null +++ b/src/wm/client.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "../core/types.h" | ||
| 5 | |||
| 6 | void manage(Window w, XWindowAttributes *wa); | ||
| 7 | void unmanage(Client *c, int destroyed); | ||
| 8 | |||
| 9 | void attach(Client *c); | ||
| 10 | void detach(Client *c); | ||
| 11 | void attachstack(Client *c); | ||
| 12 | void detachstack(Client *c); | ||
| 13 | |||
| 14 | void focus(Client *c); | ||
| 15 | void unfocus(Client *c, int setfocus); | ||
| 16 | |||
| 17 | void resize(Client *c, int x, int y, int w, int h, int interact); | ||
| 18 | void resizeclient(Client *c, int x, int y, int w, int h); | ||
| 19 | |||
| 20 | Client *nexttiled(Client *c); | ||
| 21 | Client *wintoclient(Window w); | ||
| 22 | |||
| 23 | /* swallow (optional) */ | ||
| 24 | Client *swallowingclient(Window w); | ||
| 25 | Client *termforwin(const Client *c); | ||
| 26 | pid_t winpid(Window w); | ||
diff --git a/src/wm/layout.h b/src/wm/layout.h new file mode 100644 index 0000000..5deab64 --- /dev/null +++ b/src/wm/layout.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "../core/types.h" | ||
| 5 | |||
| 6 | void arrange(Monitor *m); | ||
| 7 | void arrangemon(Monitor *m); | ||
| 8 | void tile(Monitor *m); | ||
| 9 | void restack(Monitor *m); | ||
| 10 | void showhide(Client *c); | ||
| 11 | void zoom(const Arg *arg); | ||
| 12 | void setlayout(const Arg *arg); | ||
diff --git a/src/wm/monitor.h b/src/wm/monitor.h new file mode 100644 index 0000000..e09935e --- /dev/null +++ b/src/wm/monitor.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "../core/types.h" | ||
| 5 | |||
| 6 | Monitor *createmon(void); | ||
| 7 | void cleanupmon(Monitor *mon); | ||
| 8 | |||
| 9 | Monitor *recttomon(int x, int y, int w, int h); | ||
| 10 | Monitor *wintomon(Window w); | ||
| 11 | void sendmon(Client *c, Monitor *m); | ||
| 12 | |||
| 13 | int updategeom(void); | ||
| 14 | void updatebarpos(Monitor *m); | ||
| 15 | void resizebarwin(Monitor *m); | ||
diff --git a/src/x11/xevents.h b/src/x11/xevents.h new file mode 100644 index 0000000..98129bb --- /dev/null +++ b/src/x11/xevents.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <X11/Xlib.h> | ||
| 5 | |||
| 6 | void run(void); | ||
| 7 | void scan(void); | ||
| 8 | |||
| 9 | void buttonpress(XEvent *e); | ||
| 10 | void keypress(XEvent *e); | ||
| 11 | void maprequest(XEvent *e); | ||
| 12 | void configurerequest(XEvent *e); | ||
| 13 | void configurenotify(XEvent *e); | ||
| 14 | void destroynotify(XEvent *e); | ||
| 15 | void unmapnotify(XEvent *e); | ||
| 16 | void clientmessage(XEvent *e); | ||
| 17 | void propertynotify(XEvent *e); | ||
| 18 | void resizerequest(XEvent *e); | ||
| 19 | void mappingnotify(XEvent *e); | ||
| 20 | void motionnotify(XEvent *e); | ||
| 21 | void enternotify(XEvent *e); | ||
| 22 | void focusin(XEvent *e); | ||
| 23 | void expose(XEvent *e); | ||
| 24 | |||
| 25 | extern void (*handler[LASTEvent])(XEvent *); | ||
diff --git a/src/x11/xutil.h b/src/x11/xutil.h new file mode 100644 index 0000000..2e044e3 --- /dev/null +++ b/src/x11/xutil.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | |||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include "../core/types.h" | ||
| 5 | |||
| 6 | void checkotherwm(void); | ||
| 7 | |||
| 8 | Atom getatomprop(Client *c, Atom prop); | ||
| 9 | int getrootptr(int *x, int *y); | ||
| 10 | long getstate(Window w); | ||
| 11 | int gettextprop(Window w, Atom atom, char *text, unsigned int size); | ||
| 12 | |||
| 13 | int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, | ||
| 14 | long d4); | ||
| 15 | |||
| 16 | void setfocus(Client *c); | ||
| 17 | void updatenumlockmask(void); | ||
| 18 | |||
| 19 | int xerror(Display *dpy, XErrorEvent *ee); | ||
| 20 | int xerrordummy(Display *dpy, XErrorEvent *ee); | ||
| 21 | int xerrorstart(Display *dpy, XErrorEvent *ee); | ||
