diff --git a/client.h b/client.h index ebe665b..bea7a97 100644 --- a/client.h +++ b/client.h @@ -279,7 +279,7 @@ client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb) } for (size_t i = 0; i < kb->num_keycodes; i++) { uint32_t key = kb->keycodes[i]; - if (!consumed[key]) + if (key >= LENGTH(consumed) || !consumed[key]) filtered[size++] = key; } wlr_seat_keyboard_notify_enter(seat, s, filtered, size, &kb->modifiers); diff --git a/config.def.h b/config.def.h index a4019d3..4901e7a 100644 --- a/config.def.h +++ b/config.def.h @@ -12,7 +12,6 @@ static const float rootcolor[] = COLOR(0x222222ff); static const float bordercolor[] = COLOR(0x444444ff); static const float focuscolor[] = COLOR(0x005577ff); static const float urgentcolor[] = COLOR(0xff0000ff); -/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */ /* tagging - TAGCOUNT must be no greater than 31 */ diff --git a/dwl.c b/dwl.c index 4589b8f..e7edaa0 100644 --- a/dwl.c +++ b/dwl.c @@ -529,7 +529,7 @@ applybounds(Client *c, struct wlr_box *bbox) c->geom.width = MAX(min.width + 2 * (int)c->bw, c->geom.width); c->geom.height = MAX(min.height + 2 * (int)c->bw, c->geom.height); /* Some clients set their max size to INT_MAX, which does not violate the - * protocol but it's unnecesary, as they can set their max size to zero. */ + * protocol but it's unnecessary, as they can set their max size to zero. */ if (max.width > 0 && 2 * (int)c->bw <= INT_MAX - max.width) /* Checks for overflow */ c->geom.width = MIN(max.width + 2 * (int)c->bw, c->geom.width); if (max.height > 0 && 2 * (int)c->bw <= INT_MAX - max.height) /* Checks for overflow */ @@ -1707,10 +1707,14 @@ Client * focustop(Monitor *m) { Client *c; - wl_list_for_each(c, &fstack, flink) { + + wl_list_for_each(c, &fstack, flink) + if (VISIBLEON(c, m) && c->isfullscreen) + return c; + + wl_list_for_each(c, &fstack, flink) if (VISIBLEON(c, m)) return c; - } return NULL; } @@ -1838,7 +1842,8 @@ keypress(struct wl_listener *listener, void *data) for (int i = 0; i < 2; i++) { const Key *key = keybinding(group->mods, group->keysyms[i]); if (key) { - consumed[event->keycode] = 1; + if (event->keycode < LENGTH(consumed)) + consumed[event->keycode] = 1; key->func(&key->arg); handled = 1; break; @@ -1855,7 +1860,7 @@ keypress(struct wl_listener *listener, void *data) if (handled || input_method_keyboard_grab_forward_key(group, event)) return; - if (consumed[event->keycode]) { + if (event->keycode < LENGTH(consumed) && consumed[event->keycode]) { if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) consumed[event->keycode] = 0; return; /* Don't pass to the client the release event of a handled key-press */ @@ -1983,8 +1988,6 @@ mapnotify(struct wl_listener *listener, void *data) } /* Initialize client geometry with room for border */ - client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | - WLR_EDGE_RIGHT); c->geom.width += 2 * c->bw; c->geom.height += 2 * c->bw; if (client_is_x11(c)) { @@ -2024,8 +2027,11 @@ mapnotify(struct wl_listener *listener, void *data) unset_fullscreen: m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); wl_list_for_each(w, &clients, link) { - if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags)) + if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags)) { setfullscreen(w, 0); + /* setmon() focused w because focustop() prefers fullscreen clients */ + focusclient(focustop(selmon), NULL, 1); + } } } @@ -2431,6 +2437,7 @@ rendermon(struct wl_listener *listener, void *data) wlr_scene_output_commit(m->scene_output, NULL); clock_gettime(CLOCK_MONOTONIC, &now); + wlr_output_schedule_frame(m->wlr_output); wlr_scene_output_send_frame_done(m->scene_output, &now); } @@ -2460,6 +2467,7 @@ requestmonstate(struct wl_listener *listener, void *data) { struct wlr_output_event_request_state *event = data; wlr_output_commit_state(event->output, event->state); + wlr_output_schedule_frame(event->output); updatemons(NULL, NULL); } @@ -3056,8 +3064,7 @@ tagmon(const Arg *arg) void tile(Monitor *m) { - unsigned int mw, my, ty; - int i, n = 0; + int i, n = 0, mw, my, ty; Client *c; wl_list_for_each(c, &clients, link) @@ -3358,8 +3365,9 @@ updatemons(struct wl_listener *listener, void *data) /* Don't move clients to the left output when plugging monitors */ arrange(m); /* make sure fullscreen clients have the right size */ - if ((c = focustop(m)) && c->isfullscreen) - resize(c, m->m, 0); + wl_list_for_each(c, &clients, link) + if (c->mon == m && c->isfullscreen) + resize(c, m->m, 0); /* Try to re-set the gamma LUT when updating monitors, * it's only really needed when enabling a disabled output, but meh. */