mirror of
				https://github.com/DreamMaoMao/maomaowm.git
				synced 2025-11-03 09:01:47 -05:00 
			
		
		
		
	feat: update to wlr_layer_shell v4
This commit is contained in:
		
							parent
							
								
									731eea06d4
								
							
						
					
					
						commit
						46ff9d54f1
					
				
					 1 changed files with 22 additions and 12 deletions
				
			
		
							
								
								
									
										34
									
								
								src/maomao.c
									
										
									
									
									
								
							
							
						
						
									
										34
									
								
								src/maomao.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2495,7 +2495,9 @@ void arrangelayers(Monitor *m) {
 | 
			
		|||
	/* Find topmost keyboard interactive layer, if such a layer exists */
 | 
			
		||||
	for (i = 0; i < (int)LENGTH(layers_above_shell); i++) {
 | 
			
		||||
		wl_list_for_each_reverse(l, &m->layers[layers_above_shell[i]], link) {
 | 
			
		||||
			if (locked || !l->layer_surface->current.keyboard_interactive ||
 | 
			
		||||
			if (locked ||
 | 
			
		||||
				l->layer_surface->current.keyboard_interactive !=
 | 
			
		||||
					ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE ||
 | 
			
		||||
				!l->mapped)
 | 
			
		||||
				continue;
 | 
			
		||||
			/* Deactivate the focused client. */
 | 
			
		||||
| 
						 | 
				
			
			@ -2730,13 +2732,11 @@ buttonpress(struct wl_listener *listener, void *data) {
 | 
			
		|||
	struct wlr_keyboard *keyboard;
 | 
			
		||||
	uint32_t mods;
 | 
			
		||||
	Client *c;
 | 
			
		||||
	LayerSurface *l;
 | 
			
		||||
	struct wlr_surface *surface;
 | 
			
		||||
	Client *tmpc;
 | 
			
		||||
	int ji;
 | 
			
		||||
	const MouseBinding *b;
 | 
			
		||||
	struct wlr_surface *surface;
 | 
			
		||||
 | 
			
		||||
	struct wlr_surface *old_pointer_focus_surface =
 | 
			
		||||
		seat->pointer_state.focused_surface;
 | 
			
		||||
 | 
			
		||||
	handlecursoractivity();
 | 
			
		||||
	wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
 | 
			
		||||
| 
						 | 
				
			
			@ -2748,13 +2748,17 @@ buttonpress(struct wl_listener *listener, void *data) {
 | 
			
		|||
		if (locked)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		/* Change focus if the button was _pressed_ over a client */
 | 
			
		||||
		xytonode(cursor->x, cursor->y, &surface, &c, NULL, NULL, NULL);
 | 
			
		||||
		if (c && (!client_is_unmanaged(c) || client_wants_focus(c)))
 | 
			
		||||
			focusclient(c, 1);
 | 
			
		||||
		xytonode(cursor->x, cursor->y, &surface, NULL, NULL, NULL, NULL);
 | 
			
		||||
		if (toplevel_from_wlr_surface(surface, &c, &l) >= 0) {
 | 
			
		||||
			if (c && (!client_is_unmanaged(c) || client_wants_focus(c)))
 | 
			
		||||
				focusclient(c, 1);
 | 
			
		||||
 | 
			
		||||
		if (surface != old_pointer_focus_surface)
 | 
			
		||||
			wlr_seat_pointer_notify_clear_focus(seat);
 | 
			
		||||
			if (l && l->layer_surface->current.keyboard_interactive) {
 | 
			
		||||
				focusclient(NULL, 0);
 | 
			
		||||
				client_notify_enter(l->layer_surface->surface,
 | 
			
		||||
									wlr_seat_get_keyboard(seat));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		keyboard = wlr_seat_get_keyboard(seat);
 | 
			
		||||
		mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -3010,6 +3014,11 @@ void commitlayersurfacenotify(struct wl_listener *listener, void *data) {
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (layer_surface == exclusive_focus &&
 | 
			
		||||
		layer_surface->current.keyboard_interactive !=
 | 
			
		||||
			ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
 | 
			
		||||
		exclusive_focus = NULL;
 | 
			
		||||
 | 
			
		||||
	if (layer_surface->current.committed == 0 &&
 | 
			
		||||
		l->mapped == layer_surface->surface->mapped)
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -4000,7 +4009,8 @@ void focusclient(Client *c, int lift) {
 | 
			
		|||
		int type =
 | 
			
		||||
			toplevel_from_wlr_surface(old_keyboard_focus_surface, &w, &l);
 | 
			
		||||
		if (type == LayerShell && l->scene->node.enabled &&
 | 
			
		||||
			l->layer_surface->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
 | 
			
		||||
			l->layer_surface->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP &&
 | 
			
		||||
			!l->layer_surface->current.keyboard_interactive) {
 | 
			
		||||
			return;
 | 
			
		||||
		} else if (w && w == exclusive_focus && client_wants_focus(w)) {
 | 
			
		||||
			return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue