expand_tilde(char *s)
{
struct passwd *pwd;
- int i;
- char user[LOGIN_NAME_MAX];
+ int i, max;
+ char *user;
const char *sc = s;
char *result;
}
++s;
+
+ if ((max = sysconf(_SC_LOGIN_NAME_MAX)) == -1)
+ errx(1, "expand_tilde: sysconf");
+
+ if ((user = calloc(1, max + 1)) == NULL)
+ errx(1, "expand_tilde: calloc");
+
for (i = 0; s[i] != '/' && s[i] != '\0'; ++i)
user[i] = s[i];
user[i] = '\0';
struct quirk *qp;
uint32_t event_mask, i;
xcb_icccm_get_wm_protocols_reply_t wpr;
- xcb_icccm_get_wm_class_reply_t tmpch;
if ((win = find_window(id)) != NULL)
return (win); /* already being managed */
if (xcb_icccm_get_wm_class_reply(conn,
xcb_icccm_get_wm_class(conn, win->id),
- &tmpch, NULL)) {
- win->ch.class_name = tmpch.class_name;
- win->ch.instance_name = tmpch.instance_name;
-
- xcb_icccm_get_wm_class_reply_wipe(&tmpch);
-
+ &win->ch, NULL)) {
DNPRINTF(SWM_D_CLASS, "manage_window: class: %s, name: %s\n",
win->ch.class_name, win->ch.instance_name);
if (win->wa)
free(win->wa);
+ xcb_icccm_get_wm_class_reply_wipe(&win->ch);
+
kill_refs(win);
/* paint memory */
void
leavenotify(xcb_leave_notify_event_t *e)
{
- struct ws_win *win;
DNPRINTF(SWM_D_FOCUS, "leavenotify: window: 0x%x, mode: %s(%d), "
"detail: %s(%d), root: 0x%x, subwindow: 0x%x, same_screen_focus: "
"%s, state: %d\n", e->event, get_notify_mode_label(e->mode),
c = xcb_randr_query_version(conn, 1, 1);
r = xcb_randr_query_version_reply(conn, c, NULL);
if (r) {
- if (r->major_version >= 1)
- xrandr_support = 1;
+ if (r->major_version >= 1) {
+ qep = xcb_get_extension_data(conn, &xcb_randr_id);
+ if (qep) {
+ xrandr_support = 1;
+ xrandr_eventbase = qep->first_event;
+ }
+ }
free(r);
}
- qep = xcb_get_extension_data(conn, &xcb_randr_id);
- xrandr_eventbase = qep->first_event;
cursor_font = xcb_generate_id(conn);
xcb_open_font(conn, cursor_font, strlen("cursor"), "cursor");