/* pid goo */
struct pid_e {
TAILQ_ENTRY(pid_e) entry;
- long pid;
+ pid_t pid;
int ws;
};
TAILQ_HEAD(pid_list, pid_e);
XCB_CONFIG_WINDOW_STACK_MODE, &val);
xcb_map_window(conn, win);
- xcb_flush(conn);
}
xcb_atom_t
void
ewmh_autoquirk(struct ws_win *win)
{
- int i;
- unsigned long n;
- xcb_atom_t type;
+ uint32_t i, n;
+ xcb_atom_t *type;
xcb_get_property_cookie_t c;
xcb_get_property_reply_t *r;
c = xcb_get_property(conn, False, win->id,
- ewmh[_NET_WM_WINDOW_TYPE].atom, XCB_ATOM_ATOM, 0, (~0L));
+ ewmh[_NET_WM_WINDOW_TYPE].atom, XCB_ATOM_ATOM, 0, UINT32_MAX);
r = xcb_get_property_reply(conn, c, NULL);
if (!r)
return;
+
n = xcb_get_property_value_length(r);
+ type = xcb_get_property_value(r);
for (i = 0; i < n; i++) {
- type = *((xcb_atom_t *)xcb_get_property_value(r));
- if (type == ewmh[_NET_WM_WINDOW_TYPE_NORMAL].atom)
+ if (type[i] == ewmh[_NET_WM_WINDOW_TYPE_NORMAL].atom)
break;
- if (type == ewmh[_NET_WM_WINDOW_TYPE_DOCK].atom ||
- type == ewmh[_NET_WM_WINDOW_TYPE_TOOLBAR].atom ||
- type == ewmh[_NET_WM_WINDOW_TYPE_UTILITY].atom) {
+ if (type[i] == ewmh[_NET_WM_WINDOW_TYPE_DOCK].atom ||
+ type[i] == ewmh[_NET_WM_WINDOW_TYPE_TOOLBAR].atom ||
+ type[i] == ewmh[_NET_WM_WINDOW_TYPE_UTILITY].atom) {
win->floating = 1;
win->quirks = SWM_Q_FLOAT | SWM_Q_ANYWHERE;
break;
}
- if (type == ewmh[_NET_WM_WINDOW_TYPE_SPLASH].atom ||
- type == ewmh[_NET_WM_WINDOW_TYPE_DIALOG].atom) {
+ if (type[i] == ewmh[_NET_WM_WINDOW_TYPE_SPLASH].atom ||
+ type[i] == ewmh[_NET_WM_WINDOW_TYPE_DIALOG].atom) {
win->floating = 1;
win->quirks = SWM_Q_FLOAT;
break;
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);
stack();
/* must be after stack */
bar_update();
+
+ xcb_flush(conn);
}
void
else
strlcpy(bar_vertext, "", sizeof bar_vertext);
bar_update();
+
+ xcb_flush(conn);
}
void
if (unmap_old)
TAILQ_FOREACH(win, &old_ws->winlist, entry)
unmap_window(win);
+
+ xcb_flush(conn);
}
void
sort_windows(wl);
stack();
+
+ xcb_flush(conn);
}
void
}
focus_magic(winfocus);
+
+ xcb_flush(conn);
}
void
stack();
bar_update();
+
+ xcb_flush(conn);
}
void
/* bring floaters back to top */
if (r->ws->always_raise == 0)
stack();
+
+ xcb_flush(conn);
}
void
r->ws->focus = NULL;
a.id = SWM_ARG_ID_FOCUSCUR;
focus(r, &a);
+
+ xcb_flush(conn);
}
char *
}
fclose(lfile);
+
+ xcb_flush(conn);
}
void
}
fclose(lfile);
+
+ xcb_flush(conn);
}
void
else
if (r->ws->focus->can_delete)
client_msg(r->ws->focus, adelete);
+
+ xcb_flush(conn);
}
a.id = SWM_ARG_ID_FOCUSCUR;
focus(win->ws->r, &a);
}
+
+ xcb_flush(conn);
}
void
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);
+ }
+
+ ret = strtonum(xcb_get_property_value(pr), 0, INT_MAX, &errstr);
free(pr);
return (ret);
buttons[i].button == e->detail &&
CLEANMASK(buttons[i].mask) == CLEANMASK(e->state))
buttons[i].func(win, &buttons[i].args);
+
+ xcb_flush(conn);
}
void
} else {
config_win(win, e);
}
+
+ xcb_flush(conn);
}
void
}
focus_magic(win);
+
+ xcb_flush(conn);
}
/* lets us use one switch statement for arbitrary mode/detail combinations */
/* resend unmap because we ated it */
xcb_unmap_window(conn, e->window);
+ xcb_flush(conn);
}
}
stack();
}
+
+ xcb_flush(conn);
}
int
int xfd, i, num_screens;
struct sigaction sact;
xcb_generic_event_t *evt;
-#if 0
struct timeval tv;
fd_set rd;
-#endif
time_started = time(NULL);
continue;
}
-#if 0
FD_ZERO(&rd);
FD_SET(xfd, &rd);
tv.tv_sec = 1;
if (select(xfd + 1, &rd, NULL, NULL, &tv) == -1)
if (errno != EINTR)
DNPRINTF(SWM_D_MISC, "select failed");
-#endif
if (restart_wm == 1)
restart(NULL, NULL);
if (search_resp == 1)