author | Anselm R Garbe <garbeam@gmail.com> |
Mon, 18 Aug 2008 19:19:15 +0100 | |
changeset 1335 | 83da51dfedd3 |
parent 1334 | 6f9cf8bcc4a7 |
child 1336 | 6ed902a28221 |
permissions | -rw-r--r-- |
992
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
1 |
/* See LICENSE file for copyright and license details. |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
2 |
* |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
3 |
* dynamic window manager is designed like any other X client as well. It is |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
4 |
* driven through handling X events. In contrast to other X clients, a window |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
5 |
* manager selects for SubstructureRedirectMask on the root window, to receive |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
6 |
* events about window (dis-)appearance. Only one X connection at a time is |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
7 |
* allowed to select for this event mask. |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
8 |
* |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
9 |
* Calls to fetch an X event from the event queue are blocking. Due reading |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
10 |
* status text from standard input, a select()-driven main loop has been |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
11 |
* implemented which selects for reads on the X connection and STDIN_FILENO to |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
12 |
* handle all data smoothly. The event handlers of dwm are organized in an |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
13 |
* array which is accessed whenever a new event has been fetched. This allows |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
14 |
* event dispatching in O(1) time. |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
15 |
* |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
16 |
* Each child of the root window is called a client, except windows which have |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
17 |
* set the override_redirect flag. Clients are organized in a global |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
18 |
* doubly-linked client list, the focus history is remembered through a global |
1242
91e8a7fb3b60
updated the initial comment to reflect the use of bit arrays
Anselm R Garbe <garbeam@gmail.com>
parents:
1241
diff
changeset
|
19 |
* stack list. Each client contains a bit array to indicate the tags of a |
91e8a7fb3b60
updated the initial comment to reflect the use of bit arrays
Anselm R Garbe <garbeam@gmail.com>
parents:
1241
diff
changeset
|
20 |
* client. |
992
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
21 |
* |
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
22 |
* Keys and tagging rules are organized as arrays and defined in config.h. |
992
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
23 |
* |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
24 |
* To understand everything else, start reading main(). |
d9ab31906133
backporting my intro-comment of old dwm.h
Anselm R. Garbe <garbeam@gmail.com>
parents:
991
diff
changeset
|
25 |
*/ |
990 | 26 |
#include <errno.h> |
27 |
#include <stdarg.h> |
|
28 |
#include <stdio.h> |
|
29 |
#include <stdlib.h> |
|
30 |
#include <string.h> |
|
31 |
#include <unistd.h> |
|
32 |
#include <sys/select.h> |
|
1014 | 33 |
#include <sys/types.h> |
990 | 34 |
#include <sys/wait.h> |
35 |
#include <X11/cursorfont.h> |
|
36 |
#include <X11/keysym.h> |
|
37 |
#include <X11/Xatom.h> |
|
1033 | 38 |
#include <X11/Xlib.h> |
990 | 39 |
#include <X11/Xproto.h> |
40 |
#include <X11/Xutil.h> |
|
1215
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
41 |
#ifdef XINERAMA |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
42 |
#include <X11/extensions/Xinerama.h> |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
43 |
#endif |
990 | 44 |
|
45 |
/* macros */ |
|
1311
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
46 |
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
47 |
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
48 |
#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
49 |
#define ISVISIBLE(x) (x->tags & tagset[seltags]) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
50 |
#define LENGTH(x) (sizeof x / sizeof x[0]) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
51 |
#define MAX(a, b) ((a) > (b) ? (a) : (b)) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
52 |
#define MIN(a, b) ((a) < (b) ? (a) : (b)) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
53 |
#define MAXTAGLEN 16 |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
54 |
#define MOUSEMASK (BUTTONMASK|PointerMotionMask) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
55 |
#define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
56 |
#define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) |
1059
98d06be63ce5
moved LENGTH to dwm.c, moved prevtags to dwm.c
arg@suckless.org
parents:
1058
diff
changeset
|
57 |
|
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
58 |
/* enums */ |
1209
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
59 |
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
60 |
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ |
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
61 |
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
62 |
enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ |
1295
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
63 |
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, |
1281
3e478379e74d
minor fixes towards 5.0
Anselm R Garbe <garbeam@gmail.com>
parents:
1280
diff
changeset
|
64 |
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
65 |
|
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
66 |
typedef union { |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
67 |
int i; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
68 |
unsigned int ui; |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
69 |
float f; |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
70 |
void *v; |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
71 |
} Arg; |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
72 |
|
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
73 |
typedef struct { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
74 |
unsigned int click; |
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
75 |
unsigned int mask; |
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
76 |
unsigned int button; |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
77 |
void (*func)(const Arg *arg); |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
78 |
const Arg arg; |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
79 |
} Button; |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
80 |
|
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
81 |
typedef struct Client Client; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
82 |
struct Client { |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
83 |
char name[256]; |
1281
3e478379e74d
minor fixes towards 5.0
Anselm R Garbe <garbeam@gmail.com>
parents:
1280
diff
changeset
|
84 |
float mina, maxa; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
85 |
int x, y, w, h; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
86 |
int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
1229
818892d66dc4
Key.mod is uint, Client.[old]bw is int
Anselm R Garbe <garbeam@gmail.com>
parents:
1228
diff
changeset
|
87 |
int bw, oldbw; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
88 |
unsigned int tags; |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
89 |
Bool isfixed, isfloating, isurgent; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
90 |
Client *next; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
91 |
Client *snext; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
92 |
Window win; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
93 |
}; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
94 |
|
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
95 |
typedef struct { |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
96 |
int x, y, w, h; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
97 |
unsigned long norm[ColLast]; |
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
98 |
unsigned long sel[ColLast]; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
99 |
Drawable drawable; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
100 |
GC gc; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
101 |
struct { |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
102 |
int ascent; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
103 |
int descent; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
104 |
int height; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
105 |
XFontSet set; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
106 |
XFontStruct *xfont; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
107 |
} font; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
108 |
} DC; /* draw context */ |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
109 |
|
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
110 |
typedef struct { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
111 |
unsigned int mod; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
112 |
KeySym keysym; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
113 |
void (*func)(const Arg *); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
114 |
const Arg arg; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
115 |
} Key; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
116 |
|
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
117 |
typedef struct { |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
118 |
const char *symbol; |
1114 | 119 |
void (*arrange)(void); |
1187
264e671527e6
applied the proposal by nsz
Anselm R Garbe <garbeam@gmail.com>
parents:
1186
diff
changeset
|
120 |
} Layout; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
121 |
|
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
122 |
typedef struct { |
1147
def76530f636
some changes towards 4.9
Anselm R Garbe <garbeam@gmail.com>
parents:
1145
diff
changeset
|
123 |
const char *class; |
def76530f636
some changes towards 4.9
Anselm R Garbe <garbeam@gmail.com>
parents:
1145
diff
changeset
|
124 |
const char *instance; |
def76530f636
some changes towards 4.9
Anselm R Garbe <garbeam@gmail.com>
parents:
1145
diff
changeset
|
125 |
const char *title; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
126 |
unsigned int tags; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
127 |
Bool isfloating; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
128 |
} Rule; |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
129 |
|
1037 | 130 |
/* function declarations */ |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
131 |
static void applyrules(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
132 |
static void arrange(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
133 |
static void attach(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
134 |
static void attachstack(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
135 |
static void buttonpress(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
136 |
static void checkotherwm(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
137 |
static void cleanup(void); |
1309 | 138 |
static void clearurgent(void); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
139 |
static void configure(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
140 |
static void configurenotify(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
141 |
static void configurerequest(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
142 |
static void destroynotify(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
143 |
static void detach(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
144 |
static void detachstack(Client *c); |
1308 | 145 |
static void die(const char *errstr, ...); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
146 |
static void drawbar(void); |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
147 |
static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
148 |
static void drawtext(const char *text, unsigned long col[ColLast], Bool invert); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
149 |
static void enternotify(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
150 |
static void expose(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
151 |
static void focus(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
152 |
static void focusin(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
153 |
static void focusstack(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
154 |
static Client *getclient(Window w); |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
155 |
static unsigned long getcolor(const char *colstr); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
156 |
static long getstate(Window w); |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
157 |
static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
158 |
static void grabbuttons(Client *c, Bool focused); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
159 |
static void grabkeys(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
160 |
static void initfont(const char *fontstr); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
161 |
static Bool isprotodel(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
162 |
static void keypress(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
163 |
static void killclient(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
164 |
static void manage(Window w, XWindowAttributes *wa); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
165 |
static void mappingnotify(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
166 |
static void maprequest(XEvent *e); |
1289 | 167 |
static void monocle(void); |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
168 |
static void movemouse(const Arg *arg); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
169 |
static Client *nexttiled(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
170 |
static void propertynotify(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
171 |
static void quit(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
172 |
static void resize(Client *c, int x, int y, int w, int h, Bool sizehints); |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
173 |
static void resizemouse(const Arg *arg); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
174 |
static void restack(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
175 |
static void run(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
176 |
static void scan(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
177 |
static void setclientstate(Client *c, long state); |
1289 | 178 |
static void setlayout(const Arg *arg); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
179 |
static void setmfact(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
180 |
static void setup(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
181 |
static void spawn(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
182 |
static void tag(const Arg *arg); |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
183 |
static int textnw(const char *text, unsigned int len); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
184 |
static void tile(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
185 |
static void togglebar(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
186 |
static void togglefloating(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
187 |
static void toggletag(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
188 |
static void toggleview(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
189 |
static void unmanage(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
190 |
static void unmapnotify(XEvent *e); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
191 |
static void updatebar(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
192 |
static void updategeom(void); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
193 |
static void updatesizehints(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
194 |
static void updatetitle(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
195 |
static void updatewmhints(Client *c); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
196 |
static void view(const Arg *arg); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
197 |
static int xerror(Display *dpy, XErrorEvent *ee); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
198 |
static int xerrordummy(Display *dpy, XErrorEvent *ee); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
199 |
static int xerrorstart(Display *dpy, XErrorEvent *ee); |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
200 |
static void zoom(const Arg *arg); |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
201 |
|
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
202 |
/* variables */ |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
203 |
static char stext[256]; |
1323
c1d2b106440d
added some comments regarding FAQ about s{x,y,w,h}, w{x,y,w,h}, b{y,h,lw}
Anselm R Garbe <garbeam@gmail.com>
parents:
1322
diff
changeset
|
204 |
static int screen; |
1326
158c50c241b5
making a comment more explicit
Anselm R Garbe <garbeam@gmail.com>
parents:
1325
diff
changeset
|
205 |
static int sx, sy, sw, sh; /* X display screen geometry x, y, width, height */ |
1323
c1d2b106440d
added some comments regarding FAQ about s{x,y,w,h}, w{x,y,w,h}, b{y,h,lw}
Anselm R Garbe <garbeam@gmail.com>
parents:
1322
diff
changeset
|
206 |
static int by, bh, blw; /* bar geometry y, height and layout symbol width */ |
c1d2b106440d
added some comments regarding FAQ about s{x,y,w,h}, w{x,y,w,h}, b{y,h,lw}
Anselm R Garbe <garbeam@gmail.com>
parents:
1322
diff
changeset
|
207 |
static int wx, wy, ww, wh; /* window area geometry x, y, width, height, bar excluded */ |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
208 |
static unsigned int seltags = 0, sellt = 0; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
209 |
static int (*xerrorxlib)(Display *, XErrorEvent *); |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
210 |
static unsigned int numlockmask = 0; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
211 |
static void (*handler[LASTEvent]) (XEvent *) = { |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
212 |
[ButtonPress] = buttonpress, |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
213 |
[ConfigureRequest] = configurerequest, |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
214 |
[ConfigureNotify] = configurenotify, |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
215 |
[DestroyNotify] = destroynotify, |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
216 |
[EnterNotify] = enternotify, |
1067
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
217 |
[Expose] = expose, |
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
218 |
[FocusIn] = focusin, |
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
219 |
[KeyPress] = keypress, |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
220 |
[MappingNotify] = mappingnotify, |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
221 |
[MapRequest] = maprequest, |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
222 |
[PropertyNotify] = propertynotify, |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
223 |
[UnmapNotify] = unmapnotify |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
224 |
}; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
225 |
static Atom wmatom[WMLast], netatom[NetLast]; |
1317
40cd44593977
made readin a config.h variable
Anselm R Garbe <garbeam@gmail.com>
parents:
1315
diff
changeset
|
226 |
static Bool otherwm; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
227 |
static Bool running = True; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
228 |
static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */ |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
229 |
static Client *clients = NULL; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
230 |
static Client *sel = NULL; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
231 |
static Client *stack = NULL; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
232 |
static Cursor cursor[CurLast]; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
233 |
static Display *dpy; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
234 |
static DC dc = {0}; |
1290 | 235 |
static Layout *lt[] = { NULL, NULL }; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
236 |
static Window root, barwin; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
237 |
/* configuration, allows nested code to access above variables */ |
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
238 |
#include "config.h" |
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
239 |
|
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
240 |
/* compile-time check if all tags fit into an unsigned int bit array. */ |
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
241 |
struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 : 1]; }; |
1036
e6188cb17fa1
removed dwm.h, just include C-files in config.h if you extend dwm, that's simplier and most flexible than all other possibilities
arg@suckless.org
parents:
1033
diff
changeset
|
242 |
|
1037 | 243 |
/* function implementations */ |
1106
084b17f96d9b
proceeded, though we still miss a real Tag struct
anselm@anselm1
parents:
1104
diff
changeset
|
244 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
245 |
applyrules(Client *c) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
246 |
unsigned int i; |
1104 | 247 |
Rule *r; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
248 |
XClassHint ch = { 0 }; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
249 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
250 |
/* rule matching */ |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
251 |
XGetClassHint(dpy, c->win, &ch); |
1104 | 252 |
for(i = 0; i < LENGTH(rules); i++) { |
253 |
r = &rules[i]; |
|
1174
cb9dcaba37b6
applied applyrules-fix by Jukka, thank you Jukka!
Anselm R Garbe <garbeam@gmail.com>
parents:
1173
diff
changeset
|
254 |
if((!r->title || strstr(c->name, r->title)) |
1176 | 255 |
&& (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) |
256 |
&& (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { |
|
1104 | 257 |
c->isfloating = r->isfloating; |
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
258 |
c->tags |= r->tags & TAGMASK; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
259 |
} |
1104 | 260 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
261 |
if(ch.res_class) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
262 |
XFree(ch.res_class); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
263 |
if(ch.res_name) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
264 |
XFree(ch.res_name); |
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
265 |
if(!c->tags) |
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
266 |
c->tags = tagset[seltags]; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
267 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
268 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
269 |
void |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
270 |
arrange(void) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
271 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
272 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
273 |
for(c = clients; c; c = c->next) |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
274 |
if(ISVISIBLE(c)) { |
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
275 |
XMoveWindow(dpy, c->win, c->x, c->y); |
1290 | 276 |
if(!lt[sellt]->arrange || c->isfloating) |
1201
b66f5380fce3
removed Layout->isfloating
Anselm R Garbe <garbeam@gmail.com>
parents:
1200
diff
changeset
|
277 |
resize(c, c->x, c->y, c->w, c->h, True); |
1183
b20561489ffb
applied yiyus fgeom patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1182
diff
changeset
|
278 |
} |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
279 |
else { |
1235
13f86ee1a8e6
applied yiyus domax patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1234
diff
changeset
|
280 |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
13f86ee1a8e6
applied yiyus domax patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1234
diff
changeset
|
281 |
} |
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
282 |
|
1112 | 283 |
focus(NULL); |
1290 | 284 |
if(lt[sellt]->arrange) |
285 |
lt[sellt]->arrange(); |
|
1114 | 286 |
restack(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
287 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
288 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
289 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
290 |
attach(Client *c) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
291 |
c->next = clients; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
292 |
clients = c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
293 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
294 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
295 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
296 |
attachstack(Client *c) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
297 |
c->snext = stack; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
298 |
stack = c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
299 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
300 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
301 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
302 |
buttonpress(XEvent *e) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
303 |
unsigned int i, x, click; |
1295
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
304 |
Arg arg = {0}; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
305 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
306 |
XButtonPressedEvent *ev = &e->xbutton; |
990 | 307 |
|
1281
3e478379e74d
minor fixes towards 5.0
Anselm R Garbe <garbeam@gmail.com>
parents:
1280
diff
changeset
|
308 |
click = ClkRootWin; |
1114 | 309 |
if(ev->window == barwin) { |
1296
739b1baaa853
fixed Gottox' buttonpress/ClkTagBar code
Anselm R Garbe <garbeam@gmail.com>
parents:
1295
diff
changeset
|
310 |
i = x = 0; |
739b1baaa853
fixed Gottox' buttonpress/ClkTagBar code
Anselm R Garbe <garbeam@gmail.com>
parents:
1295
diff
changeset
|
311 |
do x += TEXTW(tags[i]); while(ev->x >= x && ++i < LENGTH(tags)); |
1295
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
312 |
if(i < LENGTH(tags)) { |
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
313 |
click = ClkTagBar; |
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
314 |
arg.ui = 1 << i; |
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
315 |
} |
1271
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
316 |
else if(ev->x < x + blw) |
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
317 |
click = ClkLtSymbol; |
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
318 |
else if(ev->x > wx + ww - TEXTW(stext)) |
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
319 |
click = ClkStatusText; |
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
320 |
else |
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
321 |
click = ClkWinTitle; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
322 |
} |
1281
3e478379e74d
minor fixes towards 5.0
Anselm R Garbe <garbeam@gmail.com>
parents:
1280
diff
changeset
|
323 |
else if((c = getclient(ev->window))) { |
3e478379e74d
minor fixes towards 5.0
Anselm R Garbe <garbeam@gmail.com>
parents:
1280
diff
changeset
|
324 |
focus(c); |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
325 |
click = ClkClientWin; |
1281
3e478379e74d
minor fixes towards 5.0
Anselm R Garbe <garbeam@gmail.com>
parents:
1280
diff
changeset
|
326 |
} |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
327 |
|
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
328 |
for(i = 0; i < LENGTH(buttons); i++) |
1271
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
329 |
if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button |
c5ea09e8d2fc
some bugfixes of the patch application yesterday
Anselm R Garbe <garbeam@gmail.com>
parents:
1270
diff
changeset
|
330 |
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) |
1295
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
331 |
buttons[i].func(click == ClkTagBar ? &arg : &buttons[i].arg); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
332 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
333 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
334 |
void |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
335 |
checkotherwm(void) { |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
336 |
otherwm = False; |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
337 |
XSetErrorHandler(xerrorstart); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
338 |
|
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
339 |
/* this causes an error if some other window manager is running */ |
1077 | 340 |
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask); |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
341 |
XSync(dpy, False); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
342 |
if(otherwm) |
1308 | 343 |
die("dwm: another window manager is already running\n"); |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
344 |
XSetErrorHandler(NULL); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
345 |
xerrorxlib = XSetErrorHandler(xerror); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
346 |
XSync(dpy, False); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
347 |
} |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
348 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
349 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
350 |
cleanup(void) { |
1319
fb29ceb5932a
fixes using arg->i instead of arg->ui
Premysl Hruby <dfenze@gmail.com>
parents:
1318
diff
changeset
|
351 |
Arg a = {.ui = ~0}; |
1263
87cd6583546e
using foo layout during cleanup (suggested by Gottox), add Arg->v handling for togglelayout() suggested by anydot
Anselm R Garbe <garbeam@gmail.com>
parents:
1262
diff
changeset
|
352 |
Layout foo = { "", NULL }; |
1262
decf862df839
lt will point to a foo-layout during cleanup now (Gottox' suggestion), and togglelayout respects Arg->v
Anselm R Garbe <garbeam@gmail.com>
parents:
1261
diff
changeset
|
353 |
|
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
354 |
close(STDIN_FILENO); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
355 |
view(&a); |
1290 | 356 |
lt[sellt] = &foo; |
1235
13f86ee1a8e6
applied yiyus domax patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1234
diff
changeset
|
357 |
while(stack) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
358 |
unmanage(stack); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
359 |
if(dc.font.set) |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
360 |
XFreeFontSet(dpy, dc.font.set); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
361 |
else |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
362 |
XFreeFont(dpy, dc.font.xfont); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
363 |
XUngrabKey(dpy, AnyKey, AnyModifier, root); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
364 |
XFreePixmap(dpy, dc.drawable); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
365 |
XFreeGC(dpy, dc.gc); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
366 |
XFreeCursor(dpy, cursor[CurNormal]); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
367 |
XFreeCursor(dpy, cursor[CurResize]); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
368 |
XFreeCursor(dpy, cursor[CurMove]); |
1114 | 369 |
XDestroyWindow(dpy, barwin); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
370 |
XSync(dpy, False); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
371 |
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); |
990 | 372 |
} |
373 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
374 |
void |
1309 | 375 |
clearurgent(void) { |
376 |
XWMHints *wmh; |
|
377 |
Client *c; |
|
378 |
||
379 |
for(c = clients; c; c = c->next) |
|
380 |
if(ISVISIBLE(c) && c->isurgent) { |
|
381 |
c->isurgent = False; |
|
382 |
if (!(wmh = XGetWMHints(dpy, c->win))) |
|
383 |
continue; |
|
384 |
||
385 |
wmh->flags &= ~XUrgencyHint; |
|
386 |
XSetWMHints(dpy, c->win, wmh); |
|
387 |
XFree(wmh); |
|
388 |
} |
|
389 |
} |
|
390 |
||
391 |
void |
|
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
392 |
configure(Client *c) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
393 |
XConfigureEvent ce; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
394 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
395 |
ce.type = ConfigureNotify; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
396 |
ce.display = dpy; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
397 |
ce.event = c->win; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
398 |
ce.window = c->win; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
399 |
ce.x = c->x; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
400 |
ce.y = c->y; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
401 |
ce.width = c->w; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
402 |
ce.height = c->h; |
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
403 |
ce.border_width = c->bw; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
404 |
ce.above = None; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
405 |
ce.override_redirect = False; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
406 |
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
407 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
408 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
409 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
410 |
configurenotify(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
411 |
XConfigureEvent *ev = &e->xconfigure; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
412 |
|
1155
25e7987c7b18
updated configurenotify
Anselm R Garbe <garbeam@gmail.com>
parents:
1154
diff
changeset
|
413 |
if(ev->window == root && (ev->width != sw || ev->height != sh)) { |
25e7987c7b18
updated configurenotify
Anselm R Garbe <garbeam@gmail.com>
parents:
1154
diff
changeset
|
414 |
sw = ev->width; |
25e7987c7b18
updated configurenotify
Anselm R Garbe <garbeam@gmail.com>
parents:
1154
diff
changeset
|
415 |
sh = ev->height; |
1190
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
416 |
updategeom(); |
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
417 |
updatebar(); |
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
418 |
arrange(); |
1155
25e7987c7b18
updated configurenotify
Anselm R Garbe <garbeam@gmail.com>
parents:
1154
diff
changeset
|
419 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
420 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
421 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
422 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
423 |
configurerequest(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
424 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
425 |
XConfigureRequestEvent *ev = &e->xconfigurerequest; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
426 |
XWindowChanges wc; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
427 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
428 |
if((c = getclient(ev->window))) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
429 |
if(ev->value_mask & CWBorderWidth) |
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
430 |
c->bw = ev->border_width; |
1290 | 431 |
else if(c->isfloating || !lt[sellt]->arrange) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
432 |
if(ev->value_mask & CWX) |
1114 | 433 |
c->x = sx + ev->x; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
434 |
if(ev->value_mask & CWY) |
1114 | 435 |
c->y = sy + ev->y; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
436 |
if(ev->value_mask & CWWidth) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
437 |
c->w = ev->width; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
438 |
if(ev->value_mask & CWHeight) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
439 |
c->h = ev->height; |
1114 | 440 |
if((c->x - sx + c->w) > sw && c->isfloating) |
441 |
c->x = sx + (sw / 2 - c->w / 2); /* center in x direction */ |
|
442 |
if((c->y - sy + c->h) > sh && c->isfloating) |
|
443 |
c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */ |
|
1291
6a5c4371eb25
resize should apply if !banned
Anselm R Garbe <garbeam@gmail.com>
parents:
1290
diff
changeset
|
444 |
if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight))) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
445 |
configure(c); |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
446 |
if(ISVISIBLE(c)) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
447 |
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); |
990 | 448 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
449 |
else |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
450 |
configure(c); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
451 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
452 |
else { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
453 |
wc.x = ev->x; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
454 |
wc.y = ev->y; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
455 |
wc.width = ev->width; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
456 |
wc.height = ev->height; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
457 |
wc.border_width = ev->border_width; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
458 |
wc.sibling = ev->above; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
459 |
wc.stack_mode = ev->detail; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
460 |
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); |
990 | 461 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
462 |
XSync(dpy, False); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
463 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
464 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
465 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
466 |
destroynotify(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
467 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
468 |
XDestroyWindowEvent *ev = &e->xdestroywindow; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
469 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
470 |
if((c = getclient(ev->window))) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
471 |
unmanage(c); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
472 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
473 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
474 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
475 |
detach(Client *c) { |
1307 | 476 |
Client **tc; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
477 |
|
1307 | 478 |
for(tc = &clients; *tc && *tc != c; tc = &(*tc)->next); |
479 |
*tc = c->next; |
|
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
480 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
481 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
482 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
483 |
detachstack(Client *c) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
484 |
Client **tc; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
485 |
|
1196
58a67fab8143
applied nsz's another style patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1195
diff
changeset
|
486 |
for(tc = &stack; *tc && *tc != c; tc = &(*tc)->snext); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
487 |
*tc = c->snext; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
488 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
489 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
490 |
void |
1308 | 491 |
die(const char *errstr, ...) { |
492 |
va_list ap; |
|
493 |
||
494 |
va_start(ap, errstr); |
|
495 |
vfprintf(stderr, errstr, ap); |
|
496 |
va_end(ap); |
|
497 |
exit(EXIT_FAILURE); |
|
498 |
} |
|
499 |
||
500 |
void |
|
1114 | 501 |
drawbar(void) { |
1318
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
502 |
int x; |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
503 |
unsigned int i, occ = 0, urg = 0; |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
504 |
unsigned long *col; |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
505 |
Client *c; |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
506 |
|
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
507 |
for(c = clients; c; c = c->next) { |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
508 |
occ |= c->tags; |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
509 |
if(c->isurgent) |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
510 |
urg |= c->tags; |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
511 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
512 |
|
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
513 |
dc.x = 0; |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
514 |
for(i = 0; i < LENGTH(tags); i++) { |
1236 | 515 |
dc.w = TEXTW(tags[i]); |
1318
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
516 |
col = tagset[seltags] & 1 << i ? dc.sel : dc.norm; |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
517 |
drawtext(tags[i], col, urg & 1 << i); |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
518 |
drawsquare(sel && sel->tags & 1 << i, occ & 1 << i, urg & 1 << i, col); |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
519 |
dc.x += dc.w; |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
520 |
} |
1158
7c40610de8df
geom indicator and layout indicator is only displayed if there are several geoms/layouts
Anselm R Garbe <garbeam@gmail.com>
parents:
1157
diff
changeset
|
521 |
if(blw > 0) { |
7c40610de8df
geom indicator and layout indicator is only displayed if there are several geoms/layouts
Anselm R Garbe <garbeam@gmail.com>
parents:
1157
diff
changeset
|
522 |
dc.w = blw; |
1290 | 523 |
drawtext(lt[sellt]->symbol, dc.norm, False); |
1158
7c40610de8df
geom indicator and layout indicator is only displayed if there are several geoms/layouts
Anselm R Garbe <garbeam@gmail.com>
parents:
1157
diff
changeset
|
524 |
x = dc.x + dc.w; |
7c40610de8df
geom indicator and layout indicator is only displayed if there are several geoms/layouts
Anselm R Garbe <garbeam@gmail.com>
parents:
1157
diff
changeset
|
525 |
} |
7c40610de8df
geom indicator and layout indicator is only displayed if there are several geoms/layouts
Anselm R Garbe <garbeam@gmail.com>
parents:
1157
diff
changeset
|
526 |
else |
7c40610de8df
geom indicator and layout indicator is only displayed if there are several geoms/layouts
Anselm R Garbe <garbeam@gmail.com>
parents:
1157
diff
changeset
|
527 |
x = dc.x; |
1236 | 528 |
dc.w = TEXTW(stext); |
1240
3a7c590338b3
removed bx and bw, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1239
diff
changeset
|
529 |
dc.x = ww - dc.w; |
1114 | 530 |
if(dc.x < x) { |
531 |
dc.x = x; |
|
1240
3a7c590338b3
removed bx and bw, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1239
diff
changeset
|
532 |
dc.w = ww - x; |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
533 |
} |
1114 | 534 |
drawtext(stext, dc.norm, False); |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
535 |
if((dc.w = dc.x - x) > bh) { |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
536 |
dc.x = x; |
1292
0996dbb6a999
use sel instead of seeking the list
Anselm R Garbe <garbeam@gmail.com>
parents:
1291
diff
changeset
|
537 |
if(sel) { |
0996dbb6a999
use sel instead of seeking the list
Anselm R Garbe <garbeam@gmail.com>
parents:
1291
diff
changeset
|
538 |
drawtext(sel->name, dc.sel, False); |
0996dbb6a999
use sel instead of seeking the list
Anselm R Garbe <garbeam@gmail.com>
parents:
1291
diff
changeset
|
539 |
drawsquare(sel->isfixed, sel->isfloating, False, dc.sel); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
540 |
} |
1086
dadc0b94f695
some drawbar() polishing, and certain related fixes
Anselm R Garbe <garbeam@gmail.com>
parents:
1085
diff
changeset
|
541 |
else |
1107
589074fac88d
some more changes towards a better dwm
Anselm R Garbe <garbeam@gmail.com>
parents:
1106
diff
changeset
|
542 |
drawtext(NULL, dc.norm, False); |
990 | 543 |
} |
1240
3a7c590338b3
removed bx and bw, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1239
diff
changeset
|
544 |
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, ww, bh, 0, 0); |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
545 |
XSync(dpy, False); |
990 | 546 |
} |
547 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
548 |
void |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
549 |
drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) { |
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
550 |
int x; |
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
551 |
XGCValues gcv; |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
552 |
XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
553 |
|
1085
9c4355f988f2
urgency hook handling needs also to invert the square if present
Anselm R Garbe <garbeam@gmail.com>
parents:
1084
diff
changeset
|
554 |
gcv.foreground = col[invert ? ColBG : ColFG]; |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
555 |
XChangeGC(dpy, dc.gc, GCForeground, &gcv); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
556 |
x = (dc.font.ascent + dc.font.descent + 2) / 4; |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
557 |
r.x = dc.x + 1; |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
558 |
r.y = dc.y + 1; |
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
559 |
if(filled) { |
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
560 |
r.width = r.height = x + 1; |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
561 |
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
562 |
} |
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
563 |
else if(empty) { |
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
564 |
r.width = r.height = x; |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
565 |
XDrawRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
566 |
} |
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
567 |
} |
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
568 |
|
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
569 |
void |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
570 |
drawtext(const char *text, unsigned long col[ColLast], Bool invert) { |
1332 | 571 |
char buf[256]; |
1254 | 572 |
int i, x, y, h, len, olen; |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
573 |
XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
574 |
|
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
575 |
XSetForeground(dpy, dc.gc, col[invert ? ColFG : ColBG]); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
576 |
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
577 |
if(!text) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
578 |
return; |
1182
9940d125b703
applied dfenze drawtext simplifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1179
diff
changeset
|
579 |
olen = strlen(text); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
580 |
h = dc.font.ascent + dc.font.descent; |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
581 |
y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
582 |
x = dc.x + (h / 2); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
583 |
/* shorten text if necessary */ |
1331
1ee96809e6f2
removed the i = textnw... as remarked by Martin Hurton
Anselm R Garbe <garbeam@gmail.com>
parents:
1330
diff
changeset
|
584 |
for(len = MIN(olen, sizeof buf); len && textnw(buf, len) > dc.w - h; len--); |
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
585 |
if(!len) |
1182
9940d125b703
applied dfenze drawtext simplifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1179
diff
changeset
|
586 |
return; |
1328
0fac6d3067d7
applied Martin Hurton's drawtext() patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1327
diff
changeset
|
587 |
memcpy(buf, text, len); |
1250
1fa12fca6c0e
Gottox' drawtext simplification
Anselm R Garbe <garbeam@gmail.com>
parents:
1249
diff
changeset
|
588 |
if(len < olen) |
1259
f0c900871c87
final version -- Gottox verified it using the test driver
arg@suckless.org
parents:
1258
diff
changeset
|
589 |
for(i = len; i && i > len - 3; buf[--i] = '.'); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
590 |
XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
591 |
if(dc.font.set) |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
592 |
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
593 |
else |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
594 |
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
595 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
596 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
597 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
598 |
enternotify(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
599 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
600 |
XCrossingEvent *ev = &e->xcrossing; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
601 |
|
1109
55e2f7e96b71
removed initags -- we autoselect the first tag in each view instead
anselm@anselm1
parents:
1108
diff
changeset
|
602 |
if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) |
55e2f7e96b71
removed initags -- we autoselect the first tag in each view instead
anselm@anselm1
parents:
1108
diff
changeset
|
603 |
return; |
1023
f6b71fb9ea39
reverted Peters patch to tile, I will discuss the reasons at dwm@
Anselm R. Garbe <garbeam@gmail.com>
parents:
1018
diff
changeset
|
604 |
if((c = getclient(ev->window))) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
605 |
focus(c); |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
606 |
else |
1079
ba7486659f1d
got initial Xinerama support working, though there is a lot work todo
anselm@aab
parents:
1078
diff
changeset
|
607 |
focus(NULL); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
608 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
609 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
610 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
611 |
expose(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
612 |
XExposeEvent *ev = &e->xexpose; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
613 |
|
1114 | 614 |
if(ev->count == 0 && (ev->window == barwin)) |
615 |
drawbar(); |
|
1110
227f2d07c63f
made the basics of the tagging concept working -- if people want dynamic tags, that's even possible with this concept, the vtags[] array needs to be modified during runtime for this -- the new code is quite experimental, ugly and needs polishing
anselm@anselm1
parents:
1109
diff
changeset
|
616 |
} |
227f2d07c63f
made the basics of the tagging concept working -- if people want dynamic tags, that's even possible with this concept, the vtags[] array needs to be modified during runtime for this -- the new code is quite experimental, ugly and needs polishing
anselm@anselm1
parents:
1109
diff
changeset
|
617 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
618 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
619 |
focus(Client *c) { |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
620 |
if(!c || !ISVISIBLE(c)) |
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
621 |
for(c = stack; c && !ISVISIBLE(c); c = c->snext); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
622 |
if(sel && sel != c) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
623 |
grabbuttons(sel, False); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
624 |
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
625 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
626 |
if(c) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
627 |
detachstack(c); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
628 |
attachstack(c); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
629 |
grabbuttons(c, True); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
630 |
XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
631 |
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
632 |
} |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
633 |
else |
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
634 |
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
1254 | 635 |
sel = c; |
1114 | 636 |
drawbar(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
637 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
638 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
639 |
void |
1067
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
640 |
focusin(XEvent *e) { /* there are some broken focus acquiring clients */ |
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
641 |
XFocusChangeEvent *ev = &e->xfocus; |
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
642 |
|
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
643 |
if(sel && ev->window != sel->win) |
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
644 |
XSetInputFocus(dpy, sel->win, RevertToPointerRoot, CurrentTime); |
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
645 |
} |
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
646 |
|
d6d3085307d8
fixed focus steeling bug done by clients like opera
Anselm R. Garbe <garbeam@gmail.com>
parents:
1066
diff
changeset
|
647 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
648 |
focusstack(const Arg *arg) { |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
649 |
Client *c = NULL, *i; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
650 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
651 |
if(!sel) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
652 |
return; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
653 |
if (arg->i > 0) { |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
654 |
for(c = sel->next; c && !ISVISIBLE(c); c = c->next); |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
655 |
if(!c) |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
656 |
for(c = clients; c && !ISVISIBLE(c); c = c->next); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
657 |
} |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
658 |
else { |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
659 |
for(i = clients; i != sel; i = i->next) |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
660 |
if(ISVISIBLE(i)) |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
661 |
c = i; |
1268
fc7dd1b14093
removed trailing spaces reported by Soleen
Anselm R Garbe <garbeam@gmail.com>
parents:
1267
diff
changeset
|
662 |
if(!c) |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
663 |
for(; i; i = i->next) |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
664 |
if(ISVISIBLE(i)) |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
665 |
c = i; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
666 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
667 |
if(c) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
668 |
focus(c); |
1114 | 669 |
restack(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
670 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
671 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
672 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
673 |
Client * |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
674 |
getclient(Window w) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
675 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
676 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
677 |
for(c = clients; c && c->win != w; c = c->next); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
678 |
return c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
679 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
680 |
|
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
681 |
unsigned long |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
682 |
getcolor(const char *colstr) { |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
683 |
Colormap cmap = DefaultColormap(dpy, screen); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
684 |
XColor color; |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
685 |
|
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
686 |
if(!XAllocNamedColor(dpy, cmap, colstr, &color, &color)) |
1308 | 687 |
die("error, cannot allocate color '%s'\n", colstr); |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
688 |
return color.pixel; |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
689 |
} |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
690 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
691 |
long |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
692 |
getstate(Window w) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
693 |
int format, status; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
694 |
long result = -1; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
695 |
unsigned char *p = NULL; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
696 |
unsigned long n, extra; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
697 |
Atom real; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
698 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
699 |
status = XGetWindowProperty(dpy, w, wmatom[WMState], 0L, 2L, False, wmatom[WMState], |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
700 |
&real, &format, &n, &extra, (unsigned char **)&p); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
701 |
if(status != Success) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
702 |
return -1; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
703 |
if(n != 0) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
704 |
result = *p; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
705 |
XFree(p); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
706 |
return result; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
707 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
708 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
709 |
Bool |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
710 |
gettextprop(Window w, Atom atom, char *text, unsigned int size) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
711 |
char **list = NULL; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
712 |
int n; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
713 |
XTextProperty name; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
714 |
|
1058
5e34476a3a1c
we check variable == value, and not the other way - the other way is for beginner programmers.
Anselm R. Garbe <garbeam@gmail.com>
parents:
1057
diff
changeset
|
715 |
if(!text || size == 0) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
716 |
return False; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
717 |
text[0] = '\0'; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
718 |
XGetTextProperty(dpy, w, &name, atom); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
719 |
if(!name.nitems) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
720 |
return False; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
721 |
if(name.encoding == XA_STRING) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
722 |
strncpy(text, (char *)name.value, size - 1); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
723 |
else { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
724 |
if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success |
1058
5e34476a3a1c
we check variable == value, and not the other way - the other way is for beginner programmers.
Anselm R. Garbe <garbeam@gmail.com>
parents:
1057
diff
changeset
|
725 |
&& n > 0 && *list) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
726 |
strncpy(text, *list, size - 1); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
727 |
XFreeStringList(list); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
728 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
729 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
730 |
text[size - 1] = '\0'; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
731 |
XFree(name.value); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
732 |
return True; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
733 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
734 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
735 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
736 |
grabbuttons(Client *c, Bool focused) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
737 |
unsigned int i, j; |
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
738 |
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
739 |
|
1166
bf38679903b3
applied Peter Hartlich's simplification patch of setmfact and his revival of MFACT, appliead Janness Hofmann's simplification of grabbuttons() -- thanks guys!
anselm@anselm1
parents:
1165
diff
changeset
|
740 |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
1303
01064454b311
applied Frederik Ternerot's grabbuttons patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1302
diff
changeset
|
741 |
if(focused) { |
1166
bf38679903b3
applied Peter Hartlich's simplification patch of setmfact and his revival of MFACT, appliead Janness Hofmann's simplification of grabbuttons() -- thanks guys!
anselm@anselm1
parents:
1165
diff
changeset
|
742 |
for(i = 0; i < LENGTH(buttons); i++) |
1303
01064454b311
applied Frederik Ternerot's grabbuttons patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1302
diff
changeset
|
743 |
if(buttons[i].click == ClkClientWin) |
01064454b311
applied Frederik Ternerot's grabbuttons patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1302
diff
changeset
|
744 |
for(j = 0; j < LENGTH(modifiers); j++) |
01064454b311
applied Frederik Ternerot's grabbuttons patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1302
diff
changeset
|
745 |
XGrabButton(dpy, buttons[i].button, buttons[i].mask | modifiers[j], c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); |
1318
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
746 |
} else |
1166
bf38679903b3
applied Peter Hartlich's simplification patch of setmfact and his revival of MFACT, appliead Janness Hofmann's simplification of grabbuttons() -- thanks guys!
anselm@anselm1
parents:
1165
diff
changeset
|
747 |
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, |
1303
01064454b311
applied Frederik Ternerot's grabbuttons patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1302
diff
changeset
|
748 |
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
749 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
750 |
|
1060
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
751 |
void |
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
752 |
grabkeys(void) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
753 |
unsigned int i, j; |
1318
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
754 |
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; |
1060
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
755 |
KeyCode code; |
1077 | 756 |
XModifierKeymap *modmap; |
757 |
||
758 |
/* init modifier map */ |
|
759 |
modmap = XGetModifierMapping(dpy); |
|
760 |
for(i = 0; i < 8; i++) |
|
761 |
for(j = 0; j < modmap->max_keypermod; j++) { |
|
762 |
if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) |
|
763 |
numlockmask = (1 << i); |
|
764 |
} |
|
765 |
XFreeModifiermap(modmap); |
|
1060
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
766 |
|
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
767 |
XUngrabKey(dpy, AnyKey, AnyModifier, root); |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
768 |
for(i = 0; i < LENGTH(keys); i++) { |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
769 |
code = XKeysymToKeycode(dpy, keys[i].keysym); |
1318
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
770 |
for(j = 0; j < LENGTH(modifiers); j++) |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
771 |
XGrabKey(dpy, code, keys[i].mod | modifiers[j], root, True, |
65c37b4be9cb
applied Johannes Hofmann's patch, please test
anselm@anselm1
parents:
1317
diff
changeset
|
772 |
GrabModeAsync, GrabModeAsync); |
1060
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
773 |
} |
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
774 |
} |
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
775 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
776 |
void |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
777 |
initfont(const char *fontstr) { |
990 | 778 |
char *def, **missing; |
779 |
int i, n; |
|
780 |
||
781 |
missing = NULL; |
|
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
782 |
if(dc.font.set) |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
783 |
XFreeFontSet(dpy, dc.font.set); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
784 |
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); |
990 | 785 |
if(missing) { |
786 |
while(n--) |
|
787 |
fprintf(stderr, "dwm: missing fontset: %s\n", missing[n]); |
|
788 |
XFreeStringList(missing); |
|
789 |
} |
|
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
790 |
if(dc.font.set) { |
990 | 791 |
XFontSetExtents *font_extents; |
792 |
XFontStruct **xfonts; |
|
793 |
char **font_names; |
|
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
794 |
dc.font.ascent = dc.font.descent = 0; |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
795 |
font_extents = XExtentsOfFontSet(dc.font.set); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
796 |
n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
797 |
for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { |
1178 | 798 |
dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); |
799 |
dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent); |
|
990 | 800 |
xfonts++; |
801 |
} |
|
802 |
} |
|
803 |
else { |
|
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
804 |
if(dc.font.xfont) |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
805 |
XFreeFont(dpy, dc.font.xfont); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
806 |
dc.font.xfont = NULL; |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
807 |
if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
808 |
&& !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) |
1308 | 809 |
die("error, cannot load font: '%s'\n", fontstr); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
810 |
dc.font.ascent = dc.font.xfont->ascent; |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
811 |
dc.font.descent = dc.font.xfont->descent; |
990 | 812 |
} |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
813 |
dc.font.height = dc.font.ascent + dc.font.descent; |
990 | 814 |
} |
815 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
816 |
Bool |
990 | 817 |
isprotodel(Client *c) { |
818 |
int i, n; |
|
819 |
Atom *protocols; |
|
820 |
Bool ret = False; |
|
821 |
||
822 |
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) { |
|
823 |
for(i = 0; !ret && i < n; i++) |
|
824 |
if(protocols[i] == wmatom[WMDelete]) |
|
825 |
ret = True; |
|
826 |
XFree(protocols); |
|
827 |
} |
|
828 |
return ret; |
|
829 |
} |
|
830 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
831 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
832 |
keypress(XEvent *e) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
833 |
unsigned int i; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
834 |
KeySym keysym; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
835 |
XKeyEvent *ev; |
990 | 836 |
|
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
837 |
ev = &e->xkey; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
838 |
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
1048
98fc0d3c583a
replaced Nmacros with LENGTH(x) macro
Anselm R. Garbe <garbeam@gmail.com>
parents:
1047
diff
changeset
|
839 |
for(i = 0; i < LENGTH(keys); i++) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
840 |
if(keysym == keys[i].keysym |
1241 | 841 |
&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) |
842 |
&& keys[i].func) |
|
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
843 |
keys[i].func(&(keys[i].arg)); |
990 | 844 |
} |
845 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
846 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
847 |
killclient(const Arg *arg) { |
990 | 848 |
XEvent ev; |
849 |
||
850 |
if(!sel) |
|
851 |
return; |
|
852 |
if(isprotodel(sel)) { |
|
853 |
ev.type = ClientMessage; |
|
854 |
ev.xclient.window = sel->win; |
|
855 |
ev.xclient.message_type = wmatom[WMProtocols]; |
|
856 |
ev.xclient.format = 32; |
|
857 |
ev.xclient.data.l[0] = wmatom[WMDelete]; |
|
858 |
ev.xclient.data.l[1] = CurrentTime; |
|
859 |
XSendEvent(dpy, sel->win, False, NoEventMask, &ev); |
|
860 |
} |
|
861 |
else |
|
862 |
XKillClient(dpy, sel->win); |
|
863 |
} |
|
864 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
865 |
void |
990 | 866 |
manage(Window w, XWindowAttributes *wa) { |
867 |
Client *c, *t = NULL; |
|
1333
5be4e277ed7c
using None instead of 0 for trans
Anselm R Garbe <garbeam@gmail.com>
parents:
1332
diff
changeset
|
868 |
Window trans = None; |
990 | 869 |
XWindowChanges wc; |
870 |
||
1233 | 871 |
if(!(c = calloc(1, sizeof(Client)))) |
1308 | 872 |
die("fatal: could not calloc() %u bytes\n", sizeof(Client)); |
990 | 873 |
c->win = w; |
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
874 |
|
1129
43d862bda73e
implemented setlayout in the way proposed on the ml, split tile() into two functions, a third will follow soon
Anselm R Garbe <garbeam@gmail.com>
parents:
1128
diff
changeset
|
875 |
/* geometry */ |
43d862bda73e
implemented setlayout in the way proposed on the ml, split tile() into two functions, a third will follow soon
Anselm R Garbe <garbeam@gmail.com>
parents:
1128
diff
changeset
|
876 |
c->x = wa->x; |
43d862bda73e
implemented setlayout in the way proposed on the ml, split tile() into two functions, a third will follow soon
Anselm R Garbe <garbeam@gmail.com>
parents:
1128
diff
changeset
|
877 |
c->y = wa->y; |
1201
b66f5380fce3
removed Layout->isfloating
Anselm R Garbe <garbeam@gmail.com>
parents:
1200
diff
changeset
|
878 |
c->w = wa->width; |
b66f5380fce3
removed Layout->isfloating
Anselm R Garbe <garbeam@gmail.com>
parents:
1200
diff
changeset
|
879 |
c->h = wa->height; |
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
880 |
c->oldbw = wa->border_width; |
1114 | 881 |
if(c->w == sw && c->h == sh) { |
882 |
c->x = sx; |
|
883 |
c->y = sy; |
|
1315
ce355cea9bb8
forcing fullscreen windows to bw=0, though most fullscreen apps are broken anyways
Anselm R Garbe <garbeam@gmail.com>
parents:
1314
diff
changeset
|
884 |
c->bw = 0; |
990 | 885 |
} |
886 |
else { |
|
1218
0f2bce9f15a5
be more polite to clients which like to appear outside the window area, but still on the screen
Anselm R Garbe <garbeam@gmail.com>
parents:
1216
diff
changeset
|
887 |
if(c->x + c->w + 2 * c->bw > sx + sw) |
0f2bce9f15a5
be more polite to clients which like to appear outside the window area, but still on the screen
Anselm R Garbe <garbeam@gmail.com>
parents:
1216
diff
changeset
|
888 |
c->x = sx + sw - c->w - 2 * c->bw; |
0f2bce9f15a5
be more polite to clients which like to appear outside the window area, but still on the screen
Anselm R Garbe <garbeam@gmail.com>
parents:
1216
diff
changeset
|
889 |
if(c->y + c->h + 2 * c->bw > sy + sh) |
0f2bce9f15a5
be more polite to clients which like to appear outside the window area, but still on the screen
Anselm R Garbe <garbeam@gmail.com>
parents:
1216
diff
changeset
|
890 |
c->y = sy + sh - c->h - 2 * c->bw; |
0f2bce9f15a5
be more polite to clients which like to appear outside the window area, but still on the screen
Anselm R Garbe <garbeam@gmail.com>
parents:
1216
diff
changeset
|
891 |
c->x = MAX(c->x, sx); |
1284
14929bfb8738
restored y-coordinate fixing of client windows
Anselm R Garbe <garbeam@gmail.com>
parents:
1281
diff
changeset
|
892 |
/* only fix client y-offset, if the client center might cover the bar */ |
14929bfb8738
restored y-coordinate fixing of client windows
Anselm R Garbe <garbeam@gmail.com>
parents:
1281
diff
changeset
|
893 |
c->y = MAX(c->y, ((by == 0) && (c->x + (c->w / 2) >= wx) && (c->x + (c->w / 2) < wx + ww)) ? bh : sy); |
1209
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
894 |
c->bw = borderpx; |
990 | 895 |
} |
1129
43d862bda73e
implemented setlayout in the way proposed on the ml, split tile() into two functions, a third will follow soon
Anselm R Garbe <garbeam@gmail.com>
parents:
1128
diff
changeset
|
896 |
|
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
897 |
wc.border_width = c->bw; |
990 | 898 |
XConfigureWindow(dpy, w, CWBorderWidth, &wc); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
899 |
XSetWindowBorder(dpy, w, dc.norm[ColBorder]); |
990 | 900 |
configure(c); /* propagates border_width, if size doesn't change */ |
901 |
updatesizehints(c); |
|
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
902 |
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); |
990 | 903 |
grabbuttons(c, False); |
904 |
updatetitle(c); |
|
1321
bca7a556aa03
fix of XGetTransientForHint in manage()
Premysl Hruby <dfenze@gmail.com>
parents:
1320
diff
changeset
|
905 |
if(XGetTransientForHint(dpy, w, &trans)) |
1320
a63cb246f35c
applied cleanup from M. Hurton and S. Nagy
Premysl Hruby <dfenze@gmail.com>
parents:
1319
diff
changeset
|
906 |
t = getclient(trans); |
990 | 907 |
if(t) |
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
908 |
c->tags = t->tags; |
1115 | 909 |
else |
910 |
applyrules(c); |
|
990 | 911 |
if(!c->isfloating) |
1333
5be4e277ed7c
using None instead of 0 for trans
Anselm R Garbe <garbeam@gmail.com>
parents:
1332
diff
changeset
|
912 |
c->isfloating = trans != None || c->isfixed; |
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
913 |
if(c->isfloating) |
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
914 |
XRaiseWindow(dpy, c->win); |
990 | 915 |
attach(c); |
916 |
attachstack(c); |
|
1297
20481c9d647c
does this fix anything?
Anselm R Garbe <garbeam@gmail.com>
parents:
1295
diff
changeset
|
917 |
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ |
990 | 918 |
XMapWindow(dpy, c->win); |
919 |
setclientstate(c, NormalState); |
|
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
920 |
arrange(); |
990 | 921 |
} |
922 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
923 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
924 |
mappingnotify(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
925 |
XMappingEvent *ev = &e->xmapping; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
926 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
927 |
XRefreshKeyboardMapping(ev); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
928 |
if(ev->request == MappingKeyboard) |
1060
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
929 |
grabkeys(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
930 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
931 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
932 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
933 |
maprequest(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
934 |
static XWindowAttributes wa; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
935 |
XMapRequestEvent *ev = &e->xmaprequest; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
936 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
937 |
if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
938 |
return; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
939 |
if(wa.override_redirect) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
940 |
return; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
941 |
if(!getclient(ev->window)) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
942 |
manage(ev->window, &wa); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
943 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
944 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
945 |
void |
1289 | 946 |
monocle(void) { |
947 |
Client *c; |
|
948 |
||
949 |
for(c = nexttiled(clients); c; c = nexttiled(c->next)) |
|
1299 | 950 |
resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints); |
1289 | 951 |
} |
952 |
||
953 |
void |
|
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
954 |
movemouse(const Arg *arg) { |
1311
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
955 |
int x, y, ocx, ocy, di, nx, ny; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
956 |
unsigned int dui; |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
957 |
Client *c; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
958 |
Window dummy; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
959 |
XEvent ev; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
960 |
|
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
961 |
if(!(c = sel)) |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
962 |
return; |
1235
13f86ee1a8e6
applied yiyus domax patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1234
diff
changeset
|
963 |
restack(); |
1334
6f9cf8bcc4a7
applied Martin Hurton's movemouse() patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1333
diff
changeset
|
964 |
ocx = c->x; |
6f9cf8bcc4a7
applied Martin Hurton's movemouse() patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1333
diff
changeset
|
965 |
ocy = c->y; |
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
966 |
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
967 |
None, cursor[CurMove], CurrentTime) != GrabSuccess) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
968 |
return; |
1311
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
969 |
XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui); |
1334
6f9cf8bcc4a7
applied Martin Hurton's movemouse() patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1333
diff
changeset
|
970 |
do { |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
971 |
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
972 |
switch (ev.type) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
973 |
case ConfigureRequest: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
974 |
case Expose: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
975 |
case MapRequest: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
976 |
handler[ev.type](&ev); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
977 |
break; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
978 |
case MotionNotify: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
979 |
XSync(dpy, False); |
1311
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
980 |
nx = ocx + (ev.xmotion.x - x); |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
981 |
ny = ocy + (ev.xmotion.y - y); |
1213
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
982 |
if(snap && nx >= wx && nx <= wx + ww |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
983 |
&& ny >= wy && ny <= wy + wh) { |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
984 |
if(abs(wx - nx) < snap) |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
985 |
nx = wx; |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
986 |
else if(abs((wx + ww) - (nx + c->w + 2 * c->bw)) < snap) |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
987 |
nx = wx + ww - c->w - 2 * c->bw; |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
988 |
if(abs(wy - ny) < snap) |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
989 |
ny = wy; |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
990 |
else if(abs((wy + wh) - (ny + c->h + 2 * c->bw)) < snap) |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
991 |
ny = wy + wh - c->h - 2 * c->bw; |
1290 | 992 |
if(!c->isfloating && lt[sellt]->arrange && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) |
1213
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
993 |
togglefloating(NULL); |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
994 |
} |
1290 | 995 |
if(!lt[sellt]->arrange || c->isfloating) |
1081
2345b08ec46b
applied dwm-4.8-snaptileds.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1080
diff
changeset
|
996 |
resize(c, nx, ny, c->w, c->h, False); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
997 |
break; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
998 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
999 |
} |
1334
6f9cf8bcc4a7
applied Martin Hurton's movemouse() patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1333
diff
changeset
|
1000 |
while(ev.type != ButtonRelease); |
6f9cf8bcc4a7
applied Martin Hurton's movemouse() patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1333
diff
changeset
|
1001 |
XUngrabPointer(dpy, CurrentTime); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1002 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1003 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1004 |
Client * |
1227
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1005 |
nexttiled(Client *c) { |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
1006 |
for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1007 |
return c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1008 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1009 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1010 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1011 |
propertynotify(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1012 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1013 |
Window trans; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1014 |
XPropertyEvent *ev = &e->xproperty; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1015 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1016 |
if(ev->state == PropertyDelete) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1017 |
return; /* ignore */ |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1018 |
if((c = getclient(ev->window))) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1019 |
switch (ev->atom) { |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1020 |
default: break; |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1021 |
case XA_WM_TRANSIENT_FOR: |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1022 |
XGetTransientForHint(dpy, c->win, &trans); |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1023 |
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL))) |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1024 |
arrange(); |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1025 |
break; |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1026 |
case XA_WM_NORMAL_HINTS: |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1027 |
updatesizehints(c); |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1028 |
break; |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1029 |
case XA_WM_HINTS: |
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1030 |
updatewmhints(c); |
1114 | 1031 |
drawbar(); |
1093
5170cc8c078e
made restack, drawbar also Monitor-related only
Anselm R Garbe <garbeam@gmail.com>
parents:
1092
diff
changeset
|
1032 |
break; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1033 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1034 |
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1035 |
updatetitle(c); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1036 |
if(c == sel) |
1114 | 1037 |
drawbar(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1038 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1039 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1040 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1041 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1042 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1043 |
quit(const Arg *arg) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1044 |
readin = running = False; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1045 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1046 |
|
1070
dc37f0e022f7
implemented reapply for re-applying the tagging rules during runtime, Mod-r
Anselm R. Garbe <garbeam@gmail.com>
parents:
1067
diff
changeset
|
1047 |
void |
990 | 1048 |
resize(Client *c, int x, int y, int w, int h, Bool sizehints) { |
1024
17a935c3017f
removed two spaces reported by Soleen
Anselm R. Garbe <garbeam@gmail.com>
parents:
1023
diff
changeset
|
1049 |
XWindowChanges wc; |
1090
09f1bf0e12ee
resize handles offscreen issues
Anselm R Garbe <garbeam@gmail.com>
parents:
1089
diff
changeset
|
1050 |
|
990 | 1051 |
if(sizehints) { |
1032
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1052 |
/* set minimum possible */ |
1178 | 1053 |
w = MAX(1, w); |
1054 |
h = MAX(1, h); |
|
1032
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1055 |
|
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1056 |
/* temporarily remove base dimensions */ |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1057 |
w -= c->basew; |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1058 |
h -= c->baseh; |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1059 |
|
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1060 |
/* adjust for aspect limits */ |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1061 |
if(c->mina > 0 && c->maxa > 0) { |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1062 |
if(c->maxa < (float) w/h) |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1063 |
w = h * c->maxa; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1064 |
else if(c->mina > (float) h/w) |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1065 |
h = w * c->mina; |
990 | 1066 |
} |
1032
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1067 |
|
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1068 |
/* adjust for increment value */ |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1069 |
if(c->incw) |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1070 |
w -= w % c->incw; |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1071 |
if(c->inch) |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1072 |
h -= h % c->inch; |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1073 |
|
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1074 |
/* restore base dimensions */ |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1075 |
w += c->basew; |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1076 |
h += c->baseh; |
08bc44d1f985
applied Eric Mertens patch to mainstream dwm, however this needs testing
Anselm R. Garbe <garbeam@gmail.com>
parents:
1031
diff
changeset
|
1077 |
|
1178 | 1078 |
w = MAX(w, c->minw); |
1079 |
h = MAX(h, c->minh); |
|
1285
226e616bc123
tiled layout resizehints should be respected by default
Anselm R Garbe <garbeam@gmail.com>
parents:
1284
diff
changeset
|
1080 |
|
226e616bc123
tiled layout resizehints should be respected by default
Anselm R Garbe <garbeam@gmail.com>
parents:
1284
diff
changeset
|
1081 |
if(c->maxw) |
1178 | 1082 |
w = MIN(w, c->maxw); |
1083 |
||
1285
226e616bc123
tiled layout resizehints should be respected by default
Anselm R Garbe <garbeam@gmail.com>
parents:
1284
diff
changeset
|
1084 |
if(c->maxh) |
1178 | 1085 |
h = MIN(h, c->maxh); |
990 | 1086 |
} |
1087 |
if(w <= 0 || h <= 0) |
|
1088 |
return; |
|
1114 | 1089 |
if(x > sx + sw) |
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
1090 |
x = sw - w - 2 * c->bw; |
1114 | 1091 |
if(y > sy + sh) |
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
1092 |
y = sh - h - 2 * c->bw; |
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
1093 |
if(x + w + 2 * c->bw < sx) |
1114 | 1094 |
x = sx; |
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
1095 |
if(y + h + 2 * c->bw < sy) |
1114 | 1096 |
y = sy; |
1238 | 1097 |
if(h < bh) |
1098 |
h = bh; |
|
1099 |
if(w < bh) |
|
1100 |
w = bh; |
|
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
1101 |
if(c->x != x || c->y != y || c->w != w || c->h != h) { |
990 | 1102 |
c->x = wc.x = x; |
1103 |
c->y = wc.y = y; |
|
1104 |
c->w = wc.width = w; |
|
1105 |
c->h = wc.height = h; |
|
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
1106 |
wc.border_width = c->bw; |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1107 |
XConfigureWindow(dpy, c->win, |
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1108 |
CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); |
990 | 1109 |
configure(c); |
1110 |
XSync(dpy, False); |
|
1111 |
} |
|
1112 |
} |
|
1113 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1114 |
void |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
1115 |
resizemouse(const Arg *arg) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1116 |
int ocx, ocy; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1117 |
int nw, nh; |
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
1118 |
Client *c; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1119 |
XEvent ev; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1120 |
|
1270
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
1121 |
if(!(c = sel)) |
262ee84a2fdb
integrated yiyus mouse.diff (though the bar click handling is slightly broken, I'm to tired to debug it now, yiyus could you please?)
Anselm R Garbe <garbeam@gmail.com>
parents:
1269
diff
changeset
|
1122 |
return; |
1235
13f86ee1a8e6
applied yiyus domax patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1234
diff
changeset
|
1123 |
restack(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1124 |
ocx = c->x; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1125 |
ocy = c->y; |
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1126 |
if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
1127 |
None, cursor[CurResize], CurrentTime) != GrabSuccess) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1128 |
return; |
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
1129 |
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); |
1335
83da51dfedd3
applied Martin Hurtons resizemouse patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1334
diff
changeset
|
1130 |
do { |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1131 |
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask , &ev); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1132 |
switch(ev.type) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1133 |
case ConfigureRequest: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1134 |
case Expose: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1135 |
case MapRequest: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1136 |
handler[ev.type](&ev); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1137 |
break; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1138 |
case MotionNotify: |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1139 |
XSync(dpy, False); |
1178 | 1140 |
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); |
1141 |
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); |
|
1213
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
1142 |
|
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
1143 |
if(snap && nw >= wx && nw <= wx + ww |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
1144 |
&& nh >= wy && nh <= wy + wh) { |
1290 | 1145 |
if(!c->isfloating && lt[sellt]->arrange |
1213
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
1146 |
&& (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) |
368a80dcf5bd
only snap within window area
Anselm R Garbe <garbeam@gmail.com>
parents:
1212
diff
changeset
|
1147 |
togglefloating(NULL); |
1183
b20561489ffb
applied yiyus fgeom patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1182
diff
changeset
|
1148 |
} |
1290 | 1149 |
if(!lt[sellt]->arrange || c->isfloating) |
1081
2345b08ec46b
applied dwm-4.8-snaptileds.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1080
diff
changeset
|
1150 |
resize(c, c->x, c->y, nw, nh, True); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1151 |
break; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1152 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1153 |
} |
1335
83da51dfedd3
applied Martin Hurtons resizemouse patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1334
diff
changeset
|
1154 |
while(ev.type != ButtonRelease); |
83da51dfedd3
applied Martin Hurtons resizemouse patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1334
diff
changeset
|
1155 |
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1); |
83da51dfedd3
applied Martin Hurtons resizemouse patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1334
diff
changeset
|
1156 |
XUngrabPointer(dpy, CurrentTime); |
83da51dfedd3
applied Martin Hurtons resizemouse patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1334
diff
changeset
|
1157 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1158 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1159 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1160 |
void |
1114 | 1161 |
restack(void) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1162 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1163 |
XEvent ev; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1164 |
XWindowChanges wc; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1165 |
|
1114 | 1166 |
drawbar(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1167 |
if(!sel) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1168 |
return; |
1290 | 1169 |
if(sel->isfloating || !lt[sellt]->arrange) |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1170 |
XRaiseWindow(dpy, sel->win); |
1290 | 1171 |
if(lt[sellt]->arrange) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1172 |
wc.stack_mode = Below; |
1114 | 1173 |
wc.sibling = barwin; |
1183
b20561489ffb
applied yiyus fgeom patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1182
diff
changeset
|
1174 |
for(c = stack; c; c = c->snext) |
1294
ef082062dccc
made arrange again like it was once
Anselm R Garbe <garbeam@gmail.com>
parents:
1293
diff
changeset
|
1175 |
if(!c->isfloating && ISVISIBLE(c)) { |
1183
b20561489ffb
applied yiyus fgeom patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1182
diff
changeset
|
1176 |
XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); |
b20561489ffb
applied yiyus fgeom patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1182
diff
changeset
|
1177 |
wc.sibling = c->win; |
b20561489ffb
applied yiyus fgeom patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1182
diff
changeset
|
1178 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1179 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1180 |
XSync(dpy, False); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1181 |
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1182 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1183 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1184 |
void |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1185 |
run(void) { |
1054
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1186 |
char *p; |
1104 | 1187 |
char sbuf[sizeof stext]; |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1188 |
fd_set rd; |
1054
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1189 |
int r, xfd; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
1190 |
unsigned int len, offset; |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1191 |
XEvent ev; |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1192 |
|
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1193 |
/* main event loop, also reads status text from stdin */ |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1194 |
XSync(dpy, False); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1195 |
xfd = ConnectionNumber(dpy); |
1054
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1196 |
offset = 0; |
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1197 |
len = sizeof stext - 1; |
1104 | 1198 |
sbuf[len] = stext[len] = '\0'; /* 0-terminator is never touched */ |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1199 |
while(running) { |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1200 |
FD_ZERO(&rd); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1201 |
if(readin) |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1202 |
FD_SET(STDIN_FILENO, &rd); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1203 |
FD_SET(xfd, &rd); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1204 |
if(select(xfd + 1, &rd, NULL, NULL, NULL) == -1) { |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1205 |
if(errno == EINTR) |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1206 |
continue; |
1308 | 1207 |
die("select failed\n"); |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1208 |
} |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1209 |
if(FD_ISSET(STDIN_FILENO, &rd)) { |
1104 | 1210 |
switch((r = read(STDIN_FILENO, sbuf + offset, len - offset))) { |
1054
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1211 |
case -1: |
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1212 |
strncpy(stext, strerror(errno), len); |
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1213 |
readin = False; |
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1214 |
break; |
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1215 |
case 0: |
1053 | 1216 |
strncpy(stext, "EOF", 4); |
1054
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1217 |
readin = False; |
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1218 |
break; |
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1219 |
default: |
1104 | 1220 |
for(p = sbuf + offset; r > 0; p++, r--, offset++) |
1062
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1221 |
if(*p == '\n' || *p == '\0') { |
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1222 |
*p = '\0'; |
1104 | 1223 |
strncpy(stext, sbuf, len); |
1224 |
p += r - 1; /* p is sbuf + offset + r - 1 */ |
|
1062
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1225 |
for(r = 0; *(p - r) && *(p - r) != '\n'; r++); |
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1226 |
offset = r; |
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1227 |
if(r) |
1104 | 1228 |
memmove(sbuf, p - r + 1, r); |
1062
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1229 |
break; |
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1230 |
} |
767e76426fda
applied Ritesh's patch to stext handling with some minor modifications
Anselm R. Garbe <garbeam@gmail.com>
parents:
1061
diff
changeset
|
1231 |
break; |
1054
28813060c35f
removed fgets usage, increment offset until a line is read, dwm will drop all lines read in one call, except the first!!! one (previously it preferred the last) - but the current approach is simplier and works better for general purpose in conjunction with the offset handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
1053
diff
changeset
|
1232 |
} |
1114 | 1233 |
drawbar(); |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1234 |
} |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1235 |
while(XPending(dpy)) { |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1236 |
XNextEvent(dpy, &ev); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1237 |
if(handler[ev.type]) |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1238 |
(handler[ev.type])(&ev); /* call handler */ |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1239 |
} |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1240 |
} |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1241 |
} |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1242 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1243 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1244 |
scan(void) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
1245 |
unsigned int i, num; |
1330
06677766e7aa
applied Martin Hurton's scan() patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1329
diff
changeset
|
1246 |
Window d1, d2, *wins = NULL; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1247 |
XWindowAttributes wa; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1248 |
|
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1249 |
if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1250 |
for(i = 0; i < num; i++) { |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1251 |
if(!XGetWindowAttributes(dpy, wins[i], &wa) |
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
1252 |
|| wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) |
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1253 |
continue; |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1254 |
if(wa.map_state == IsViewable || getstate(wins[i]) == IconicState) |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1255 |
manage(wins[i], &wa); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1256 |
} |
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1257 |
for(i = 0; i < num; i++) { /* now the transients */ |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1258 |
if(!XGetWindowAttributes(dpy, wins[i], &wa)) |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1259 |
continue; |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1260 |
if(XGetTransientForHint(dpy, wins[i], &d1) |
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
1261 |
&& (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)) |
1087
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1262 |
manage(wins[i], &wa); |
197bfedb953c
removed Monitor->root, since we do not support classical multihead
Anselm R Garbe <garbeam@gmail.com>
parents:
1086
diff
changeset
|
1263 |
} |
1330
06677766e7aa
applied Martin Hurton's scan() patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1329
diff
changeset
|
1264 |
if(wins) |
06677766e7aa
applied Martin Hurton's scan() patch with slight modifications
Anselm R Garbe <garbeam@gmail.com>
parents:
1329
diff
changeset
|
1265 |
XFree(wins); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1266 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1267 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1268 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1269 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1270 |
setclientstate(Client *c, long state) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1271 |
long data[] = {state, None}; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1272 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1273 |
XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32, |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1274 |
PropModeReplace, (unsigned char *)data, 2); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1275 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1276 |
|
1289 | 1277 |
void |
1278 |
setlayout(const Arg *arg) { |
|
1295
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
1279 |
if(!arg || !arg->v || arg->v != lt[sellt]) |
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
1280 |
sellt ^= 1; |
9f20458e3bbc
applied Gottox' ClkTagBar patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1294
diff
changeset
|
1281 |
if(arg && arg->v) |
1290 | 1282 |
lt[sellt] = (Layout *)arg->v; |
1289 | 1283 |
if(sel) |
1284 |
arrange(); |
|
1285 |
else |
|
1286 |
drawbar(); |
|
1287 |
} |
|
1288 |
||
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
1289 |
/* arg > 1.0 will set mfact absolutly */ |
1160
bf37ef388dd6
revival of mfact and setmfact
Anselm R Garbe <garbeam@gmail.com>
parents:
1159
diff
changeset
|
1290 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1291 |
setmfact(const Arg *arg) { |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1292 |
float f; |
1220 | 1293 |
|
1290 | 1294 |
if(!arg || !lt[sellt]->arrange) |
1220 | 1295 |
return; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1296 |
f = arg->f < 1.0 ? arg->f + mfact : arg->f - 1.0; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1297 |
if(f < 0.1 || f > 0.9) |
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
1298 |
return; |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1299 |
mfact = f; |
1220 | 1300 |
arrange(); |
1301 |
} |
|
1302 |
||
1303 |
void |
|
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1304 |
setup(void) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
1305 |
unsigned int i; |
1257 | 1306 |
int w; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1307 |
XSetWindowAttributes wa; |
1114 | 1308 |
|
1309 |
/* init screen */ |
|
1310 |
screen = DefaultScreen(dpy); |
|
1311 |
root = RootWindow(dpy, screen); |
|
1275
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1312 |
initfont(font); |
1148
d49ff154375f
some experimental state DO NOT USE THIS, I plan to have a nicer interface to change geometries
Anselm R Garbe <garbeam@gmail.com>
parents:
1147
diff
changeset
|
1313 |
sx = 0; |
d49ff154375f
some experimental state DO NOT USE THIS, I plan to have a nicer interface to change geometries
Anselm R Garbe <garbeam@gmail.com>
parents:
1147
diff
changeset
|
1314 |
sy = 0; |
d49ff154375f
some experimental state DO NOT USE THIS, I plan to have a nicer interface to change geometries
Anselm R Garbe <garbeam@gmail.com>
parents:
1147
diff
changeset
|
1315 |
sw = DisplayWidth(dpy, screen); |
d49ff154375f
some experimental state DO NOT USE THIS, I plan to have a nicer interface to change geometries
Anselm R Garbe <garbeam@gmail.com>
parents:
1147
diff
changeset
|
1316 |
sh = DisplayHeight(dpy, screen); |
1275
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1317 |
bh = dc.h = dc.font.height + 2; |
1290 | 1318 |
lt[0] = &layouts[0]; |
1319 |
lt[1] = &layouts[1 % LENGTH(layouts)]; |
|
1190
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1320 |
updategeom(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1321 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1322 |
/* init atoms */ |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1323 |
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1324 |
wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1325 |
wmatom[WMName] = XInternAtom(dpy, "WM_NAME", False); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1326 |
wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1327 |
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1328 |
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1329 |
|
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1330 |
/* init cursors */ |
1077 | 1331 |
wa.cursor = cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1332 |
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1333 |
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); |
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1334 |
|
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1335 |
/* init appearance */ |
1275
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1336 |
dc.norm[ColBorder] = getcolor(normbordercolor); |
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1337 |
dc.norm[ColBG] = getcolor(normbgcolor); |
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1338 |
dc.norm[ColFG] = getcolor(normfgcolor); |
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1339 |
dc.sel[ColBorder] = getcolor(selbordercolor); |
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1340 |
dc.sel[ColBG] = getcolor(selbgcolor); |
e121660425a0
removed font and color definitions
Anselm R Garbe <garbeam@gmail.com>
parents:
1273
diff
changeset
|
1341 |
dc.sel[ColFG] = getcolor(selfgcolor); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1342 |
dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen)); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1343 |
dc.gc = XCreateGC(dpy, root, 0, 0); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1344 |
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1345 |
if(!dc.font.set) |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1346 |
XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1347 |
|
1114 | 1348 |
/* init bar */ |
1158
7c40610de8df
geom indicator and layout indicator is only displayed if there are several geoms/layouts
Anselm R Garbe <garbeam@gmail.com>
parents:
1157
diff
changeset
|
1349 |
for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) { |
1236 | 1350 |
w = TEXTW(layouts[i].symbol); |
1178 | 1351 |
blw = MAX(blw, w); |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1352 |
} |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1353 |
|
1114 | 1354 |
wa.override_redirect = 1; |
1355 |
wa.background_pixmap = ParentRelative; |
|
1356 |
wa.event_mask = ButtonPressMask|ExposureMask; |
|
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1357 |
|
1240
3a7c590338b3
removed bx and bw, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1239
diff
changeset
|
1358 |
barwin = XCreateWindow(dpy, root, wx, by, ww, bh, 0, DefaultDepth(dpy, screen), |
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
1359 |
CopyFromParent, DefaultVisual(dpy, screen), |
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
1360 |
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); |
1114 | 1361 |
XDefineCursor(dpy, barwin, cursor[CurNormal]); |
1362 |
XMapRaised(dpy, barwin); |
|
1363 |
strcpy(stext, "dwm-"VERSION); |
|
1364 |
drawbar(); |
|
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1365 |
|
1114 | 1366 |
/* EWMH support per view */ |
1367 |
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
|
1368 |
PropModeReplace, (unsigned char *) netatom, NetLast); |
|
1077 | 1369 |
|
1114 | 1370 |
/* select for events */ |
1281
3e478379e74d
minor fixes towards 5.0
Anselm R Garbe <garbeam@gmail.com>
parents:
1280
diff
changeset
|
1371 |
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask |
1114 | 1372 |
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask; |
1373 |
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); |
|
1374 |
XSelectInput(dpy, root, wa.event_mask); |
|
1077 | 1375 |
|
1107
589074fac88d
some more changes towards a better dwm
Anselm R Garbe <garbeam@gmail.com>
parents:
1106
diff
changeset
|
1376 |
|
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1377 |
/* grab keys */ |
1060
9df583e2c03c
Using a new tags definition (const char [][MAXTAGLEN] - thanks go to Szabolcs!
Anselm R. Garbe <garbeam@gmail.com>
parents:
1059
diff
changeset
|
1378 |
grabkeys(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1379 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1380 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1381 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1382 |
spawn(const Arg *arg) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1383 |
/* The double-fork construct avoids zombie processes and keeps the code |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1384 |
* clean from stupid signal handlers. */ |
1058
5e34476a3a1c
we check variable == value, and not the other way - the other way is for beginner programmers.
Anselm R. Garbe <garbeam@gmail.com>
parents:
1057
diff
changeset
|
1385 |
if(fork() == 0) { |
5e34476a3a1c
we check variable == value, and not the other way - the other way is for beginner programmers.
Anselm R. Garbe <garbeam@gmail.com>
parents:
1057
diff
changeset
|
1386 |
if(fork() == 0) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1387 |
if(dpy) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1388 |
close(ConnectionNumber(dpy)); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1389 |
setsid(); |
1261
218a33808046
integrated Peter Hartlich's patch, removed const char *c from union, simplified togglelayout
Anselm R Garbe <garbeam@gmail.com>
parents:
1260
diff
changeset
|
1390 |
execvp(((char **)arg->v)[0], (char **)arg->v); |
218a33808046
integrated Peter Hartlich's patch, removed const char *c from union, simplified togglelayout
Anselm R Garbe <garbeam@gmail.com>
parents:
1260
diff
changeset
|
1391 |
fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1392 |
perror(" failed"); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1393 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1394 |
exit(0); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1395 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1396 |
wait(0); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1397 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1398 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1399 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1400 |
tag(const Arg *arg) { |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1401 |
if(sel && arg->ui & TAGMASK) { |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1402 |
sel->tags = arg->ui & TAGMASK; |
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
1403 |
arrange(); |
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
1404 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1405 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1406 |
|
1257 | 1407 |
int |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
1408 |
textnw(const char *text, unsigned int len) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1409 |
XRectangle r; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1410 |
|
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1411 |
if(dc.font.set) { |
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1412 |
XmbTextExtents(dc.font.set, text, len, NULL, &r); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1413 |
return r.width; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1414 |
} |
1088
06fbc117e7d8
removed Monitor->dc, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1087
diff
changeset
|
1415 |
return XTextWidth(dc.font.xfont, text, len); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1416 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1417 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1418 |
void |
1220 | 1419 |
tile(void) { |
1238 | 1420 |
int x, y, h, w, mw; |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
1421 |
unsigned int i, n; |
1220 | 1422 |
Client *c; |
1423 |
||
1227
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1424 |
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++); |
1220 | 1425 |
if(n == 0) |
1426 |
return; |
|
1427 |
||
1428 |
/* master */ |
|
1227
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1429 |
c = nexttiled(clients); |
1238 | 1430 |
mw = mfact * ww; |
1252
d4528eea6e0d
fixed the tile() issue with xpdf
Anselm R Garbe <garbeam@gmail.com>
parents:
1251
diff
changeset
|
1431 |
resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints); |
1220 | 1432 |
|
1433 |
if(--n == 0) |
|
1434 |
return; |
|
1435 |
||
1436 |
/* tile stack */ |
|
1252
d4528eea6e0d
fixed the tile() issue with xpdf
Anselm R Garbe <garbeam@gmail.com>
parents:
1251
diff
changeset
|
1437 |
x = (wx + mw > c->x + c->w) ? c->x + c->w + 2 * c->bw : wx + mw; |
1238 | 1438 |
y = wy; |
1439 |
w = (wx + mw > c->x + c->w) ? wx + ww - x : ww - mw; |
|
1440 |
h = wh / n; |
|
1220 | 1441 |
if(h < bh) |
1238 | 1442 |
h = wh; |
1220 | 1443 |
|
1227
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1444 |
for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
1238 | 1445 |
resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) |
1446 |
? (wy + wh) - y : h) - 2 * c->bw, resizehints); |
|
1447 |
if(h != wh) |
|
1220 | 1448 |
y = c->y + c->h + 2 * c->bw; |
1449 |
} |
|
1450 |
} |
|
1451 |
||
1452 |
void |
|
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1453 |
togglebar(const Arg *arg) { |
1209
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1454 |
showbar = !showbar; |
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1455 |
updategeom(); |
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1456 |
updatebar(); |
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1457 |
arrange(); |
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1458 |
} |
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1459 |
|
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1460 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1461 |
togglefloating(const Arg *arg) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1462 |
if(!sel) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1463 |
return; |
1244
c8bd07e7d006
applied yiyus tip patch from tue
Anselm R Garbe <garbeam@gmail.com>
parents:
1243
diff
changeset
|
1464 |
sel->isfloating = !sel->isfloating || sel->isfixed; |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1465 |
if(sel->isfloating) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1466 |
resize(sel, sel->x, sel->y, sel->w, sel->h, True); |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1467 |
arrange(); |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1468 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1469 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1470 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1471 |
toggletag(const Arg *arg) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
1472 |
unsigned int mask = sel->tags ^ (arg->ui & TAGMASK); |
1288 | 1473 |
|
1474 |
if(sel && mask) { |
|
1475 |
sel->tags = mask; |
|
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
1476 |
arrange(); |
1288 | 1477 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1478 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1479 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1480 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1481 |
toggleview(const Arg *arg) { |
1310
1d52b420daa4
reverted uint redefinition
Anselm R Garbe <garbeam@gmail.com>
parents:
1309
diff
changeset
|
1482 |
unsigned int mask = tagset[seltags] ^ (arg->ui & TAGMASK); |
1288 | 1483 |
|
1484 |
if(mask) { |
|
1485 |
tagset[seltags] = mask; |
|
1309 | 1486 |
clearurgent(); |
1224
47496de04028
applied Gottox bitmask + void *arg patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1223
diff
changeset
|
1487 |
arrange(); |
1288 | 1488 |
} |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1489 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1490 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1491 |
void |
990 | 1492 |
unmanage(Client *c) { |
1493 |
XWindowChanges wc; |
|
1494 |
||
1152
960659820908
renamed c->border into c->bw, fixed monocle to subtract c->bw from each h/w value
Anselm R Garbe <garbeam@gmail.com>
parents:
1151
diff
changeset
|
1495 |
wc.border_width = c->oldbw; |
990 | 1496 |
/* The server grab construct avoids race conditions. */ |
1497 |
XGrabServer(dpy); |
|
1498 |
XSetErrorHandler(xerrordummy); |
|
1499 |
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ |
|
1500 |
detach(c); |
|
1501 |
detachstack(c); |
|
1502 |
if(sel == c) |
|
1503 |
focus(NULL); |
|
1504 |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
|
1505 |
setclientstate(c, WithdrawnState); |
|
1506 |
free(c); |
|
1507 |
XSync(dpy, False); |
|
1508 |
XSetErrorHandler(xerror); |
|
1509 |
XUngrabServer(dpy); |
|
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1510 |
arrange(); |
990 | 1511 |
} |
1512 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1513 |
void |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1514 |
unmapnotify(XEvent *e) { |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1515 |
Client *c; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1516 |
XUnmapEvent *ev = &e->xunmap; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1517 |
|
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1518 |
if((c = getclient(ev->window))) |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1519 |
unmanage(c); |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1520 |
} |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1521 |
|
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1522 |
void |
1190
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1523 |
updatebar(void) { |
1136 | 1524 |
if(dc.drawable != 0) |
1525 |
XFreePixmap(dpy, dc.drawable); |
|
1240
3a7c590338b3
removed bx and bw, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1239
diff
changeset
|
1526 |
dc.drawable = XCreatePixmap(dpy, root, ww, bh, DefaultDepth(dpy, screen)); |
3a7c590338b3
removed bx and bw, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1239
diff
changeset
|
1527 |
XMoveResizeWindow(dpy, barwin, wx, by, ww, bh); |
1136 | 1528 |
} |
1529 |
||
1530 |
void |
|
1190
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1531 |
updategeom(void) { |
1254 | 1532 |
#ifdef XINERAMA |
1312
95b9bfa84b57
local use of xidx is useless, got rid of it, falling back to screen 0 if pointer query fails for whatever reason
Anselm R Garbe <garbeam@gmail.com>
parents:
1311
diff
changeset
|
1533 |
int n, i = 0; |
1215
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1534 |
XineramaScreenInfo *info = NULL; |
1190
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1535 |
|
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1536 |
/* window area geometry */ |
1314
f8c445284353
potential crash fix if xinerama behaves broken, though I doubt it
Anselm R Garbe <garbeam@gmail.com>
parents:
1312
diff
changeset
|
1537 |
if(XineramaIsActive(dpy) && (info = XineramaQueryScreens(dpy, &n))) { |
1311
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
1538 |
if(n > 1) { |
1312
95b9bfa84b57
local use of xidx is useless, got rid of it, falling back to screen 0 if pointer query fails for whatever reason
Anselm R Garbe <garbeam@gmail.com>
parents:
1311
diff
changeset
|
1539 |
int di, x, y; |
1311
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
1540 |
unsigned int dui; |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
1541 |
Window dummy; |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
1542 |
if(XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui)) |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
1543 |
for(i = 0; i < n; i++) |
1312
95b9bfa84b57
local use of xidx is useless, got rid of it, falling back to screen 0 if pointer query fails for whatever reason
Anselm R Garbe <garbeam@gmail.com>
parents:
1311
diff
changeset
|
1544 |
if(INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height)) |
1311
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
1545 |
break; |
47b3dbd9a7d3
got rid of compile time xidx configuration, querying mouse pointer instead
Anselm R Garbe <garbeam@gmail.com>
parents:
1310
diff
changeset
|
1546 |
} |
1312
95b9bfa84b57
local use of xidx is useless, got rid of it, falling back to screen 0 if pointer query fails for whatever reason
Anselm R Garbe <garbeam@gmail.com>
parents:
1311
diff
changeset
|
1547 |
wx = info[i].x_org; |
95b9bfa84b57
local use of xidx is useless, got rid of it, falling back to screen 0 if pointer query fails for whatever reason
Anselm R Garbe <garbeam@gmail.com>
parents:
1311
diff
changeset
|
1548 |
wy = showbar && topbar ? info[i].y_org + bh : info[i].y_org; |
95b9bfa84b57
local use of xidx is useless, got rid of it, falling back to screen 0 if pointer query fails for whatever reason
Anselm R Garbe <garbeam@gmail.com>
parents:
1311
diff
changeset
|
1549 |
ww = info[i].width; |
95b9bfa84b57
local use of xidx is useless, got rid of it, falling back to screen 0 if pointer query fails for whatever reason
Anselm R Garbe <garbeam@gmail.com>
parents:
1311
diff
changeset
|
1550 |
wh = showbar ? info[i].height - bh : info[i].height; |
1215
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1551 |
XFree(info); |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1552 |
} |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1553 |
else |
1209
c2dc0bd92158
recent changes, introduced togglebar, changed some defines into variable declarations where possible
Anselm R Garbe <garbeam@gmail.com>
parents:
1207
diff
changeset
|
1554 |
#endif |
1215
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1555 |
{ |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1556 |
wx = sx; |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1557 |
wy = showbar && topbar ? sy + bh : sy; |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1558 |
ww = sw; |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1559 |
wh = showbar ? sh - bh : sh; |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1560 |
} |
840fd59e3141
make it easier for the user, if Xinerama support is given, always use the screen 0 as window area/bar area, everything else can be used for floating clients
Anselm R Garbe <garbeam@gmail.com>
parents:
1213
diff
changeset
|
1561 |
|
1240
3a7c590338b3
removed bx and bw, unnecessary
Anselm R Garbe <garbeam@gmail.com>
parents:
1239
diff
changeset
|
1562 |
/* bar position */ |
1223 | 1563 |
by = showbar ? (topbar ? wy - bh : wy + wh) : -bh; |
1190
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1564 |
} |
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1565 |
|
c8eaba1445a4
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
Anselm R Garbe <garbeam@gmail.com>
parents:
1188
diff
changeset
|
1566 |
void |
990 | 1567 |
updatesizehints(Client *c) { |
1568 |
long msize; |
|
1569 |
XSizeHints size; |
|
1570 |
||
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1571 |
XGetWMNormalHints(dpy, c->win, &size, &msize); |
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1572 |
if(size.flags & PBaseSize) { |
990 | 1573 |
c->basew = size.base_width; |
1574 |
c->baseh = size.base_height; |
|
1575 |
} |
|
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1576 |
else if(size.flags & PMinSize) { |
990 | 1577 |
c->basew = size.min_width; |
1578 |
c->baseh = size.min_height; |
|
1579 |
} |
|
1580 |
else |
|
1581 |
c->basew = c->baseh = 0; |
|
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1582 |
if(size.flags & PResizeInc) { |
990 | 1583 |
c->incw = size.width_inc; |
1584 |
c->inch = size.height_inc; |
|
1585 |
} |
|
1586 |
else |
|
1587 |
c->incw = c->inch = 0; |
|
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1588 |
if(size.flags & PMaxSize) { |
990 | 1589 |
c->maxw = size.max_width; |
1590 |
c->maxh = size.max_height; |
|
1591 |
} |
|
1592 |
else |
|
1593 |
c->maxw = c->maxh = 0; |
|
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1594 |
if(size.flags & PMinSize) { |
990 | 1595 |
c->minw = size.min_width; |
1596 |
c->minh = size.min_height; |
|
1597 |
} |
|
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1598 |
else if(size.flags & PBaseSize) { |
990 | 1599 |
c->minw = size.base_width; |
1600 |
c->minh = size.base_height; |
|
1601 |
} |
|
1602 |
else |
|
1603 |
c->minw = c->minh = 0; |
|
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1604 |
if(size.flags & PAspect) { |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1605 |
c->mina = (float)size.min_aspect.y / (float)size.min_aspect.x; |
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1606 |
c->maxa = (float)size.max_aspect.x / (float)size.max_aspect.y; |
990 | 1607 |
} |
1608 |
else |
|
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1609 |
c->maxa = c->mina = 0.0; |
990 | 1610 |
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh |
1611 |
&& c->maxw == c->minw && c->maxh == c->minh); |
|
1612 |
} |
|
1613 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1614 |
void |
990 | 1615 |
updatetitle(Client *c) { |
1616 |
if(!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) |
|
1617 |
gettextprop(c->win, wmatom[WMName], c->name, sizeof c->name); |
|
1618 |
} |
|
1619 |
||
1080
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1620 |
void |
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1621 |
updatewmhints(Client *c) { |
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1622 |
XWMHints *wmh; |
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1623 |
|
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1624 |
if((wmh = XGetWMHints(dpy, c->win))) { |
1309 | 1625 |
if(ISVISIBLE(c) && wmh->flags & XUrgencyHint) { |
1626 |
wmh->flags &= ~XUrgencyHint; |
|
1627 |
XSetWMHints(dpy, c->win, wmh); |
|
1628 |
} |
|
1122
6f93af279e0a
fixed urgent hint handling
Anselm R Garbe <garbeam@gmail.com>
parents:
1121
diff
changeset
|
1629 |
else |
6f93af279e0a
fixed urgent hint handling
Anselm R Garbe <garbeam@gmail.com>
parents:
1121
diff
changeset
|
1630 |
c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; |
1309 | 1631 |
|
1080
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1632 |
XFree(wmh); |
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1633 |
} |
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1634 |
} |
9bfb57c89407
implemented urgent hint handling (with multihead support)
anselm@aab
parents:
1079
diff
changeset
|
1635 |
|
1104 | 1636 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1637 |
view(const Arg *arg) { |
1327
920833e10274
applied Martin Hurton's view() simplification, not checking arg
Anselm R Garbe <garbeam@gmail.com>
parents:
1326
diff
changeset
|
1638 |
if((arg->ui & TAGMASK) == tagset[seltags]) |
1304 | 1639 |
return; |
1249
1fcb3350609d
applied noviewprev.diff, fix.diff and unusedflags.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1248
diff
changeset
|
1640 |
seltags ^= 1; /* toggle sel tagset */ |
1327
920833e10274
applied Martin Hurton's view() simplification, not checking arg
Anselm R Garbe <garbeam@gmail.com>
parents:
1326
diff
changeset
|
1641 |
if(arg->ui & TAGMASK) |
1319
fb29ceb5932a
fixes using arg->i instead of arg->ui
Premysl Hruby <dfenze@gmail.com>
parents:
1318
diff
changeset
|
1642 |
tagset[seltags] = arg->ui & TAGMASK; |
1309 | 1643 |
clearurgent(); |
1104 | 1644 |
arrange(); |
1645 |
} |
|
1646 |
||
990 | 1647 |
/* There's no way to check accesses to destroyed windows, thus those cases are |
1648 |
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
|
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1649 |
* default error handler, which may call exit. */ |
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1650 |
int |
990 | 1651 |
xerror(Display *dpy, XErrorEvent *ee) { |
1652 |
if(ee->error_code == BadWindow |
|
1653 |
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
|
1654 |
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) |
|
1655 |
|| (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) |
|
1656 |
|| (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) |
|
1657 |
|| (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) |
|
1186 | 1658 |
|| (ee->request_code == X_GrabButton && ee->error_code == BadAccess) |
990 | 1659 |
|| (ee->request_code == X_GrabKey && ee->error_code == BadAccess) |
1660 |
|| (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) |
|
1661 |
return 0; |
|
1662 |
fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", |
|
1195
33ba827ee84e
applied nsz's style.diff patch
Anselm R Garbe <garbeam@gmail.com>
parents:
1194
diff
changeset
|
1663 |
ee->request_code, ee->error_code); |
990 | 1664 |
return xerrorxlib(dpy, ee); /* may call exit */ |
1665 |
} |
|
1666 |
||
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1667 |
int |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1668 |
xerrordummy(Display *dpy, XErrorEvent *ee) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1669 |
return 0; |
990 | 1670 |
} |
1671 |
||
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1672 |
/* Startup Error handler to check if another window manager |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1673 |
* is already running. */ |
1001
2477f818215c
made all stuff non-static - so you can choose wether to use dwm the static or the extern way when extending it
arg@suckless.org
parents:
1000
diff
changeset
|
1674 |
int |
1102
239f5ee65766
pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but those changes are necessary to get a decent multihead support) -- I renamed Monitor into View, to reflect in a better way the dwm terminology of the past
anselm@anselm1
parents:
1101
diff
changeset
|
1675 |
xerrorstart(Display *dpy, XErrorEvent *ee) { |
996
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1676 |
otherwm = True; |
b4d47b6a8ba8
ordered all functions alphabetically
Anselm R. Garbe <garbeam@gmail.com>
parents:
995
diff
changeset
|
1677 |
return -1; |
990 | 1678 |
} |
1679 |
||
1220 | 1680 |
void |
1260
2d3d08d2dd19
applied anydot's patchset.diff
Anselm R Garbe <garbeam@gmail.com>
parents:
1259
diff
changeset
|
1681 |
zoom(const Arg *arg) { |
1220 | 1682 |
Client *c = sel; |
1683 |
||
1290 | 1684 |
if(!lt[sellt]->arrange || lt[sellt]->arrange == monocle || (sel && sel->isfloating)) |
1227
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1685 |
return; |
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1686 |
if(c == nexttiled(clients)) |
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1687 |
if(!c || !(c = nexttiled(c->next))) |
1220 | 1688 |
return; |
1227
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1689 |
detach(c); |
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1690 |
attach(c); |
1f0e2de78c35
s/nextunfloating/nexttiled/, changed zoom() behavior
Anselm R Garbe <garbeam@gmail.com>
parents:
1226
diff
changeset
|
1691 |
focus(c); |
1220 | 1692 |
arrange(); |
1693 |
} |
|
1694 |
||
1072
5a06b4b69479
merged Christof Musik's Xinerama support patches, though this needs some polishing!
anselm@anselm1
parents:
1071
diff
changeset
|
1695 |
int |
990 | 1696 |
main(int argc, char *argv[]) { |
1697 |
if(argc == 2 && !strcmp("-v", argv[1])) |
|
1308 | 1698 |
die("dwm-"VERSION", © 2006-2008 dwm engineers, see LICENSE for details\n"); |
990 | 1699 |
else if(argc != 1) |
1308 | 1700 |
die("usage: dwm [-v]\n"); |
994
201550f99b8e
macros which have been defined in config.h can only be used at function level, however you can nest code into config.h now for implementing a different layout (just for example), eg. #include "supertile.c"
Anselm R. Garbe <garbeam@gmail.com>
parents:
993
diff
changeset
|
1701 |
|
1325
5456239bb8ad
removed setlocale() stuff, not necessary if Xmb in use
Anselm R Garbe <garbeam@gmail.com>
parents:
1323
diff
changeset
|
1702 |
if(!XSupportsLocale()) |
1302 | 1703 |
fprintf(stderr, "warning: no locale support\n"); |
1704 |
||
990 | 1705 |
if(!(dpy = XOpenDisplay(0))) |
1308 | 1706 |
die("dwm: cannot open display\n"); |
990 | 1707 |
|
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1708 |
checkotherwm(); |
990 | 1709 |
setup(); |
1710 |
scan(); |
|
997
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1711 |
run(); |
8e721021e636
some more rearrangements
Anselm R. Garbe <garbeam@gmail.com>
parents:
996
diff
changeset
|
1712 |
cleanup(); |
990 | 1713 |
|
1714 |
XCloseDisplay(dpy); |
|
1715 |
return 0; |
|
1716 |
} |