27 Commits
Author SHA1 Message Date
guyuming a6e2c155de fix focustop(): prefer a visible fullscreen client
Problem (reproducible on vanilla 0.9, unrelated to any local patch):
1. fullscreen client A on tag 3 (MOD+e);
2. MOD+0 to view all tags;
3. MOD+1 to switch to tag 1, focus lands on client B;
4. MOD+0 again: client A is displayed fullscreen, covering everything,
   but the focused client is the invisible B;
5. so MOD+e / MOD+q act on B behind A and the user thinks MOD+e does
   not work on A until A is clicked with the mouse.

Root cause: focustop() returns the first VISIBLEON() client on the
fstack, but VISIBLEON() only checks whether the client is on a
currently visible tag; it does not check whether the client is covered
by a fullscreen client. When switching back to tag 0, the last focused
client B is first on the fstack, so B gets the focus while A is still
displayed fullscreen.

Fix: focustop() first looks for a visible fullscreen client on the
fstack (at most one fullscreen client per monitor is actually shown,
and it always sits on top, covering the whole monitor), and only falls
back to the previous "first visible client" if there is none. As a
result:
- after a tag switch the focus goes back to the fullscreen client that
  actually occupies the screen, so MOD+e / MOD+q behave as expected;
- the fullscreen_bg decision in arrange() is fixed as a side effect
  (it used to be turned off when the focus was not on the fullscreen
  client, so a non-opaque fullscreen surface could reveal other
  clients behind it, which violates the protocol);
- focusstack() already returns early when the focused client is
  fullscreen, so MOD+j/k and the arrow keys no longer move the focus
  to a covered client either.

Verified with headless dwl, two foot clients and keys injected through
zwp_virtual_keyboard_v1: before the fix the last step gives
focal = winB / fullscreen 0; after the fix focal = winA / fullscreen 1,
and MOD+e then restores A as expected.

ta: 20261031_022753
2026-11-02 15:34:33 +08:00
Guido Cella be2bd72314 remove old comment
This was added 4 years in ago in 8cdb997. New users won't understand
what "old behavior" refers to, so this line is confusing. And it is
self-evident that you should change the alpha value if you want
transparency.
2026-10-29 17:51:48 +01:00
Guido Cella 12a5856427 don't allocate memory for drag_icon_destroy
Not needed since dwl supports only one drag icon at a time.
2026-10-27 23:14:43 +01:00
save196 4ecb2a9df5 fix the focused border color after leaving an unmanaged client
Clients focused after an unmanaged client that wants focus didn't get
the focused border color. Regression from 87029e2.
2026-10-26 15:49:23 +02:00
Guido Cella 4953b7ea0c keep outputs off when they reconnect
Some monitors disconnect when they are turned off and reconnect shortly
after, and createmon() enabled them again. Remember the names of
the outputs turned off through output_power_management or
output_management and don't enable them in createmon().

Fixes https://codeberg.org/dwl/dwl/issues/719
2026-10-22 23:35:06 +02:00
Guido Cella 9dfaea2f79 call updatemons() when createmon() leaves an output disabled
This lets you enable it later.

Fixes afbafd5.
2026-10-22 13:31:04 +02:00
Guido Cella afbafd53ab don't crash when initializing more monitors than supported
Fixes https://codeberg.org/dwl/dwl/issues/726
2026-10-21 19:02:00 +02:00
Guido Cella 4ff9db2c40 Revert "remove zero flickering lie"
This reverts commit b1c101515a.

Fixed by d3fa329.
2026-10-20 21:26:05 +02:00
Guido Cella d3fa32993c fix flicker when arranging tiled windows
Fixes https://codeberg.org/dwl/dwl/issues/552
Fixes https://codeberg.org/dwl/dwl/issues/705

Also, floating children of fullscreen windows in floating layout now go
in LyrFS instead of LyrTile.
2026-10-20 21:23:49 +02:00
Guido Cella f08d8b3913 fix segfault when XWayland fails to initialize
Fixes https://codeberg.org/dwl/dwl/issues/1202
2026-10-19 22:57:02 +02:00
Guido Cella 90e7c722e9 remove client_is_rendered_on_mon() and client_is_stopped()
Unused since 70c33c0.
2026-10-19 21:17:43 +02:00
Guido CellaandDanD e2038450f2 fix popup positioning
Related: https://codeberg.org/dwl/dwl/pulls/1244

Co-authored-by: DanD <dandgg.ftw@gmail.com>
2026-09-29 13:54:59 +02:00
save196 4fd683cc84 fix X11 clients shifting by the border width on map
c->geom includes the border, but client_get_geometry() returns the
content position. Subtract the border, clamped to the layout edges.
2026-09-29 00:18:49 +03:00
Guido Cella d29259c26a refactor focusclient() 2026-09-28 13:18:49 +02:00
Guido Cella fccce97448 remove obsolete comment
No longer accurate since a514a92.
2026-09-28 12:19:24 +02:00
Guido Cella d9ddaba762 also make clients tiled on map
While making them tiled on the first commit was needed to fix Firefox
starting with rounded corners, if you don't set them tiled again on map
resizing mpv after starting it with a rule that makes it floating
behaves wrong.

Fixes d1ebf3c.
Fixes https://codeberg.org/dwl/dwl/issues/1247.
2026-09-26 19:31:15 +02:00
Guido Cella f1675a4800 Revert "client: do not drop configure events based on current committed size"
This reverts commit 242ffd7a75.

Removing this conditon can cause a xdg_toplevel.configure ↔
wl_surface.commit loop that uses 100% CPU.

Fixes https://codeberg.org/dwl/dwl/issues/1245
Fixes https://codeberg.org/dwl/dwl/issues/1246
2026-09-23 09:03:08 +02:00
Guido Cella a75ca79630 add missing void
Needed to compile on OpenBSD.
2026-09-22 20:42:48 +02:00
Guido Cella 87029e21c0 remove exclusive_focus variable
This is not needed because focusclient() already calls
toplevel_from_wlr_surface(seat->keyboard_state.focused_surface) and can
check if that should have exclusive focus.

When it was added there was no function to get the focused layer shell
surface in this way.
2026-09-22 14:53:00 +02:00
aloires a514a928e4 focusclient: set input method focus for layer surfaces
Focusing a layer surface only set the keyboard focus, not the text-input
focus, so layer-shell clients (launchers, menus, ...) never received a
text-input enter event and IME input didn't work. Pass the layer surface
to focusclient() and set the input method focus there, like we already do
for regular clients.
2026-09-22 16:25:29 +08:00
André Desgualdo Pereira 242ffd7a75 client: do not drop configure events based on current committed size 2026-09-21 14:35:09 -03:00
save196 f22c223cbf don't run keybindings on keyrepeat while locked 2026-09-21 17:07:38 +03:00
save196 b83881f881 don't send pointer events to clients while locked 2026-09-21 12:37:19 +03:00
save196 fa400c5d3d don't run axis bindings when locked 2026-09-21 01:06:08 +03:00
save196 40b0ae76ae bind axis to nothing by default 2026-09-21 00:07:22 +03:00
save196 2a567195e6 don't use the xdg window geometry offset as a position
It is the offset of the visible bounds inside the surface, which is not
zero for clients that pad their surface or place subsurfaces outside it,
so floating windows were mapped offset by their client side decorations.
2026-09-20 19:53:12 +03:00
Guido Cella cc23250527 bump version to 0.10-dev 2026-09-20 12:20:09 +02:00
6 changed files with 438 additions and 180 deletions
+1
View File
@@ -153,6 +153,7 @@ given the base on which it is built. Implemented default features are:
- Support screen lockers via ext-session-lock-v1 protocol
- Various Wayland protocols
- XWayland support as provided by wlroots (can be enabled in `config.mk`)
- Zero flickering - Wayland users naturally expect that "every frame is perfect"
- Layer shell popups (used by Waybar)
- Damage tracking provided by scenegraph API
+23 -47
View File
@@ -189,6 +189,7 @@ client_get_geometry(Client *c, struct wlr_box *geom)
}
#endif
*geom = c->surface.xdg->geometry;
geom->x = geom->y = 0;
}
static inline Client *
@@ -257,48 +258,6 @@ client_is_float_type(Client *c)
(min.width == max.width || min.height == max.height));
}
static inline int
client_is_rendered_on_mon(Client *c, Monitor *m)
{
/* This is needed for when you don't want to check formal assignment,
* but rather actual displaying of the pixels.
* Usually VISIBLEON suffices and is also faster. */
struct wlr_surface_output *s;
int unused_lx, unused_ly;
if (!wlr_scene_node_coords(&c->scene->node, &unused_lx, &unused_ly))
return 0;
wl_list_for_each(s, &client_surface(c)->current_outputs, link)
if (s->output == m->wlr_output)
return 1;
return 0;
}
static inline int
client_is_stopped(Client *c)
{
int pid;
siginfo_t in = {0};
#ifdef XWAYLAND
if (client_is_x11(c))
return 0;
#endif
wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL);
if (waitid(P_PID, pid, &in, WNOHANG|WCONTINUED|WSTOPPED|WNOWAIT) < 0) {
/* This process is not our child process, while is very unlikely that
* it is stopped, in order to do not skip frames, assume that it is. */
if (errno == ECHILD)
return 1;
} else if (in.si_pid) {
if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED)
return 1;
if (in.si_code == CLD_CONTINUED)
return 0;
}
return 0;
}
static inline int
client_is_unmanaged(Client *c)
{
@@ -365,19 +324,36 @@ client_set_scale(struct wlr_surface *s, float scale)
wlr_surface_set_preferred_buffer_scale(s, (int32_t)ceilf(scale));
}
static inline void
/* Returns nonzero if the client has to commit a buffer with the new size */
static inline uint32_t
client_set_size(Client *c, uint32_t width, uint32_t height)
{
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_configure(c->surface.xwayland,
c->geom.x + c->bw, c->geom.y + c->bw, width, height);
return;
return (int)width != client_surface(c)->current.width
|| (int)height != client_surface(c)->current.height;
}
#endif
if ((int32_t)width != c->surface.xdg->toplevel->current.width
|| (int32_t)height != c->surface.xdg->toplevel->current.height)
wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width, (int32_t)height);
if ((int32_t)width == c->surface.xdg->toplevel->scheduled.width
&& (int32_t)height == c->surface.xdg->toplevel->scheduled.height)
return 0;
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width, (int32_t)height);
}
static inline void
client_send_frame_done_iterator(struct wlr_surface *s, int sx, int sy, void *data)
{
wlr_surface_send_frame_done(s, data);
}
static inline void
client_send_frame_done(Client *c)
{
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
wlr_surface_for_each_surface(client_surface(c), client_send_frame_done_iterator, &now);
}
static inline void
+4 -2
View File
@@ -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 */
@@ -172,6 +171,9 @@ static const Button buttons[] = {
};
static const Axis axes[] = {
/* example of volume control:
{ MODKEY, AxisUp, spawn, SHCMD("volume-up_EXAMPLE") },
{ MODKEY, AxisDown, spawn, SHCMD("volume-down_EXAMPLE") },
{ MODKEY, AxisDown, spawn, SHCMD("volume-down_EXAMPLE") }, */
{ 0, 0, NULL, {0} },
/* does nothing, but the array cannot be empty */
};
+1 -1
View File
@@ -1,4 +1,4 @@
_VERSION = 0.9-dev
_VERSION = 0.10-dev
VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
PKG_CONFIG = pkg-config
+408 -129
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -594,7 +594,7 @@ handle_focused_surface_destroy(struct wl_listener *listener,
}
struct input_method_relay *
input_method_relay_create()
input_method_relay_create(void)
{
struct input_method_relay *relay = ecalloc(1, sizeof(*relay));
wl_list_init(&relay->text_inputs);