Mercurial > aewl
annotate aewl.c @ 782:f1e806b34697
created separated floating space; added per space mode
Eventually I realized the plans I had for so long.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Mon, 05 Sep 2011 23:05:08 +0200 |
parents | 7ea91d4d0882 |
children | f259785bac44 |
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; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
93 Bool isfixed, isfloat, ismax; |
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) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
215 for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); |
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)) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
274 if(c->isfloat) { |
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)) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
314 if(c->isfloat) { |
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; |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
383 /*if(sel->isfloat)*/ |
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); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
385 |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
386 /* |
768
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
387 if(!sel->isfloat) |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
388 XLowerWindow(dpy, sel->win); |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
389 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
390 if(c == sel) |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
391 continue; |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
392 XLowerWindow(dpy, c->win); |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
393 } |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
394 */ |
754
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 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
397 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
|
398 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
399 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
400 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
401 togglefloat() { |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
402 if (!sel) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
403 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
404 sel->isfloat = !sel->isfloat; |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
405 floattoggle(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
406 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
407 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
408 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
409 togglemode() { |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
410 /* toggle between tile and max */ |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
411 if (viewfloats) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
412 return; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
413 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
414 if (seltag) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
415 arrange1 = (arrange1 == dotile) ? domax : dotile; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
416 } else { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
417 arrange2 = (arrange2 == dotile) ? domax : dotile; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
418 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
419 if(sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
420 arrange(); |
776
a3399a8964c7
no need to update the bar when the layout changes
meillo@marmaro.de
parents:
773
diff
changeset
|
421 zoom(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
422 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
423 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
424 void |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
425 arrange() { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
426 if (seltag) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
427 arrange1(); |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
428 } else { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
429 arrange2(); |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
430 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
431 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
432 |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
433 void |
755 | 434 toggleview() { |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
435 if (viewfloats) { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
436 return; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
437 } |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
438 seltag = !seltag; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
439 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
440 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
441 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
442 void |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
443 floattoggle() { |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
444 viewfloats = !viewfloats; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
445 arrange(); |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
446 } |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
447 |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
448 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
449 zoom() { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
450 unsigned int n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
451 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
452 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
453 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
454 return; |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
455 if(sel->isfloat) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
456 togglemax(sel); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
457 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
458 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
459 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
|
460 n++; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
461 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
462 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
|
463 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
|
464 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
465 detach(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
466 if(clients) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
467 clients->prev = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
468 c->next = clients; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
469 clients = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
470 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
471 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
472 } |
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 /* from util.c */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
475 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
476 void * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
477 emallocz(unsigned int size) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
478 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
|
479 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
480 if(!res) |
778 | 481 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
|
482 return res; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
483 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
484 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
485 void |
778 | 486 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
|
487 va_list ap; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
488 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
489 va_start(ap, errstr); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
490 vfprintf(stderr, errstr, ap); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
491 va_end(ap); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
492 exit(EXIT_FAILURE); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
493 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
494 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
495 void |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
496 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
|
497 static char *shell = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
498 |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
499 if(!cmd) |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
500 return; |
769 | 501 if(!(shell = getenv("SHELL"))) |
502 shell = "/bin/sh"; | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
503 /* 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
|
504 * 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
|
505 if(fork() == 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
506 if(fork() == 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
507 if(dpy) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
508 close(ConnectionNumber(dpy)); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
509 setsid(); |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
510 execl(shell, shell, "-c", cmd, (char *)NULL); |
772 | 511 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
|
512 perror(" failed"); |
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 exit(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 wait(0); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
517 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
518 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
519 /* 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
|
520 |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
521 Client * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
522 getnext(Client *c) { |
768
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
523 while(c && !isvisible(c)) { |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
524 c = c->next; |
a1c6805aa018
simplified and corrected domax() and restack()
meillo@marmaro.de
parents:
767
diff
changeset
|
525 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
526 return c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
527 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
528 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
529 void |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
530 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
|
531 unsigned int i; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
532 XClassHint ch = { 0 }; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
533 |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
534 if(trans) { |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
535 c->tag = trans->tag; |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
536 return; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
537 } |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
538 c->tag = seltag; /* default */ |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
539 XGetClassHint(dpy, c->win, &ch); |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
540 len = sizeof rule / sizeof rule[0]; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
541 for(i = 0; i < len; i++) { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
542 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
|
543 || (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
|
544 || (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
|
545 c->isfloat = rule[i].isfloat; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
546 if (rule[i].tag < 0) { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
547 c->tag = seltag; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
548 } else if (rule[i].tag) { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
549 c->tag = True; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
550 } else { |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
551 c->tag = False; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
552 } |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
553 break; |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
554 } |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
555 } |
767
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
556 if(ch.res_class) |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
557 XFree(ch.res_class); |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
558 if(ch.res_name) |
706991d15451
removed rexexp for old strstr matching; simplifications
meillo@marmaro.de
parents:
766
diff
changeset
|
559 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
|
560 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
561 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
562 void |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
563 toggletag() { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
564 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
565 return; |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
566 sel->tag = !sel->tag; |
755 | 567 toggleview(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
568 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
569 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
570 /* from event.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
571 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
572 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
573 movemouse(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
574 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
|
575 unsigned int dui; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
576 Window dummy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
577 XEvent ev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
578 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
579 ocx = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
580 ocy = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
581 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
|
582 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
|
583 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
584 c->ismax = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
585 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
|
586 for(;;) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
587 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
|
588 switch (ev.type) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
589 case ButtonRelease: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
590 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
591 XUngrabPointer(dpy, CurrentTime); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
592 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
593 case ConfigureRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
594 case Expose: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
595 case MapRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
596 handler[ev.type](&ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
597 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
598 case MotionNotify: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
599 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
600 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
|
601 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
|
602 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
|
603 c->x = wax; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
604 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
|
605 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
|
606 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
|
607 c->y = way; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
608 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
|
609 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
|
610 resize(c, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
611 break; |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
615 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
616 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
617 resizemouse(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
618 int ocx, ocy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
619 int nw, nh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
620 XEvent ev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
621 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
622 ocx = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
623 ocy = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
624 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
|
625 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
|
626 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
627 c->ismax = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
628 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
|
629 for(;;) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
630 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
|
631 switch(ev.type) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
632 case ButtonRelease: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
633 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
634 XUngrabPointer(dpy, CurrentTime); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
635 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
636 case ConfigureRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
637 case Expose: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
638 case MapRequest: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
639 handler[ev.type](&ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
640 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
641 case MotionNotify: |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
642 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
643 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
|
644 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
|
645 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
|
646 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
|
647 resize(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
648 break; |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
652 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
653 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
654 buttonpress(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
655 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
656 XButtonPressedEvent *ev = &e->xbutton; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
657 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
658 if(barwin == ev->window) { |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
659 return; |
763
17428bca4a12
removed group-toggle by mouse; small cleanup
meillo@marmaro.de
parents:
762
diff
changeset
|
660 } |
17428bca4a12
removed group-toggle by mouse; small cleanup
meillo@marmaro.de
parents:
762
diff
changeset
|
661 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
|
662 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
663 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
|
664 return; |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
665 if(ev->button == Button1 && c->isfloat) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
666 restack(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
667 movemouse(c); |
761
59ce221b9a37
removed global float (dofloat); number of tags is fixed (2)
meillo@marmaro.de
parents:
760
diff
changeset
|
668 } else if(ev->button == Button3 && c->isfloat && !c->isfixed) { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
669 restack(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
670 resizemouse(c); |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
674 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
675 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
676 configurerequest(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
677 unsigned long newmask; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
678 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
679 XConfigureRequestEvent *ev = &e->xconfigurerequest; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
680 XWindowChanges wc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
681 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
682 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
|
683 c->ismax = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
684 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
|
685 c->x = ev->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
686 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
|
687 c->y = ev->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
688 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
|
689 c->w = ev->width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
690 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
|
691 c->h = ev->height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
692 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
|
693 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
|
694 wc.x = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
695 wc.y = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
696 wc.width = c->w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
697 wc.height = c->h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
698 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
|
699 if(newmask) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
700 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
|
701 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
702 configure(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
703 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
704 if(c->isfloat) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
705 resize(c, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
706 if(!isvisible(c)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
707 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
|
708 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
709 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
710 arrange(); |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
711 } else { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
712 wc.x = ev->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
713 wc.y = ev->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
714 wc.width = ev->width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
715 wc.height = ev->height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
716 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
|
717 wc.sibling = ev->above; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
718 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
|
719 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
|
720 XSync(dpy, False); |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
723 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
724 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
725 destroynotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
726 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
727 XDestroyWindowEvent *ev = &e->xdestroywindow; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
728 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
729 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
|
730 unmanage(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
731 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
732 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
733 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
734 enternotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
735 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
736 XCrossingEvent *ev = &e->xcrossing; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
737 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
738 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
|
739 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
740 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
|
741 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
742 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
|
743 selscreen = True; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
744 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
|
745 focus(c); |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
748 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
749 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
750 expose(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
751 XExposeEvent *ev = &e->xexpose; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
752 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
753 if(ev->count == 0) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
754 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
|
755 drawbar(); |
754
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
758 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
759 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
760 keypress(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
761 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
|
762 unsigned int i; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
763 KeySym keysym; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
764 XKeyEvent *ev = &e->xkey; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
765 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
766 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
|
767 for(i = 0; i < len; i++) { |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
768 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
|
769 if(key[i].func) |
758
bc512840e5a5
removed union arg (using const char* cmd now)
meillo@marmaro.de
parents:
756
diff
changeset
|
770 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
|
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
774 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
775 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
776 leavenotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
777 XCrossingEvent *ev = &e->xcrossing; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
778 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
779 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
|
780 selscreen = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
781 focus(NULL); |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
784 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
785 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
786 mappingnotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
787 XMappingEvent *ev = &e->xmapping; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
788 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
789 XRefreshKeyboardMapping(ev); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
790 if(ev->request == MappingKeyboard) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
791 grabkeys(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
792 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
793 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
794 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
795 maprequest(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
796 static XWindowAttributes wa; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
797 XMapRequestEvent *ev = &e->xmaprequest; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
798 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
799 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
|
800 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
801 if(wa.override_redirect) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
802 XSelectInput(dpy, ev->window, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
803 (StructureNotifyMask | PropertyChangeMask)); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
804 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
805 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
806 if(!getclient(ev->window)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
807 manage(ev->window, &wa); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
808 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
809 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
810 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
811 propertynotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
812 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
813 Window trans; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
814 XPropertyEvent *ev = &e->xproperty; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
815 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
816 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
|
817 updatestatus(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
818 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
|
819 return; /* ignore */ |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
820 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
|
821 switch (ev->atom) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
822 default: break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
823 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
|
824 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
|
825 if(!c->isfloat && (c->isfloat = (trans != 0))) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
826 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
827 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
828 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
|
829 updatesizehints(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
830 break; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
831 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
832 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
|
833 updatetitle(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
834 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
|
835 drawbar(); |
754
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
839 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
840 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
841 unmapnotify(XEvent *e) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
842 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
843 XUnmapEvent *ev = &e->xunmap; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
844 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
845 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
|
846 unmanage(c); |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
851 void (*handler[LASTEvent]) (XEvent *) = { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
852 [ButtonPress] = buttonpress, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
853 [ConfigureRequest] = configurerequest, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
854 [DestroyNotify] = destroynotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
855 [EnterNotify] = enternotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
856 [LeaveNotify] = leavenotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
857 [Expose] = expose, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
858 [KeyPress] = keypress, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
859 [MappingNotify] = mappingnotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
860 [MapRequest] = maprequest, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
861 [PropertyNotify] = propertynotify, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
862 [UnmapNotify] = unmapnotify |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
865 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
866 grabkeys(void) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
867 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
|
868 unsigned int i; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
869 KeyCode code; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
870 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
871 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
|
872 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
|
873 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
|
874 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
|
875 GrabModeAsync, GrabModeAsync); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
876 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
|
877 GrabModeAsync, GrabModeAsync); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
878 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
|
879 GrabModeAsync, GrabModeAsync); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
880 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
|
881 GrabModeAsync, GrabModeAsync); |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
884 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
885 /* from draw.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
886 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
887 unsigned int |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
888 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
|
889 XRectangle r; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
890 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
891 if(dc.font.set) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
892 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
|
893 return r.width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
894 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
895 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
|
896 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
897 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
898 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
899 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
|
900 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
|
901 static char buf[256]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
902 unsigned int len, olen; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
903 XGCValues gcv; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
904 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
|
905 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
906 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
|
907 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
|
908 if(!text) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
909 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
910 w = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
911 olen = len = strlen(text); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
912 if(len >= sizeof buf) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
913 len = sizeof buf - 1; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
914 memcpy(buf, text, len); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
915 buf[len] = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
916 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
|
917 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
|
918 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
|
919 /* shorten text if necessary */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
920 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
|
921 buf[--len] = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
922 if(len < olen) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
923 if(len > 1) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
924 buf[len - 1] = '.'; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
925 if(len > 2) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
926 buf[len - 2] = '.'; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
927 if(len > 3) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
928 buf[len - 3] = '.'; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
929 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
930 if(w > dc.w) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
931 return; /* too long */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
932 gcv.foreground = col[ColFG]; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
933 if(dc.font.set) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
934 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
|
935 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
|
936 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
937 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
|
938 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
|
939 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
|
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
943 void |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
944 drawbar(void) { |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
945 int x; |
771 | 946 unsigned long black[ColLast]; |
947 black[ColBG] = getcolor("#000000"); | |
948 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
|
949 |
771 | 950 /* views */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
951 dc.x = dc.y = 0; |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
952 dc.w = textw(NAMETAGGED); |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
953 drawtext(NAMETAGGED, ( (seltag&&!viewfloats) ? dc.sel : dc.norm )); |
771 | 954 |
955 dc.x += dc.w; | |
956 dc.w = BORDERPX; | |
957 drawtext(NULL, black); | |
958 | |
959 dc.x += dc.w; | |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
960 dc.w = textw(NAMEUNTAGGED); |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
961 drawtext(NAMEUNTAGGED, ( (!seltag&&!viewfloats) ? dc.sel : dc.norm )); |
771 | 962 |
963 dc.x += dc.w; | |
964 dc.w = BORDERPX; | |
965 drawtext(NULL, black); | |
966 | |
967 /* status text */ | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
968 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
|
969 dc.w = textw(stext); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
970 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
|
971 if(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.x = x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
973 dc.w = sw - x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
974 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
975 drawtext(stext, dc.norm); |
771 | 976 |
977 /* client title */ | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
978 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
|
979 dc.x = x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
980 drawtext(sel ? sel->name : NULL, dc.norm); |
771 | 981 |
982 dc.x += dc.w; | |
983 dc.w = BORDERPX; | |
984 drawtext(NULL, black); | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
985 } |
771 | 986 |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
987 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
|
988 XSync(dpy, False); |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
991 unsigned long |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
992 getcolor(const char *colstr) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
993 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
|
994 XColor color; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
995 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
996 if(!XAllocNamedColor(dpy, cmap, colstr, &color, &color)) |
778 | 997 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
|
998 return color.pixel; |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1001 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1002 setfont(const char *fontstr) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1003 char *def, **missing; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1004 int i, n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1005 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1006 missing = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1007 if(dc.font.set) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1008 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
|
1009 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
|
1010 if(missing) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1011 while(n--) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1012 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
|
1013 XFreeStringList(missing); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1014 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1015 if(dc.font.set) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1016 XFontSetExtents *font_extents; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1017 XFontStruct **xfonts; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1018 char **font_names; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1019 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
|
1020 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
|
1021 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
|
1022 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
|
1023 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
|
1024 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
|
1025 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
|
1026 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
|
1027 xfonts++; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1028 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1029 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1030 if(dc.font.xfont) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1031 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
|
1032 dc.font.xfont = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1033 if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr))) |
778 | 1034 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
|
1035 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
|
1036 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
|
1037 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1038 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
|
1039 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1040 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1041 unsigned int |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1042 textw(const char *text) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1043 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
|
1044 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1045 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1046 /* from client.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1047 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1048 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1049 detachstack(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1050 Client **tc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1051 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
|
1052 *tc = c->snext; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1053 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1054 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1055 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1056 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
|
1057 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
|
1058 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1059 if(focused) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1060 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
|
1061 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1062 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
|
1063 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1064 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
|
1065 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1066 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
|
1067 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1068 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1069 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
|
1070 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1071 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
|
1072 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1073 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
|
1074 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1075 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
|
1076 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1077 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1078 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
|
1079 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1080 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
|
1081 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1082 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
|
1083 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1084 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
|
1085 GrabModeAsync, GrabModeSync, None, None); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1086 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1087 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
|
1088 GrabModeAsync, GrabModeSync, None, None); |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1091 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1092 void |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1093 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
|
1094 long data[] = {state, None}; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1095 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
|
1096 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
|
1097 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1098 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1099 int |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1100 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
|
1101 return 0; |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1104 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1105 configure(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1106 XEvent synev; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1107 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1108 synev.type = ConfigureNotify; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1109 synev.xconfigure.display = dpy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1110 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
|
1111 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
|
1112 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
|
1113 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
|
1114 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
|
1115 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
|
1116 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
|
1117 synev.xconfigure.above = None; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1118 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
|
1119 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1120 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1121 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1122 focus(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1123 if(c && !isvisible(c)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1124 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1125 if(sel && sel != c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1126 grabbuttons(sel, False); |
764 | 1127 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
|
1128 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1129 if(c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1130 detachstack(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1131 c->snext = stack; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1132 stack = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1133 grabbuttons(c, True); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1134 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1135 sel = c; |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1136 drawbar(); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1137 if(!selscreen) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1138 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1139 if(c) { |
764 | 1140 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
|
1141 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
|
1142 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1143 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
|
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1147 Client * |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1148 getclient(Window w) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1149 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1150 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1151 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
|
1152 if(c->win == w) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1153 return c; |
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 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1156 return NULL; |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1159 Bool |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1160 isprotodel(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1161 int i, n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1162 Atom *protocols; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1163 Bool ret = False; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1164 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1165 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
|
1166 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
|
1167 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
|
1168 ret = True; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1169 XFree(protocols); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1170 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1171 return ret; |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1174 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
1175 killclient() { |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1176 if(!sel) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1177 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1178 if(isprotodel(sel)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1179 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
|
1180 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1181 XKillClient(dpy, sel->win); |
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 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1184 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1185 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
|
1186 Client *c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1187 Window trans; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1188 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1189 c = emallocz(sizeof(Client)); |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
1190 c->tag = True; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1191 c->win = w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1192 c->x = wa->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1193 c->y = wa->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1194 c->w = wa->width; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1195 c->h = wa->height; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1196 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
|
1197 c->border = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1198 c->x = sx; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1199 c->y = sy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1200 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1201 c->border = BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1202 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
|
1203 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
|
1204 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
|
1205 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
|
1206 if(c->x < wax) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1207 c->x = wax; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1208 if(c->y < way) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1209 c->y = way; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1210 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1211 updatesizehints(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1212 XSelectInput(dpy, c->win, |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1213 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1214 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
|
1215 grabbuttons(c, False); |
764 | 1216 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
|
1217 updatetitle(c); |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
1218 settag(c, getclient(trans)); |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1219 if(!c->isfloat) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1220 c->isfloat = trans || c->isfixed; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1221 if(clients) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1222 clients->prev = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1223 c->next = clients; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1224 c->snext = stack; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1225 stack = clients = c; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1226 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
|
1227 XMapWindow(dpy, c->win); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1228 setclientstate(c, NormalState); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1229 if(isvisible(c)) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1230 focus(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1231 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1232 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1233 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1234 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1235 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
|
1236 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
|
1237 XWindowChanges wc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1238 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1239 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
|
1240 return; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1241 if(sizehints) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1242 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
|
1243 c->w = c->minw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1244 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
|
1245 c->h = c->minh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1246 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
|
1247 c->w = c->maxw; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1248 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
|
1249 c->h = c->maxh; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1250 /* 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
|
1251 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
|
1252 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
|
1253 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
|
1254 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
|
1255 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
|
1256 actual = dx / dy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1257 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
|
1258 if(actual < min) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1259 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
|
1260 dx = dy * min; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1261 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
|
1262 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
|
1263 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1264 else if(actual > max) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1265 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
|
1266 dx = dy * min; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1267 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
|
1268 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
|
1269 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1270 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1271 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1272 if(c->incw) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1273 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
|
1274 if(c->inch) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1275 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
|
1276 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1277 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
|
1278 c->border = 0; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1279 else |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1280 c->border = BORDERPX; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1281 /* offscreen appearance fixes */ |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1282 if(c->x > sw) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1283 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
|
1284 if(c->y > sh) |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1285 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
|
1286 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
|
1287 c->x = sx; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1288 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
|
1289 c->y = sy; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1290 wc.x = c->x; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1291 wc.y = c->y; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1292 wc.width = c->w; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1293 wc.height = c->h; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1294 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
|
1295 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
|
1296 configure(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1297 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1298 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1299 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1300 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1301 updatesizehints(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1302 long msize; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1303 XSizeHints size; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1304 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1305 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
|
1306 size.flags = PSize; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1307 c->flags = size.flags; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1308 if(c->flags & PBaseSize) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1309 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
|
1310 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
|
1311 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1312 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
|
1313 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1314 if(c->flags & PResizeInc) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1315 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
|
1316 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
|
1317 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1318 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
|
1319 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1320 if(c->flags & PMaxSize) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1321 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
|
1322 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
|
1323 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1324 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
|
1325 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1326 if(c->flags & PMinSize) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1327 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
|
1328 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
|
1329 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1330 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
|
1331 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1332 if(c->flags & PAspect) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1333 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
|
1334 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
|
1335 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
|
1336 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
|
1337 } else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1338 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
|
1339 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1340 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
|
1341 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
|
1342 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1343 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1344 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1345 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
|
1346 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
|
1347 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
|
1348 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1349 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1350 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1351 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1352 Bool |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1353 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
|
1354 char **list = NULL; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1355 int n; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1356 XTextProperty name; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1357 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1358 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
|
1359 return False; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1360 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1361 text[0] = '\0'; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1362 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
|
1363 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
|
1364 return False; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1365 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
|
1366 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
|
1367 else { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1368 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
|
1369 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
|
1370 XFreeStringList(list); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1371 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1372 } |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1373 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
|
1374 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
|
1375 return True; |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1376 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1377 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1378 void |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1379 unmanage(Client *c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1380 Client *nc; |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1381 |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1382 /* 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
|
1383 XGrabServer(dpy); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1384 XSetErrorHandler(xerrordummy); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1385 detach(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1386 detachstack(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1387 if(sel == c) { |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1388 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
|
1389 focus(nc); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1390 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1391 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
|
1392 setclientstate(c, WithdrawnState); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1393 free(c); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1394 XSync(dpy, False); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1395 XSetErrorHandler(xerror); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1396 XUngrabServer(dpy); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1397 arrange(); |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1398 } |
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1399 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1400 /* from main.c */ |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1401 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1402 void |
487 | 1403 cleanup(void) { |
645 | 1404 while(stack) { |
708
a2d568a5cdb8
applied Sanders all5.patch (thanks for your weekend session, Sander!)
Anselm R. Garbe <arg@suckless.org>
parents:
697
diff
changeset
|
1405 resize(stack, True); |
645 | 1406 unmanage(stack); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1407 } |
295 | 1408 if(dc.font.set) |
1409 XFreeFontSet(dpy, dc.font.set); | |
1410 else | |
1411 XFreeFont(dpy, dc.font.xfont); | |
292 | 1412 XUngrabKey(dpy, AnyKey, AnyModifier, root); |
295 | 1413 XFreePixmap(dpy, dc.drawable); |
1414 XFreeGC(dpy, dc.gc); | |
309
204427dcc087
corrected order of cleanup code
Anselm R.Garbe <arg@10ksloc.org>
parents:
302
diff
changeset
|
1415 XDestroyWindow(dpy, barwin); |
616 | 1416 XFreeCursor(dpy, cursor[CurNormal]); |
1417 XFreeCursor(dpy, cursor[CurResize]); | |
1418 XFreeCursor(dpy, cursor[CurMove]); | |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1419 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); |
292 | 1420 XSync(dpy, False); |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1421 } |
0 | 1422 |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1423 void |
487 | 1424 scan(void) { |
0 | 1425 unsigned int i, num; |
123 | 1426 Window *wins, d1, d2; |
0 | 1427 XWindowAttributes wa; |
1428 | |
292 | 1429 wins = NULL; |
0 | 1430 if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { |
1431 for(i = 0; i < num; i++) { | |
1432 if(!XGetWindowAttributes(dpy, wins[i], &wa)) | |
1433 continue; | |
1434 if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) | |
1435 continue; | |
1436 if(wa.map_state == IsViewable) | |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
1437 manage(wins[i], &wa); |
0 | 1438 } |
1439 } | |
1440 if(wins) | |
1441 XFree(wins); | |
1442 } | |
1443 | |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1444 void |
487 | 1445 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
|
1446 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
|
1447 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
|
1448 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
|
1449 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
|
1450 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
|
1451 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1452 screen = DefaultScreen(dpy); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1453 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
|
1454 |
333
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1455 /* 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
|
1456 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
|
1457 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
|
1458 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
|
1459 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
|
1460 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
|
1461 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
|
1462 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
|
1463 /* 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
|
1464 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
|
1465 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
|
1466 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1467 /* init modifier map */ |
679
5f0134b88b8d
small fix of initial numlockmask value
Anselm R. Garbe <arg@suckless.org>
parents:
675
diff
changeset
|
1468 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
|
1469 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
|
1470 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
|
1471 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
|
1472 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
|
1473 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
|
1474 } |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1475 } |
616 | 1476 XFreeModifiermap(modmap); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1477 /* 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
|
1478 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
|
1479 | 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
|
1480 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
|
1481 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
|
1482 grabkeys(); |
766
3f7c68a720b5
undone naming change: "group" is "tag" again (but without plural)
meillo@marmaro.de
parents:
764
diff
changeset
|
1483 seltag = True; |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
1484 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
|
1485 /* style */ |
353
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1486 dc.norm[ColBG] = getcolor(NORMBGCOLOR); |
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1487 dc.norm[ColFG] = getcolor(NORMFGCOLOR); |
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1488 dc.sel[ColBG] = getcolor(SELBGCOLOR); |
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1489 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
|
1490 setfont(FONT); |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1491 /* 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
|
1492 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
|
1493 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
|
1494 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
|
1495 nmaster = NMASTER; |
782
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
1496 arrange1 = DEFMODE; |
f1e806b34697
created separated floating space; added per space mode
markus schnalke <meillo@marmaro.de>
parents:
778
diff
changeset
|
1497 arrange2 = DEFMODE; |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1498 /* bar */ |
353
8a06efe5b563
new color stuff/new rendering stuff
Anselm R. Garbe <arg@10kloc.org>
parents:
352
diff
changeset
|
1499 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
|
1500 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
|
1501 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
|
1502 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
|
1503 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
|
1504 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
|
1505 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
|
1506 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
|
1507 XMapRaised(dpy, barwin); |
565 | 1508 /* windowarea */ |
1509 wax = sx; | |
754
4c12dccc288d
this is the (second) begin of aewl - my personal stipped down dwm
meillo@marmaro.de
parents:
744
diff
changeset
|
1510 way = sy + bh; |
565 | 1511 wah = sh - bh; |
1512 waw = sw; | |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1513 /* 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
|
1514 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
|
1515 dc.gc = XCreateGC(dpy, root, 0, 0); |
344
93192711a36a
changing tag indicator through underline
Anselm R. Garbe <arg@10kloc.org>
parents:
339
diff
changeset
|
1516 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
|
1517 /* multihead support */ |
716
4ce65f61f01b
renamed activescreen into selscreen
Anselm R. Garbe <arg@suckless.org>
parents:
714
diff
changeset
|
1518 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
|
1519 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1520 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
|
1521 } |
827f8f6c9e97
separated setup stuff into main.c:setup() - this makes main() more readable
Anselm R. Garbe <arg@10kloc.org>
parents:
329
diff
changeset
|
1522 |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1523 /* |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1524 * 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
|
1525 * is already running. |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1526 */ |
773
d2e56ce18f5b
remove static since its only one source file now; removed empty lines
meillo@marmaro.de
parents:
772
diff
changeset
|
1527 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
|
1528 xerrorstart(Display *dsply, XErrorEvent *ee) { |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1529 otherwm = True; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1530 return -1; |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1531 } |
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1532 |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1533 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
|
1534 sendevent(Window w, Atom a, long value) { |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1535 XEvent e; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1536 |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1537 e.type = ClientMessage; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1538 e.xclient.window = w; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1539 e.xclient.message_type = a; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1540 e.xclient.format = 32; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1541 e.xclient.data.l[0] = value; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1542 e.xclient.data.l[1] = CurrentTime; |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1543 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
|
1544 XSync(dpy, False); |
13
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1545 } |
5cc5e55a132d
added protocol killing stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
10
diff
changeset
|
1546 |
76
4bd49f404f10
proceeded with cleaning up, sorting functions, etc
Anselm R. Garbe <garbeam@wmii.de>
parents:
75
diff
changeset
|
1547 void |
756
bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
meillo@marmaro.de
parents:
755
diff
changeset
|
1548 quit() { |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1549 running = False; |
75 | 1550 } |
1551 | |
532
651f2c868b31
code polishing, removed unnecessary newlines
Anselm R. Garbe <arg@10kloc.org>
parents:
530
diff
changeset
|
1552 /* 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
|
1553 * 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
|
1554 * default error handler, which may call exit. |
0 | 1555 */ |
10
703255003abb
changed how manage client works
Anselm R. Garbe <garbeam@wmii.de>
parents:
9
diff
changeset
|
1556 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
|
1557 xerror(Display *dpy, XErrorEvent *ee) { |
75 | 1558 if(ee->error_code == BadWindow |
123 | 1559 || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
1560 || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) | |
1561 || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) | |
1562 || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) | |
1563 || (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
|
1564 || (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
|
1565 || (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) |
0 | 1566 return 0; |
772 | 1567 fprintf(stderr, "aewl: fatal error: request code=%d, error code=%d\n", |
123 | 1568 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
|
1569 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
|
1570 } |
f96fb3fd8203
added grid mode on Mod1Mask g
Anselm R. Garbe <garbeam@wmii.de>
parents:
26
diff
changeset
|
1571 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1572 void |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1573 checkotherwm(void) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1574 otherwm = False; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1575 xerrorxlib = XSetErrorHandler(xerrorstart); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1576 /* 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
|
1577 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
|
1578 XSync(dpy, False); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1579 if(otherwm) { |
778 | 1580 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
|
1581 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1582 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1583 XSetErrorHandler(xerror); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1584 XSync(dpy, False); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1585 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1586 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1587 void |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1588 run(void) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1589 XEvent ev; |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1590 |
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 /* main event loop */ |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1593 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
|
1594 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
|
1595 (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
|
1596 } |
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 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1599 |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1600 void |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1601 updatestatus(void) { |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1602 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
|
1603 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
|
1604 } |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1605 drawbar(); |
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 |
0 | 1608 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
|
1609 main(int argc, char *argv[]) { |
0 | 1610 |
137
77922a389fa8
simplified main.c, switching back to single urxvt usage
arg@10ksloc.org
parents:
126
diff
changeset
|
1611 if(argc == 2 && !strncmp("-v", argv[1], 3)) { |
772 | 1612 fputs("aewl-"VERSION", Copyright 2008 markus schnalke <meillo@marmaro.de>\n", stdout); |
1613 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
|
1614 exit(EXIT_SUCCESS); |
755 | 1615 } else if(argc != 1) { |
778 | 1616 die("usage: aewl [-v]\n"); |
0 | 1617 } |
619 | 1618 setlocale(LC_CTYPE, ""); |
0 | 1619 dpy = XOpenDisplay(0); |
755 | 1620 if(!dpy) { |
778 | 1621 die("aewl: cannot open display\n"); |
755 | 1622 } |
3
e969f3575b7a
several new changes, made gridmenu working
Anselm R. Garbe <garbeam@wmii.de>
parents:
2
diff
changeset
|
1623 |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1624 checkotherwm(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1625 setup(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1626 scan(); |
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1627 run(); |
0 | 1628 cleanup(); |
777
3835ddb75a55
changed to status text setting through XA_WM_NAME (suggested by Neale Pickett)
meillo@marmaro.de
parents:
776
diff
changeset
|
1629 |
0 | 1630 XCloseDisplay(dpy); |
1631 return 0; | |
1632 } |