diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 12:52:57 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-11 12:52:57 +0200 |
| commit | 16c67f32d62849792c8e6d4fdec22a1896f9c279 (patch) | |
| tree | cb18262f3e207d8229bf0f8833f602a7b7903b03 /wm.c | |
| parent | added key handling (diff) | |
| download | dwm-16c67f32d62849792c8e6d4fdec22a1896f9c279.tar.gz dwm-16c67f32d62849792c8e6d4fdec22a1896f9c279.zip | |
fixed several stuff (gridwm gets better and better)
Diffstat (limited to '')
| -rw-r--r-- | wm.c | 50 |
1 files changed, 4 insertions, 46 deletions
| @@ -16,11 +16,11 @@ | |||
| 16 | /* X structs */ | 16 | /* X structs */ |
| 17 | Display *dpy; | 17 | Display *dpy; |
| 18 | Window root, barwin; | 18 | Window root, barwin; |
| 19 | Atom wm_atom[WMLast], net_atom[NetLast]; | 19 | Atom net_atom[NetLast]; |
| 20 | Cursor cursor[CurLast]; | 20 | Cursor cursor[CurLast]; |
| 21 | XRectangle rect, barrect; | 21 | XRectangle rect, barrect; |
| 22 | Bool running = True; | 22 | Bool running = True; |
| 23 | Client *client = NULL; | 23 | Client *clients = NULL; |
| 24 | 24 | ||
| 25 | char *bartext, tag[256]; | 25 | char *bartext, tag[256]; |
| 26 | int screen, sel_screen; | 26 | int screen, sel_screen; |
| @@ -63,46 +63,6 @@ scan_wins() | |||
| 63 | XFree(wins); | 63 | XFree(wins); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static int | ||
| 67 | win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) | ||
| 68 | { | ||
| 69 | Atom real; | ||
| 70 | int format; | ||
| 71 | unsigned long res, extra; | ||
| 72 | int status; | ||
| 73 | |||
| 74 | status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, | ||
| 75 | &res, &extra, prop); | ||
| 76 | |||
| 77 | if(status != Success || *prop == NULL) { | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | if(res == 0) | ||
| 81 | free((void *) *prop); | ||
| 82 | return res; | ||
| 83 | } | ||
| 84 | |||
| 85 | int | ||
| 86 | win_proto(Window w) | ||
| 87 | { | ||
| 88 | Atom *protocols; | ||
| 89 | long res; | ||
| 90 | int protos = 0; | ||
| 91 | int i; | ||
| 92 | |||
| 93 | res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L, | ||
| 94 | ((unsigned char **) &protocols)); | ||
| 95 | if(res <= 0) { | ||
| 96 | return protos; | ||
| 97 | } | ||
| 98 | for(i = 0; i < res; i++) { | ||
| 99 | if(protocols[i] == wm_atom[WMDelete]) | ||
| 100 | protos |= WM_PROTOCOL_DELWIN; | ||
| 101 | } | ||
| 102 | free((char *) protocols); | ||
| 103 | return protos; | ||
| 104 | } | ||
| 105 | |||
| 106 | /* | 66 | /* |
| 107 | * There's no way to check accesses to destroyed windows, thus | 67 | * There's no way to check accesses to destroyed windows, thus |
| 108 | * those cases are ignored (especially on UnmapNotify's). | 68 | * those cases are ignored (especially on UnmapNotify's). |
| @@ -201,9 +161,6 @@ main(int argc, char *argv[]) | |||
| 201 | x_error_handler = XSetErrorHandler(error_handler); | 161 | x_error_handler = XSetErrorHandler(error_handler); |
| 202 | 162 | ||
| 203 | /* init atoms */ | 163 | /* init atoms */ |
| 204 | wm_atom[WMState] = XInternAtom(dpy, "WM_STATE", False); | ||
| 205 | wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); | ||
| 206 | wm_atom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); | ||
| 207 | net_atom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); | 164 | net_atom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); |
| 208 | net_atom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); | 165 | net_atom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); |
| 209 | 166 | ||
| @@ -242,7 +199,8 @@ main(int argc, char *argv[]) | |||
| 242 | XMapRaised(dpy, barwin); | 199 | XMapRaised(dpy, barwin); |
| 243 | draw_bar(); | 200 | draw_bar(); |
| 244 | 201 | ||
| 245 | wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask; | 202 | wa.event_mask = SubstructureRedirectMask | EnterWindowMask \ |
| 203 | | LeaveWindowMask; | ||
| 246 | wa.cursor = cursor[CurNormal]; | 204 | wa.cursor = cursor[CurNormal]; |
| 247 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); | 205 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
| 248 | 206 | ||
