diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 34 |
1 files changed, 7 insertions, 27 deletions
| @@ -62,25 +62,6 @@ scan() | |||
| 62 | XFree(wins); | 62 | XFree(wins); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | static int | ||
| 66 | winprop(Window w, Atom a, Atom t, long l, unsigned char **prop) | ||
| 67 | { | ||
| 68 | int status, format; | ||
| 69 | unsigned long res, extra; | ||
| 70 | Atom real; | ||
| 71 | |||
| 72 | status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, | ||
| 73 | &res, &extra, prop); | ||
| 74 | |||
| 75 | if(status != Success || *prop == 0) { | ||
| 76 | return 0; | ||
| 77 | } | ||
| 78 | if(res == 0) { | ||
| 79 | free((void *) *prop); | ||
| 80 | } | ||
| 81 | return res; | ||
| 82 | } | ||
| 83 | |||
| 84 | /* | 65 | /* |
| 85 | * Startup Error handler to check if another window manager | 66 | * Startup Error handler to check if another window manager |
| 86 | * is already running. | 67 | * is already running. |
| @@ -111,21 +92,20 @@ Window root, barwin; | |||
| 111 | int | 92 | int |
| 112 | getproto(Window w) | 93 | getproto(Window w) |
| 113 | { | 94 | { |
| 114 | int protos = 0; | 95 | int status, format, protos = 0; |
| 115 | int i; | 96 | int i; |
| 116 | long res; | 97 | unsigned long extra, res; |
| 117 | Atom *protocols; | 98 | Atom *protocols, real; |
| 118 | 99 | ||
| 119 | res = winprop(w, wmatom[WMProtocols], XA_ATOM, 20L, | 100 | status = XGetWindowProperty(dpy, w, wmatom[WMProtocols], 0L, 20L, |
| 120 | ((unsigned char **)&protocols)); | 101 | False, XA_ATOM, &real, &format, &res, &extra, (unsigned char **)&protocols); |
| 121 | if(res <= 0) { | 102 | if(status != Success || protocols == 0) |
| 122 | return protos; | 103 | return protos; |
| 123 | } | ||
| 124 | for(i = 0; i < res; i++) { | 104 | for(i = 0; i < res; i++) { |
| 125 | if(protocols[i] == wmatom[WMDelete]) | 105 | if(protocols[i] == wmatom[WMDelete]) |
| 126 | protos |= PROTODELWIN; | 106 | protos |= PROTODELWIN; |
| 127 | } | 107 | } |
| 128 | free((char *) protocols); | 108 | free(protocols); |
| 129 | return protos; | 109 | return protos; |
| 130 | } | 110 | } |
| 131 | 111 | ||
