mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-04 05:54:14 +00:00 
			
		
		
		
	use wlr_xwayland_surface_has_window_type() (wlroots!4553)
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4553
This commit is contained in:
		
							parent
							
								
									1b805ddd38
								
							
						
					
					
						commit
						43e846432a
					
				
							
								
								
									
										11
									
								
								client.h
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								client.h
									
									
									
									
									
								
							@ -215,16 +215,15 @@ client_is_float_type(Client *c)
 | 
				
			|||||||
	if (client_is_x11(c)) {
 | 
						if (client_is_x11(c)) {
 | 
				
			||||||
		struct wlr_xwayland_surface *surface = c->surface.xwayland;
 | 
							struct wlr_xwayland_surface *surface = c->surface.xwayland;
 | 
				
			||||||
		xcb_size_hints_t *size_hints = surface->size_hints;
 | 
							xcb_size_hints_t *size_hints = surface->size_hints;
 | 
				
			||||||
		size_t i;
 | 
					 | 
				
			||||||
		if (surface->modal)
 | 
							if (surface->modal)
 | 
				
			||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (i = 0; i < surface->window_type_len; i++)
 | 
							if (wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG)
 | 
				
			||||||
			if (surface->window_type[i] == netatom[NetWMWindowTypeDialog]
 | 
									|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH)
 | 
				
			||||||
					|| surface->window_type[i] == netatom[NetWMWindowTypeSplash]
 | 
									|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR)
 | 
				
			||||||
					|| surface->window_type[i] == netatom[NetWMWindowTypeToolbar]
 | 
									|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY)) {
 | 
				
			||||||
					|| surface->window_type[i] == netatom[NetWMWindowTypeUtility])
 | 
					 | 
				
			||||||
			return 1;
 | 
								return 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return size_hints && size_hints->min_width > 0 && size_hints->min_height > 0
 | 
							return size_hints && size_hints->min_width > 0 && size_hints->min_height > 0
 | 
				
			||||||
			&& (size_hints->max_width == size_hints->min_width
 | 
								&& (size_hints->max_width == size_hints->min_width
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										34
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								dwl.c
									
									
									
									
									
								
							@ -85,10 +85,6 @@
 | 
				
			|||||||
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
 | 
					enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
 | 
				
			||||||
enum { XDGShell, LayerShell, X11 }; /* client types */
 | 
					enum { XDGShell, LayerShell, X11 }; /* client types */
 | 
				
			||||||
enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */
 | 
					enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */
 | 
				
			||||||
#ifdef XWAYLAND
 | 
					 | 
				
			||||||
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
 | 
					 | 
				
			||||||
	NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef union {
 | 
					typedef union {
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
@ -420,11 +416,9 @@ static void associatex11(struct wl_listener *listener, void *data);
 | 
				
			|||||||
static void configurex11(struct wl_listener *listener, void *data);
 | 
					static void configurex11(struct wl_listener *listener, void *data);
 | 
				
			||||||
static void createnotifyx11(struct wl_listener *listener, void *data);
 | 
					static void createnotifyx11(struct wl_listener *listener, void *data);
 | 
				
			||||||
static void dissociatex11(struct wl_listener *listener, void *data);
 | 
					static void dissociatex11(struct wl_listener *listener, void *data);
 | 
				
			||||||
static xcb_atom_t getatom(xcb_connection_t *xc, const char *name);
 | 
					 | 
				
			||||||
static void sethints(struct wl_listener *listener, void *data);
 | 
					static void sethints(struct wl_listener *listener, void *data);
 | 
				
			||||||
static void xwaylandready(struct wl_listener *listener, void *data);
 | 
					static void xwaylandready(struct wl_listener *listener, void *data);
 | 
				
			||||||
static struct wlr_xwayland *xwayland;
 | 
					static struct wlr_xwayland *xwayland;
 | 
				
			||||||
static xcb_atom_t netatom[NetLast];
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* configuration, allows nested code to access above variables */
 | 
					/* configuration, allows nested code to access above variables */
 | 
				
			||||||
@ -3128,19 +3122,6 @@ dissociatex11(struct wl_listener *listener, void *data)
 | 
				
			|||||||
	wl_list_remove(&c->unmap.link);
 | 
						wl_list_remove(&c->unmap.link);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
xcb_atom_t
 | 
					 | 
				
			||||||
getatom(xcb_connection_t *xc, const char *name)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	xcb_atom_t atom = 0;
 | 
					 | 
				
			||||||
	xcb_intern_atom_reply_t *reply;
 | 
					 | 
				
			||||||
	xcb_intern_atom_cookie_t cookie = xcb_intern_atom(xc, 0, strlen(name), name);
 | 
					 | 
				
			||||||
	if ((reply = xcb_intern_atom_reply(xc, cookie, NULL)))
 | 
					 | 
				
			||||||
		atom = reply->atom;
 | 
					 | 
				
			||||||
	free(reply);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return atom;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
sethints(struct wl_listener *listener, void *data)
 | 
					sethints(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -3160,19 +3141,6 @@ void
 | 
				
			|||||||
xwaylandready(struct wl_listener *listener, void *data)
 | 
					xwaylandready(struct wl_listener *listener, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct wlr_xcursor *xcursor;
 | 
						struct wlr_xcursor *xcursor;
 | 
				
			||||||
	xcb_connection_t *xc = xcb_connect(xwayland->display_name, NULL);
 | 
					 | 
				
			||||||
	int err = xcb_connection_has_error(xc);
 | 
					 | 
				
			||||||
	if (err) {
 | 
					 | 
				
			||||||
		fprintf(stderr, "xcb_connect to X server failed with code %d\n. Continuing with degraded functionality.\n", err);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Collect atoms we are interested in. If getatom returns 0, we will
 | 
					 | 
				
			||||||
	 * not detect that window type. */
 | 
					 | 
				
			||||||
	netatom[NetWMWindowTypeDialog] = getatom(xc, "_NET_WM_WINDOW_TYPE_DIALOG");
 | 
					 | 
				
			||||||
	netatom[NetWMWindowTypeSplash] = getatom(xc, "_NET_WM_WINDOW_TYPE_SPLASH");
 | 
					 | 
				
			||||||
	netatom[NetWMWindowTypeToolbar] = getatom(xc, "_NET_WM_WINDOW_TYPE_TOOLBAR");
 | 
					 | 
				
			||||||
	netatom[NetWMWindowTypeUtility] = getatom(xc, "_NET_WM_WINDOW_TYPE_UTILITY");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* assign the one and only seat */
 | 
						/* assign the one and only seat */
 | 
				
			||||||
	wlr_xwayland_set_seat(xwayland, seat);
 | 
						wlr_xwayland_set_seat(xwayland, seat);
 | 
				
			||||||
@ -3183,8 +3151,6 @@ xwaylandready(struct wl_listener *listener, void *data)
 | 
				
			|||||||
				xcursor->images[0]->buffer, xcursor->images[0]->width * 4,
 | 
									xcursor->images[0]->buffer, xcursor->images[0]->width * 4,
 | 
				
			||||||
				xcursor->images[0]->width, xcursor->images[0]->height,
 | 
									xcursor->images[0]->width, xcursor->images[0]->height,
 | 
				
			||||||
				xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y);
 | 
									xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	xcb_disconnect(xc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user