mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-11-03 09:01:45 -05:00 
			
		
		
		
	guarantee client_get_{title,appid} never return NULL
ΔSLOC: -6
This commit is contained in:
		
							parent
							
								
									1b805ddd38
								
							
						
					
					
						commit
						93068810ef
					
				
					 2 changed files with 14 additions and 14 deletions
				
			
		
							
								
								
									
										14
									
								
								client.h
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								client.h
									
										
									
									
									
								
							| 
						 | 
					@ -124,11 +124,14 @@ client_set_bounds(Client *c, int32_t width, int32_t height)
 | 
				
			||||||
static inline const char *
 | 
					static inline const char *
 | 
				
			||||||
client_get_appid(Client *c)
 | 
					client_get_appid(Client *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						const char *app_id;
 | 
				
			||||||
#ifdef XWAYLAND
 | 
					#ifdef XWAYLAND
 | 
				
			||||||
	if (client_is_x11(c))
 | 
						if (client_is_x11(c))
 | 
				
			||||||
		return c->surface.xwayland->class;
 | 
							app_id = c->surface.xwayland->class;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	return c->surface.xdg->toplevel->app_id;
 | 
							app_id = c->surface.xdg->toplevel->app_id;
 | 
				
			||||||
 | 
						return app_id ? app_id : "broken";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void
 | 
					static inline void
 | 
				
			||||||
| 
						 | 
					@ -198,11 +201,14 @@ client_has_children(Client *c)
 | 
				
			||||||
static inline const char *
 | 
					static inline const char *
 | 
				
			||||||
client_get_title(Client *c)
 | 
					client_get_title(Client *c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						const char *title;
 | 
				
			||||||
#ifdef XWAYLAND
 | 
					#ifdef XWAYLAND
 | 
				
			||||||
	if (client_is_x11(c))
 | 
						if (client_is_x11(c))
 | 
				
			||||||
		return c->surface.xwayland->title;
 | 
							title = c->surface.xwayland->title;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	return c->surface.xdg->toplevel->title;
 | 
							title = c->surface.xdg->toplevel->title;
 | 
				
			||||||
 | 
						return title ? title : "broken";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int
 | 
					static inline int
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								dwl.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								dwl.c
									
										
									
									
									
								
							| 
						 | 
					@ -358,7 +358,6 @@ static void xytonode(double x, double y, struct wlr_surface **psurface,
 | 
				
			||||||
static void zoom(const Arg *arg);
 | 
					static void zoom(const Arg *arg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* variables */
 | 
					/* variables */
 | 
				
			||||||
static const char broken[] = "broken";
 | 
					 | 
				
			||||||
static pid_t child_pid = -1;
 | 
					static pid_t child_pid = -1;
 | 
				
			||||||
static int locked;
 | 
					static int locked;
 | 
				
			||||||
static void *exclusive_focus;
 | 
					static void *exclusive_focus;
 | 
				
			||||||
| 
						 | 
					@ -462,10 +461,8 @@ applyrules(Client *c)
 | 
				
			||||||
	Monitor *mon = selmon, *m;
 | 
						Monitor *mon = selmon, *m;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c->isfloating = client_is_float_type(c);
 | 
						c->isfloating = client_is_float_type(c);
 | 
				
			||||||
	if (!(appid = client_get_appid(c)))
 | 
						appid = client_get_appid(c);
 | 
				
			||||||
		appid = broken;
 | 
						title = client_get_title(c);
 | 
				
			||||||
	if (!(title = client_get_title(c)))
 | 
					 | 
				
			||||||
		title = broken;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (r = rules; r < END(rules); r++) {
 | 
						for (r = rules; r < END(rules); r++) {
 | 
				
			||||||
		if ((!r->title || strstr(title, r->title))
 | 
							if ((!r->title || strstr(title, r->title))
 | 
				
			||||||
| 
						 | 
					@ -2040,7 +2037,6 @@ printstatus(void)
 | 
				
			||||||
	Monitor *m = NULL;
 | 
						Monitor *m = NULL;
 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
	uint32_t occ, urg, sel;
 | 
						uint32_t occ, urg, sel;
 | 
				
			||||||
	const char *appid, *title;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_list_for_each(m, &mons, link) {
 | 
						wl_list_for_each(m, &mons, link) {
 | 
				
			||||||
		occ = urg = 0;
 | 
							occ = urg = 0;
 | 
				
			||||||
| 
						 | 
					@ -2052,10 +2048,8 @@ printstatus(void)
 | 
				
			||||||
				urg |= c->tags;
 | 
									urg |= c->tags;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if ((c = focustop(m))) {
 | 
							if ((c = focustop(m))) {
 | 
				
			||||||
			title = client_get_title(c);
 | 
								printf("%s title %s\n", m->wlr_output->name, client_get_title(c));
 | 
				
			||||||
			appid = client_get_appid(c);
 | 
								printf("%s appid %s\n", m->wlr_output->name, client_get_appid(c));
 | 
				
			||||||
			printf("%s title %s\n", m->wlr_output->name, title ? title : broken);
 | 
					 | 
				
			||||||
			printf("%s appid %s\n", m->wlr_output->name, appid ? appid : broken);
 | 
					 | 
				
			||||||
			printf("%s fullscreen %d\n", m->wlr_output->name, c->isfullscreen);
 | 
								printf("%s fullscreen %d\n", m->wlr_output->name, c->isfullscreen);
 | 
				
			||||||
			printf("%s floating %d\n", m->wlr_output->name, c->isfloating);
 | 
								printf("%s floating %d\n", m->wlr_output->name, c->isfloating);
 | 
				
			||||||
			sel = c->tags;
 | 
								sel = c->tags;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue