making enternotify less focus hungry
This commit is contained in:
		
							parent
							
								
									92fe06b501
								
							
						
					
					
						commit
						3a392b8558
					
				
							
								
								
									
										21
									
								
								BUGS
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								BUGS
									
									
									
									
									
								
							| 
						 | 
					@ -8,27 +8,6 @@ reproducible with xrandr -s but not with --output and --mode, strange
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> 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:
 | 
					yet another corner case:
 | 
				
			||||||
open a terminal, focus another monitor, but without moving the mouse
 | 
					open a terminal, focus another monitor, but without moving the mouse
 | 
				
			||||||
pointer there
 | 
					pointer there
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										4
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								dwm.c
									
									
									
									
									
								
							| 
						 | 
					@ -820,15 +820,19 @@ drawtext(const char *text, unsigned long col[ColLast], Bool invert) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
enternotify(XEvent *e) {
 | 
					enternotify(XEvent *e) {
 | 
				
			||||||
 | 
						Client *c;
 | 
				
			||||||
	Monitor *m;
 | 
						Monitor *m;
 | 
				
			||||||
	XCrossingEvent *ev = &e->xcrossing;
 | 
						XCrossingEvent *ev = &e->xcrossing;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
 | 
						if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
						c = wintoclient(ev->window);
 | 
				
			||||||
	if((m = wintomon(ev->window)) && m != selmon) {
 | 
						if((m = wintomon(ev->window)) && m != selmon) {
 | 
				
			||||||
		unfocus(selmon->sel, True);
 | 
							unfocus(selmon->sel, True);
 | 
				
			||||||
		selmon = m;
 | 
							selmon = m;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						else if(c == selmon->sel || c == NULL)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
	focus((wintoclient(ev->window)));
 | 
						focus((wintoclient(ev->window)));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user