JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added mouse-based resizals
[dwm.git] / wm.h
1 /*
2  * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3  * See LICENSE file for license details.
4  */
5
6 #include "config.h"
7 #include "draw.h"
8 #include "util.h"
9
10 #include <X11/Xutil.h>
11
12 #define WM_PROTOCOL_DELWIN 1
13
14 typedef struct Client Client;
15 typedef struct Key Key;
16 typedef enum Align Align;
17
18 enum Align {
19         NORTH = 0x01,
20         EAST  = 0x02,
21         SOUTH = 0x04,
22         WEST  = 0x08,
23         NEAST = NORTH | EAST,
24         NWEST = NORTH | WEST,
25         SEAST = SOUTH | EAST,
26         SWEST = SOUTH | WEST,
27         CENTER = NEAST | SWEST
28 };
29
30 /* atoms */
31 enum { WMProtocols, WMDelete, WMLast };
32 enum { NetSupported, NetWMName, NetLast };
33
34 /* cursor */
35 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
36
37 /* rects */
38 enum { RFloat, RGrid, RLast };
39
40 struct Client {
41         char name[256];
42         char tag[256];
43         unsigned int border;
44         int proto;
45         Bool fixedsize;
46         Window win;
47         Window trans;
48         Window title;
49         XSizeHints size;
50         XRectangle r[RLast];
51         Client *next;
52         Client *snext;
53 };
54
55 struct Key {
56         unsigned long mod;
57         KeySym keysym;
58         void (*func)(void *aux);
59         void *aux;
60 };
61
62 extern Display *dpy;
63 extern Window root, barwin;
64 extern Atom wm_atom[WMLast], net_atom[NetLast];
65 extern Cursor cursor[CurLast];
66 extern XRectangle rect, barrect;
67 extern Bool running, sel_screen, grid;
68 extern void (*handler[LASTEvent]) (XEvent *);
69
70 extern int screen;
71 extern char statustext[1024], tag[256];
72
73 extern Brush brush;
74 extern Client *clients, *stack;
75
76 /* bar.c */
77 extern void draw_bar();
78
79 /* cmd.c */
80 extern void run(void *aux);
81 extern void quit(void *aux);
82 extern void kill(void *aux);
83
84 /* client.c */
85 extern void manage(Window w, XWindowAttributes *wa);
86 extern void unmanage(Client *c);
87 extern Client *getclient(Window w);
88 extern void focus(Client *c);
89 extern void update_name(Client *c);
90 extern void draw_client(Client *c);
91 extern void resize(Client *c);
92
93 /* event.c */
94 extern unsigned int discard_events(long even_mask);
95
96 /* key.c */
97 extern void update_keys();
98 extern void keypress(XEvent *e);
99
100 /* mouse.c */
101 extern void mresize(Client *c);
102 extern void mmove(Client *c);
103
104 /* wm.c */
105 extern int error_handler(Display *dpy, XErrorEvent *error);
106 extern void send_message(Window w, Atom a, long value);
107 extern int win_proto(Window w);