/** Whether the application used _NET_WM_NAME */
bool uses_net_wm_name;
+
+ /** Whether the window says it is a dock window */
+ bool dock;
};
struct Match {
char *class;
char *instance;
char *mark;
+ int dock;
xcb_window_t id;
Con *con_id;
enum { M_ANY = 0, M_TILING, M_FLOATING } floating;
#ifndef _MATCH_H
#define _MATCH_H
+/*
+ * Initializes the Match data structure. This function is necessary because the
+ * members representing boolean values (like dock) need to be initialized with
+ * -1 instead of 0.
+ *
+ */
+void match_init(Match *match);
+
/**
* Check if a match is empty. This is necessary while parsing commands to see
* whether the user specified a match at all.
+/*
+ * vim:ts=4:sw=4:expandtab
+ *
+ */
#include <yajl/yajl_common.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_parse.h>
LOG("start of map\n");
if (parsing_swallows) {
LOG("TODO: create new swallow\n");
- current_swallow = scalloc(sizeof(Match));
+ current_swallow = smalloc(sizeof(Match));
+ match_init(current_swallow);
TAILQ_INSERT_TAIL(&(json_node->swallow_head), current_swallow, matches);
} else {
if (!parsing_rect)
if (strcasecmp(last_key, "id") == 0) {
current_swallow->id = val;
}
+ if (strcasecmp(last_key, "dock") == 0) {
+ current_swallow->dock = true;
+ }
}
return 1;
/* proof-of-concept for assignments */
Con *ws = workspace_get("3");
- Match *current_swallow = scalloc(sizeof(Match));
+ Match *current_swallow = smalloc(sizeof(Match));
+ match_init(current_swallow);
+
TAILQ_INSERT_TAIL(&(ws->swallow_head), current_swallow, matches);
current_swallow->insert_where = M_ACTIVE;
window_update_name_legacy(cwindow, xcb_get_property_reply(conn, title_cookie, NULL));
window_update_name(cwindow, xcb_get_property_reply(conn, utf8_title_cookie, NULL));
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, wm_type_cookie, NULL);
+ if (xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_DOCK])) {
+ cwindow->dock = true;
+ LOG("this window is a dock\n");
+ }
+
+
Con *nc;
Match *match;
nc->window = cwindow;
x_reinit(nc);
- xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, wm_type_cookie, NULL);
- if (xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_DOCK]))
- LOG("this window is a dock\n");
/* set floating if necessary */
if (xcb_reply_contains_atom(reply, atoms[_NET_WM_WINDOW_TYPE_DIALOG]) ||
#include "all.h"
+/*
+ * Initializes the Match data structure. This function is necessary because the
+ * members representing boolean values (like dock) need to be initialized with
+ * -1 instead of 0.
+ *
+ */
+void match_init(Match *match) {
+ memset(match, 0, sizeof(Match));
+ match->dock = -1;
+}
+
/*
* Check if a match is empty. This is necessary while parsing commands to see
* whether the user specified a match at all.
match->instance == NULL &&
match->id == XCB_NONE &&
match->con_id == NULL &&
+ match->dock == -1 &&
match->floating == M_ANY);
}
return true;
}
+ LOG("match->dock = %d, window->dock = %d\n", match->dock, window->dock);
+ if (match->dock != -1 && window->dock == match->dock) {
+ LOG("match made by dock\n");
+ return true;
+ }
+
LOG("window %d (%s) could not be matched\n", window->id, window->class_class);
return false;