mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-03 09:01:45 -05:00 
			
		
		
		
	use the new {a,di}ssociate events to handle xwayland commit listener
This commit is contained in:
		
							parent
							
								
									06bc65549f
								
							
						
					
					
						commit
						f3d017077a
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		
							
								
								
									
										10
									
								
								dwl.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								dwl.c
									
										
									
									
									
								
							| 
						 | 
					@ -1021,6 +1021,7 @@ createnotify(struct wl_listener *listener, void *data)
 | 
				
			||||||
	c->surface.xdg = xdg_surface;
 | 
						c->surface.xdg = xdg_surface;
 | 
				
			||||||
	c->bw = borderpx;
 | 
						c->bw = borderpx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify);
 | 
				
			||||||
	LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify);
 | 
						LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify);
 | 
				
			||||||
	LISTEN(&xdg_surface->surface->events.unmap, &c->unmap, unmapnotify);
 | 
						LISTEN(&xdg_surface->surface->events.unmap, &c->unmap, unmapnotify);
 | 
				
			||||||
	LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
 | 
						LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
 | 
				
			||||||
| 
						 | 
					@ -1177,6 +1178,7 @@ destroynotify(struct wl_listener *listener, void *data)
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							wl_list_remove(&c->commit.link);
 | 
				
			||||||
		wl_list_remove(&c->map.link);
 | 
							wl_list_remove(&c->map.link);
 | 
				
			||||||
		wl_list_remove(&c->unmap.link);
 | 
							wl_list_remove(&c->unmap.link);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1541,12 +1543,7 @@ mapnotify(struct wl_listener *listener, void *data)
 | 
				
			||||||
	c->scene_surface = c->type == XDGShell
 | 
						c->scene_surface = c->type == XDGShell
 | 
				
			||||||
			? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg)
 | 
								? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg)
 | 
				
			||||||
			: wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
 | 
								: wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
 | 
				
			||||||
	if (client_surface(c)) {
 | 
					 | 
				
			||||||
	client_surface(c)->data = c->scene;
 | 
						client_surface(c)->data = c->scene;
 | 
				
			||||||
		/* Ideally we should do this in createnotify{,x11} but at that moment
 | 
					 | 
				
			||||||
		* wlr_xwayland_surface doesn't have wlr_surface yet. */
 | 
					 | 
				
			||||||
		LISTEN(&client_surface(c)->events.commit, &c->commit, commitnotify);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	c->scene->node.data = c->scene_surface->node.data = c;
 | 
						c->scene->node.data = c->scene_surface->node.data = c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Handle unmanaged clients first so we can return prior create borders */
 | 
						/* Handle unmanaged clients first so we can return prior create borders */
 | 
				
			||||||
| 
						 | 
					@ -2525,7 +2522,6 @@ unmapnotify(struct wl_listener *listener, void *data)
 | 
				
			||||||
		wl_list_remove(&c->flink);
 | 
							wl_list_remove(&c->flink);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_remove(&c->commit.link);
 | 
					 | 
				
			||||||
	wlr_scene_node_destroy(&c->scene->node);
 | 
						wlr_scene_node_destroy(&c->scene->node);
 | 
				
			||||||
	printstatus();
 | 
						printstatus();
 | 
				
			||||||
	motionnotify(0);
 | 
						motionnotify(0);
 | 
				
			||||||
| 
						 | 
					@ -2747,6 +2743,7 @@ associatex11(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Client *c = wl_container_of(listener, c, associate);
 | 
						Client *c = wl_container_of(listener, c, associate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						LISTEN(&client_surface(c)->events.commit, &c->commit, commitnotify);
 | 
				
			||||||
	LISTEN(&client_surface(c)->events.map, &c->map, mapnotify);
 | 
						LISTEN(&client_surface(c)->events.map, &c->map, mapnotify);
 | 
				
			||||||
	LISTEN(&client_surface(c)->events.unmap, &c->unmap, unmapnotify);
 | 
						LISTEN(&client_surface(c)->events.unmap, &c->unmap, unmapnotify);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2792,6 +2789,7 @@ void
 | 
				
			||||||
dissociatex11(struct wl_listener *listener, void *data)
 | 
					dissociatex11(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Client *c = wl_container_of(listener, c, dissociate);
 | 
						Client *c = wl_container_of(listener, c, dissociate);
 | 
				
			||||||
 | 
						wl_list_remove(&c->commit.link);
 | 
				
			||||||
	wl_list_remove(&c->map.link);
 | 
						wl_list_remove(&c->map.link);
 | 
				
			||||||
	wl_list_remove(&c->unmap.link);
 | 
						wl_list_remove(&c->unmap.link);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue