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