X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=753bbf039a21153f5f5ee8a837ea986e39140666;hb=ebb72d68f2e0cf5f5d921f98f7c2f0f9e118ae6f;hp=f4ab936f4e6893b706eee702bbc97d6476a1b9b8;hpb=5e2b9113a98ce3991cf8971ec3db75cae812df3e;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index f4ab936..753bbf0 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -701,7 +701,7 @@ void update_window(struct ws_win *); char * expand_tilde(char *s) { - struct passwd *pwd; + struct passwd *ppwd; int i, max; char *user; const char *sc = s; @@ -728,11 +728,11 @@ expand_tilde(char *s) user[i] = '\0'; s = &s[i]; - pwd = strlen(user) == 0 ? getpwuid(getuid()) : getpwnam(user); - if (pwd == NULL) + ppwd = strlen(user) == 0 ? getpwuid(getuid()) : getpwnam(user); + if (ppwd == NULL) result = strdup(sc); else - if (asprintf(&result, "%s%s", pwd->pw_dir, s) == -1) + if (asprintf(&result, "%s%s", ppwd->pw_dir, s) == -1) result = NULL; out: if (result == NULL) @@ -1992,8 +1992,9 @@ bar_setup(struct swm_region *r) xcb_create_pixmap(conn, screen->root_depth, r->bar->buffer, r->bar->id, WIDTH(r->bar), HEIGHT(r->bar)); - xcb_randr_select_input(conn, r->bar->id, - XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE); + if (xrandr_support) + xcb_randr_select_input(conn, r->bar->id, + XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE); if (bar_enabled) map_window_raised(r->bar->id); @@ -5779,7 +5780,7 @@ setconfquirk(char *selector, char *value, int flags) { char *cp, *class, *name; int retval; - unsigned long quirks; + unsigned long qrks; /* suppress unused warning since var is needed */ (void)flags; @@ -5791,8 +5792,8 @@ setconfquirk(char *selector, char *value, int flags) *cp = '\0'; class = selector; name = cp + 1; - if ((retval = parsequirks(value, &quirks)) == 0) - setquirk(class, name, quirks); + if ((retval = parsequirks(value, &qrks)) == 0) + setquirk(class, name, qrks); return (retval); } @@ -7409,10 +7410,10 @@ clientmessage(xcb_client_message_event_t *e) void check_conn(void) { - int err = xcb_connection_has_error(conn); + int errcode = xcb_connection_has_error(conn); char *s; - - switch (err) { +#ifdef XCB_CONN_ERROR + switch (errcode) { case XCB_CONN_ERROR: s = "Socket error, pipe error or other stream error."; break; @@ -7431,9 +7432,12 @@ check_conn(void) default: s = "Unknown error."; } - - if (err) - errx(err, "X CONNECTION ERROR: %s", s); + if (errcode) + errx(errcode, "X CONNECTION ERROR: %s", s); +#else + if (errcode) + errx(errcode, "X CONNECTION ERROR"); +#endif } int @@ -7739,17 +7743,17 @@ setup_screens(void) /* initial Xrandr setup */ xrandr_support = 0; - c = xcb_randr_query_version(conn, 1, 1); - r = xcb_randr_query_version_reply(conn, c, NULL); - if (r) { - if (r->major_version >= 1) { - qep = xcb_get_extension_data(conn, &xcb_randr_id); - if (qep) { + qep = xcb_get_extension_data(conn, &xcb_randr_id); + if (qep->present) { + 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; xrandr_eventbase = qep->first_event; } + free(r); } - free(r); } cursor_font = xcb_generate_id(conn);