add deco_rect property to con in ipc response

This commit is contained in:
cornerman 2014-11-16 22:05:51 +01:00 committed by Michael Stapelberg
parent 9cbae6bb4f
commit 58c65a64fe
4 changed files with 18 additions and 8 deletions

View File

@ -316,6 +316,10 @@ window_rect (map)::
So, when using the +default+ layout, you will have a 2 pixel border on
each side, making the window_rect +{ "x": 2, "y": 0, "width": 632,
"height": 366 }+ (for example).
deco_rect (map)::
The coordinates of the *window decoration* inside its container. These
coordinates are relative to the container and do not include the actual
client window.
geometry (map)::
The original geometry the window specified when i3 mapped it. Used when
switching a window to floating mode, for example.

View File

@ -347,6 +347,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
y(integer, con->current_border_width);
dump_rect(gen, "rect", con->rect);
dump_rect(gen, "deco_rect", con->deco_rect);
dump_rect(gen, "window_rect", con->window_rect);
dump_rect(gen, "geometry", con->geometry);

View File

@ -24,6 +24,7 @@ static Con *json_node;
static Con *to_focus;
static bool parsing_swallows;
static bool parsing_rect;
static bool parsing_deco_rect;
static bool parsing_window_rect;
static bool parsing_geometry;
static bool parsing_focus;
@ -47,7 +48,7 @@ static int json_start_map(void *ctx) {
match_init(current_swallow);
TAILQ_INSERT_TAIL(&(json_node->swallow_head), current_swallow, matches);
} else {
if (!parsing_rect && !parsing_window_rect && !parsing_geometry) {
if (!parsing_rect && !parsing_deco_rect && !parsing_window_rect && !parsing_geometry) {
if (last_key && strcasecmp(last_key, "floating_nodes") == 0) {
DLOG("New floating_node\n");
Con *ws = con_get_workspace(json_node);
@ -68,7 +69,7 @@ static int json_start_map(void *ctx) {
static int json_end_map(void *ctx) {
LOG("end of map\n");
if (!parsing_swallows && !parsing_rect && !parsing_window_rect && !parsing_geometry) {
if (!parsing_swallows && !parsing_rect && !parsing_deco_rect && !parsing_window_rect && !parsing_geometry) {
/* Set a few default values to simplify manually crafted layout files. */
if (json_node->layout == L_DEFAULT) {
DLOG("Setting layout = L_SPLITH\n");
@ -121,11 +122,10 @@ static int json_end_map(void *ctx) {
x_con_init(json_node, json_node->depth);
json_node = json_node->parent;
}
if (parsing_rect)
parsing_rect = false;
if (parsing_window_rect)
parsing_deco_rect = false;
parsing_window_rect = false;
if (parsing_geometry)
parsing_geometry = false;
return 1;
}
@ -175,6 +175,9 @@ static int json_key(void *ctx, const unsigned char *val, size_t len) {
if (strcasecmp(last_key, "rect") == 0)
parsing_rect = true;
if (strcasecmp(last_key, "deco_rect") == 0)
parsing_deco_rect = true;
if (strcasecmp(last_key, "window_rect") == 0)
parsing_window_rect = true;
@ -532,6 +535,7 @@ void tree_append_json(Con *con, const char *filename, char **errormsg) {
to_focus = NULL;
parsing_swallows = false;
parsing_rect = false;
parsing_deco_rect = false;
parsing_window_rect = false;
parsing_geometry = false;
parsing_focus = false;

View File

@ -54,6 +54,7 @@ my $expected = {
type => 'root',
id => $ignore,
rect => $ignore,
deco_rect => $ignore,
window_rect => $ignore,
geometry => $ignore,
swallows => $ignore,