guarantee client_get_{title,appid} never return NULL
ΔSLOC: -6
This commit is contained in:
parent
e454f7ae81
commit
07aeef1f7e
8
client.h
8
client.h
@ -126,9 +126,9 @@ client_get_appid(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->class;
|
||||
return c->surface.xwayland->class ? c->surface.xwayland->class : "broken";
|
||||
#endif
|
||||
return c->surface.xdg->toplevel->app_id;
|
||||
return c->surface.xdg->toplevel->app_id ? c->surface.xdg->toplevel->app_id : "broken";
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -200,9 +200,9 @@ client_get_title(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->title;
|
||||
return c->surface.xwayland->title ? c->surface.xwayland->title : "broken";
|
||||
#endif
|
||||
return c->surface.xdg->toplevel->title;
|
||||
return c->surface.xdg->toplevel->title ? c->surface.xdg->toplevel->title : "broken";
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
static pid_t child_pid = -1;
|
||||
static int locked;
|
||||
static void *exclusive_focus;
|
||||
@ -462,10 +461,8 @@ applyrules(Client *c)
|
||||
Monitor *mon = selmon, *m;
|
||||
|
||||
c->isfloating = client_is_float_type(c);
|
||||
if (!(appid = client_get_appid(c)))
|
||||
appid = broken;
|
||||
if (!(title = client_get_title(c)))
|
||||
title = broken;
|
||||
appid = client_get_appid(c);
|
||||
title = client_get_title(c);
|
||||
|
||||
for (r = rules; r < END(rules); r++) {
|
||||
if ((!r->title || strstr(title, r->title))
|
||||
@ -2040,7 +2037,6 @@ printstatus(void)
|
||||
Monitor *m = NULL;
|
||||
Client *c;
|
||||
uint32_t occ, urg, sel;
|
||||
const char *appid, *title;
|
||||
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
occ = urg = 0;
|
||||
@ -2052,10 +2048,8 @@ printstatus(void)
|
||||
urg |= c->tags;
|
||||
}
|
||||
if ((c = focustop(m))) {
|
||||
title = client_get_title(c);
|
||||
appid = 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 title %s\n", m->wlr_output->name, client_get_title(c));
|
||||
printf("%s appid %s\n", m->wlr_output->name, client_get_appid(c));
|
||||
printf("%s fullscreen %d\n", m->wlr_output->name, c->isfullscreen);
|
||||
printf("%s floating %d\n", m->wlr_output->name, c->isfloating);
|
||||
sel = c->tags;
|
||||
|
Loading…
Reference in New Issue
Block a user