#!/bin/sh
-cc -g -o lwm *.c -I. -I/usr/X11/include/ -L/usr/X11/lib -lX11 -lICE -lSM
+cc -Wall -Wextra -g -o lwm *.c -I. -I/usr/X11/include/ -L/usr/X11/lib -lX11 -lICE -lSM
};
extern void
-initialiseCursors(int screen) {
+initialiseCursors(void) {
XColor red, white, exact;
Colormap cmp;
int i;
- cmp = DefaultColormap(dpy, screen);
+ cmp = DefaultColormap(dpy, DefaultScreen(dpy));
XAllocNamedColor(dpy, cmp, "red", &red, &exact);
XAllocNamedColor(dpy, cmp, "white", &white, &exact);
{NoExpose, 0},
};
-/**
- * pending it the client in which an action has been started by a mouse press
- * and we are waiting for the button to be released before performing the action
- */
-static Client *pending=NULL;
-
extern void
dispatch(XEvent * ev) {
Disp * p;
buttonpress(XEvent *ev) {
Client *c;
XButtonEvent *e = &ev->xbutton;
- int quarter;
/* If we're getting it already, we're not in the market for more. */
if (mode != wm_idle) {
static void
buttonrelease(XEvent *ev) {
+ (void)ev;
mode = wm_idle;
}
c = Client_Get(e->window);
if (c == 0 || c->window != e->window) {
- int screen;
scanWindowTree();
c = Client_Get(e->window);
if (c == 0 || c->window != e->window) {
switch (c->state) {
case WithdrawnState:
if (c->parent == root) {
- manage(c, 0);
+ manage(c);
break;
}
if (c->framed == True) {
int pointer_x;
int pointer_y;
+ (void)ev;
if (mode != wm_reshaping || !current) return;
Window wroot, child;
char *argv0;
-static void initScreens(void);
-static void initScreen(int);
+static void initScreen(void);
/*ARGSUSED*/
extern int
XEvent ev;
argv0 = argv[0];
mode = wm_initialising;
+ (void)argc;
/* Open a connection to the X server. */
dpy = XOpenDisplay(NULL);
font_set_ext = XExtentsOfFontSet(font_set);
}
- initScreens();
-
+ /* Go through the screens one-by-one, initialising them. */
+ initialiseCursors();
+ initScreen();
+ scanWindowTree();
mode = wm_idle;
+
for (;;)
{
XNextEvent(dpy, &ev);
c->border = attr.border_width;
if (attr.map_state == IsViewable) {
c->internal_state = IPendingReparenting;
- manage(c, 1);
+ manage(c);
}
}
}
name = c->name;
namelen = c->namelen;
if (name == NULL) return 0;
- Xutf8TextExtents(font_set, name, namelen,
- &ink, &logical);
+ Xutf8TextExtents(font_set, name, namelen, &ink, &logical);
return logical.width;
}
static void
-initScreens(void) {
- /* Go through the screens one-by-one, initialising them. */
- initialiseCursors(0);
- initScreen(0);
- scanWindowTree();
-}
-
-static void
-initScreen(int screen) {
+initScreen(void) {
XGCValues gv;
XSetWindowAttributes attr;
XColor colour, exact;
- int len;
/* Find the root window. */
+ int screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
display_width = DisplayWidth(dpy, screen);
display_height = DisplayHeight(dpy, screen);
/* cursor.c */
extern Cursor getEdgeCursor(Edge edge);
-extern void initialiseCursors(int);
+extern void initialiseCursors(void);
/* disp.c */
extern void dispatch(XEvent *);
/* manage.c */
extern void getWindowName(Client *);
extern void getNormalHints(Client *);
-extern void manage(Client *, int);
+extern void manage(Client *);
/*ARGSUSED*/
void
-manage(Client * c, int mapped)
+manage(Client * c)
{
int state;
XWMHints * hints;
int n;
int p;
- /* Where auto-placement is going to put the next window. */
- static int auto_x = 100;
- static int auto_y = 100;
-
/* is this window to have a frame? */
c->framed = True;