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