X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=75aec9cf4796edefe95ac39274b46dd89fef3b4c;hb=c646259731aa2e159b196f00d65f313737920a65;hp=f47613465d6d8b9e6c1cda9c930dcbe7ba94b5a6;hpb=8d6f43bd88e79d5222889eb3f1a2f0ac25f1695b;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index f476134..75aec9c 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -348,7 +348,7 @@ double dialog_ratio = 0.6; char *bar_argv[] = { NULL, NULL }; int bar_pipe[2]; -unsigned char bar_ext[SWM_BAR_MAX]; +char bar_ext[SWM_BAR_MAX]; char bar_vertext[SWM_BAR_MAX]; int bar_version = 0; sig_atomic_t bar_alarm = 0; @@ -871,7 +871,7 @@ char *expand_tilde(const char *); void expose(xcb_expose_event_t *); void fake_keypress(struct ws_win *, xcb_keysym_t, uint16_t); struct pid_e *find_pid(pid_t); -struct ws_win *find_unmanaged_window(xcb_window_t); +struct ws_win *find_unmanaged_window(xcb_window_t); struct ws_win *find_window(xcb_window_t); void floating_toggle(struct swm_region *, union arg *); int floating_toggle_win(struct ws_win *); @@ -1852,7 +1852,7 @@ bar_extra_stop(void) kill(bar_pid, SIGTERM); bar_pid = 0; } - strlcpy((char *)bar_ext, "", sizeof bar_ext); + strlcpy(bar_ext, "", sizeof bar_ext); bar_extra = 0; } @@ -2198,14 +2198,14 @@ bar_update(void) while ((b = fgetln(stdin, &len)) != NULL) if (b && b[len - 1] == '\n') { b[len - 1] = '\0'; - strlcpy((char *)bar_ext, b, sizeof bar_ext); + strlcpy(bar_ext, b, sizeof bar_ext); } if (b == NULL && errno != EAGAIN) { warn("bar_update: bar_extra failed"); bar_extra_stop(); } } else - strlcpy((char *)bar_ext, "", sizeof bar_ext); + strlcpy(bar_ext, "", sizeof bar_ext); bar_fmt_print(); alarm(bar_delay); @@ -2405,7 +2405,7 @@ xft_init(struct swm_region *r) if (!XftColorAllocValue(display, DefaultVisual(display, r->s->idx), DefaultColormap(display, r->s->idx), &color, &bar_font_color)) - warn("unable to allocate Xft color"); + warn("Xft error: unable to allocate color."); bar_height = bar_font->height + 2 * bar_border_width; @@ -5940,7 +5940,7 @@ setkeybinding(unsigned int mod, KeySym ks, enum keyfuncid kfid, return; } if (kfid == KF_INVALID) { - warnx("error: setkeybinding: cannot find mod/key combination"); + warnx("bind: Key combination already unbound."); DNPRINTF(SWM_D_KEY, "setkeybinding: leave\n"); return; } @@ -7442,7 +7442,13 @@ buttonpress(xcb_button_press_event_t *e) /* Focus on empty region */ /* If no windows on region if its empty. */ r = root_to_region(e->root, SWM_CK_POINTER); - if (r && TAILQ_EMPTY(&r->ws->winlist)) { + if (r == NULL) { + DNPRINTF(SWM_D_EVENT, "buttonpress: " + "NULL region; ignoring.\n"); + goto out; + } + + if (TAILQ_EMPTY(&r->ws->winlist)) { old_r = root_to_region(e->root, SWM_CK_FOCUS); if (old_r && old_r != r) unfocus_win(old_r->ws->focus); @@ -7816,6 +7822,12 @@ enternotify(xcb_enter_notify_event_t *e) if (e->event == e->root) { /* If no windows on pointer region, then focus root. */ r = root_to_region(e->root, SWM_CK_POINTER); + if (r == NULL) { + DNPRINTF(SWM_D_EVENT, "enterntoify: " + "NULL region; ignoring.\n"); + return; + } + if (TAILQ_EMPTY(&r->ws->winlist)) { old_r = root_to_region(e->root, SWM_CK_FOCUS); if (old_r && old_r != r)