X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=f550e1a27c07d68741e1367d2dc28a15732b1991;hb=eb81669a3447b4ad7e80fd0113dfd2d1f5ceb0c6;hp=267d0148c463b4afbc99bd1b60e5072e5b9f5423;hpb=42610fddc37e9af64d0ebf3a274b16c96200b46c;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 267d014..f550e1a 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -269,8 +269,8 @@ xcb_atom_t a_swm_iconic; xcb_atom_t a_swm_ws; volatile sig_atomic_t running = 1; volatile sig_atomic_t restart_wm = 0; +xcb_timestamp_t last_event_time = 0; int outputs = 0; -/*int last_focus_event = FocusOut;*/ int other_wm; int ss_enabled = 0; int xrandr_support; @@ -280,7 +280,6 @@ unsigned int numlockmask = 0; Display *display; xcb_connection_t *conn; xcb_key_symbols_t *syms; -xcb_timestamp_t last_event_time; int cycle_empty = 0; int cycle_visible = 0; @@ -851,7 +850,6 @@ get_swm_iconic(struct ws_win *win) int32_t v = 0; xcb_get_property_reply_t *pr = NULL; - pr = xcb_get_property_reply(conn, xcb_get_property(conn, 0, win->id, a_swm_iconic, XCB_ATOM_INTEGER, 0, 1), NULL); @@ -2148,7 +2146,8 @@ set_win_state(struct ws_win *win, uint16_t state) { uint16_t data[2] = { state, XCB_ATOM_NONE }; - DNPRINTF(SWM_D_EVENT, "set_win_state: window: 0x%x\n", win->id); + DNPRINTF(SWM_D_EVENT, "set_win_state: window: 0x%x, state: %u\n", + win->id, state); if (win == NULL) return; @@ -3029,7 +3028,6 @@ swapwin(struct swm_region *r, union arg *args) struct ws_win *cur_focus; struct ws_win_list *wl; - DNPRINTF(SWM_D_WS, "swapwin: id: %d, screen[%d]:%dx%d+%d+%d, ws: %d\n", args->id, r->s->idx, WIDTH(r), HEIGHT(r), X(r), Y(r), r->ws->idx); @@ -3523,7 +3521,7 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) int w_inc = 1, h_inc, w_base = 1, h_base; int hrh, extra = 0, h_slice, last_h = 0; int split, colno, winno, mwin, msize, mscale; - int remain, missing, v_slice, reconfigure; + int remain, missing, v_slice, reconfigure = 0; int bordered = 1; DNPRINTF(SWM_D_STACK, "stack_master: workspace: %d, rot: %s, " @@ -4434,7 +4432,6 @@ wkill(struct swm_region *r, union arg *args) xcb_flush(conn); } - int floating_toggle_win(struct ws_win *win) { @@ -4898,7 +4895,6 @@ move_step(struct swm_region *r, union arg *args) move(win, args); } - /* user/key callable function IDs */ enum keyfuncid { KF_BAR_TOGGLE, @@ -6507,7 +6503,6 @@ struct config_option configopt[] = { { "layout", setlayout, 0 }, }; - int conf_load(char *filename, int keymapping) { @@ -6515,7 +6510,7 @@ conf_load(char *filename, int keymapping) char *line, *cp, *optsub, *optval; size_t linelen, lineno = 0; int wordlen, i, optidx; - struct config_option *opt; + struct config_option *opt = NULL; DNPRINTF(SWM_D_CONF, "conf_load: begin\n"); @@ -6564,7 +6559,7 @@ conf_load(char *filename, int keymapping) filename, lineno, wordlen, cp); goto out; } - if (keymapping && strcmp(opt->optname, "bind")) { + if (keymapping && opt && strcmp(opt->optname, "bind")) { warnx("%s: line %zd: invalid option %.*s", filename, lineno, wordlen, cp); goto out; @@ -6916,7 +6911,6 @@ manage_window(xcb_window_t id, uint16_t mapped) update_window(win); } - /* Select which X events to monitor and set border pixel color. */ wa[0] = win->s->c[SWM_S_COLOR_UNFOCUS].pixel; wa[1] = XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_PROPERTY_CHANGE | @@ -7570,12 +7564,14 @@ propertynotify(xcb_property_notify_event_t *e) focus_flush(); return; } else if (e->state == XCB_PROPERTY_NEW_VALUE) { + win->ws->focus_pending = get_focus_prev(win); unfocus_win(win); unmap_window(win); if (win->ws->r) { - focus_win(get_focus_prev(win)); stack(); + focus_win(win->ws->focus_pending); + win->ws->focus_pending = NULL; focus_flush(); } } @@ -7616,6 +7612,9 @@ unmapnotify(xcb_unmap_notify_event_t *e) if (win == win->ws->focus) win->ws->focus_pending = get_focus_prev(win); + win->mapped = 0; + set_win_state(win, XCB_ICCCM_WM_STATE_ICONIC); + unmanage_window(win); stack();