X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Ffake_outputs.c;h=b898ce987db9120498870056eb1e2ab15fb72b86;hb=4a2d5da0443d34051ef246fcdb91b94538f86211;hp=e115329952fc14f0a2860276d856b11a8f354ba9;hpb=65e5bcfdf4c44845dadf057a6bde1f15db3381ff;p=i3%2Fi3 diff --git a/src/fake_outputs.c b/src/fake_outputs.c index e1153299..b898ce98 100644 --- a/src/fake_outputs.c +++ b/src/fake_outputs.c @@ -1,10 +1,8 @@ -#undef I3__FILE__ -#define I3__FILE__ "fake_outputs.c" /* * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager - * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) + * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * * Faking outputs is useful in pathological situations (like network X servers * which don’t support multi-monitor in a useful way) and for our testsuite. @@ -18,11 +16,11 @@ static int num_screens; * Looks in outputs for the Output whose start coordinates are x, y * */ -static Output *get_screen_at(int x, int y) { +static Output *get_screen_at(unsigned int x, unsigned int y) { Output *output; TAILQ_FOREACH(output, &outputs, outputs) - if (output->rect.x == x && output->rect.y == y) - return output; + if (output->rect.x == x && output->rect.y == y) + return output; return NULL; } @@ -49,7 +47,7 @@ void fake_outputs_init(const char *output_spec) { new_output->rect.width = min(new_output->rect.width, width); new_output->rect.height = min(new_output->rect.height, height); } else { - new_output = scalloc(sizeof(Output)); + new_output = scalloc(1, sizeof(Output)); sasprintf(&(new_output->name), "fake-%d", num_screens); DLOG("Created new fake output %s (%p)\n", new_output->name, new_output); new_output->active = true; @@ -60,7 +58,8 @@ void fake_outputs_init(const char *output_spec) { /* We always treat the screen at 0x0 as the primary screen */ if (new_output->rect.x == 0 && new_output->rect.y == 0) TAILQ_INSERT_HEAD(&outputs, new_output, outputs); - else TAILQ_INSERT_TAIL(&outputs, new_output, outputs); + else + TAILQ_INSERT_TAIL(&outputs, new_output, outputs); output_init_con(new_output); init_ws_for_output(new_output, output_get_content(new_output->con)); num_screens++;