You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
3.1 KiB
137 lines
3.1 KiB
19 years ago
|
/*
|
||
|
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
||
|
* See LICENSE file for license details.
|
||
|
*/
|
||
|
|
||
19 years ago
|
#include <X11/Xlib.h>
|
||
19 years ago
|
|
||
19 years ago
|
/********** CUSTOMIZE **********/
|
||
19 years ago
|
|
||
19 years ago
|
#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
|
||
19 years ago
|
#define BGCOLOR "DarkSlateGrey"
|
||
|
#define FGCOLOR "LightSteelBlue"
|
||
|
#define BORDERCOLOR "SlateGray"
|
||
19 years ago
|
#define WM_PROTOCOL_DELWIN 1
|
||
|
|
||
19 years ago
|
/* tags */
|
||
|
enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast };
|
||
|
|
||
|
/********** CUSTOMIZE **********/
|
||
|
|
||
19 years ago
|
typedef struct DC DC;
|
||
19 years ago
|
typedef struct Client Client;
|
||
19 years ago
|
typedef struct Fnt Fnt;
|
||
19 years ago
|
typedef struct Key Key;
|
||
|
|
||
19 years ago
|
/* atoms */
|
||
19 years ago
|
enum { WMProtocols, WMDelete, WMLast };
|
||
19 years ago
|
enum { NetSupported, NetWMName, NetLast };
|
||
|
|
||
19 years ago
|
/* cursor */
|
||
19 years ago
|
enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
|
||
|
|
||
19 years ago
|
struct Fnt {
|
||
|
XFontStruct *xfont;
|
||
|
XFontSet set;
|
||
|
int ascent;
|
||
|
int descent;
|
||
|
int height;
|
||
|
};
|
||
|
|
||
19 years ago
|
struct DC { /* draw context */
|
||
19 years ago
|
GC gc;
|
||
|
Drawable drawable;
|
||
|
int x, y, w, h;
|
||
|
Fnt font;
|
||
|
unsigned long bg;
|
||
|
unsigned long fg;
|
||
|
unsigned long border;
|
||
|
};
|
||
|
|
||
19 years ago
|
struct Client {
|
||
19 years ago
|
char name[256];
|
||
|
char *tags[TLast];
|
||
19 years ago
|
int proto;
|
||
19 years ago
|
int x, y, w, h;
|
||
19 years ago
|
int tx, ty, tw, th;
|
||
19 years ago
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||
19 years ago
|
int grav;
|
||
|
unsigned int border;
|
||
19 years ago
|
long flags;
|
||
19 years ago
|
Window win;
|
||
|
Window trans;
|
||
|
Window title;
|
||
|
Client *next;
|
||
19 years ago
|
Client *snext;
|
||
19 years ago
|
};
|
||
|
|
||
19 years ago
|
struct Key {
|
||
|
unsigned long mod;
|
||
|
KeySym keysym;
|
||
19 years ago
|
void (*func)(void *aux);
|
||
|
void *aux;
|
||
19 years ago
|
};
|
||
|
|
||
19 years ago
|
extern Display *dpy;
|
||
19 years ago
|
extern Window root;
|
||
19 years ago
|
extern Atom wm_atom[WMLast], net_atom[NetLast];
|
||
19 years ago
|
extern Cursor cursor[CurLast];
|
||
19 years ago
|
extern Bool running, issel;
|
||
19 years ago
|
extern void (*handler[LASTEvent]) (XEvent *);
|
||
19 years ago
|
|
||
19 years ago
|
extern int tsel, screen, sx, sy, sw, sh, th;
|
||
19 years ago
|
extern char stext[1024], *tags[TLast];
|
||
19 years ago
|
|
||
19 years ago
|
extern DC dc;
|
||
19 years ago
|
extern Client *clients, *stack;
|
||
19 years ago
|
|
||
19 years ago
|
/* client.c */
|
||
19 years ago
|
extern void manage(Window w, XWindowAttributes *wa);
|
||
19 years ago
|
extern void unmanage(Client *c);
|
||
|
extern Client *getclient(Window w);
|
||
|
extern void focus(Client *c);
|
||
|
extern void update_name(Client *c);
|
||
19 years ago
|
extern void draw_client(Client *c);
|
||
19 years ago
|
extern void resize(Client *c);
|
||
19 years ago
|
extern void update_size(Client *c);
|
||
19 years ago
|
extern Client *gettitle(Window w);
|
||
19 years ago
|
extern void craise(Client *c);
|
||
19 years ago
|
extern void lower(Client *c);
|
||
19 years ago
|
extern void ckill(void *aux);
|
||
19 years ago
|
extern void sel(void *aux);
|
||
19 years ago
|
extern void max(void *aux);
|
||
19 years ago
|
extern void toggle(void *aux);
|
||
19 years ago
|
extern void gravitate(Client *c, Bool invert);
|
||
19 years ago
|
|
||
19 years ago
|
/* draw.c */
|
||
19 years ago
|
extern void draw(Bool border, const char *text);
|
||
19 years ago
|
extern unsigned long initcolor(const char *colstr);
|
||
|
extern void initfont(const char *fontstr);
|
||
|
extern unsigned int textnw(char *text, unsigned int len);
|
||
|
extern unsigned int textw(char *text);
|
||
|
extern unsigned int texth(void);
|
||
19 years ago
|
|
||
19 years ago
|
/* event.c */
|
||
19 years ago
|
extern void discard_events(long even_mask);
|
||
19 years ago
|
|
||
19 years ago
|
/* dev.c */
|
||
19 years ago
|
extern void update_keys(void);
|
||
19 years ago
|
extern void keypress(XEvent *e);
|
||
19 years ago
|
extern void mresize(Client *c);
|
||
|
extern void mmove(Client *c);
|
||
|
|
||
19 years ago
|
/* main.c */
|
||
|
extern int error_handler(Display *dsply, XErrorEvent *e);
|
||
|
extern void send_message(Window w, Atom a, long value);
|
||
|
extern int win_proto(Window w);
|
||
|
extern void quit(void *aux);
|
||
|
|
||
19 years ago
|
/* util.c */
|
||
19 years ago
|
extern void error(const char *errstr, ...);
|
||
19 years ago
|
extern void *emallocz(unsigned int size);
|
||
|
extern void *emalloc(unsigned int size);
|
||
|
extern void *erealloc(void *ptr, unsigned int size);
|
||
|
extern char *estrdup(const char *str);
|
||
19 years ago
|
extern void spawn(char *argv[]);
|
||
19 years ago
|
extern void swap(void **p1, void **p2);
|