X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=6e88cdd0ece3f161de141d45a437b5a9b8c9008f;hb=25360b61720c1fc74f2bd5051f08e1212df77c9b;hp=037915603a879eaa51be854bf0d9d39d47d32c47;hpb=92be9fb26cc5691ca30428519205df168e12cf02;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 0379156..6e88cdd 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) @@ -1009,7 +1009,7 @@ ewmh_update_actions(struct ws_win *win) #define _NET_WM_STATE_TOGGLE 2 /* toggle property */ void -ewmh_update_win_state(struct ws_win *win, long state, long action) +ewmh_update_win_state(struct ws_win *win, xcb_atom_t state, long action) { unsigned int mask = 0; unsigned int changed = 0; @@ -1908,7 +1908,7 @@ bar_refresh(void) void bar_setup(struct swm_region *r) { - char *font, *fontpos, *dup, *search; + char *font, *fontpos, *d, *search; int count; xcb_screen_t *screen; uint32_t wa[3]; @@ -1924,9 +1924,9 @@ bar_setup(struct swm_region *r) err(1, "bar_setup: calloc: failed to allocate memory."); if (bar_font == NULL) { - if ((dup = strdup(bar_fonts)) == NULL) + if ((d = strdup(bar_fonts)) == NULL) errx(1, "insufficient memory."); - search = dup; + search = d; while ((font = strsep(&search, ",")) != NULL) { if (*font == '\0') continue; @@ -1955,7 +1955,7 @@ bar_setup(struct swm_region *r) break; } } - free(dup); + free(d); } if (bar_font == 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); } @@ -6138,7 +6139,7 @@ setautorun(char *selector, char *value, int flags) int setlayout(char *selector, char *value, int flags) { - int ws_id, i, x, mg, ma, si, raise, f = 0; + int ws_id, i, x, mg, ma, si, ar, f = 0; int st = SWM_V_STACK, num_screens; char s[1024]; struct workspace *ws; @@ -6152,7 +6153,7 @@ setlayout(char *selector, char *value, int flags) bzero(s, sizeof s); if (sscanf(value, "ws[%d]:%d:%d:%d:%d:%1023c", - &ws_id, &mg, &ma, &si, &raise, s) != 6) + &ws_id, &mg, &ma, &si, &ar, s) != 6) errx(1, "invalid layout entry, should be 'ws[]:" "::::" "'"); @@ -6182,7 +6183,7 @@ setlayout(char *selector, char *value, int flags) ws = (struct workspace *)&screens[i].ws; ws[ws_id].cur_layout = &layouts[st]; - ws[ws_id].always_raise = raise; + ws[ws_id].always_raise = ar; if (st == SWM_MAX_STACK) continue; @@ -6278,7 +6279,7 @@ conf_load(char *filename, int keymapping) FILE *config; char *line, *cp, *optsub, *optval; size_t linelen, lineno = 0; - int wordlen, i, optind; + int wordlen, i, optidx; struct config_option *opt; DNPRINTF(SWM_D_CONF, "conf_load: begin\n"); @@ -6314,16 +6315,16 @@ conf_load(char *filename, int keymapping) filename, lineno); goto out; } - optind = -1; + optidx = -1; for (i = 0; i < LENGTH(configopt); i++) { opt = &configopt[i]; if (!strncasecmp(cp, opt->optname, wordlen) && (int)strlen(opt->optname) == wordlen) { - optind = i; + optidx = i; break; } } - if (optind == -1) { + if (optidx == -1) { warnx("%s: line %zd: unknown option %.*s", filename, lineno, wordlen, cp); goto out; @@ -6362,10 +6363,10 @@ conf_load(char *filename, int keymapping) /* get RHS value */ optval = strdup(cp); /* call function to deal with it all */ - if (configopt[optind].func(optsub, optval, - configopt[optind].funcflags) != 0) + if (configopt[optidx].func(optsub, optval, + configopt[optidx].funcflags) != 0) errx(1, "%s: line %zd: invalid data for %s", - filename, lineno, configopt[optind].optname); + filename, lineno, configopt[optidx].optname); free(optval); free(optsub); free(line); @@ -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); +#ifdef XCB_CONN_ERROR char *s; - - switch (err) { + 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