Mercurial > aewl
annotate aewl.c @ 787:eecb13b34511 default tip
Put floating windows on random starting positions
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Fri, 18 Oct 2024 23:42:20 +0200 |
parents | e65be4ffdbdc |
children |
rev | line source |
---|---|
644 | 1 /* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com> |
759 | 2 * (C)opyright MMVIII markus schnalke <meillo at marmaro dot de> |
0 | 3 * See LICENSE file for license details. |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
4 * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
5 * dynamic window manager is designed like any other X client as well. It is |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
6 * driven through handling X events. In contrast to other X clients, a window |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
7 * manager selects for SubstructureRedirectMask on the root window, to receive |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
8 * events about window (dis-)appearance. Only one X connection at a time is |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
9 * allowed to select for this event mask. |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
10 * |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
11 * The event handlers of dwm are organized in an array which is accessed |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
12 * whenever a new event has been fetched. This allows event dispatching in O(1) |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
13 * time. |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
14 * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
15 * Each child of the root window is called a client, except windows which have |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
16 * set the override_redirect flag. Clients are organized in a global |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
17 * doubly-linked client list, the focus history is remembered through a global |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
18 * stack list. [...] |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
19 * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
20 * Keys and tagging rules are organized as arrays and defined in the config.h |
771 | 21 * file. [...] The current mode is represented by the arrange() function |
22 * pointer, which wether points to [domax()] or dotile(). | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
23 * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
24 * To understand everything else, start reading main.c:main(). |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
25 * |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
26 * -- and now about aewl -- |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
27 * |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
28 * aewl is a stripped down dwm. It stated as a patchset, but finally forked off |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
29 * completely. The reason for this was the increasing gap between my wish to |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
30 * stay where dwm was, and dwm direction to go further. Further more did I |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
31 * always use only a small subset of dwm's features, so condencing dwm had been |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
32 * my wish for a long time. |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
33 * |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
34 * In aewl clients are either tagged or not (only one tag). Visible are either |
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
35 * all tagged clients or all without the tag. |
0 | 36 */ |
37 | |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
38 |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
39 #include <errno.h> |
619 | 40 #include <locale.h> |
0 | 41 #include <stdio.h> |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
42 #include <stdarg.h> |
0 | 43 #include <stdlib.h> |
57
f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
52
diff
changeset
|
44 #include <string.h> |
59
5d4653de9a1c
implemented dwm reading status text from stdin
Anselm R. Garbe <garbeam@wmii.de>
parents:
58
diff
changeset
|
45 #include <unistd.h> |
776
a3399a8964c7
no need to update the bar when the layout changes
meillo@marmaro.de
parents:
773
diff
changeset
|
46 #include <sys/signal.h> |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
47 #include <sys/types.h> |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
48 #include <sys/wait.h> |
0 | 49 #include <X11/cursorfont.h> |
291
8e6e0aa5e2ae
removed NUMLOCKMASK, added dynamically calculated numlockmask instead
Anselm R.Garbe <arg@10ksloc.org>
parents:
281
diff
changeset
|
50 #include <X11/keysym.h> |
0 | 51 #include <X11/Xatom.h> |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
52 #include <X11/Xlib.h> |
0 | 53 #include <X11/Xproto.h> |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
54 #include <X11/Xutil.h> |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
55 |
769 | 56 #include "config.h" |
57 | |
58 | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
59 /* mask shorthands, used in event.c and client.c */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
60 #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
61 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
62 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
63 enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
64 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ |
764 | 65 enum { ColFG, ColBG, ColLast }; /* color */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
66 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
67 typedef struct { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
68 int ascent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
69 int descent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
70 int height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
71 XFontSet set; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
72 XFontStruct *xfont; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
73 } Fnt; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
74 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
75 typedef struct { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
76 int x, y, w, h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
77 unsigned long norm[ColLast]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
78 unsigned long sel[ColLast]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
79 Drawable drawable; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
80 Fnt font; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
81 GC gc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
82 } DC; /* draw context */ |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
83 |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
84 typedef struct Client Client; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
85 struct Client { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
86 char name[256]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
87 int x, y, w, h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
88 int rx, ry, rw, rh; /* revert geometry */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
89 int basew, baseh, incw, inch, maxw, maxh, minw, minh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
90 int minax, minay, maxax, maxay; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
91 long flags; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
92 unsigned int border; |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
93 Bool isfixed, isfloat, ismax, ispopup; |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
94 Bool tag; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
95 Client *next; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
96 Client *prev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
97 Client *snext; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
98 Window win; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
99 }; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
100 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
101 typedef struct { |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
102 const char* class; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
103 const char* instance; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
104 const char* title; |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
105 int tag; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
106 Bool isfloat; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
107 } Rule; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
108 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
109 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
110 typedef struct { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
111 unsigned long mod; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
112 KeySym keysym; |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
113 void (*func)(const char* cmd); |
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
114 const char* cmd; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
115 } Key; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
116 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
117 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
118 #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
119 #define MOUSEMASK (BUTTONMASK | PointerMotionMask) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
120 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
121 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
122 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
123 char stext[256]; /* status text */ |
771 | 124 int bh; /* bar height */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
125 int screen, sx, sy, sw, sh; /* screen geometry */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
126 int wax, way, wah, waw; /* windowarea geometry */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
127 unsigned int nmaster; /* number of master clients */ |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
128 unsigned int numlockmask; /* dynamic lock mask */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
129 void (*handler[LASTEvent])(XEvent *); /* event handler */ |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
130 void arrange(void); /* arrange */ |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
131 void (*arrange1)(void); /* arrange function, indicates mode */ |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
132 void (*arrange2)(void); /* arrange function, indicates mode */ |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
133 Atom wmatom[WMLast], netatom[NetLast]; |
772 | 134 Bool running = True; |
135 Bool selscreen = True; | |
136 Bool seltag; | |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
137 Bool viewfloats; |
772 | 138 Client* clients = NULL; /* global client list */ |
139 Client* stack = NULL; /* global client stack */ | |
140 Client* sel = NULL; /* selected client */ | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
141 Cursor cursor[CurLast]; |
772 | 142 DC dc = {0}; /* global draw context */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
143 Display *dpy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
144 Window root, barwin; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
145 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
146 static int (*xerrorxlib)(Display *, XErrorEvent *); |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
147 static Bool otherwm; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
148 static unsigned int len = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
149 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
150 |
772 | 151 |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
152 void configure(Client *c); /* send synthetic configure event */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
153 void focus(Client *c); /* focus c, c may be NULL */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
154 Client *getclient(Window w); /* return client of w */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
155 Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
156 void manage(Window w, XWindowAttributes *wa); /* manage new client */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
157 void resize(Client *c, Bool sizehints); /* resize c*/ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
158 void updatesizehints(Client *c); /* update the size hint variables of c */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
159 void updatetitle(Client *c); /* update the name of c */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
160 void unmanage(Client *c); /* destroy c */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
161 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
162 void drawbar(void); /* draw the bar */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
163 unsigned long getcolor(const char *colstr); /* return color of colstr */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
164 void setfont(const char *fontstr); /* set the font for DC */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
165 unsigned int textw(const char *text); /* return the width of text in px*/ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
166 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
167 void grabkeys(void); /* grab all keys defined in config.h */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
168 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
169 void sendevent(Window w, Atom a, long value); /* send synthetic event to w */ |
772 | 170 int xerror(Display *dsply, XErrorEvent *ee); /* X error handler */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
171 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
172 Client *getnext(Client *c); /* returns next visible client */ |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
173 void settag(Client *c, Client *trans); /* sets tag of c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
174 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
175 void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ |
778 | 176 void die(const char *errstr, ...); /* prints errstr and exits with 1 */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
177 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
178 void detach(Client *c); /* detaches c from global client list */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
179 void dotile(void); /* arranges all windows tiled */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
180 void domax(void); /* arranges all windows fullscreen */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
181 Bool isvisible(Client *c); /* returns True if client is visible */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
182 void restack(void); /* restores z layers of all clients */ |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
183 |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
184 void toggleview(void); /* toggle the view */ |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
185 void floattoggle(); /* toggle floatsview */ |
760 | 186 void focusnext(void); /* focuses next visible client */ |
187 void zoom(void); /* zooms the focused client to master area */ | |
188 void killclient(void); /* kill c nicely */ | |
772 | 189 void quit(void); /* quit nicely */ |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
190 void togglemode(void); /* toggles arrange function (dotile/domax) */ |
760 | 191 void togglefloat(void); /* toggles focusesd client between floating/non-floating state */ |
192 void incnmaster(void); /* increments nmaster */ | |
193 void decnmaster(void); /* decrements nmaster */ | |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
194 void toggletag(void); /* toggles tag of c */ |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
195 void spawn(const char* cmd); /* forks a new subprocess with cmd */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
196 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
197 void updatestatus(void); /* update the status text */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
198 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
199 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
200 RULES |
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
201 KEYS |
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
202 |
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
203 |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
204 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
205 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
206 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
207 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
208 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
209 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
210 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
211 /* from view.c */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
212 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
213 Client * |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
214 nexttiled(Client *c) { |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
215 for(c = getnext(c); c && (c->isfloat || c->ispopup); c = getnext(c->next)); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
216 return c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
217 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
218 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
219 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
220 togglemax(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
221 XEvent ev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
222 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
223 if(c->isfixed) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
224 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
225 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
226 if((c->ismax = !c->ismax)) { |
769 | 227 c->rx = c->x; |
228 c->ry = c->y; | |
229 c->rw = c->w; | |
230 c->rh = c->h; | |
231 c->x = wax; | |
232 c->y = way; | |
233 c->w = waw - 2 * BORDERPX; | |
234 c->h = wah - 2 * BORDERPX; | |
235 } else { | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
236 c->x = c->rx; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
237 c->y = c->ry; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
238 c->w = c->rw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
239 c->h = c->rh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
240 } |
769 | 241 resize(c, False); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
242 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
243 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
244 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
245 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
246 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
247 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
248 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
249 detach(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
250 if(c->prev) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
251 c->prev->next = c->next; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
252 if(c->next) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
253 c->next->prev = c->prev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
254 if(c == clients) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
255 clients = c->next; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
256 c->next = c->prev = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
257 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
258 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
259 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
260 dotile(void) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
261 unsigned int i, n, mw, mh, tw, th; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
262 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
263 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
264 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
265 n++; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
266 /* window geoms */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
267 mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
268 mw = (n > nmaster) ? waw / 2 : waw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
269 th = (n > nmaster) ? wah / (n - nmaster) : 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
270 tw = waw - mw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
271 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
272 for(i = 0, c = clients; c; c = c->next) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
273 if(isvisible(c)) { |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
274 if(c->isfloat || c->ispopup) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
275 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
276 continue; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
277 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
278 c->ismax = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
279 c->x = wax; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
280 c->y = way; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
281 if(i < nmaster) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
282 c->y += i * mh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
283 c->w = mw - 2 * BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
284 c->h = mh - 2 * BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
285 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
286 else { /* tile window */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
287 c->x += mw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
288 c->w = tw - 2 * BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
289 if(th > 2 * BORDERPX) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
290 c->y += (i - nmaster) * th; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
291 c->h = th - 2 * BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
292 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
293 else /* fallback if th <= 2 * BORDERPX */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
294 c->h = wah - 2 * BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
295 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
296 resize(c, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
297 i++; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
298 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
299 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
300 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
301 if(!sel || !isvisible(sel)) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
302 for(c = stack; c && !isvisible(c); c = c->snext); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
303 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
304 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
305 restack(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
306 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
307 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
308 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
309 domax(void) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
310 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
311 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
312 for(c = clients; c; c = c->next) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
313 if(isvisible(c)) { |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
314 if(c->isfloat || c->ispopup) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
315 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
316 continue; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
317 } |
768
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
318 c->ismax = True; |
769 | 319 c->x = wax; |
320 c->y = way; | |
321 c->w = waw - 2 * BORDERPX; | |
322 c->h = wah - 2 * BORDERPX; | |
323 resize(c, False); | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
324 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
325 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
326 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
327 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
328 if(!sel || !isvisible(sel)) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
329 for(c = stack; c && !isvisible(c); c = c->snext); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
330 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
331 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
332 restack(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
333 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
334 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
335 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
336 focusnext() { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
337 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
338 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
339 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
340 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
341 if(!(c = getnext(sel->next))) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
342 c = getnext(clients); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
343 if(c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
344 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
345 restack(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
346 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
347 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
348 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
349 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
350 incnmaster() { |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
351 if(wah / (nmaster + 1) <= 2 * BORDERPX) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
352 return; |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
353 nmaster++; |
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
354 if(sel) |
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
355 arrange(); |
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
356 } |
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
357 |
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
358 void |
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
359 decnmaster() { |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
360 if(nmaster <= 1) |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
361 return; |
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
362 nmaster--; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
363 if(sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
364 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
365 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
366 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
367 Bool |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
368 isvisible(Client *c) { |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
369 if (c->isfloat) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
370 return viewfloats; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
371 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
372 return (!viewfloats && c->tag == seltag); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
373 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
374 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
375 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
376 restack(void) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
377 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
378 XEvent ev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
379 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
380 drawbar(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
381 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
382 return; |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
383 if(sel->isfloat || sel->ispopup) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
384 XRaiseWindow(dpy, sel->win); |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
385 else |
768
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
386 XLowerWindow(dpy, sel->win); |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
387 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
388 if(c == sel) |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
389 continue; |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
390 XLowerWindow(dpy, c->win); |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
391 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
392 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
393 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
394 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
395 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
396 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
397 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
398 togglefloat() { |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
399 if (!sel) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
400 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
401 sel->isfloat = !sel->isfloat; |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
402 floattoggle(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
403 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
404 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
405 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
406 togglemode() { |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
407 /* toggle between tile and max */ |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
408 if (viewfloats) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
409 return; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
410 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
411 if (seltag) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
412 arrange1 = (arrange1 == dotile) ? domax : dotile; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
413 } else { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
414 arrange2 = (arrange2 == dotile) ? domax : dotile; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
415 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
416 if(sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
417 arrange(); |
776
a3399a8964c7
no need to update the bar when the layout changes
meillo@marmaro.de
parents:
773
diff
changeset
|
418 zoom(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
419 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
420 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
421 void |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
422 arrange() { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
423 if (seltag) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
424 arrange1(); |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
425 } else { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
426 arrange2(); |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
427 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
428 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
429 |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
430 void |
755 | 431 toggleview() { |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
432 if (viewfloats) { |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
433 floattoggle(); |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
434 return; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
435 } |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
436 seltag = !seltag; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
437 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
438 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
439 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
440 void |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
441 floattoggle() { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
442 viewfloats = !viewfloats; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
443 arrange(); |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
444 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
445 |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
446 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
447 zoom() { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
448 unsigned int n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
449 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
450 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
451 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
452 return; |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
453 if(sel->isfloat || sel->ispopup) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
454 togglemax(sel); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
455 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
456 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
457 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
458 n++; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
459 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
460 if((c = sel) == nexttiled(clients)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
461 if(!(c = nexttiled(c->next))) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
462 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
463 detach(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
464 if(clients) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
465 clients->prev = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
466 c->next = clients; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
467 clients = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
468 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
469 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
470 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
471 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
472 /* from util.c */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
473 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
474 void * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
475 emallocz(unsigned int size) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
476 void *res = calloc(1, size); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
477 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
478 if(!res) |
778 | 479 die("fatal: could not malloc() %u bytes\n", size); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
480 return res; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
481 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
482 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
483 void |
778 | 484 die(const char *errstr, ...) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
485 va_list ap; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
486 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
487 va_start(ap, errstr); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
488 vfprintf(stderr, errstr, ap); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
489 va_end(ap); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
490 exit(EXIT_FAILURE); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
491 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
492 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
493 void |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
494 spawn(const char* cmd) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
495 static char *shell = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
496 |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
497 if(!cmd) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
498 return; |
769 | 499 if(!(shell = getenv("SHELL"))) |
500 shell = "/bin/sh"; | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
501 /* The double-fork construct avoids zombie processes and keeps the code |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
502 * clean from stupid signal handlers. */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
503 if(fork() == 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
504 if(fork() == 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
505 if(dpy) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
506 close(ConnectionNumber(dpy)); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
507 setsid(); |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
508 execl(shell, shell, "-c", cmd, (char *)NULL); |
772 | 509 fprintf(stderr, "aewl: execl '%s -c %s'", shell, cmd); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
510 perror(" failed"); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
511 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
512 exit(0); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
513 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
514 wait(0); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
515 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
516 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
517 /* from tag.c */ |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
518 |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
519 Client * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
520 getnext(Client *c) { |
768
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
521 while(c && !isvisible(c)) { |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
522 c = c->next; |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
523 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
524 return c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
525 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
526 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
527 void |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
528 settag(Client *c, Client *trans) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
529 unsigned int i; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
530 XClassHint ch = { 0 }; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
531 |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
532 if(trans) { |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
533 c->tag = trans->tag; |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
534 c->isfloat = trans->isfloat; |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
535 return; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
536 } |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
537 c->tag = seltag; /* default */ |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
538 XGetClassHint(dpy, c->win, &ch); |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
539 len = sizeof rule / sizeof rule[0]; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
540 for(i = 0; i < len; i++) { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
541 if((rule[i].title && strstr(c->name, rule[i].title)) |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
542 || (ch.res_class && rule[i].class && strstr(ch.res_class, rule[i].class)) |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
543 || (ch.res_name && rule[i].instance && strstr(ch.res_name, rule[i].instance))) { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
544 c->isfloat = rule[i].isfloat; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
545 if (rule[i].tag < 0) { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
546 c->tag = seltag; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
547 } else if (rule[i].tag) { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
548 c->tag = True; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
549 } else { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
550 c->tag = False; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
551 } |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
552 break; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
553 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
554 } |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
555 if(ch.res_class) |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
556 XFree(ch.res_class); |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
557 if(ch.res_name) |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
558 XFree(ch.res_name); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
559 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
560 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
561 void |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
562 toggletag() { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
563 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
564 return; |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
565 sel->tag = !sel->tag; |
755 | 566 toggleview(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
567 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
568 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
569 /* from event.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
570 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
571 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
572 movemouse(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
573 int x1, y1, ocx, ocy, di; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
574 unsigned int dui; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
575 Window dummy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
576 XEvent ev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
577 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
578 ocx = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
579 ocy = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
580 if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
581 None, cursor[CurMove], CurrentTime) != GrabSuccess) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
582 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
583 c->ismax = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
584 XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
585 for(;;) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
586 XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
587 switch (ev.type) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
588 case ButtonRelease: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
589 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
590 XUngrabPointer(dpy, CurrentTime); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
591 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
592 case ConfigureRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
593 case Expose: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
594 case MapRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
595 handler[ev.type](&ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
596 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
597 case MotionNotify: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
598 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
599 c->x = ocx + (ev.xmotion.x - x1); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
600 c->y = ocy + (ev.xmotion.y - y1); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
601 if(abs(wax + c->x) < SNAP) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
602 c->x = wax; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
603 else if(abs((wax + waw) - (c->x + c->w + 2 * c->border)) < SNAP) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
604 c->x = wax + waw - c->w - 2 * c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
605 if(abs(way - c->y) < SNAP) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
606 c->y = way; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
607 else if(abs((way + wah) - (c->y + c->h + 2 * c->border)) < SNAP) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
608 c->y = way + wah - c->h - 2 * c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
609 resize(c, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
610 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
611 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
612 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
613 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
614 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
615 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
616 resizemouse(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
617 int ocx, ocy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
618 int nw, nh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
619 XEvent ev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
620 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
621 ocx = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
622 ocy = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
623 if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
624 None, cursor[CurResize], CurrentTime) != GrabSuccess) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
625 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
626 c->ismax = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
627 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
628 for(;;) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
629 XMaskEvent(dpy, MOUSEMASK | ExposureMask | SubstructureRedirectMask , &ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
630 switch(ev.type) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
631 case ButtonRelease: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
632 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
633 XUngrabPointer(dpy, CurrentTime); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
634 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
635 case ConfigureRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
636 case Expose: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
637 case MapRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
638 handler[ev.type](&ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
639 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
640 case MotionNotify: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
641 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
642 nw = ev.xmotion.x - ocx - 2 * c->border + 1; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
643 c->w = nw > 0 ? nw : 1; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
644 nh = ev.xmotion.y - ocy - 2 * c->border + 1; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
645 c->h = nh > 0 ? nh : 1; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
646 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
647 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
648 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
649 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
650 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
651 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
652 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
653 buttonpress(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
654 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
655 XButtonPressedEvent *ev = &e->xbutton; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
656 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
657 if(barwin == ev->window) { |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
658 return; |
763
17428bca4a12
removed group-toggle by mouse; small cleanup
meillo@marmaro.de
parents:
762
diff
changeset
|
659 } |
17428bca4a12
removed group-toggle by mouse; small cleanup
meillo@marmaro.de
parents:
762
diff
changeset
|
660 if((c = getclient(ev->window))) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
661 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
662 if(CLEANMASK(ev->state) != MODKEY) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
663 return; |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
664 if(ev->button == Button1 && (c->isfloat || c->ispopup)) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
665 restack(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
666 movemouse(c); |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
667 } else if(ev->button == Button3 && (c->isfloat || c->ispopup) && !c->isfixed) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
668 restack(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
669 resizemouse(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
670 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
671 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
672 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
673 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
674 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
675 configurerequest(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
676 unsigned long newmask; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
677 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
678 XConfigureRequestEvent *ev = &e->xconfigurerequest; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
679 XWindowChanges wc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
680 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
681 if((c = getclient(ev->window))) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
682 c->ismax = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
683 if(ev->value_mask & CWX) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
684 c->x = ev->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
685 if(ev->value_mask & CWY) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
686 c->y = ev->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
687 if(ev->value_mask & CWWidth) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
688 c->w = ev->width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
689 if(ev->value_mask & CWHeight) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
690 c->h = ev->height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
691 if(ev->value_mask & CWBorderWidth) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
692 c->border = ev->border_width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
693 wc.x = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
694 wc.y = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
695 wc.width = c->w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
696 wc.height = c->h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
697 newmask = ev->value_mask & (~(CWSibling | CWStackMode | CWBorderWidth)); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
698 if(newmask) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
699 XConfigureWindow(dpy, c->win, newmask, &wc); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
700 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
701 configure(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
702 XSync(dpy, False); |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
703 if(c->isfloat || c->ispopup) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
704 resize(c, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
705 if(!isvisible(c)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
706 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
707 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
708 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
709 arrange(); |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
710 } else { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
711 wc.x = ev->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
712 wc.y = ev->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
713 wc.width = ev->width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
714 wc.height = ev->height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
715 wc.border_width = ev->border_width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
716 wc.sibling = ev->above; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
717 wc.stack_mode = ev->detail; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
718 XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
719 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
720 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
721 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
722 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
723 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
724 destroynotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
725 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
726 XDestroyWindowEvent *ev = &e->xdestroywindow; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
727 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
728 if((c = getclient(ev->window))) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
729 unmanage(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
730 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
731 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
732 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
733 enternotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
734 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
735 XCrossingEvent *ev = &e->xcrossing; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
736 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
737 if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
738 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
739 if((c = getclient(ev->window)) && isvisible(c)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
740 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
741 else if(ev->window == root) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
742 selscreen = True; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
743 for(c = stack; c && !isvisible(c); c = c->snext); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
744 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
745 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
746 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
747 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
748 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
749 expose(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
750 XExposeEvent *ev = &e->xexpose; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
751 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
752 if(ev->count == 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
753 if(barwin == ev->window) |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
754 drawbar(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
755 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
756 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
757 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
758 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
759 keypress(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
760 static unsigned int len = sizeof key / sizeof key[0]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
761 unsigned int i; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
762 KeySym keysym; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
763 XKeyEvent *ev = &e->xkey; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
764 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
765 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
766 for(i = 0; i < len; i++) { |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
767 if(keysym == key[i].keysym && CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
768 if(key[i].func) |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
769 key[i].func(key[i].cmd); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
770 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
771 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
772 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
773 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
774 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
775 leavenotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
776 XCrossingEvent *ev = &e->xcrossing; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
777 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
778 if((ev->window == root) && !ev->same_screen) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
779 selscreen = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
780 focus(NULL); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
781 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
782 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
783 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
784 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
785 mappingnotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
786 XMappingEvent *ev = &e->xmapping; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
787 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
788 XRefreshKeyboardMapping(ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
789 if(ev->request == MappingKeyboard) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
790 grabkeys(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
791 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
792 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
793 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
794 maprequest(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
795 static XWindowAttributes wa; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
796 XMapRequestEvent *ev = &e->xmaprequest; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
797 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
798 if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
799 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
800 if(wa.override_redirect) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
801 XSelectInput(dpy, ev->window, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
802 (StructureNotifyMask | PropertyChangeMask)); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
803 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
804 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
805 if(!getclient(ev->window)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
806 manage(ev->window, &wa); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
807 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
808 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
809 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
810 propertynotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
811 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
812 Window trans; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
813 XPropertyEvent *ev = &e->xproperty; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
814 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
815 if((ev->window == root) && (ev->atom = XA_WM_NAME)) |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
816 updatestatus(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
817 else if(ev->state == PropertyDelete) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
818 return; /* ignore */ |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
819 else if((c = getclient(ev->window))) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
820 switch (ev->atom) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
821 default: break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
822 case XA_WM_TRANSIENT_FOR: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
823 XGetTransientForHint(dpy, c->win, &trans); |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
824 if(!c->ispopup && (c->ispopup = (trans != 0))) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
825 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
826 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
827 case XA_WM_NORMAL_HINTS: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
828 updatesizehints(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
829 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
830 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
831 if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
832 updatetitle(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
833 if(c == sel) |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
834 drawbar(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
835 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
836 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
837 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
838 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
839 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
840 unmapnotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
841 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
842 XUnmapEvent *ev = &e->xunmap; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
843 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
844 if((c = getclient(ev->window))) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
845 unmanage(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
846 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
847 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
848 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
849 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
850 void (*handler[LASTEvent]) (XEvent *) = { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
851 [ButtonPress] = buttonpress, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
852 [ConfigureRequest] = configurerequest, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
853 [DestroyNotify] = destroynotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
854 [EnterNotify] = enternotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
855 [LeaveNotify] = leavenotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
856 [Expose] = expose, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
857 [KeyPress] = keypress, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
858 [MappingNotify] = mappingnotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
859 [MapRequest] = maprequest, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
860 [PropertyNotify] = propertynotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
861 [UnmapNotify] = unmapnotify |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
862 }; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
863 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
864 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
865 grabkeys(void) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
866 static unsigned int len = sizeof key / sizeof key[0]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
867 unsigned int i; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
868 KeyCode code; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
869 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
870 XUngrabKey(dpy, AnyKey, AnyModifier, root); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
871 for(i = 0; i < len; i++) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
872 code = XKeysymToKeycode(dpy, key[i].keysym); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
873 XGrabKey(dpy, code, key[i].mod, root, True, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
874 GrabModeAsync, GrabModeAsync); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
875 XGrabKey(dpy, code, key[i].mod | LockMask, root, True, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
876 GrabModeAsync, GrabModeAsync); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
877 XGrabKey(dpy, code, key[i].mod | numlockmask, root, True, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
878 GrabModeAsync, GrabModeAsync); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
879 XGrabKey(dpy, code, key[i].mod | numlockmask | LockMask, root, True, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
880 GrabModeAsync, GrabModeAsync); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
881 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
882 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
883 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
884 /* from draw.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
885 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
886 unsigned int |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
887 textnw(const char *text, unsigned int len) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
888 XRectangle r; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
889 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
890 if(dc.font.set) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
891 XmbTextExtents(dc.font.set, text, len, NULL, &r); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
892 return r.width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
893 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
894 return XTextWidth(dc.font.xfont, text, len); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
895 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
896 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
897 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
898 drawtext(const char *text, unsigned long col[ColLast]) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
899 int x, y, w, h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
900 static char buf[256]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
901 unsigned int len, olen; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
902 XGCValues gcv; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
903 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
904 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
905 XSetForeground(dpy, dc.gc, col[ColBG]); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
906 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
907 if(!text) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
908 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
909 w = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
910 olen = len = strlen(text); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
911 if(len >= sizeof buf) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
912 len = sizeof buf - 1; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
913 memcpy(buf, text, len); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
914 buf[len] = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
915 h = dc.font.ascent + dc.font.descent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
916 y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
917 x = dc.x + (h / 2); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
918 /* shorten text if necessary */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
919 while(len && (w = textnw(buf, len)) > dc.w - h) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
920 buf[--len] = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
921 if(len < olen) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
922 if(len > 1) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
923 buf[len - 1] = '.'; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
924 if(len > 2) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
925 buf[len - 2] = '.'; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
926 if(len > 3) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
927 buf[len - 3] = '.'; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
928 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
929 if(w > dc.w) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
930 return; /* too long */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
931 gcv.foreground = col[ColFG]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
932 if(dc.font.set) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
933 XChangeGC(dpy, dc.gc, GCForeground, &gcv); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
934 XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
935 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
936 gcv.font = dc.font.xfont->fid; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
937 XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
938 XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
939 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
940 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
941 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
942 void |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
943 drawbar(void) { |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
944 int x; |
771 | 945 unsigned long black[ColLast]; |
946 black[ColBG] = getcolor("#000000"); | |
947 black[ColFG] = getcolor("#ffffff"); | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
948 |
771 | 949 /* views */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
950 dc.x = dc.y = 0; |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
951 dc.w = textw(NAMETAGGED); |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
952 drawtext(NAMETAGGED, ( (seltag&&!viewfloats) ? dc.sel : dc.norm )); |
771 | 953 |
954 dc.x += dc.w; | |
955 dc.w = BORDERPX; | |
956 drawtext(NULL, black); | |
957 | |
958 dc.x += dc.w; | |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
959 dc.w = textw(NAMEUNTAGGED); |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
960 drawtext(NAMEUNTAGGED, ( (!seltag&&!viewfloats) ? dc.sel : dc.norm )); |
771 | 961 |
962 dc.x += dc.w; | |
963 dc.w = BORDERPX; | |
964 drawtext(NULL, black); | |
965 | |
966 /* status text */ | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
967 x = dc.x + dc.w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
968 dc.w = textw(stext); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
969 dc.x = sw - dc.w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
970 if(dc.x < x) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
971 dc.x = x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
972 dc.w = sw - x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
973 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
974 drawtext(stext, dc.norm); |
771 | 975 |
976 /* client title */ | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
977 if((dc.w = dc.x - x) > bh) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
978 dc.x = x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
979 drawtext(sel ? sel->name : NULL, dc.norm); |
771 | 980 |
981 dc.x += dc.w; | |
982 dc.w = BORDERPX; | |
983 drawtext(NULL, black); | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
984 } |
771 | 985 |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
986 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
987 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
988 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
989 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
990 unsigned long |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
991 getcolor(const char *colstr) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
992 Colormap cmap = DefaultColormap(dpy, screen); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
993 XColor color; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
994 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
995 if(!XAllocNamedColor(dpy, cmap, colstr, &color, &color)) |
778 | 996 die("error, cannot allocate color '%s'\n", colstr); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
997 return color.pixel; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
998 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
999 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1000 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1001 setfont(const char *fontstr) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1002 char *def, **missing; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1003 int i, n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1004 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1005 missing = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1006 if(dc.font.set) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1007 XFreeFontSet(dpy, dc.font.set); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1008 dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1009 if(missing) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1010 while(n--) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1011 fprintf(stderr, "missing fontset: %s\n", missing[n]); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1012 XFreeStringList(missing); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1013 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1014 if(dc.font.set) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1015 XFontSetExtents *font_extents; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1016 XFontStruct **xfonts; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1017 char **font_names; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1018 dc.font.ascent = dc.font.descent = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1019 font_extents = XExtentsOfFontSet(dc.font.set); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1020 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1021 for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1022 if(dc.font.ascent < (*xfonts)->ascent) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1023 dc.font.ascent = (*xfonts)->ascent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1024 if(dc.font.descent < (*xfonts)->descent) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1025 dc.font.descent = (*xfonts)->descent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1026 xfonts++; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1027 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1028 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1029 if(dc.font.xfont) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1030 XFreeFont(dpy, dc.font.xfont); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1031 dc.font.xfont = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1032 if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))) |
778 | 1033 die("error, cannot load font: '%s'\n", fontstr); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1034 dc.font.ascent = dc.font.xfont->ascent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1035 dc.font.descent = dc.font.xfont->descent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1036 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1037 dc.font.height = dc.font.ascent + dc.font.descent; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1038 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1039 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1040 unsigned int |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1041 textw(const char *text) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1042 return textnw(text, strlen(text)) + dc.font.height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1043 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1044 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1045 /* from client.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1046 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1047 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1048 detachstack(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1049 Client **tc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1050 for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1051 *tc = c->snext; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1052 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1053 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1054 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1055 grabbuttons(Client *c, Bool focused) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1056 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1057 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1058 if(focused) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1059 XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1060 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1061 XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1062 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1063 XGrabButton(dpy, Button1, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1064 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1065 XGrabButton(dpy, Button1, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1066 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1067 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1068 XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1069 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1070 XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1071 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1072 XGrabButton(dpy, Button2, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1073 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1074 XGrabButton(dpy, Button2, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1075 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1076 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1077 XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1078 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1079 XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1080 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1081 XGrabButton(dpy, Button3, MODKEY | numlockmask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1082 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1083 XGrabButton(dpy, Button3, MODKEY | numlockmask | LockMask, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1084 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1085 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1086 XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1087 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1088 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1089 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1090 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1091 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1092 setclientstate(Client *c, long state) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1093 long data[] = {state, None}; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1094 XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1095 PropModeReplace, (unsigned char *)data, 2); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1096 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1097 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1098 int |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1099 xerrordummy(Display *dsply, XErrorEvent *ee) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1100 return 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1101 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1102 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1103 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1104 configure(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1105 XEvent synev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1106 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1107 synev.type = ConfigureNotify; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1108 synev.xconfigure.display = dpy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1109 synev.xconfigure.event = c->win; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1110 synev.xconfigure.window = c->win; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1111 synev.xconfigure.x = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1112 synev.xconfigure.y = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1113 synev.xconfigure.width = c->w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1114 synev.xconfigure.height = c->h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1115 synev.xconfigure.border_width = c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1116 synev.xconfigure.above = None; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1117 XSendEvent(dpy, c->win, True, NoEventMask, &synev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1118 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1119 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1120 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1121 focus(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1122 if(c && !isvisible(c)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1123 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1124 if(sel && sel != c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1125 grabbuttons(sel, False); |
764 | 1126 XSetWindowBorder(dpy, sel->win, dc.norm[ColBG]); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1127 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1128 if(c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1129 detachstack(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1130 c->snext = stack; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1131 stack = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1132 grabbuttons(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1133 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1134 sel = c; |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1135 drawbar(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1136 if(!selscreen) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1137 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1138 if(c) { |
764 | 1139 XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1140 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1141 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1142 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1143 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1144 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1145 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1146 Client * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1147 getclient(Window w) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1148 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1149 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1150 for(c = clients; c; c = c->next) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1151 if(c->win == w) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1152 return c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1153 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1154 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1155 return NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1156 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1157 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1158 Bool |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1159 isprotodel(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1160 int i, n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1161 Atom *protocols; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1162 Bool ret = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1163 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1164 if(XGetWMProtocols(dpy, c->win, &protocols, &n)) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1165 for(i = 0; !ret && i < n; i++) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1166 if(protocols[i] == wmatom[WMDelete]) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1167 ret = True; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1168 XFree(protocols); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1169 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1170 return ret; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1171 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1172 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1173 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
1174 killclient() { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1175 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1176 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1177 if(isprotodel(sel)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1178 sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1179 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1180 XKillClient(dpy, sel->win); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1181 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1182 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1183 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1184 manage(Window w, XWindowAttributes *wa) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1185 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1186 Window trans; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1187 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1188 c = emallocz(sizeof(Client)); |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
1189 c->tag = True; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1190 c->win = w; |
787
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1191 if (wa->width < sw) { |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1192 c->x = rand() % (sw - wa->width); |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1193 } |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1194 if (wa->height < sh) { |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1195 c->y = rand() % (sh - wa->height); |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1196 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1197 c->w = wa->width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1198 c->h = wa->height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1199 if(c->w == sw && c->h == sh) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1200 c->border = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1201 c->x = sx; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1202 c->y = sy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1203 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1204 c->border = BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1205 if(c->x + c->w + 2 * c->border > wax + waw) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1206 c->x = wax + waw - c->w - 2 * c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1207 if(c->y + c->h + 2 * c->border > way + wah) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1208 c->y = way + wah - c->h - 2 * c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1209 if(c->x < wax) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1210 c->x = wax; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1211 if(c->y < way) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1212 c->y = way; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1213 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1214 updatesizehints(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1215 XSelectInput(dpy, c->win, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1216 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1217 XGetTransientForHint(dpy, c->win, &trans); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1218 grabbuttons(c, False); |
764 | 1219 XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1220 updatetitle(c); |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
1221 settag(c, getclient(trans)); |
786
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
1222 if(!c->ispopup) |
e65be4ffdbdc
Add handling for popup windows
markus schnalke <meillo@marmaro.de>
parents:
784
diff
changeset
|
1223 c->ispopup = trans || c->isfixed; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1224 if(clients) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1225 clients->prev = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1226 c->next = clients; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1227 c->snext = stack; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1228 stack = clients = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1229 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1230 XMapWindow(dpy, c->win); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1231 setclientstate(c, NormalState); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1232 if(isvisible(c)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1233 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1234 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1235 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1236 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1237 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1238 resize(Client *c, Bool sizehints) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1239 float actual, dx, dy, max, min; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1240 XWindowChanges wc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1241 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1242 if(c->w <= 0 || c->h <= 0) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1243 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1244 if(sizehints) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1245 if(c->minw && c->w < c->minw) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1246 c->w = c->minw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1247 if(c->minh && c->h < c->minh) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1248 c->h = c->minh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1249 if(c->maxw && c->w > c->maxw) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1250 c->w = c->maxw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1251 if(c->maxh && c->h > c->maxh) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1252 c->h = c->maxh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1253 /* inspired by algorithm from fluxbox */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1254 if(c->minay > 0 && c->maxay && (c->h - c->baseh) > 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1255 dx = (float)(c->w - c->basew); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1256 dy = (float)(c->h - c->baseh); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1257 min = (float)(c->minax) / (float)(c->minay); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1258 max = (float)(c->maxax) / (float)(c->maxay); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1259 actual = dx / dy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1260 if(max > 0 && min > 0 && actual > 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1261 if(actual < min) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1262 dy = (dx * min + dy) / (min * min + 1); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1263 dx = dy * min; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1264 c->w = (int)dx + c->basew; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1265 c->h = (int)dy + c->baseh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1266 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1267 else if(actual > max) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1268 dy = (dx * min + dy) / (max * max + 1); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1269 dx = dy * min; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1270 c->w = (int)dx + c->basew; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1271 c->h = (int)dy + c->baseh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1272 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1273 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1274 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1275 if(c->incw) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1276 c->w -= (c->w - c->basew) % c->incw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1277 if(c->inch) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1278 c->h -= (c->h - c->baseh) % c->inch; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1279 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1280 if(c->w == sw && c->h == sh) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1281 c->border = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1282 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1283 c->border = BORDERPX; |
787
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1284 /* move outside window back to original place */ |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1285 if(c->x > sw) { |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1286 c->x -= 2 * sw; |
eecb13b34511
Put floating windows on random starting positions
markus schnalke <meillo@marmaro.de>
parents:
786
diff
changeset
|
1287 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1288 /* offscreen appearance fixes */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1289 if(c->x > sw) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1290 c->x = sw - c->w - 2 * c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1291 if(c->y > sh) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1292 c->y = sh - c->h - 2 * c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1293 if(c->x + c->w + 2 * c->border < sx) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1294 c->x = sx; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1295 if(c->y + c->h + 2 * c->border < sy) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1296 c->y = sy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1297 wc.x = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1298 wc.y = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1299 wc.width = c->w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1300 wc.height = c->h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1301 wc.border_width = c->border; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1302 XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1303 configure(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1304 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1305 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1306 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1307 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1308 updatesizehints(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1309 long msize; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1310 XSizeHints size; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1311 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1312 if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1313 size.flags = PSize; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1314 c->flags = size.flags; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1315 if(c->flags & PBaseSize) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1316 c->basew = size.base_width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1317 c->baseh = size.base_height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1318 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1319 c->basew = c->baseh = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1320 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1321 if(c->flags & PResizeInc) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1322 c->incw = size.width_inc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1323 c->inch = size.height_inc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1324 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1325 c->incw = c->inch = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1326 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1327 if(c->flags & PMaxSize) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1328 c->maxw = size.max_width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1329 c->maxh = size.max_height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1330 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1331 c->maxw = c->maxh = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1332 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1333 if(c->flags & PMinSize) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1334 c->minw = size.min_width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1335 c->minh = size.min_height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1336 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1337 c->minw = c->minh = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1338 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1339 if(c->flags & PAspect) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1340 c->minax = size.min_aspect.x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1341 c->minay = size.min_aspect.y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1342 c->maxax = size.max_aspect.x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1343 c->maxay = size.max_aspect.y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1344 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1345 c->minax = c->minay = c->maxax = c->maxay = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1346 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1347 c->isfixed = (c->maxw && c->minw && c->maxh && c->minh && |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1348 c->maxw == c->minw && c->maxh == c->minh); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1349 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1350 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1351 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1352 updatetitle(Client *c) { |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1353 if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name)) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1354 gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1355 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1356 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1357 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1358 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1359 Bool |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1360 gettextprop(Window w, Atom atom, char* text, unsigned int size) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1361 char **list = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1362 int n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1363 XTextProperty name; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1364 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1365 if (!text || size == 0) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1366 return False; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1367 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1368 text[0] = '\0'; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1369 XGetTextProperty(dpy, w, &name, atom); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1370 if(!name.nitems) |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1371 return False; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1372 if(name.encoding == XA_STRING) |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1373 strncpy(text, (char *)name.value, size - 1); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1374 else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1375 if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) { |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1376 strncpy(text, *list, size - 1); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1377 XFreeStringList(list); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1378 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1379 } |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1380 text[size - 1] = '\0'; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1381 XFree(name.value); |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1382 return True; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1383 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1384 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1385 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1386 unmanage(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1387 Client *nc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1388 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1389 /* The server grab construct avoids race conditions. */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1390 XGrabServer(dpy); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1391 XSetErrorHandler(xerrordummy); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1392 detach(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1393 detachstack(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1394 if(sel == c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1395 for(nc = stack; nc && !isvisible(nc); nc = nc->snext); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1396 focus(nc); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1397 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1398 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1399 setclientstate(c, WithdrawnState); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1400 free(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1401 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1402 XSetErrorHandler(xerror); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1403 XUngrabServer(dpy); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1404 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1405 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1406 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1407 /* from main.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1408 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1409 void |
487 | 1410 cleanup(void) { |
645 | 1411 while(stack) { |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
697
diff
changeset
|
1412 resize(stack, True); |
645 | 1413 unmanage(stack); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1414 } |
295 | 1415 if(dc.font.set) |
1416 XFreeFontSet(dpy, dc.font.set); | |
1417 else | |
1418 XFreeFont(dpy, dc.font.xfont); | |
292 | 1419 XUngrabKey(dpy, AnyKey, AnyModifier, root); |
295 | 1420 XFreePixmap(dpy, dc.drawable); |
1421 XFreeGC(dpy, dc.gc); | |
309
204427dcc087
corrected order of cleanup code
Anselm R.Garbe <arg@10ksloc.org>
parents:
302
diff
changeset
|
1422 XDestroyWindow(dpy, barwin); |
616 | 1423 XFreeCursor(dpy, cursor[CurNormal]); |
1424 XFreeCursor(dpy, cursor[CurResize]); | |
1425 XFreeCursor(dpy, cursor[CurMove]); | |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1426 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); |
292 | 1427 XSync(dpy, False); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1428 } |
0 | 1429 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1430 void |
487 | 1431 scan(void) { |
0 | 1432 unsigned int i, num; |
123 | 1433 Window *wins, d1, d2; |
0 | 1434 XWindowAttributes wa; |
1435 | |
292 | 1436 wins = NULL; |
0 | 1437 if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { |
1438 for(i = 0; i < num; i++) { | |
1439 if(!XGetWindowAttributes(dpy, wins[i], &wa)) | |
1440 continue; | |
1441 if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) | |
1442 continue; | |
1443 if(wa.map_state == IsViewable) | |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
1444 manage(wins[i], &wa); |
0 | 1445 } |
1446 } | |
1447 if(wins) | |
1448 XFree(wins); | |
1449 } | |
1450 | |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1451 void |
487 | 1452 setup(void) { |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1453 int i, j; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1454 unsigned int mask; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1455 Window w; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1456 XModifierKeymap *modmap; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1457 XSetWindowAttributes wa; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1458 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1459 screen = DefaultScreen(dpy); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1460 root = RootWindow(dpy, screen); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1461 |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1462 /* init atoms */ |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1463 wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1464 wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
725
d99be681d502
handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle this in dwm as well
Anselm R. Garbe <arg@suckless.org>
parents:
716
diff
changeset
|
1465 wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1466 netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1467 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1468 XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1469 PropModeReplace, (unsigned char *) netatom, NetLast); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1470 /* init cursors */ |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1471 cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1472 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1473 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1474 /* init modifier map */ |
679
5f0134b88b8d
small fix of initial numlockmask value
Anselm R. Garbe <arg@suckless.org>
parents:
675
diff
changeset
|
1475 numlockmask = 0; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1476 modmap = XGetModifierMapping(dpy); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1477 for (i = 0; i < 8; i++) { |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1478 for (j = 0; j < modmap->max_keypermod; j++) { |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1479 if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1480 numlockmask = (1 << i); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1481 } |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1482 } |
616 | 1483 XFreeModifiermap(modmap); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1484 /* select for events */ |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
458
diff
changeset
|
1485 wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1486 | EnterWindowMask | LeaveWindowMask | PropertyChangeMask; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1487 wa.cursor = cursor[CurNormal]; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1488 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1489 grabkeys(); |
784
f259785bac44
Start up with the not-sel view.
markus schnalke <meillo@marmaro.de>
parents:
782
diff
changeset
|
1490 seltag = False; |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
1491 viewfloats = False; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1492 /* style */ |
353
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1493 dc.norm[ColBG] = getcolor(NORMBGCOLOR); |
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1494 dc.norm[ColFG] = getcolor(NORMFGCOLOR); |
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1495 dc.sel[ColBG] = getcolor(SELBGCOLOR); |
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1496 dc.sel[ColFG] = getcolor(SELFGCOLOR); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1497 setfont(FONT); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1498 /* geometry */ |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1499 sx = sy = 0; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1500 sw = DisplayWidth(dpy, screen); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1501 sh = DisplayHeight(dpy, screen); |
650
f3b8c71a69d4
experimental version which allows master clients being increased/decreased
Anselm R. Garbe <arg@suckless.org>
parents:
645
diff
changeset
|
1502 nmaster = NMASTER; |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
1503 arrange1 = DEFMODE; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
1504 arrange2 = DEFMODE; |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1505 /* bar */ |
353
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1506 dc.h = bh = dc.font.height + 2; |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1507 wa.override_redirect = 1; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1508 wa.background_pixmap = ParentRelative; |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1509 wa.event_mask = ButtonPressMask | ExposureMask; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1510 barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, |
739
7834ffd650d5
added TOPBAR option for making the bar appear what the user likes
Anselm R. Garbe <arg@suckless.org>
parents:
737
diff
changeset
|
1511 DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1512 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1513 XDefineCursor(dpy, barwin, cursor[CurNormal]); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1514 XMapRaised(dpy, barwin); |
565 | 1515 /* windowarea */ |
1516 wax = sx; | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1517 way = sy + bh; |
565 | 1518 wah = sh - bh; |
1519 waw = sw; | |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1520 /* pixmap for everything */ |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1521 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1522 dc.gc = XCreateGC(dpy, root, 0, 0); |
344
93192711a36a
changing tag indicator through underline
Anselm R. Garbe <arg@10kloc.org>
parents:
339
diff
changeset
|
1523 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1524 /* multihead support */ |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
1525 selscreen = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1526 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1527 updatestatus(); |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1528 } |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1529 |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1530 /* |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1531 * Startup Error handler to check if another window manager |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1532 * is already running. |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1533 */ |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1534 int |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
458
diff
changeset
|
1535 xerrorstart(Display *dsply, XErrorEvent *ee) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1536 otherwm = True; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1537 return -1; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1538 } |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1539 |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1540 void |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
458
diff
changeset
|
1541 sendevent(Window w, Atom a, long value) { |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1542 XEvent e; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1543 |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1544 e.type = ClientMessage; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1545 e.xclient.window = w; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1546 e.xclient.message_type = a; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1547 e.xclient.format = 32; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1548 e.xclient.data.l[0] = value; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1549 e.xclient.data.l[1] = CurrentTime; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1550 XSendEvent(dpy, w, False, NoEventMask, &e); |
79
aabebd6e61f3
fixed XSync handling and finished man page
Anselm R. Garbe <garbeam@wmii.de>
parents:
78
diff
changeset
|
1551 XSync(dpy, False); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1552 } |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1553 |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1554 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
1555 quit() { |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1556 running = False; |
75 | 1557 } |
1558 | |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1559 /* There's no way to check accesses to destroyed windows, thus those cases are |
84
052fe7498930
ordered variables in structs and source files alphabetically
Anselm R. Garbe <garbeam@wmii.de>
parents:
79
diff
changeset
|
1560 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |
455
4e3e22673073
fixed some other comments, now also the code side seems to be at a level to be reviewed by experienced programmers
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
1561 * default error handler, which may call exit. |
0 | 1562 */ |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
1563 int |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
458
diff
changeset
|
1564 xerror(Display *dpy, XErrorEvent *ee) { |
75 | 1565 if(ee->error_code == BadWindow |
123 | 1566 || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
1567 || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) | |
1568 || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) | |
1569 || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) | |
1570 || (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) | |
458
81fcd7ddafee
applied Christof Musik's multihead patch for a pathologic cornercase
Anselm R. Garbe <arg@10kloc.org>
parents:
455
diff
changeset
|
1571 || (ee->request_code == X_GrabKey && ee->error_code == BadAccess) |
81fcd7ddafee
applied Christof Musik's multihead patch for a pathologic cornercase
Anselm R. Garbe <arg@10kloc.org>
parents:
455
diff
changeset
|
1572 || (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) |
0 | 1573 return 0; |
772 | 1574 fprintf(stderr, "aewl: fatal error: request code=%d, error code=%d\n", |
123 | 1575 ee->request_code, ee->error_code); |
455
4e3e22673073
fixed some other comments, now also the code side seems to be at a level to be reviewed by experienced programmers
Anselm R. Garbe <arg@10kloc.org>
parents:
446
diff
changeset
|
1576 return xerrorxlib(dpy, ee); /* may call exit */ |
27
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
26
diff
changeset
|
1577 } |
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
26
diff
changeset
|
1578 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1579 void |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1580 checkotherwm(void) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1581 otherwm = False; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1582 xerrorxlib = XSetErrorHandler(xerrorstart); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1583 /* this causes an error if some other window manager is running */ |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1584 XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1585 XSync(dpy, False); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1586 if(otherwm) { |
778 | 1587 die("aewl: another window manager is already running\n"); |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1588 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1589 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1590 XSetErrorHandler(xerror); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1591 XSync(dpy, False); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1592 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1593 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1594 void |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1595 run(void) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1596 XEvent ev; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1597 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1598 XSync(dpy, False); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1599 /* main event loop */ |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1600 while(running && !XNextEvent(dpy, &ev)) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1601 if(handler[ev.type]) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1602 (handler[ev.type])(&ev); /* call handler */ |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1603 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1604 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1605 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1606 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1607 void |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1608 updatestatus(void) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1609 if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1610 strcpy(stext, "aewl-"VERSION); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1611 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1612 drawbar(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1613 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1614 |
0 | 1615 int |
461
9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Anselm R. Garbe <arg@10kloc.org>
parents:
458
diff
changeset
|
1616 main(int argc, char *argv[]) { |
0 | 1617 |
137
77922a389fa8
simplified main.c, switching back to single urxvt usage
arg@10ksloc.org
parents:
126
diff
changeset
|
1618 if(argc == 2 && !strncmp("-v", argv[1], 3)) { |
772 | 1619 fputs("aewl-"VERSION", Copyright 2008 markus schnalke <meillo@marmaro.de>\n", stdout); |
1620 fputs("forked off dwm-3.4, (C)opyright MMVI-MMVII Anselm R. Garbe\n", stdout); | |
137
77922a389fa8
simplified main.c, switching back to single urxvt usage
arg@10ksloc.org
parents:
126
diff
changeset
|
1621 exit(EXIT_SUCCESS); |
755 | 1622 } else if(argc != 1) { |
778 | 1623 die("usage: aewl [-v]\n"); |
0 | 1624 } |
619 | 1625 setlocale(LC_CTYPE, ""); |
0 | 1626 dpy = XOpenDisplay(0); |
755 | 1627 if(!dpy) { |
778 | 1628 die("aewl: cannot open display\n"); |
755 | 1629 } |
3
e969f3575b7a
several new changes, made gridmenu working
Anselm R. Garbe <garbeam@wmii.de>
parents:
2
diff
changeset
|
1630 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1631 checkotherwm(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1632 setup(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1633 scan(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1634 run(); |
0 | 1635 cleanup(); |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1636 |
0 | 1637 XCloseDisplay(dpy); |
1638 return 0; | |
1639 } |