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