diff options
| author | Guido Cella <guidocella91@gmail.com> | 2020-09-04 21:30:47 +0200 | 
|---|---|---|
| committer | Guido Cella <guidocella91@gmail.com> | 2020-09-04 21:35:48 +0200 | 
| commit | ae798c694ae0b9991d23dcd35b943967475ac2e5 (patch) | |
| tree | b3f322cecaa340d0b85fe63d4991d7a822362114 | |
| parent | fix restoring pointer focus (diff) | |
| download | dwl-ae798c694ae0b9991d23dcd35b943967475ac2e5.tar.gz dwl-ae798c694ae0b9991d23dcd35b943967475ac2e5.tar.bz2 dwl-ae798c694ae0b9991d23dcd35b943967475ac2e5.tar.xz dwl-ae798c694ae0b9991d23dcd35b943967475ac2e5.tar.zst dwl-ae798c694ae0b9991d23dcd35b943967475ac2e5.zip | |
Don't let overlays lose focus
if you open a new window while an overlay is mapped, the overlay should
stay focused
| -rw-r--r-- | dwl.c | 22 | 
1 files changed, 20 insertions, 2 deletions
| @@ -256,6 +256,7 @@ static void setmfact(const Arg *arg);  static void setmon(Client *c, Monitor *m, unsigned int newtags);  static void setup(void);  static void sigchld(int unused); +static bool shouldfocusclients();  static void spawn(const Arg *arg);  static void tag(const Arg *arg);  static void tagmon(const Arg *arg); @@ -1037,8 +1038,9 @@ focusclient(Client *old, Client *c, int lift)  	}  	/* Have a client, so focus its top-level wlr_surface */ -	wlr_seat_keyboard_notify_enter(seat, WLR_SURFACE(c), -			kb->keycodes, kb->num_keycodes, &kb->modifiers); +	if (shouldfocusclients(c->mon)) +		wlr_seat_keyboard_notify_enter(seat, WLR_SURFACE(c), +				kb->keycodes, kb->num_keycodes, &kb->modifiers);  	/* Put the new client atop the focus stack and select its monitor */  	wl_list_remove(&c->flink); @@ -1979,6 +1981,22 @@ sigchld(int unused)  		;  } +bool +shouldfocusclients(Monitor *m) +{ +	LayerSurface *layersurface; +	uint32_t layers_above_shell[] = { +		ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, +		ZWLR_LAYER_SHELL_V1_LAYER_TOP, +	}; +	for (unsigned int i = 0; i < LENGTH(layers_above_shell); ++i) +		wl_list_for_each(layersurface, &m->layers[layers_above_shell[i]], link) +			if (layersurface->layer_surface->current.keyboard_interactive && +					!layersurface->unmapping) +				return false; +	return true; +} +  void  spawn(const Arg *arg)  { | 
