/* pid goo */
struct pid_e {
TAILQ_ENTRY(pid_e) entry;
- long pid;
+ pid_t pid;
int ws;
};
TAILQ_HEAD(pid_list, pid_e);
win->ewmh_flags |= SWM_F_MANUAL;
c = xcb_get_property(conn, False, win->id, ewmh[_NET_WM_STATE].atom,
- XCB_ATOM_ATOM, 0, (~0L));
+ XCB_ATOM_ATOM, 0, UINT32_MAX);
r = xcb_get_property_reply(conn, c, NULL);
if (!r)
return;
}
struct pid_e *
-find_pid(long pid)
+find_pid(pid_t pid)
{
struct pid_e *p = NULL;
- DNPRINTF(SWM_D_MISC, "find_pid: %lu\n", pid);
+ DNPRINTF(SWM_D_MISC, "find_pid: %d\n", pid);
if (pid == 0)
return (NULL);
char *ap, *sp = s;
union arg a;
int argc = 0;
- long pid;
+ pid_t pid;
struct pid_e *p;
if (getenv("SWM_STARTED"))
}
}
-long
+pid_t
window_get_pid(xcb_window_t win)
{
- long ret = 0;
+ pid_t ret = 0;
const char *errstr;
xcb_atom_t apid;
xcb_get_property_cookie_t pc;
pr = xcb_get_property_reply(conn, pc, NULL);
if (!pr)
goto tryharder;
- if (pr->type != XCB_ATOM_CARDINAL)
+ if (pr->type != XCB_ATOM_CARDINAL) {
+ free(pr);
goto tryharder;
+ }
- ret = *(long *)xcb_get_property_value(pr);
+ ret = *((pid_t *)xcb_get_property_value(pr));
free(pr);
return (ret);
pr = xcb_get_property_reply(conn, pc, NULL);
if (!pr)
return (0);
- if (pr->type != XCB_ATOM_STRING)
+ if (pr->type != XCB_ATOM_STRING) {
free(pr);
return (0);
+ }
+
ret = strtonum(xcb_get_property_value(pr), 0, UINT_MAX, &errstr);
free(pr);