sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 8a870b7a53e195d14e9b12c37e62ca62ab6b8ac3
parent cbd5383a4a46c652dd79c62cb4e5a9e1fee3097d
Author: Chris Down <chris@chrisdown.name>
Date:   Sat, 18 Dec 2021 16:06:16 +0000

[dwm][patches][destroyfocus] Make more efficient

Move focus(getclientundermouse()) to unmanage() so we don't call it
unconditionally on DestroyNotify.

Diffstat:
Mdwm.suckless.org/patches/destroyfocus/dwm-destroyfocus-20210329-61bb8b2.diff | 44++++++++++++++------------------------------
1 file changed, 14 insertions(+), 30 deletions(-)

diff --git a/dwm.suckless.org/patches/destroyfocus/dwm-destroyfocus-20210329-61bb8b2.diff b/dwm.suckless.org/patches/destroyfocus/dwm-destroyfocus-20210329-61bb8b2.diff @@ -1,20 +1,7 @@ -From 464e7eee34bce7ff4365fc3be75275cc157608a6 Mon Sep 17 00:00:00 2001 -From: Chris Down <chris@chrisdown.name> -Date: Mon, 29 Mar 2021 11:49:13 +0000 -Subject: [PATCH] Focus client under mouse on DestroyNotify - -The client selected after destroy is somewhat deterministic, but not -trivial to reason about for a user, especially for long-term windows. As -such, apply the focus to whichever window the mouse ends up being on top -of on destroy. ---- - dwm.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/dwm.c b/dwm.c -index 664c527..4bc877d 100644 ---- a/dwm.c -+++ b/dwm.c +diff --git dwm.c dwm.c +index 5e4d494..bdb1446 100644 +--- dwm.c ++++ dwm.c @@ -170,6 +170,7 @@ static void focusin(XEvent *e); static void focusmon(const Arg *arg); static void focusstack(const Arg *arg); @@ -23,16 +10,7 @@ index 664c527..4bc877d 100644 static int getrootptr(int *x, int *y); static long getstate(Window w); static int gettextprop(Window w, Atom atom, char *text, unsigned int size); -@@ -653,6 +654,8 @@ destroynotify(XEvent *e) - - if ((c = wintoclient(ev->window))) - unmanage(c, 1); -+ -+ focus(getclientundermouse()); - } - - void -@@ -872,6 +875,20 @@ getatomprop(Client *c, Atom prop) +@@ -872,6 +873,20 @@ getatomprop(Client *c, Atom prop) return atom; } @@ -53,6 +31,12 @@ index 664c527..4bc877d 100644 int getrootptr(int *x, int *y) { --- -2.31.1 - +@@ -1782,7 +1797,7 @@ unmanage(Client *c, int destroyed) + XUngrabServer(dpy); + } + free(c); +- focus(NULL); ++ focus(getclientundermouse()); + updateclientlist(); + arrange(m); + }