[wiki] [sites] [dwm][patches][destroyfocus] Make more efficient || Chris Down

From: <git_AT_suckless.org>
Date: Sat, 18 Dec 2021 17:06:51 +0100

commit 8a870b7a53e195d14e9b12c37e62ca62ab6b8ac3
Author: Chris Down <chris_AT_chrisdown.name>
Date: Sat Dec 18 16:06:16 2021 +0000

    [dwm][patches][destroyfocus] Make more efficient
    
    Move focus(getclientundermouse()) to unmanage() so we don't call it
    unconditionally on DestroyNotify.

diff --git a/dwm.suckless.org/patches/destroyfocus/dwm-destroyfocus-20210329-61bb8b2.diff b/dwm.suckless.org/patches/destroyfocus/dwm-destroyfocus-20210329-61bb8b2.diff
index 17e047e9..f17c3f54 100644
--- a/dwm.suckless.org/patches/destroyfocus/dwm-destroyfocus-20210329-61bb8b2.diff
+++ b/dwm.suckless.org/patches/destroyfocus/dwm-destroyfocus-20210329-61bb8b2.diff
_AT_@ -1,20 +1,7 @@
-From 464e7eee34bce7ff4365fc3be75275cc157608a6 Mon Sep 17 00:00:00 2001
-From: Chris Down <chris_AT_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
 _AT_@ -170,6 +170,7 @@ static void focusin(XEvent *e);
  static void focusmon(const Arg *arg);
  static void focusstack(const Arg *arg);
_AT_@ -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);
-_AT_@ -653,6 +654,8 @@ destroynotify(XEvent *e)
- 
- 	if ((c = wintoclient(ev->window)))
- 		unmanage(c, 1);
-+
-+	focus(getclientundermouse());
- }
- 
- void
-_AT_@ -872,6 +875,20 @@ getatomprop(Client *c, Atom prop)
+_AT_@ -872,6 +873,20 @@ getatomprop(Client *c, Atom prop)
  	return atom;
  }
  
_AT_@ -53,6 +31,12 @@ index 664c527..4bc877d 100644
  int
  getrootptr(int *x, int *y)
  {
--- 
-2.31.1
-
+_AT_@ -1782,7 +1797,7 @@ unmanage(Client *c, int destroyed)
+ 		XUngrabServer(dpy);
+ 	}
+ 	free(c);
+-	focus(NULL);
++	focus(getclientundermouse());
+ 	updateclientlist();
+ 	arrange(m);
+ }
Received on Sat Dec 18 2021 - 17:06:51 CET

This archive was generated by hypermail 2.3.0 : Sat Dec 18 2021 - 17:12:42 CET