container: Store class attribute for views.

This commit is contained in:
S. Christoffer Eliesen 2015-11-22 22:05:00 +01:00
parent c671329681
commit 47c313fe3e
2 changed files with 9 additions and 0 deletions

View file

@ -75,7 +75,9 @@ struct sway_container {
bool is_floating;
bool is_focused;
// Attributes that mostly views have.
char *name;
char *class;
int gaps;

View file

@ -50,6 +50,9 @@ static void free_swayc(swayc_t *cont) {
if (cont->name) {
free(cont->name);
}
if (cont->class) {
free(cont->class);
}
free(cont);
}
@ -214,6 +217,8 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) {
// Setup values
view->handle = handle;
view->name = title ? strdup(title) : NULL;
const char *class = wlc_view_get_class(handle);
view->class = class ? strdup(class) : NULL;
view->visible = true;
view->is_focused = true;
// Setup geometry
@ -246,6 +251,8 @@ swayc_t *new_floating_view(wlc_handle handle) {
// Setup values
view->handle = handle;
view->name = title ? strdup(title) : NULL;
const char *class = wlc_view_get_class(handle);
view->class = class ? strdup(class) : NULL;
view->visible = true;
// Set the geometry of the floating view