struct ClientCapability {
bool (*visible)(struct Client *); /* whether or not to display the capability. set to NULL or true return value = displayed */
+ bool (*attainable)(struct Client *); /* whether or not to give this capability upon request. set to NULL uses visible() */
const char *(*data)(struct Client *); /* any custom data for the capability. set to NULL or return NULL = no data */
unsigned int flags;
};
return clicap->visible(client_p);
}
+static inline int
+clicap_attainable(struct Client *client_p, const struct CapabilityEntry *cap)
+{
+ struct ClientCapability *clicap;
+
+ if (cap->flags & CAP_ORPHANED)
+ return 0;
+
+ if (cap->ownerdata == NULL)
+ return 1;
+
+ clicap = cap->ownerdata;
+
+ if (clicap->attainable != NULL)
+ return clicap->attainable(client_p);
+
+ if (clicap->visible != NULL)
+ return clicap->visible(client_p);
+
+ return 1;
+}
+
/* clicap_find()
* Used iteratively over a buffer, extracts individual cap tokens.
*
}
else
{
- if (!clicap_visible(source_p, cap))
+ if (!clicap_attainable(source_p, cap))
{
finished = 0;
break;