[hackers] [dwm] making enternotify less focus hungry || garbeam

From: <hg_AT_suckless.org>
Date: Sat, 25 Jun 2011 10:07:32 +0200 (CEST)

changeset: 1554:014df3c34b64
tag: tip
user: garbeam_AT_gmail.com
date: Sat Jun 25 09:07:28 2011 +0100
files: BUGS dwm.c
description:
making enternotify less focus hungry

diff -r 79fe8e97dcf7 -r 014df3c34b64 BUGS
--- a/BUGS Fri Jun 24 21:02:32 2011 +0100
+++ b/BUGS Sat Jun 25 09:07:28 2011 +0100
@@ -8,27 +8,6 @@
 
 ---
 
-> enternotify is handled even when the entered window is already focused
-> (eg moving the mouse to the bar and back, scrolling on the border..)
->
-> focusing might be expensive for some clients (eg dim/light up)
->
-> a possible solution is to modify enternotify:
->
-> + c = wintoclient(ev->window);
-> if((m = wintomon(ev->window)) && m != selmon) {
-> unfocus(selmon->sel);
-> selmon = m;
-> }
-> + else if (c == selmon->sel || c == NULL)
-> + return;
-

----
-
-dmenu appears on the monitor where the pointer is and not on selmon
-
----
-
 yet another corner case:
 open a terminal, focus another monitor, but without moving the mouse
 pointer there
diff -r 79fe8e97dcf7 -r 014df3c34b64 dwm.c
--- a/dwm.c	Fri Jun 24 21:02:32 2011 +0100
+++ b/dwm.c	Sat Jun 25 09:07:28 2011 +0100
@@ -820,15 +820,19 @@
 
 void
 enternotify(XEvent *e) {
+	Client *c;
 	Monitor *m;
 	XCrossingEvent *ev = &e->xcrossing;
 
 	if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
 		return;
+	c = wintoclient(ev->window);
 	if((m = wintomon(ev->window)) && m != selmon) {
 		unfocus(selmon->sel, True);
 		selmon = m;
 	}
+	else if(c == selmon->sel || c == NULL)
+		return;
 	focus((wintoclient(ev->window)));
 }
 
Received on Sat Jun 25 2011 - 10:07:32 CEST

This archive was generated by hypermail 2.2.0 : Sat Jun 25 2011 - 10:12:04 CEST