File: aewm.h

package info (click to toggle)
aewm 1.2.0-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 264 kB
  • ctags: 259
  • sloc: ansic: 2,017; makefile: 139; sh: 22
file content (198 lines) | stat: -rw-r--r-- 5,134 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/* aewm - a minimalist X11 window mananager. vim:noet:sw=4:ts=4
 * Copyright 1998-2001 Decklin Foster <decklin@red-bean.com>
 * This program is free software; see LICENSE for details. */

#ifndef AEWM_H
#define AEWM_H

#define VERSION "1.2.0"

#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef SHAPE
#include <X11/extensions/shape.h>
#endif
#ifdef MWM_HINTS
#include <Xm/MwmUtil.h>
#endif
#ifdef XFT
#include <X11/Xft/Xft.h>
#endif

/* Here are the default settings; they can be overriden in .aewmrc,
 * but you can also change them here at compile time. */

#ifdef XFT
#define DEF_FONT "-*-arial-medium-r-normal-*-*-80-*-*-p-*-iso8859-1"
#else
#define DEF_FONT "fixed"
#endif

#define DEF_RC   "/etc/X11/aewm/aewmrc"
#define DEF_FG   "white"
#define DEF_BG   "slategray"
#define DEF_BD   "black"
#define DEF_NEW1 "aemenu"
#define DEF_NEW2 "aemenu --switch"
#define DEF_NEW3 "x-terminal-emulator"

#define DEF_BW   1
#define DEF_PAD  3

/* A few useful masks made up out of X's basic ones. `ChildMask' is a
 * silly name, but oh well. */

#define ChildMask (SubstructureRedirectMask|SubstructureNotifyMask)
#define ButtonMask (ButtonPressMask|ButtonReleaseMask)
#define MouseMask (ButtonMask|PointerMotionMask)

/* Shorthand for wordy function calls */

#define setmouse(w, x, y) XWarpPointer(dpy, None, w, 0, 0, 0, 0, x, y)
#define ungrab() XUngrabPointer(dpy, CurrentTime)
#define grab(w, mask, curs) (XGrabPointer(dpy, w, False, mask, \
    GrabModeAsync, GrabModeAsync, None, curs, CurrentTime) == GrabSuccess)

/* I wanna know who the morons who prototyped these functions as
 * implicit int are...  */

#define lower_win(c) ((void) XLowerWindow(dpy, (c)->frame))
#define raise_win(c) ((void) XRaiseWindow(dpy, (c)->frame))

/* Border width accessor to handle hints/no hints */

#ifdef MWM_HINTS
#define BW(c) ((c)->has_border ? opt_bw : 0)
#else
#define BW(c) (opt_bw)
#endif

/* Multipliers for calling gravitate */

#define APPLY_GRAVITY 1
#define REMOVE_GRAVITY -1

/* Modes to call get_incsize with */

#define PIXELS 0
#define INCREMENTS 1

/* Modes for find_client */

#define WINDOW 0
#define FRAME 1

/* And finally modes for remove_client. */

#define WITHDRAW 0
#define REMAP 1

/* This structure keeps track of top-level windows (hereinafter
 * 'clients'). The clients we know about (i.e. all that don't set
 * override-redirect) are kept track of in linked list starting at the
 * global pointer called, appropriately, 'clients'. 
 *
 * window and parent refer to the actual client window and the larget
 * frame into which we will reparent it respectively. trans is set to
 * None for regular windows, and the window's 'owner' for a transient
 * window. Currently, we don't actually do anything with the owner for
 * transients; it's just used as a boolean.
 *
 * ignore_unmap is for our own purposes and doesn't reflect anything
 * from X. Whenever we unmap a window intentionally, we increment
 * ignore_unmap. This way our unmap event handler can tell when it
 * isn't supposed to do anything. */

typedef struct _Client Client;

struct _Client {
	Client     *next;
	char       *name;
	XSizeHints *size;
	Window     window, frame, trans;
	Colormap   cmap;
	int        x, y, width, height;
	int        ignore_unmap;
#ifdef SHAPE
	Bool       has_been_shaped;
#endif
#ifdef MWM_HINTS
	Bool       has_title, has_border;
#endif
#ifdef XFT
	XftDraw    *xftdraw;
#endif
};

/* Below here are (mainly generated with cproto) declarations and
 * prototypes for each file. */

/* main.c */
extern Display *dpy;
extern Window root;
extern int screen;
extern Client *head_client;
extern XFontStruct *font;
#ifdef XFT
extern XftFont *xftfont;
extern XftColor xft_fg;
#endif
extern GC invert_gc, string_gc, border_gc;
extern XColor fg, bg, bd;
extern Cursor move_curs, resize_curs;
extern Atom wm_state, wm_change_state, wm_protos, wm_delete, wm_cmapwins;
#ifdef GNOME_PDA
extern Atom gnome_pda;
#endif
#ifdef MWM_HINTS
extern Atom mwm_hints;
#endif
extern char *opt_new1, *opt_new2, *opt_new3;
extern int opt_bw, opt_pad;
#ifdef SHAPE
extern int shape, shape_event;
#endif

/* events.c */
extern void do_event_loop(void);

/* client.c */
extern Client *find_client(Window, int);
extern int theight(Client *);
extern void set_wm_state(Client *, int);
extern long get_wm_state(Client *);
extern void send_config(Client *);
extern void remove_client(Client *, int);
extern void redraw(Client *);
extern void gravitate(Client *, int);
#ifdef SHAPE
extern void set_shape(Client *);
#endif

/* new.c */
extern void make_new_client(Window);

/* manage.c */
extern void move(Client *);
extern void resize(Client *);
extern void hide(Client *);
extern void send_wm_delete(Client *);

/* misc.c */
void err(const char *, ...);
void fork_exec(char *);
void sig_handler(int);
int handle_xerror(Display *, XErrorEvent *);
int ignore_xerror(Display *, XErrorEvent *);
int send_xmessage(Window, Atom, long);
void get_mouse_position(int *, int *);
#ifdef DEBUG
extern void show_event(XEvent);
extern void dump(Client *);
extern void dump_clients(void);
#endif

#endif /* AEWM_H */