*
*/
#define CLIENT_LOG(client) do { \
- LOG("Window: frame 0x%08x, child 0x%08x\n", client->frame, client->child); \
+ DLOG("Window: frame 0x%08x, child 0x%08x\n", client->frame, client->child); \
} while (0)
#endif
*
* i3 - an improved dynamic tiling window manager
*
- * (c) 2009 Michael Stapelberg and contributors
+ * © 2009 Michael Stapelberg and contributors
*
* See file LICENSE for license information.
*
} \
while (0)
-/** ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that
- is, delete the preceding comma */
-#define LOG(fmt, ...) slog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
-
TAILQ_HEAD(keyvalue_table_head, keyvalue_element);
extern struct keyvalue_table_head by_parent;
extern struct keyvalue_table_head by_child;
int min(int a, int b);
int max(int a, int b);
-/**
- * Logs the given message to stdout while prefixing the current time to it.
- * This is to be called by LOG() which includes filename/linenumber
- *
- */
-void slog(char *fmt, ...);
-
/**
* Safe-wrapper around malloc which exits if malloc returns NULL (meaning that
* there is no more memory available)
#include "table.h"
#include "workspace.h"
#include "xcb.h"
+#include "log.h"
typedef struct yy_buffer_state *YY_BUFFER_STATE;
extern int yylex(void);
new->key = sstrdup(v_key);
new->value = sstrdup(v_value);
SLIST_INSERT_HEAD(&variables, new, variables);
- LOG("Got new variable %s = %s\n", v_key, v_value);
+ DLOG("Got new variable %s = %s\n", v_key, v_value);
continue;
}
}
floating_modifier:
TOKFLOATING_MODIFIER WHITESPACE binding_modifiers
{
- LOG("floating modifier = %d\n", $<number>3);
+ DLOG("floating modifier = %d\n", $<number>3);
config.floating_modifier = $<number>3;
}
;
new_container:
TOKNEWCONTAINER WHITESPACE TOKCONTAINERMODE
{
- LOG("new containers will be in mode %d\n", $<number>3);
+ DLOG("new containers will be in mode %d\n", $<number>3);
config.container_mode = $<number>3;
/* We also need to change the layout of the already existing
}
| TOKNEWCONTAINER WHITESPACE TOKSTACKLIMIT WHITESPACE TOKSTACKLIMIT WHITESPACE NUMBER
{
- LOG("stack-limit %d with val %d\n", $<number>5, $<number>7);
+ DLOG("stack-limit %d with val %d\n", $<number>5, $<number>7);
config.container_stack_limit = $<number>5;
config.container_stack_limit_value = $<number>7;
new_window:
TOKNEWWINDOW WHITESPACE WORD
{
- LOG("new windows should start in mode %s\n", $<string>3);
+ DLOG("new windows should start in mode %s\n", $<string>3);
config.default_border = strdup($<string>3);
}
;
{
int ws_num = $<number>3;
if (ws_num < 1) {
- LOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
+ DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
} else {
Workspace *ws = workspace_get(ws_num - 1);
ws->preferred_screen = sstrdup($<string>7);
{
int ws_num = $<number>3;
if (ws_num < 1) {
- LOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
+ DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
} else {
if ($<string>5 != NULL)
workspace_set_name(workspace_get(ws_num - 1), $<string>5);
terminal:
TOKTERMINAL WHITESPACE STR
{
- LOG("The terminal option is DEPRECATED and has no effect. "
+ DLOG("The terminal option is DEPRECATED and has no effect. "
"Please remove it from your configuration file.");
}
;
#include "commands.h"
#include "floating.h"
#include "resize.h"
+#include "log.h"
static struct Stack_Window *get_stack_window(xcb_window_t window_id) {
struct Stack_Window *current;
int wrap = ceil((float)num_clients / container->stack_limit_value);
int clicked_column = (event->event_x / (stack_win->rect.width / container->stack_limit_value));
int clicked_row = (event->event_y / decoration_height);
- LOG("clicked on column %d, row %d\n", clicked_column, clicked_row);
+ DLOG("clicked on column %d, row %d\n", clicked_column, clicked_row);
destination = (wrap * clicked_column) + clicked_row;
} else {
int width = (stack_win->rect.width / ceil((float)num_clients / container->stack_limit_value));
int clicked_column = (event->event_x / width);
int clicked_row = (event->event_y / decoration_height);
- LOG("clicked on column %d, row %d\n", clicked_column, clicked_row);
+ DLOG("clicked on column %d, row %d\n", clicked_column, clicked_row);
destination = (container->stack_limit_value * clicked_column) + clicked_row;
}
}
- LOG("Click on stack_win for client %d\n", destination);
+ DLOG("Click on stack_win for client %d\n", destination);
CIRCLEQ_FOREACH(client, &(stack_win->container->clients), clients)
if (c++ == destination) {
set_focus(conn, client, true);
if (screen->bar != event->event)
continue;
- LOG("Click on a bar\n");
+ DLOG("Click on a bar\n");
/* Check if the button was one of button4 or button5 (scroll up / scroll down) */
if (event->detail == XCB_BUTTON_INDEX_4 || event->detail == XCB_BUTTON_INDEX_5) {
TAILQ_FOREACH(ws, workspaces, workspaces) {
if (ws->screen != screen)
continue;
- LOG("Checking if click was on workspace %d with drawn = %d, tw = %d\n",
+ DLOG("Checking if click was on workspace %d with drawn = %d, tw = %d\n",
ws->num, drawn, ws->text_width);
if (event->event_x > (drawn + 1) &&
event->event_x <= (drawn + 1 + ws->text_width + 5 + 5)) {
Workspace *ws = con->workspace;
int first = 0, second = 0;
- LOG("click was %d px to the right, %d px to the left, %d px to top, %d px to bottom\n",
+ DLOG("click was %d px to the right, %d px to the left, %d px to top, %d px to bottom\n",
to_right, to_left, to_top, to_bottom);
if (to_right < to_left &&
to_right < to_bottom) {
/* …right border */
first = con->col + (con->colspan - 1);
- LOG("column %d\n", first);
+ DLOG("column %d\n", first);
if (!cell_exists(first, con->row) ||
(first == (ws->cols-1)))
}
int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_event_t *event) {
- LOG("Button %d pressed\n", event->state);
+ DLOG("Button %d pressed\n", event->state);
/* This was either a focus for a client’s parent (= titlebar)… */
Client *client = table_get(&by_child, event->event);
bool border_click = false;
if (config.floating_modifier != 0 &&
(event->state & config.floating_modifier) != 0) {
if (client == NULL) {
- LOG("Not handling, floating_modifier was pressed and no client found\n");
+ DLOG("Not handling, floating_modifier was pressed and no client found\n");
return 1;
}
if (client->fullscreen) {
- LOG("Not handling, client is in fullscreen mode\n");
+ DLOG("Not handling, client is in fullscreen mode\n");
return 1;
}
if (client_is_floating(client)) {
- LOG("button %d pressed\n", event->detail);
+ DLOG("button %d pressed\n", event->detail);
if (event->detail == 1) {
- LOG("left mouse button, dragging\n");
+ DLOG("left mouse button, dragging\n");
floating_drag_window(conn, client, event);
} else if (event->detail == 3) {
- LOG("right mouse button\n");
+ DLOG("right mouse button\n");
floating_resize_window(conn, client, event);
}
return 1;
if (button_press_bar(conn, event))
return 1;
- LOG("Could not handle this button press\n");
+ DLOG("Could not handle this button press\n");
return 1;
}
set_focus(conn, client, true);
/* Let’s see if this was on the borders (= resize). If not, we’re done */
- LOG("press button on x=%d, y=%d\n", event->event_x, event->event_y);
+ DLOG("press button on x=%d, y=%d\n", event->event_x, event->event_y);
resize_orientation_t orientation = O_VERTICAL;
Container *con = client->container;
int first, second;
if (client->dock) {
- LOG("dock. done.\n");
+ DLOG("dock. done.\n");
xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time);
xcb_flush(conn);
return 1;
}
- LOG("event->event_x = %d, client->rect.width = %d\n", event->event_x, client->rect.width);
+ DLOG("event->event_x = %d, client->rect.width = %d\n", event->event_x, client->rect.width);
/* Some clients (xfontsel for example) seem to pass clicks on their
* window to the parent window, thus we receive an event here which in
event->event_x <= (client->child_rect.x + client->child_rect.width) &&
event->event_y >= client->child_rect.y &&
event->event_y <= (client->child_rect.y + client->child_rect.height)) {
- LOG("Fixing border_click = false because of click in child\n");
+ DLOG("Fixing border_click = false because of click in child\n");
border_click = false;
}
if (!border_click) {
- LOG("client. done.\n");
+ DLOG("client. done.\n");
xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time);
/* Floating clients should be raised on click */
if (client_is_floating(client))
/* Don’t handle events inside the titlebar, only borders are interesting */
i3Font *font = load_font(conn, config.font);
if (event->event_y >= 2 && event->event_y <= (font->height + 2 + 2)) {
- LOG("click on titlebar\n");
+ DLOG("click on titlebar\n");
/* Floating clients can be dragged by grabbing their titlebar */
if (client_is_floating(client)) {
} else if (event->event_x > 2) {
/* …right border */
first = con->col + (con->colspan - 1);
- LOG("column %d\n", first);
+ DLOG("column %d\n", first);
if (!cell_exists(first, con->row) ||
(first == (ws->cols-1)))
#include "table.h"
#include "workspace.h"
#include "config.h"
+#include "log.h"
/*
* Removes the given client from the container, either because it will be inserted into another
if (CIRCLEQ_EMPTY(&(container->clients)) &&
(container->mode == MODE_STACK ||
container->mode == MODE_TABBED)) {
- LOG("Unmapping stack window\n");
+ DLOG("Unmapping stack window\n");
struct Stack_Window *stack_win = &(container->stack_win);
stack_win->rect.height = 0;
xcb_unmap_window(conn, stack_win->window);
workspace->rect.width,
workspace->rect.height};
- LOG("child itself will be at %dx%d with size %dx%d\n",
+ DLOG("child itself will be at %dx%d with size %dx%d\n",
values[0], values[1], values[2], values[3]);
xcb_configure_window(conn, client->frame, mask, values);
if (first_floating == TAILQ_END(&(ws->floating_clients)))
return;
- LOG("Setting below floating\n");
+ DLOG("Setting below floating\n");
uint32_t values[] = { first_floating->frame, XCB_STACK_MODE_BELOW };
xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
if (client->workspace->fullscreen_client == NULL)
return;
- LOG("(and below fullscreen)\n");
+ DLOG("(and below fullscreen)\n");
/* Ensure that the window is still below the fullscreen window */
values[0] = client->workspace->fullscreen_client->frame;
xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
#include "workspace.h"
#include "commands.h"
#include "resize.h"
+#include "log.h"
bool focus_window_in_container(xcb_connection_t *conn, Container *container, direction_t direction) {
/* If this container is empty, we’re done */
else if (direction == D_DOWN) {
if ((candidate = CIRCLEQ_NEXT_OR_NULL(&(container->clients), container->currently_focused, clients)) == NULL)
candidate = CIRCLEQ_FIRST(&(container->clients));
- } else LOG("Direction not implemented!\n");
+ } else ELOG("Direction not implemented!\n");
/* If we could not switch, the container contains exactly one client. We return false */
if (candidate == container->currently_focused)
return;
}
- LOG("No window with this mark found\n");
+ ELOG("No window with this mark found\n");
}
static void focus_thing(xcb_connection_t *conn, direction_t direction, thing_t thing) {
- LOG("focusing direction %d\n", direction);
+ DLOG("focusing direction %d\n", direction);
int new_row = current_row,
new_col = current_col;
i3Screen *target = get_screen_containing(bounds.x, bounds.y);
if (target == NULL) {
- LOG("Target screen NULL\n");
+ DLOG("Target screen NULL\n");
/* Wrap around if the target screen is out of bounds */
if (direction == D_RIGHT)
target = get_screen_most(D_LEFT, cs);
else target = get_screen_most(D_UP, cs);
}
- LOG("Switching to ws %d\n", target->current_workspace + 1);
+ DLOG("Switching to ws %d\n", target->current_workspace + 1);
workspace_show(conn, target->current_workspace->num + 1);
return;
}
}
} else {
/* Let’s see if there is a screen down/up there to which we can switch */
- LOG("container is at %d with height %d\n", container->y, container->height);
+ DLOG("container is at %d with height %d\n", container->y, container->height);
i3Screen *screen;
int destination_y = (direction == D_UP ? (container->y - 1) : (container->y + container->height + 1));
if ((screen = get_screen_containing(container->x, destination_y)) == NULL) {
- LOG("Wrapping screen around vertically\n");
+ DLOG("Wrapping screen around vertically\n");
/* No screen found? Then wrap */
screen = get_screen_most((direction == D_UP ? D_DOWN : D_UP), container->workspace->screen);
}
check_colrow_boundaries();
- LOG("new_col = %d, new_row = %d\n", new_col, new_row);
+ DLOG("new_col = %d, new_row = %d\n", new_col, new_row);
if (t_ws->table[new_col][new_row]->currently_focused == NULL) {
- LOG("Cell empty, checking for colspanned client above...\n");
+ DLOG("Cell empty, checking for colspanned client above...\n");
for (int cols = 0; cols < new_col; cols += t_ws->table[cols][new_row]->colspan) {
if (new_col > (cols + (t_ws->table[cols][new_row]->colspan - 1)))
continue;
new_col = cols;
break;
}
- LOG("Fixed it to new col %d\n", new_col);
+ DLOG("Fixed it to new col %d\n", new_col);
}
} else if (direction == D_LEFT || direction == D_RIGHT) {
if (direction == D_RIGHT && cell_exists(current_col+1, current_row))
}
} else {
/* Let’s see if there is a screen left/right here to which we can switch */
- LOG("container is at %d with width %d\n", container->x, container->width);
+ DLOG("container is at %d with width %d\n", container->x, container->width);
i3Screen *screen;
int destination_x = (direction == D_LEFT ? (container->x - 1) : (container->x + container->width + 1));
if ((screen = get_screen_containing(destination_x, container->y)) == NULL) {
- LOG("Wrapping screen around horizontally\n");
+ DLOG("Wrapping screen around horizontally\n");
screen = get_screen_most((direction == D_LEFT ? D_RIGHT : D_LEFT), container->workspace->screen);
}
t_ws = screen->current_workspace;
check_colrow_boundaries();
- LOG("new_col = %d, new_row = %d\n", new_col, new_row);
+ DLOG("new_col = %d, new_row = %d\n", new_col, new_row);
if (t_ws->table[new_col][new_row]->currently_focused == NULL) {
- LOG("Cell empty, checking for rowspanned client above...\n");
+ DLOG("Cell empty, checking for rowspanned client above...\n");
for (int rows = 0; rows < new_row; rows += t_ws->table[new_col][rows]->rowspan) {
if (new_row > (rows + (t_ws->table[new_col][rows]->rowspan - 1)))
continue;
new_row = rows;
break;
}
- LOG("Fixed it to new row %d\n", new_row);
+ DLOG("Fixed it to new row %d\n", new_row);
}
} else {
- LOG("direction unhandled\n");
+ ELOG("direction unhandled\n");
return;
}
if (other == CIRCLEQ_END(&(client->container->clients)))
return false;
- LOG("i can do that\n");
+ DLOG("i can do that\n");
/* We can move the client inside its current container */
CIRCLEQ_REMOVE(&(client->container->clients), client, clients);
if (direction == D_UP)
return;
}
- LOG("old = %d,%d and new = %d,%d\n", container->col, container->row, new->col, new->row);
+ DLOG("old = %d,%d and new = %d,%d\n", container->col, container->row, new->col, new->row);
/* Swap the containers */
int col = new->col;
/* Snap to the left is actually a move to the left and then a snap right */
if (!cell_exists(container->col - 1, container->row) ||
CUR_TABLE[container->col-1][container->row]->currently_focused != NULL) {
- LOG("cannot snap to left - the cell is already used\n");
+ ELOG("cannot snap to left - the cell is already used\n");
return;
}
for (int i = 0; i < container->rowspan; i++)
if (!cell_exists(new_col, container->row + i) ||
CUR_TABLE[new_col][container->row + i]->currently_focused != NULL) {
- LOG("cannot snap to right - the cell is already used\n");
+ ELOG("cannot snap to right - the cell is already used\n");
return;
}
/* Check if there are other cells with rowspan, which are in our way.
* If so, reduce their rowspan. */
for (int i = container->row-1; i >= 0; i--) {
- LOG("we got cell %d, %d with rowspan %d\n",
+ DLOG("we got cell %d, %d with rowspan %d\n",
new_col, i, CUR_TABLE[new_col][i]->rowspan);
while ((CUR_TABLE[new_col][i]->rowspan-1) >= (container->row - i))
CUR_TABLE[new_col][i]->rowspan--;
- LOG("new rowspan = %d\n", CUR_TABLE[new_col][i]->rowspan);
+ DLOG("new rowspan = %d\n", CUR_TABLE[new_col][i]->rowspan);
}
container->colspan++;
case D_UP:
if (!cell_exists(container->col, container->row - 1) ||
CUR_TABLE[container->col][container->row-1]->currently_focused != NULL) {
- LOG("cannot snap to top - the cell is already used\n");
+ ELOG("cannot snap to top - the cell is already used\n");
return;
}
snap_current_container(conn, D_DOWN);
return;
case D_DOWN: {
- LOG("snapping down\n");
+ DLOG("snapping down\n");
int new_row = container->row + container->rowspan;
for (int i = 0; i < container->colspan; i++)
if (!cell_exists(container->col + i, new_row) ||
CUR_TABLE[container->col + i][new_row]->currently_focused != NULL) {
- LOG("cannot snap down - the cell is already used\n");
+ ELOG("cannot snap down - the cell is already used\n");
return;
}
for (int i = container->col-1; i >= 0; i--) {
- LOG("we got cell %d, %d with colspan %d\n",
+ DLOG("we got cell %d, %d with colspan %d\n",
i, new_row, CUR_TABLE[i][new_row]->colspan);
while ((CUR_TABLE[i][new_row]->colspan-1) >= (container->col - i))
CUR_TABLE[i][new_row]->colspan--;
- LOG("new colspan = %d\n", CUR_TABLE[i][new_row]->colspan);
+ DLOG("new colspan = %d\n", CUR_TABLE[i][new_row]->colspan);
}
/* Check if there is already a fullscreen client on the destination workspace and
* stop moving if so. */
if (client->fullscreen && (t_ws->fullscreen_client != NULL)) {
- LOG("Not moving: Fullscreen client already existing on destination workspace.\n");
+ ELOG("Not moving: Fullscreen client already existing on destination workspace.\n");
return;
}
/* If we’re moving it to an invisible screen, we need to unmap it */
if (!workspace_is_visible(t_ws)) {
- LOG("This workspace is not visible, unmapping\n");
+ DLOG("This workspace is not visible, unmapping\n");
client_unmap(conn, client);
} else {
/* If this is not the case, we move the window to a workspace
* which is on another screen, so we also need to adjust its
* coordinates. */
- LOG("before x = %d, y = %d\n", client->rect.x, client->rect.y);
+ DLOG("before x = %d, y = %d\n", client->rect.x, client->rect.y);
uint32_t relative_x = client->rect.x - old_ws->rect.x,
relative_y = client->rect.y - old_ws->rect.y;
- LOG("rel_x = %d, rel_y = %d\n", relative_x, relative_y);
+ DLOG("rel_x = %d, rel_y = %d\n", relative_x, relative_y);
client->rect.x = t_ws->rect.x + relative_x;
client->rect.y = t_ws->rect.y + relative_y;
- LOG("after x = %d, y = %d\n", client->rect.x, client->rect.y);
+ DLOG("after x = %d, y = %d\n", client->rect.x, client->rect.y);
reposition_client(conn, client);
xcb_flush(conn);
}
- LOG("done\n");
+ DLOG("done\n");
render_layout(conn);
Client *current_client = container->currently_focused;
if (current_client == NULL) {
- LOG("No currently focused client in current container.\n");
+ ELOG("No currently focused client in current container.\n");
return;
}
Client *to_focus = CIRCLEQ_NEXT_OR_NULL(&(container->clients), current_client, clients);
/* Check if there is already a fullscreen client on the destination workspace and
* stop moving if so. */
if (current_client->fullscreen && (t_ws->fullscreen_client != NULL)) {
- LOG("Not moving: Fullscreen client already existing on destination workspace.\n");
+ ELOG("Not moving: Fullscreen client already existing on destination workspace.\n");
return;
}
CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients);
SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_clients);
- LOG("Moved.\n");
+ DLOG("Moved.\n");
current_client->container = to_container;
current_client->workspace = to_container->workspace;
/* If we’re moving it to an invisible screen, we need to unmap it */
if (!workspace_is_visible(to_container->workspace)) {
- LOG("This workspace is not visible, unmapping\n");
+ DLOG("This workspace is not visible, unmapping\n");
client_unmap(conn, current_client);
} else {
if (current_client->fullscreen) {
- LOG("Calling client_enter_fullscreen again\n");
+ DLOG("Calling client_enter_fullscreen again\n");
client_enter_fullscreen(conn, current_client);
}
}
if ((client = get_matching_client(conn, classtitle, NULL)) == NULL) {
free(classtitle);
- LOG("No matching client found.\n");
+ ELOG("No matching client found.\n");
return;
}
/* No match? Either no arguments were specified, or no numbers */
if (result < 1) {
- LOG("At least one valid argument required\n");
+ ELOG("At least one valid argument required\n");
return;
}
if (result < 3)
return;
- LOG("Boundary-checking col %d, row %d... (max cols %d, max rows %d)\n", col, row, c_ws->cols, c_ws->rows);
+ DLOG("Boundary-checking col %d, row %d... (max cols %d, max rows %d)\n", col, row, c_ws->cols, c_ws->rows);
/* Move to row/col */
if (row >= c_ws->rows)
if (col >= c_ws->cols)
col = c_ws->cols - 1;
- LOG("Jumping to col %d, row %d\n", col, row);
+ DLOG("Jumping to col %d, row %d\n", col, row);
if (c_ws->table[col][row]->currently_focused != NULL)
set_focus(conn, c_ws->table[col][row]->currently_focused, true);
}
} else if (strcasecmp(arguments, "ft") == 0) {
Client *last_focused = SLIST_FIRST(&(c_ws->focus_stack));
if (last_focused == SLIST_END(&(c_ws->focus_stack))) {
- LOG("Cannot select the next floating/tiling client because there is no client at all\n");
+ ELOG("Cannot select the next floating/tiling client because there is no client at all\n");
return;
}
} else {
/* …or a number was specified */
if (sscanf(arguments, "%u", ×) != 1) {
- LOG("No or invalid argument given (\"%s\"), using default of 1 times\n", arguments);
+ ELOG("No or invalid argument given (\"%s\"), using default of 1 times\n", arguments);
times = 1;
}
SLIST_FOREACH(current, &(CUR_CELL->workspace->focus_stack), focus_clients) {
if (++count < times) {
- LOG("Skipping\n");
+ DLOG("Skipping\n");
continue;
}
- LOG("Focussing\n");
+ DLOG("Focussing\n");
set_focus(conn, current, true);
break;
}
static char **append_argument(char **original, char *argument) {
int num_args;
for (num_args = 0; original[num_args] != NULL; num_args++) {
- LOG("original argument: \"%s\"\n", original[num_args]);
+ DLOG("original argument: \"%s\"\n", original[num_args]);
/* If the argument is already present we return the original pointer */
if (strcmp(original[num_args], argument) == 0)
return original;
command += strlen("left");
} else if (STARTS_WITH(command, "right")) {
first = con->col + (con->colspan - 1);
- LOG("column %d\n", first);
+ DLOG("column %d\n", first);
if (!cell_exists(first, con->row) ||
(first == (ws->cols-1)))
orientation = O_HORIZONTAL;
command += strlen("bottom");
} else {
- LOG("Syntax: resize <left|right|top|bottom> [+|-]<pixels>\n");
+ ELOG("Syntax: resize <left|right|top|bottom> [+|-]<pixels>\n");
return;
}
if (STARTS_WITH(command, "mark")) {
if (last_focused == NULL) {
- LOG("There is no window to mark\n");
+ ELOG("There is no window to mark\n");
return;
}
const char *rest = command + strlen("mark");
while (*rest == ' ')
rest++;
if (*rest == '\0') {
- LOG("interactive mark starting\n");
+ DLOG("interactive mark starting\n");
start_application("i3-input -p 'mark ' -l 1 -P 'Mark: '");
} else {
LOG("mark with \"%s\"\n", rest);
while (*rest == ' ')
rest++;
if (*rest == '\0') {
- LOG("interactive go to mark starting\n");
+ DLOG("interactive go to mark starting\n");
start_application("i3-input -p 'goto ' -l 1 -P 'Goto: '");
} else {
LOG("go to \"%s\"\n", rest);
if (STARTS_WITH(command, "stack-limit ")) {
if (last_focused == NULL || client_is_floating(last_focused)) {
- LOG("No container focused\n");
+ ELOG("No container focused\n");
return;
}
const char *rest = command + strlen("stack-limit ");
last_focused->container->stack_limit = STACK_LIMIT_COLS;
rest += strlen("cols ");
} else {
- LOG("Syntax: stack-limit <cols|rows> <limit>\n");
+ ELOG("Syntax: stack-limit <cols|rows> <limit>\n");
return;
}
if (STARTS_WITH(command, "kill")) {
if (last_focused == NULL) {
- LOG("There is no window to kill\n");
+ ELOG("There is no window to kill\n");
return;
}
/* Is it just 's' for stacking or 'd' for default? */
if ((command[0] == 's' || command[0] == 'd' || command[0] == 'T') && (command[1] == '\0')) {
if (last_focused != NULL && client_is_floating(last_focused)) {
- LOG("not switching, this is a floating client\n");
+ ELOG("not switching, this is a floating client\n");
return;
}
LOG("Switching mode for current container\n");
/* or even 'bt' (toggle border: 'bp' -> 'bb' -> 'bn' ) */
if (command[0] == 'b') {
if (last_focused == NULL) {
- LOG("No window focused, cannot change border type\n");
+ ELOG("No window focused, cannot change border type\n");
return;
}
with = WITH_SCREEN;
command++;
} else {
- LOG("not yet implemented.\n");
+ ELOG("not yet implemented.\n");
return;
}
}
return;
}
if (last_focused == NULL) {
- LOG("Cannot toggle tiling/floating: workspace empty\n");
+ ELOG("Cannot toggle tiling/floating: workspace empty\n");
return;
}
direction_t direction;
int times = strtol(command, &rest, 10);
if (rest == NULL) {
- LOG("Invalid command (\"%s\")\n", command);
+ ELOG("Invalid command (\"%s\")\n", command);
return;
}
int workspace = strtol(rest, &rest, 10);
if (rest == NULL) {
- LOG("Invalid command (\"%s\")\n", command);
+ ELOG("Invalid command (\"%s\")\n", command);
return;
}
}
if (last_focused == NULL) {
- LOG("Not performing (no window found)\n");
+ ELOG("Not performing (no window found)\n");
return;
}
if (client_is_floating(last_focused) &&
(action != ACTION_FOCUS && action != ACTION_MOVE)) {
- LOG("Not performing (floating)\n");
+ ELOG("Not performing (floating)\n");
return;
}
else if (*rest == 'l')
direction = D_RIGHT;
else {
- LOG("unknown direction: %c\n", *rest);
+ ELOG("unknown direction: %c\n", *rest);
return;
}
rest++;
/* TODO: this should swap the screen’s contents
* (e.g. all workspaces) with the next/previous/…
* screen */
- LOG("Not yet implemented\n");
+ ELOG("Not yet implemented\n");
continue;
}
if (client_is_floating(last_focused)) {
if (action == ACTION_SNAP) {
if (with == WITH_SCREEN) {
- LOG("You cannot snap a screen (it makes no sense).\n");
+ ELOG("You cannot snap a screen (it makes no sense).\n");
continue;
}
snap_current_container(conn, direction);
#include "xcb.h"
#include "table.h"
#include "workspace.h"
+#include "log.h"
Config config;
struct modes_head modes;
*
*/
void ungrab_all_keys(xcb_connection_t *conn) {
- LOG("Ungrabbing all keys\n");
+ DLOG("Ungrabbing all keys\n");
xcb_ungrab_key(conn, XCB_GRAB_ANY, root, XCB_BUTTON_MASK_ANY);
}
static void grab_keycode_for_binding(xcb_connection_t *conn, Binding *bind, uint32_t keycode) {
- LOG("Grabbing %d\n", keycode);
+ DLOG("Grabbing %d\n", keycode);
if ((bind->mods & BIND_MODE_SWITCH) != 0)
xcb_grab_key(conn, 0, root, 0, keycode,
XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_SYNC);
/* We need to translate the symbol to a keycode */
xcb_keysym_t keysym = XStringToKeysym(bind->symbol);
if (keysym == NoSymbol) {
- LOG("Could not translate string to key symbol: \"%s\"\n", bind->symbol);
+ ELOG("Could not translate string to key symbol: \"%s\"\n", bind->symbol);
continue;
}
#ifdef OLD_XCB_KEYSYMS_API
bind->number_keycodes = 1;
xcb_keycode_t code = xcb_key_symbols_get_keycode(keysyms, keysym);
- LOG("Translated symbol \"%s\" to 1 keycode (%d)\n", bind->symbol, code);
+ DLOG("Translated symbol \"%s\" to 1 keycode (%d)\n", bind->symbol, code);
grab_keycode_for_binding(conn, bind, code);
bind->translated_to = smalloc(sizeof(xcb_keycode_t));
memcpy(bind->translated_to, &code, sizeof(xcb_keycode_t));
uint32_t last_keycode = 0;
xcb_keycode_t *keycodes = xcb_key_symbols_get_keycode(keysyms, keysym);
if (keycodes == NULL) {
- LOG("Could not translate symbol \"%s\"\n", bind->symbol);
+ DLOG("Could not translate symbol \"%s\"\n", bind->symbol);
continue;
}
last_keycode = *walk;
bind->number_keycodes++;
}
- LOG("Translated symbol \"%s\" to %d keycode\n", bind->symbol, bind->number_keycodes);
+ DLOG("Translated symbol \"%s\" to %d keycode\n", bind->symbol, bind->number_keycodes);
bind->translated_to = smalloc(bind->number_keycodes * sizeof(xcb_keycode_t));
memcpy(bind->translated_to, keycodes, bind->number_keycodes * sizeof(xcb_keycode_t));
free(keycodes);
return;
}
- LOG("ERROR: Mode not found\n");
+ ELOG("ERROR: Mode not found\n");
}
/*
#include "client.h"
#include "floating.h"
#include "workspace.h"
+#include "log.h"
/*
* Toggles floating mode for the given client.
i3Font *font = load_font(conn, config.font);
if (con == NULL) {
- LOG("This client is already in floating (container == NULL), re-inserting\n");
+ DLOG("This client is already in floating (container == NULL), re-inserting\n");
Client *next_tiling;
Workspace *ws = client->workspace;
SLIST_FOREACH(next_tiling, &(ws->focus_stack), focus_clients)
/* Remove the client from the list of floating clients */
TAILQ_REMOVE(&(ws->floating_clients), client, floating_clients);
- LOG("destination container = %p\n", con);
+ DLOG("destination container = %p\n", con);
Client *old_focused = con->currently_focused;
/* Preserve position/size */
memcpy(&(client->floating_rect), &(client->rect), sizeof(Rect));
CIRCLEQ_INSERT_AFTER(&(con->clients), old_focused, client, clients);
else CIRCLEQ_INSERT_TAIL(&(con->clients), client, clients);
- LOG("Re-inserted the client into the matrix.\n");
+ DLOG("Re-inserted the window.\n");
con->currently_focused = client;
client_set_below_floating(conn, client);
return;
}
- LOG("Entering floating for client %08x\n", client->child);
+ DLOG("Entering floating for client %08x\n", client->child);
/* Remove the client of its container */
client_remove_from_container(conn, client, con, false);
TAILQ_INSERT_TAIL(&(client->workspace->floating_clients), client, floating_clients);
if (con->currently_focused == client) {
- LOG("Need to re-adjust currently_focused\n");
+ DLOG("Need to re-adjust currently_focused\n");
/* Get the next client in the focus stack for this particular container */
con->currently_focused = get_last_focused_client(conn, con, NULL);
}
client->rect.width = client->child_rect.width + 2 + 2;
client->rect.height = client->child_rect.height + (font->height + 2 + 2) + 2;
- LOG("copying size from tiling (%d, %d) size (%d, %d)\n", client->floating_rect.x, client->floating_rect.y,
+ DLOG("copying size from tiling (%d, %d) size (%d, %d)\n", client->floating_rect.x, client->floating_rect.y,
client->floating_rect.width, client->floating_rect.height);
} else {
/* If the client was already in floating before we restore the old position / size */
- LOG("using: (%d, %d) size (%d, %d)\n", client->floating_rect.x, client->floating_rect.y,
+ DLOG("using: (%d, %d) size (%d, %d)\n", client->floating_rect.x, client->floating_rect.y,
client->floating_rect.width, client->floating_rect.height);
memcpy(&(client->rect), &(client->floating_rect), sizeof(Rect));
}
*
*/
int floating_border_click(xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event) {
-
- LOG("floating border click\n");
+ DLOG("floating border click\n");
border_t border;
else if (event->event_x >= (client->rect.width - 2))
border = BORDER_RIGHT;
else {
- LOG("Not on any border, not doing anything.\n");
+ DLOG("Not on any border, not doing anything.\n");
return 1;
}
- LOG("border = %d\n", border);
+ DLOG("border = %d\n", border);
drag_pointer(conn, client, event, XCB_NONE, border, resize_callback);
*
*/
void floating_drag_window(xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event) {
- LOG("floating_drag_window\n");
+ DLOG("floating_drag_window\n");
void drag_window_callback(Rect *old_rect, uint32_t new_x, uint32_t new_y) {
/* Reposition the client correctly while moving */
*
*/
void floating_resize_window(xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event) {
- LOG("floating_resize_window\n");
+ DLOG("floating_resize_window\n");
void resize_window_callback(Rect *old_rect, uint32_t new_x, uint32_t new_y) {
int32_t new_width = old_rect->width + (new_x - event->root_x);
break;
case XCB_UNMAP_NOTIFY:
- LOG("Unmap-notify, aborting\n");
+ DLOG("Unmap-notify, aborting\n");
xcb_event_handle(&evenths, inside_event);
goto done;
default:
- LOG("Passing to original handler\n");
+ DLOG("Passing to original handler\n");
/* Use original handler */
xcb_event_handle(&evenths, inside_event);
break;
*
*/
void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused, direction_t direction) {
- LOG("floating focus\n");
+ DLOG("floating focus\n");
if (direction == D_LEFT || direction == D_RIGHT) {
/* Go to the next/previous floating client */
*
*/
void floating_move(xcb_connection_t *conn, Client *currently_focused, direction_t direction) {
- LOG("floating move\n");
+ DLOG("floating move\n");
switch (direction) {
case D_LEFT:
Client *client;
workspace->floating_hidden = !workspace->floating_hidden;
- LOG("floating_hidden is now: %d\n", workspace->floating_hidden);
+ DLOG("floating_hidden is now: %d\n", workspace->floating_hidden);
TAILQ_FOREACH(client, &(workspace->floating_clients), floating_clients) {
if (workspace->floating_hidden)
client_unmap(conn, client);
#include "manage.h"
#include "floating.h"
#include "workspace.h"
+#include "log.h"
/* After mapping/unmapping windows, a notify event is generated. However, we don’t want it,
since it’d trigger an infinite loop of switching between the different windows when
*
*/
int handle_key_press(void *ignored, xcb_connection_t *conn, xcb_key_press_event_t *event) {
- LOG("Keypress %d, state raw = %d\n", event->detail, event->state);
+ DLOG("Keypress %d, state raw = %d\n", event->detail, event->state);
/* Remove the numlock bit, all other bits are modifiers we can bind to */
uint16_t state_filtered = event->state & ~(xcb_numlock_mask | XCB_MOD_MASK_LOCK);
- LOG("(removed numlock, state = %d)\n", state_filtered);
+ DLOG("(removed numlock, state = %d)\n", state_filtered);
/* Only use the lower 8 bits of the state (modifier masks) so that mouse
* button masks are filtered out */
state_filtered &= 0xFF;
- LOG("(removed upper 8 bits, state = %d)\n", state_filtered);
+ DLOG("(removed upper 8 bits, state = %d)\n", state_filtered);
if (xkb_supported) {
/* We need to get the keysym group (There are group 1 to group 4, each holding
state_filtered |= BIND_MODE_SWITCH;
}
- LOG("(checked mode_switch, state %d)\n", state_filtered);
+ DLOG("(checked mode_switch, state %d)\n", state_filtered);
/* Find the binding */
Binding *bind;
parse_command(conn, bind->command);
if (state_filtered & BIND_MODE_SWITCH) {
- LOG("Mode_switch -> allow_events(SyncKeyboard)\n");
+ DLOG("Mode_switch -> allow_events(SyncKeyboard)\n");
xcb_allow_events(conn, SyncKeyboard, event->time);
xcb_flush(conn);
}
i3Screen *screen;
if ((screen = get_screen_containing(x, y)) == NULL) {
- LOG("ERROR: No such screen\n");
+ ELOG("ERROR: No such screen\n");
return;
}
if (screen == c_ws->screen)
c_ws = screen->current_workspace;
current_row = c_ws->current_row;
current_col = c_ws->current_col;
- LOG("We're now on virtual screen number %d\n", screen->num);
+ DLOG("We're now on virtual screen number %d\n", screen->num);
}
/*
*
*/
int handle_enter_notify(void *ignored, xcb_connection_t *conn, xcb_enter_notify_event_t *event) {
- LOG("enter_notify for %08x, mode = %d, detail %d, serial %d\n", event->event, event->mode, event->detail, event->sequence);
+ DLOG("enter_notify for %08x, mode = %d, detail %d, serial %d\n", event->event, event->mode, event->detail, event->sequence);
if (event->mode != XCB_NOTIFY_MODE_NORMAL) {
- LOG("This was not a normal notify, ignoring\n");
+ DLOG("This was not a normal notify, ignoring\n");
return 1;
}
/* Some events are not interesting, because they were not generated actively by the
/* If not, then the user moved his cursor to the root window. In that case, we adjust c_ws */
if (client == NULL) {
- LOG("Getting screen at %d x %d\n", event->root_x, event->root_y);
+ DLOG("Getting screen at %d x %d\n", event->root_x, event->root_y);
check_crossing_screen_boundary(event->root_x, event->root_y);
return 1;
}
if (client->container != NULL &&
client->container->mode == MODE_STACK &&
client->container->currently_focused != client) {
- LOG("Plausibility check says: no\n");
+ DLOG("Plausibility check says: no\n");
return 1;
}
/* This can happen when a client gets assigned to a different workspace than
* the current one (see src/mainx.c:reparent_window). Shortly after it was created,
* an enter_notify will follow. */
- LOG("enter_notify for a client on a different workspace but the same screen, ignoring\n");
+ DLOG("enter_notify for a client on a different workspace but the same screen, ignoring\n");
return 1;
}
event->request != XCB_MAPPING_MODIFIER)
return 0;
- LOG("Received mapping_notify for keyboard or modifier mapping, re-grabbing keys\n");
+ DLOG("Received mapping_notify for keyboard or modifier mapping, re-grabbing keys\n");
xcb_refresh_keyboard_mapping(keysyms, event);
xcb_get_numlock_mask(conn);
cookie = xcb_get_window_attributes_unchecked(conn, event->window);
- LOG("window = 0x%08x, serial is %d.\n", event->window, event->sequence);
+ DLOG("window = 0x%08x, serial is %d.\n", event->window, event->sequence);
add_ignore_event(event->sequence);
manage_window(prophs, conn, event->window, cookie, false);
*
*/
int handle_configure_request(void *prophs, xcb_connection_t *conn, xcb_configure_request_event_t *event) {
- LOG("window 0x%08x wants to be at %dx%d with %dx%d\n",
+ DLOG("window 0x%08x wants to be at %dx%d with %dx%d\n",
event->window, event->x, event->y, event->width, event->height);
Client *client = table_get(&by_child, event->window);
}
if (client->fullscreen) {
- LOG("Client is in fullscreen mode\n");
+ DLOG("Client is in fullscreen mode\n");
Rect child_rect = client->workspace->rect;
child_rect.x = child_rect.y = 0;
}
}
- LOG("Accepted new position/size for floating client: (%d, %d) size %d x %d\n",
+ DLOG("Accepted new position/size for floating client: (%d, %d) size %d x %d\n",
client->rect.x, client->rect.y, client->rect.width, client->rect.height);
/* Push the new position/size to X11 */
/* Dock clients can be reconfigured in their height */
if (client->dock) {
- LOG("Reconfiguring height of this dock client\n");
+ DLOG("Reconfiguring height of this dock client\n");
if (!(event->value_mask & XCB_CONFIG_WINDOW_HEIGHT)) {
- LOG("Ignoring configure request, no height given\n");
+ DLOG("Ignoring configure request, no height given\n");
return 1;
}
}
if (client->fullscreen) {
- LOG("Client is in fullscreen mode\n");
+ DLOG("Client is in fullscreen mode\n");
Rect child_rect = client->container->workspace->rect;
child_rect.x = child_rect.y = 0;
add_ignore_event(event->sequence);
if (event->event == root) {
- LOG("event->x = %d, ->y = %d, ->width = %d, ->height = %d\n", event->x, event->y, event->width, event->height);
- LOG("reconfigure of the root window, need to xinerama\n");
+ DLOG("event->x = %d, ->y = %d, ->width = %d, ->height = %d\n", event->x, event->y, event->width, event->height);
+ DLOG("reconfigure of the root window, need to xinerama\n");
/* FIXME: Somehow, this is occuring too often. Therefore, we check for 0/0,
but is there a better way? */
if (event->x == 0 && event->y == 0)
return 1;
}
- LOG("event->window = %08x, event->event = %08x\n", event->window, event->event);
- LOG("UnmapNotify for 0x%08x (received from 0x%08x)\n", event->window, event->event);
+ DLOG("event->window = %08x, event->event = %08x\n", event->window, event->event);
+ DLOG("UnmapNotify for 0x%08x (received from 0x%08x)\n", event->window, event->event);
if (client == NULL) {
- LOG("not a managed window. Ignoring.\n");
+ DLOG("not a managed window. Ignoring.\n");
/* This was most likely the destroyed frame of a client which is
* currently being unmapped, so we add this sequence (again!) to
if ((con->currently_focused != NULL) && ((con == CUR_CELL) || client->fullscreen))
set_focus(conn, con->currently_focused, true);
} else if (client_is_floating(client)) {
- LOG("Removing from floating clients\n");
+ DLOG("Removing from floating clients\n");
TAILQ_REMOVE(&(client->workspace->floating_clients), client, floating_clients);
SLIST_REMOVE(&(client->workspace->focus_stack), client, Client, focus_clients);
}
if (client->dock) {
- LOG("Removing from dock clients\n");
+ DLOG("Removing from dock clients\n");
SLIST_REMOVE(&(client->workspace->screen->dock_clients), client, Client, dock_clients);
}
- LOG("child of 0x%08x.\n", client->frame);
+ DLOG("child of 0x%08x.\n", client->frame);
xcb_reparent_window(conn, client->child, root, 0, 0);
client_unmap(conn, client);
if (to_focus != NULL)
set_focus(conn, to_focus, true);
else {
- LOG("Restoring focus to root screen\n");
+ DLOG("Restoring focus to root screen\n");
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
xcb_flush(conn);
}
int handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t state,
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
- LOG("_NET_WM_NAME not specified, not changing\n");
+ DLOG("_NET_WM_NAME not specified, not changing\n");
return 1;
}
Client *client = table_get(&by_child, window);
int handle_windowname_change_legacy(void *data, xcb_connection_t *conn, uint8_t state,
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
- LOG("prop == NULL\n");
+ DLOG("prop == NULL\n");
return 1;
}
Client *client = table_get(&by_child, window);
char *new_name;
if (asprintf(&new_name, "%.*s", xcb_get_property_value_length(prop), (char*)xcb_get_property_value(prop)) == -1) {
perror("Could not get old name");
- LOG("Could not get old name\n");
+ DLOG("Could not get old name\n");
return 1;
}
/* Convert it to UCS-2 here for not having to convert it later every time we want to pass it to X */
int handle_windowclass_change(void *data, xcb_connection_t *conn, uint8_t state,
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
- LOG("prop == NULL\n");
+ DLOG("prop == NULL\n");
return 1;
}
Client *client = table_get(&by_child, window);
char *new_class;
if (asprintf(&new_class, "%.*s", xcb_get_property_value_length(prop), (char*)xcb_get_property_value(prop)) == -1) {
perror("Could not get window class");
- LOG("Could not get window class\n");
+ DLOG("Could not get window class\n");
return 1;
}
return 1;
if (strcmp(new_class, "tools") == 0 || strcmp(new_class, "Dialog") == 0) {
- LOG("tool/dialog window, should we put it floating?\n");
+ DLOG("tool/dialog window, should we put it floating?\n");
if (client->floating == FLOATING_AUTO_OFF)
toggle_floating_mode(conn, client, true);
}
skip all events but the last one */
if (event->count != 0)
return 1;
- LOG("window = %08x\n", event->window);
+ DLOG("window = %08x\n", event->window);
Client *client = table_get(&by_parent, event->window);
if (client == NULL) {
event->data.data32[0] == _NET_WM_STATE_TOGGLE)))
client_toggle_fullscreen(conn, client);
} else {
- LOG("unhandled clientmessage\n");
+ ELOG("unhandled clientmessage\n");
return 0;
}
xcb_atom_t atom, xcb_get_property_reply_t *property) {
/* TODO: Implement this one. To do this, implement a little test program which sleep(1)s
before changing this property. */
- LOG("_NET_WM_WINDOW_TYPE changed, this is not yet implemented.\n");
+ ELOG("_NET_WM_WINDOW_TYPE changed, this is not yet implemented.\n");
return 0;
}
xcb_atom_t name, xcb_get_property_reply_t *reply) {
Client *client = table_get(&by_child, window);
if (client == NULL) {
- LOG("Received WM_SIZE_HINTS for unknown client\n");
+ DLOG("Received WM_SIZE_HINTS for unknown client\n");
return 1;
}
xcb_size_hints_t size_hints;
base_height != client->base_height) {
client->base_width = base_width;
client->base_height = base_height;
- LOG("client's base_height changed to %d\n", base_height);
+ DLOG("client's base_height changed to %d\n", base_height);
if (client->fullscreen)
- LOG("Not resizing client, it is in fullscreen mode\n");
+ DLOG("Not resizing client, it is in fullscreen mode\n");
else
resize_client(conn, client);
}
double min_aspect = (double)size_hints.min_aspect_num / size_hints.min_aspect_den;
double max_aspect = (double)size_hints.max_aspect_num / size_hints.min_aspect_den;
- LOG("Aspect ratio set: minimum %f, maximum %f\n", min_aspect, max_aspect);
- LOG("width = %f, height = %f\n", width, height);
+ DLOG("Aspect ratio set: minimum %f, maximum %f\n", min_aspect, max_aspect);
+ DLOG("width = %f, height = %f\n", width, height);
/* Sanity checks, this is user-input, in a way */
if (max_aspect <= 0 || min_aspect <= 0 || height == 0 || (width / height) <= 0)
xcb_atom_t name, xcb_get_property_reply_t *reply) {
Client *client = table_get(&by_child, window);
if (client == NULL) {
- LOG("Received WM_HINTS for unknown client\n");
+ DLOG("Received WM_HINTS for unknown client\n");
return 1;
}
xcb_wm_hints_t hints;
Client *last_focused = SLIST_FIRST(&(c_ws->focus_stack));
if (!client->urgent && client == last_focused) {
- LOG("Ignoring urgency flag for current client\n");
+ DLOG("Ignoring urgency flag for current client\n");
return 1;
}
xcb_atom_t name, xcb_get_property_reply_t *reply) {
Client *client = table_get(&by_child, window);
if (client == NULL) {
- LOG("No such client\n");
+ DLOG("No such client\n");
return 1;
}
}
if (client->floating == FLOATING_AUTO_OFF) {
- LOG("This is a popup window, putting into floating\n");
+ DLOG("This is a popup window, putting into floating\n");
toggle_floating_mode(conn, client, true);
}
if (leader == NULL || *leader == 0)
return 1;
- LOG("Client leader changed to %08x\n", *leader);
+ DLOG("Client leader changed to %08x\n", *leader);
client->leader = *leader;
#include "i3.h"
#include "util.h"
#include "commands.h"
+#include "log.h"
typedef struct ipc_client {
int fd;
*/
static void ipc_handle_message(uint8_t *message, int size,
uint32_t message_size, uint32_t message_type) {
- LOG("handling message of size %d\n", size);
- LOG("sender specified size %d\n", message_size);
- LOG("sender specified type %d\n", message_type);
- LOG("payload as a string = %s\n", message);
+ DLOG("handling message of size %d\n", size);
+ DLOG("sender specified size %d\n", message_size);
+ DLOG("sender specified type %d\n", message_type);
+ DLOG("payload as a string = %s\n", message);
switch (message_type) {
case I3_IPC_MESSAGE_TYPE_COMMAND: {
break;
}
default:
- LOG("unhandled ipc message\n");
+ DLOG("unhandled ipc message\n");
break;
}
}
ev_io_stop(EV_A_ w);
- LOG("IPC: client disconnected\n");
+ DLOG("IPC: client disconnected\n");
return;
}
/* Check if the message starts with the i3 IPC magic code */
if (n < strlen(I3_IPC_MAGIC)) {
- LOG("IPC: message too short, ignoring\n");
+ DLOG("IPC: message too short, ignoring\n");
return;
}
if (strncmp(buf, I3_IPC_MAGIC, strlen(I3_IPC_MAGIC)) != 0) {
- LOG("IPC: message does not start with the IPC magic\n");
+ DLOG("IPC: message does not start with the IPC magic\n");
return;
}
uint8_t *message = (uint8_t*)buf;
while (n > 0) {
- LOG("IPC: n = %d\n", n);
+ DLOG("IPC: n = %d\n", n);
message += strlen(I3_IPC_MAGIC);
n -= strlen(I3_IPC_MAGIC);
n -= sizeof(uint32_t);
if (message_size > n) {
- LOG("IPC: Either the message size was wrong or the message was not read completely, dropping\n");
+ DLOG("IPC: Either the message size was wrong or the message was not read completely, dropping\n");
return;
}
ev_io_init(package, ipc_receive_message, client, EV_READ);
ev_io_start(EV_A_ package);
- LOG("IPC: new client connected\n");
+ DLOG("IPC: new client connected\n");
struct ipc_client *new = calloc(sizeof(struct ipc_client), 1);
new->fd = client;
#include "floating.h"
#include "handlers.h"
#include "workspace.h"
+#include "log.h"
/*
* Updates *destination with new_value and returns true if it was changed or false
double unoccupied = workspace->rect.width;
double default_factor = ((float)workspace->rect.width / workspace->cols) / workspace->rect.width;
- LOG("get_unoccupied_x(), starting with %f, default_factor = %f\n", unoccupied, default_factor);
+ DLOG("get_unoccupied_x(), starting with %f, default_factor = %f\n", unoccupied, default_factor);
for (int cols = 0; cols < workspace->cols; cols++) {
- LOG("width_factor[%d] = %f, unoccupied = %f\n", cols, workspace->width_factor[cols], unoccupied);
+ DLOG("width_factor[%d] = %f, unoccupied = %f\n", cols, workspace->width_factor[cols], unoccupied);
if (workspace->width_factor[cols] == 0)
unoccupied -= workspace->rect.width * default_factor;
}
- LOG("unoccupied space: %f\n", unoccupied);
+ DLOG("unoccupied space: %f\n", unoccupied);
return unoccupied;
}
double unoccupied = height;
double default_factor = ((float)height / workspace->rows) / height;
- LOG("get_unoccupied_y(), starting with %f, default_factor = %f\n", unoccupied, default_factor);
+ DLOG("get_unoccupied_y(), starting with %f, default_factor = %f\n", unoccupied, default_factor);
for (int rows = 0; rows < workspace->rows; rows++) {
- LOG("height_factor[%d] = %f, unoccupied = %f\n", rows, workspace->height_factor[rows], unoccupied);
+ DLOG("height_factor[%d] = %f, unoccupied = %f\n", rows, workspace->height_factor[rows], unoccupied);
if (workspace->height_factor[rows] == 0)
unoccupied -= height * default_factor;
}
- LOG("unoccupied space: %f\n", unoccupied);
+ DLOG("unoccupied space: %f\n", unoccupied);
return unoccupied;
}
void reposition_client(xcb_connection_t *conn, Client *client) {
i3Screen *screen;
- LOG("frame 0x%08x needs to be pushed to %dx%d\n", client->frame, client->rect.x, client->rect.y);
+ DLOG("frame 0x%08x needs to be pushed to %dx%d\n", client->frame, client->rect.x, client->rect.y);
/* Note: We can use a pointer to client->x like an array of uint32_ts
because it is followed by client->y by definition */
xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, &(client->rect.x));
return;
if (screen == NULL) {
- LOG("Boundary checking disabled, no screen found for (%d, %d)\n", client->rect.x, client->rect.y);
+ DLOG("Boundary checking disabled, no screen found for (%d, %d)\n", client->rect.x, client->rect.y);
return;
}
- LOG("Client is on workspace %p with screen %p\n", client->workspace, client->workspace->screen);
- LOG("but screen at %d, %d is %p\n", client->rect.x, client->rect.y, screen);
+ DLOG("Client is on workspace %p with screen %p\n", client->workspace, client->workspace->screen);
+ DLOG("but screen at %d, %d is %p\n", client->rect.x, client->rect.y, screen);
floating_assign_to_workspace(client, screen->current_workspace);
}
void resize_client(xcb_connection_t *conn, Client *client) {
i3Font *font = load_font(conn, config.font);
- LOG("frame 0x%08x needs to be pushed to %dx%d\n", client->frame, client->rect.x, client->rect.y);
- LOG("resizing client 0x%08x to %d x %d\n", client->frame, client->rect.width, client->rect.height);
+ DLOG("frame 0x%08x needs to be pushed to %dx%d\n", client->frame, client->rect.x, client->rect.y);
+ DLOG("resizing client 0x%08x to %d x %d\n", client->frame, client->rect.width, client->rect.height);
xcb_configure_window(conn, client->frame,
XCB_CONFIG_WINDOW_X |
XCB_CONFIG_WINDOW_Y |
/* Obey the ratio, if any */
if (client->proportional_height != 0 &&
client->proportional_width != 0) {
- LOG("proportional height = %d, width = %d\n", client->proportional_height, client->proportional_width);
+ DLOG("proportional height = %d, width = %d\n", client->proportional_height, client->proportional_width);
double new_height = rect->height + 1;
int new_width = rect->width;
rect->height = new_height;
rect->width = new_width;
- LOG("new_height = %f, new_width = %d\n", new_height, new_width);
+ DLOG("new_height = %f, new_width = %d\n", new_height, new_width);
}
if (client->height_increment > 1) {
int old_height = rect->height;
rect->height -= (rect->height - client->base_height) % client->height_increment;
- LOG("Lost %d pixel due to client's height_increment (%d px, base_height = %d)\n",
+ DLOG("Lost %d pixel due to client's height_increment (%d px, base_height = %d)\n",
old_height - rect->height, client->height_increment, client->base_height);
}
if (client->width_increment > 1) {
int old_width = rect->width;
rect->width -= (rect->width - client->base_width) % client->width_increment;
- LOG("Lost %d pixel due to client's width_increment (%d px, base_width = %d)\n",
+ DLOG("Lost %d pixel due to client's width_increment (%d px, base_width = %d)\n",
old_width - rect->width, client->width_increment, client->base_width);
}
- LOG("child will be at %dx%d with size %dx%d\n", rect->x, rect->y, rect->width, rect->height);
+ DLOG("child will be at %dx%d with size %dx%d\n", rect->x, rect->y, rect->width, rect->height);
xcb_configure_window(conn, client->child, mask, &(rect->x));
if (container->mode == MODE_DEFAULT) {
int height = (container->height / max(1, num_clients));
int rest_pixels = (container->height % max(1, num_clients));
- LOG("height per client = %d, rest = %d\n", height, rest_pixels);
+ DLOG("height per client = %d, rest = %d\n", height, rest_pixels);
CIRCLEQ_FOREACH(client, &(container->clients), clients) {
/* If the client is in fullscreen mode, it does not get reconfigured */
/* Check if we need to remap our stack title window, it gets unmapped when the container
is empty in src/handlers.c:unmap_notify() */
if (stack_win->rect.height == 0 && num_clients > 0) {
- LOG("remapping stack win\n");
+ DLOG("remapping stack win\n");
xcb_map_window(conn, stack_win->window);
- } else LOG("not remapping stackwin, height = %d, num_clients = %d\n",
+ } else DLOG("not remapping stackwin, height = %d, num_clients = %d\n",
stack_win->rect.height, num_clients);
if (container->mode == MODE_TABBED) {
/* By setting num_clients to 1 we force that the stack window will be only one line
* high. The rest of the code is useful in both cases. */
- LOG("tabbed mode, setting num_clients = 1\n");
+ DLOG("tabbed mode, setting num_clients = 1\n");
if (stack_lines > 1)
stack_lines = 1;
}
current_client++;
} else if (container->mode == MODE_TABBED) {
if (container->stack_limit == STACK_LIMIT_ROWS) {
- LOG("You limited this container in its rows. "
+ LOG("You limited a tabbed container in its rows. "
"This makes no sense in tabbing mode.\n");
}
offset_x = current_client++ * size_each;
static void render_bars(xcb_connection_t *conn, Workspace *r_ws, int width, int *height) {
Client *client;
SLIST_FOREACH(client, &(r_ws->screen->dock_clients), dock_clients) {
- LOG("client is at %d, should be at %d\n", client->rect.y, *height);
+ DLOG("client is at %d, should be at %d\n", client->rect.y, *height);
if (client->force_reconfigure |
update_if_necessary(&(client->rect.x), r_ws->rect.x) |
update_if_necessary(&(client->rect.y), *height))
resize_client(conn, client);
client->force_reconfigure = false;
- LOG("desired_height = %d\n", client->desired_height);
+ DLOG("desired_height = %d\n", client->desired_height);
*height += client->desired_height;
}
}
single_width = container->width;
}
- LOG("height is %d\n", height);
+ DLOG("height is %d\n", height);
container->height = 0;
*
*/
static void xkb_got_event(EV_P_ struct ev_io *w, int revents) {
- LOG("got xkb event, yay\n");
+ DLOG("Handling XKB event\n");
XEvent ev;
/* When using xmodmap, every change (!) gets an own event.
* Therefore, we just read all events and only handle the
xcb_get_numlock_mask(global_conn);
ungrab_all_keys(global_conn);
- LOG("Re-grabbing...\n");
+ DLOG("Re-grabbing...\n");
grab_all_keys(global_conn);
- LOG("Done\n");
+ DLOG("Done\n");
}
int evBase, errBase;
if ((xkbdpy = XkbOpenDisplay(getenv("DISPLAY"), &evBase, &errBase, &major, &minor, &error)) == NULL) {
- LOG("ERROR: XkbOpenDisplay() failed, disabling XKB support\n");
+ ELOG("ERROR: XkbOpenDisplay() failed, disabling XKB support\n");
xkb_supported = false;
}
#define GET_ATOM(name) { \
xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(conn, atom_cookies[name], NULL); \
if (!reply) { \
- LOG("Could not get atom " #name "\n"); \
+ ELOG("Could not get atom " #name "\n"); \
exit(-1); \
} \
atoms[name] = reply->atom; \
}
/* check for Xinerama */
- LOG("Checking for Xinerama...\n");
+ DLOG("Checking for Xinerama...\n");
initialize_xinerama(conn);
xcb_flush(conn);
/* Get pointer position to see on which screen we’re starting */
xcb_query_pointer_reply_t *reply;
if ((reply = xcb_query_pointer_reply(conn, xcb_query_pointer(conn, root), NULL)) == NULL) {
- LOG("Could not get pointer position\n");
+ ELOG("Could not get pointer position\n");
return 1;
}
i3Screen *screen = get_screen_containing(reply->root_x, reply->root_y);
if (screen == NULL) {
- LOG("ERROR: No screen at %d x %d, starting on the first screen\n",
+ ELOG("ERROR: No screen at %d x %d, starting on the first screen\n",
reply->root_x, reply->root_y);
screen = TAILQ_FIRST(virtual_screens);
}
- LOG("Starting on %d\n", screen->current_workspace);
+ DLOG("Starting on %d\n", screen->current_workspace);
c_ws = screen->current_workspace;
manage_existing_windows(conn, &prophs, root);
if (config.ipc_socket_path != NULL) {
int ipc_socket = ipc_create_socket(config.ipc_socket_path);
if (ipc_socket == -1) {
- LOG("Could not create the IPC socket, IPC disabled\n");
+ ELOG("Could not create the IPC socket, IPC disabled\n");
} else {
struct ev_io *ipc_io = scalloc(sizeof(struct ev_io));
ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ);
#include "floating.h"
#include "client.h"
#include "workspace.h"
+#include "log.h"
/*
* Go through all existing windows (if the window manager is restarted) and manage them
/* Check if the window is mapped (it could be not mapped when intializing and
calling manage_window() for every window) */
if ((attr = xcb_get_window_attributes_reply(conn, cookie, 0)) == NULL) {
- LOG("Could not get attributes\n");
+ ELOG("Could not get attributes\n");
return;
}
/* Events for already managed windows should already be filtered in manage_window() */
assert(new == NULL);
- LOG("Reparenting window 0x%08x\n", child);
- LOG("x = %d, y = %d, width = %d, height = %d\n", x, y, width, height);
+ LOG("Managing window 0x%08x\n", child);
+ DLOG("x = %d, y = %d, width = %d, height = %d\n", x, y, width, height);
new = calloc(sizeof(Client), 1);
new->force_reconfigure = true;
new->awaiting_useless_unmap = true;
xcb_void_cookie_t cookie = xcb_reparent_window_checked(conn, child, new->frame, 0, font->height);
if (xcb_request_check(conn, cookie) != NULL) {
- LOG("Could not reparent the window, aborting\n");
+ DLOG("Could not reparent the window, aborting\n");
xcb_destroy_window(conn, new->frame);
free(new);
return;
if (preply != NULL && preply->value_len > 0 && (atom = xcb_get_property_value(preply))) {
for (int i = 0; i < xcb_get_property_value_length(preply); i++)
if (atom[i] == atoms[_NET_WM_WINDOW_TYPE_DOCK]) {
- LOG("Window is a dock.\n");
+ DLOG("Window is a dock.\n");
new->dock = true;
new->borderless = true;
new->titlebar_position = TITLEBAR_OFF;
atom[i] == atoms[_NET_WM_WINDOW_TYPE_SPLASH]) {
/* Set the dialog window to automatically floating, will be used below */
new->floating = FLOATING_AUTO_ON;
- LOG("dialog/utility/toolbar/splash window, automatically floating\n");
+ DLOG("dialog/utility/toolbar/splash window, automatically floating\n");
}
}
/* All clients which have a leader should be floating */
if (!new->dock && !client_is_floating(new) && new->leader != 0) {
- LOG("Client has WM_CLIENT_LEADER hint set, setting floating\n");
+ DLOG("Client has WM_CLIENT_LEADER hint set, setting floating\n");
new->floating = FLOATING_AUTO_ON;
}
if (new->workspace->auto_float) {
new->floating = FLOATING_AUTO_ON;
- LOG("workspace is in autofloat mode, setting floating\n");
+ DLOG("workspace is in autofloat mode, setting floating\n");
}
if (new->dock) {
TODO: bars at the top */
new->desired_height = strut[3];
if (new->desired_height == 0) {
- LOG("Client wanted to be 0 pixels high, using the window's height (%d)\n", original_height);
+ DLOG("Client wanted to be 0 pixels high, using the window's height (%d)\n", original_height);
new->desired_height = original_height;
}
- LOG("the client wants to be %d pixels high\n", new->desired_height);
+ DLOG("the client wants to be %d pixels high\n", new->desired_height);
} else {
- LOG("The client didn't specify space to reserve at the screen edge, using its height (%d)\n", original_height);
+ DLOG("The client didn't specify space to reserve at the screen edge, using its height (%d)\n", original_height);
new->desired_height = original_height;
}
} else {
assign->windowclass_title, assign->workspace);
if (c_ws->screen->current_workspace->num == (assign->workspace-1)) {
- LOG("We are already there, no need to do anything\n");
+ DLOG("We are already there, no need to do anything\n");
break;
}
- LOG("Changing container/workspace and unmapping the client\n");
+ DLOG("Changing container/workspace and unmapping the client\n");
Workspace *t_ws = workspace_get(assign->workspace-1);
workspace_initialize(t_ws, c_ws->screen);
}
if (new->workspace->fullscreen_client != NULL) {
- LOG("Setting below fullscreen window\n");
+ DLOG("Setting below fullscreen window\n");
/* If we are in fullscreen, we should lower the window to not be annoying */
uint32_t values[] = { XCB_STACK_MODE_BELOW };
* to (0, 0), so we push them to a reasonable position
* (centered over their leader) */
if (new->leader != 0 && x == 0 && y == 0) {
- LOG("Floating client wants to (0x0), moving it over its leader instead\n");
+ DLOG("Floating client wants to (0x0), moving it over its leader instead\n");
Client *leader = table_get(&by_child, new->leader);
if (leader == NULL) {
- LOG("leader is NULL, centering it over current workspace\n");
+ DLOG("leader is NULL, centering it over current workspace\n");
x = c_ws->rect.x + (c_ws->rect.width / 2) - (new->rect.width / 2);
y = c_ws->rect.y + (c_ws->rect.height / 2) - (new->rect.height / 2);
}
new->floating_rect.x = new->rect.x = x;
new->floating_rect.y = new->rect.y = y;
- LOG("copying floating_rect from tiling (%d, %d) size (%d, %d)\n",
+ DLOG("copying floating_rect from tiling (%d, %d) size (%d, %d)\n",
new->floating_rect.x, new->floating_rect.y,
new->floating_rect.width, new->floating_rect.height);
- LOG("outer rect (%d, %d) size (%d, %d)\n",
+ DLOG("outer rect (%d, %d) size (%d, %d)\n",
new->rect.x, new->rect.y, new->rect.width, new->rect.height);
/* Make sure it is on top of the other windows */
#include "config.h"
#include "floating.h"
#include "workspace.h"
+#include "log.h"
/*
* Renders the resize window between the first/second container and resizes
int new_position;
i3Screen *screen = get_screen_containing(event->root_x, event->root_y);
if (screen == NULL) {
- LOG("BUG: No screen found at this position (%d, %d)\n", event->root_x, event->root_y);
+ ELOG("BUG: No screen found at this position (%d, %d)\n", event->root_x, event->root_y);
return 1;
}
i3Screen *most_right = get_screen_most(D_RIGHT, screen),
*most_bottom = get_screen_most(D_DOWN, screen);
- LOG("event->event_x = %d, event->root_x = %d\n", event->event_x, event->root_x);
+ DLOG("event->event_x = %d, event->root_x = %d\n", event->event_x, event->root_x);
- LOG("Screen dimensions: (%d, %d) %d x %d\n", screen->rect.x, screen->rect.y, screen->rect.width, screen->rect.height);
+ DLOG("Screen dimensions: (%d, %d) %d x %d\n", screen->rect.x, screen->rect.y, screen->rect.width, screen->rect.height);
uint32_t mask = 0;
uint32_t values[2];
xcb_flush(conn);
void resize_callback(Rect *old_rect, uint32_t new_x, uint32_t new_y) {
- LOG("new x = %d, y = %d\n", new_x, new_y);
+ DLOG("new x = %d, y = %d\n", new_x, new_y);
if (orientation == O_VERTICAL) {
/* Check if the new coordinates are within screen boundaries */
if (new_x > (screen->rect.x + screen->rect.width - 25) ||
if (ws->width_factor[second] == 0)
new_unoccupied_x += default_width;
- LOG("\n\n\n");
- LOG("old = %d, new = %d\n", old_unoccupied_x, new_unoccupied_x);
+ DLOG("\n\n\n");
+ DLOG("old = %d, new = %d\n", old_unoccupied_x, new_unoccupied_x);
int cols_without_wf = 0;
int old_width, old_second_width;
if (ws->width_factor[col] == 0)
cols_without_wf++;
- LOG("old_unoccupied_x = %d\n", old_unoccupied_x);
+ DLOG("old_unoccupied_x = %d\n", old_unoccupied_x);
- LOG("Updating first (before = %f)\n", ws->width_factor[first]);
+ DLOG("Updating first (before = %f)\n", ws->width_factor[first]);
/* Convert 0 (for default width_factor) to actual numbers */
if (ws->width_factor[first] == 0)
old_width = (old_unoccupied_x / max(cols_without_wf, 1));
else old_width = ws->width_factor[first] * old_unoccupied_x;
- LOG("second (before = %f)\n", ws->width_factor[second]);
+ DLOG("second (before = %f)\n", ws->width_factor[second]);
if (ws->width_factor[second] == 0)
old_second_width = (old_unoccupied_x / max(cols_without_wf, 1));
else old_second_width = ws->width_factor[second] * old_unoccupied_x;
- LOG("middle = %f\n", ws->width_factor[first]);
+ DLOG("middle = %f\n", ws->width_factor[first]);
/* If the space used for customly resized columns has changed we need to adapt the
* other customly resized columns, if any */
if (ws->width_factor[col] == 0)
continue;
- LOG("Updating other column (%d) (current width_factor = %f)\n", col, ws->width_factor[col]);
+ DLOG("Updating other column (%d) (current width_factor = %f)\n", col, ws->width_factor[col]);
ws->width_factor[col] = (ws->width_factor[col] * old_unoccupied_x) / new_unoccupied_x;
- LOG("to %f\n", ws->width_factor[col]);
+ DLOG("to %f\n", ws->width_factor[col]);
}
- LOG("Updating first (before = %f)\n", ws->width_factor[first]);
+ DLOG("Updating first (before = %f)\n", ws->width_factor[first]);
/* Convert 0 (for default width_factor) to actual numbers */
if (ws->width_factor[first] == 0)
ws->width_factor[first] = ((float)ws->rect.width / ws->cols) / new_unoccupied_x;
- LOG("first->width = %d, pixels = %d\n", old_width, pixels);
+ DLOG("first->width = %d, pixels = %d\n", old_width, pixels);
ws->width_factor[first] *= (float)(old_width + pixels) / old_width;
- LOG("-> %f\n", ws->width_factor[first]);
+ DLOG("-> %f\n", ws->width_factor[first]);
- LOG("Updating second (before = %f)\n", ws->width_factor[second]);
+ DLOG("Updating second (before = %f)\n", ws->width_factor[second]);
if (ws->width_factor[second] == 0)
ws->width_factor[second] = ((float)ws->rect.width / ws->cols) / new_unoccupied_x;
- LOG("middle = %f\n", ws->width_factor[second]);
- LOG("second->width = %d, pixels = %d\n", old_second_width, pixels);
+ DLOG("middle = %f\n", ws->width_factor[second]);
+ DLOG("second->width = %d, pixels = %d\n", old_second_width, pixels);
ws->width_factor[second] *= (float)(old_second_width - pixels) / old_second_width;
- LOG("-> %f\n", ws->width_factor[second]);
+ DLOG("-> %f\n", ws->width_factor[second]);
- LOG("new unoccupied_x = %d\n", get_unoccupied_x(ws));
+ DLOG("new unoccupied_x = %d\n", get_unoccupied_x(ws));
- LOG("\n\n\n");
+ DLOG("\n\n\n");
} else {
int ws_height = workspace_height(ws);
int default_height = ws_height / ws->rows;
if (ws->height_factor[row] == 0)
cols_without_hf++;
- LOG("old_unoccupied_y = %d\n", old_unoccupied_y);
+ DLOG("old_unoccupied_y = %d\n", old_unoccupied_y);
- LOG("Updating first (before = %f)\n", ws->height_factor[first]);
+ DLOG("Updating first (before = %f)\n", ws->height_factor[first]);
/* Convert 0 (for default width_factor) to actual numbers */
if (ws->height_factor[first] == 0)
old_height = (old_unoccupied_y / max(cols_without_hf, 1));
else old_height = ws->height_factor[first] * old_unoccupied_y;
- LOG("second (before = %f)\n", ws->height_factor[second]);
+ DLOG("second (before = %f)\n", ws->height_factor[second]);
if (ws->height_factor[second] == 0)
old_second_height = (old_unoccupied_y / max(cols_without_hf, 1));
else old_second_height = ws->height_factor[second] * old_unoccupied_y;
- LOG("middle = %f\n", ws->height_factor[first]);
+ DLOG("middle = %f\n", ws->height_factor[first]);
- LOG("\n\n\n");
- LOG("old = %d, new = %d\n", old_unoccupied_y, new_unoccupied_y);
+ DLOG("\n\n\n");
+ DLOG("old = %d, new = %d\n", old_unoccupied_y, new_unoccupied_y);
/* If the space used for customly resized columns has changed we need to adapt the
* other customly resized columns, if any */
if (ws->height_factor[row] == 0)
continue;
- LOG("Updating other column (%d) (current width_factor = %f)\n", row, ws->height_factor[row]);
+ DLOG("Updating other column (%d) (current width_factor = %f)\n", row, ws->height_factor[row]);
ws->height_factor[row] = (ws->height_factor[row] * old_unoccupied_y) / new_unoccupied_y;
- LOG("to %f\n", ws->height_factor[row]);
+ DLOG("to %f\n", ws->height_factor[row]);
}
- LOG("Updating first (before = %f)\n", ws->height_factor[first]);
+ DLOG("Updating first (before = %f)\n", ws->height_factor[first]);
/* Convert 0 (for default width_factor) to actual numbers */
if (ws->height_factor[first] == 0)
ws->height_factor[first] = ((float)ws_height / ws->rows) / new_unoccupied_y;
- LOG("first->width = %d, pixels = %d\n", old_height, pixels);
+ DLOG("first->width = %d, pixels = %d\n", old_height, pixels);
ws->height_factor[first] *= (float)(old_height + pixels) / old_height;
- LOG("-> %f\n", ws->height_factor[first]);
+ DLOG("-> %f\n", ws->height_factor[first]);
- LOG("Updating second (before = %f)\n", ws->height_factor[second]);
+ DLOG("Updating second (before = %f)\n", ws->height_factor[second]);
if (ws->height_factor[second] == 0)
ws->height_factor[second] = ((float)ws_height / ws->rows) / new_unoccupied_y;
- LOG("middle = %f\n", ws->height_factor[second]);
- LOG("second->width = %d, pixels = %d\n", old_second_height, pixels);
+ DLOG("middle = %f\n", ws->height_factor[second]);
+ DLOG("second->width = %d, pixels = %d\n", old_second_height, pixels);
ws->height_factor[second] *= (float)(old_second_height - pixels) / old_second_height;
- LOG("-> %f\n", ws->height_factor[second]);
+ DLOG("-> %f\n", ws->height_factor[second]);
- LOG("new unoccupied_y = %d\n", get_unoccupied_y(ws));
+ DLOG("new unoccupied_y = %d\n", get_unoccupied_y(ws));
- LOG("\n\n\n");
+ DLOG("\n\n\n");
}
render_layout(conn);
#include "layout.h"
#include "config.h"
#include "workspace.h"
+#include "log.h"
int current_workspace = 0;
int num_workspaces = 1;
workspace->height_factor = realloc(workspace->height_factor, sizeof(float) * workspace->rows);
- LOG("rows = %d\n", workspace->rows);
+ DLOG("rows = %d\n", workspace->rows);
for (int rows = (workspace->rows - 1); rows >= 1; rows--) {
- LOG("Moving height_factor %d (%f) to %d\n", rows-1, workspace->height_factor[rows-1], rows);
+ DLOG("Moving height_factor %d (%f) to %d\n", rows-1, workspace->height_factor[rows-1], rows);
workspace->height_factor[rows] = workspace->height_factor[rows-1];
}
/* Move the other rows */
for (int cols = 0; cols < workspace->cols; cols++)
for (int rows = workspace->rows - 1; rows > 0; rows--) {
- LOG("Moving row %d to %d\n", rows-1, rows);
+ DLOG("Moving row %d to %d\n", rows-1, rows);
workspace->table[cols][rows] = workspace->table[cols][rows-1];
workspace->table[cols][rows]->row = rows;
}
workspace->width_factor = realloc(workspace->width_factor, sizeof(float) * workspace->cols);
- LOG("cols = %d\n", workspace->cols);
+ DLOG("cols = %d\n", workspace->cols);
for (int cols = (workspace->cols - 1); cols >= 1; cols--) {
- LOG("Moving width_factor %d (%f) to %d\n", cols-1, workspace->width_factor[cols-1], cols);
+ DLOG("Moving width_factor %d (%f) to %d\n", cols-1, workspace->width_factor[cols-1], cols);
workspace->width_factor[cols] = workspace->width_factor[cols-1];
}
/* Move the other columns */
for (int rows = 0; rows < workspace->rows; rows++)
for (int cols = workspace->cols - 1; cols > 0; cols--) {
- LOG("Moving col %d to %d\n", cols-1, cols);
+ DLOG("Moving col %d to %d\n", cols-1, cols);
workspace->table[cols][rows] = workspace->table[cols-1][rows];
workspace->table[cols][rows]->col = cols;
}
if (workspace->width_factor[cols] == 0)
continue;
- LOG("Added free space (%f) to %d (had %f)\n", free_space, cols,
+ DLOG("Added free space (%f) to %d (had %f)\n", free_space, cols,
workspace->width_factor[cols]);
workspace->width_factor[cols] += free_space;
break;
if (workspace->height_factor[rows] == 0)
continue;
- LOG("Added free space (%f) to %d (had %f)\n", free_space, rows,
+ DLOG("Added free space (%f) to %d (had %f)\n", free_space, rows,
workspace->height_factor[rows]);
workspace->height_factor[rows] += free_space;
break;
}
static void move_columns_from(xcb_connection_t *conn, Workspace *workspace, int cols) {
- LOG("firstly freeing \n");
+ DLOG("firstly freeing \n");
/* Free the columns which are cleaned up */
for (int rows = 0; rows < workspace->rows; rows++)
for (; cols < workspace->cols; cols++)
for (int rows = 0; rows < workspace->rows; rows++) {
- LOG("at col = %d, row = %d\n", cols, rows);
+ DLOG("at col = %d, row = %d\n", cols, rows);
Container *new_container = workspace->table[cols][rows];
- LOG("moving cols = %d to cols -1 = %d\n", cols, cols-1);
+ DLOG("moving cols = %d to cols -1 = %d\n", cols, cols-1);
workspace->table[cols-1][rows] = new_container;
new_container->row = rows;
for (int cols = 0; cols < workspace->cols; cols++) {
Container *new_container = workspace->table[cols][rows];
- LOG("moving rows = %d to rows -1 = %d\n", rows, rows - 1);
+ DLOG("moving rows = %d to rows -1 = %d\n", rows, rows - 1);
workspace->table[cols][rows-1] = new_container;
new_container->row = rows-1;
*
*/
void dump_table(xcb_connection_t *conn, Workspace *workspace) {
- LOG("dump_table()\n");
+ DLOG("dump_table()\n");
FOR_TABLE(workspace) {
Container *con = workspace->table[cols][rows];
- LOG("----\n");
- LOG("at col=%d, row=%d\n", cols, rows);
- LOG("currently_focused = %p\n", con->currently_focused);
+ DLOG("----\n");
+ DLOG("at col=%d, row=%d\n", cols, rows);
+ DLOG("currently_focused = %p\n", con->currently_focused);
Client *loop;
CIRCLEQ_FOREACH(loop, &(con->clients), clients) {
- LOG("got client %08x / %s\n", loop->child, loop->name);
+ DLOG("got client %08x / %s\n", loop->child, loop->name);
}
- LOG("----\n");
+ DLOG("----\n");
}
- LOG("done\n");
+ DLOG("done\n");
}
/*
*
*/
void cleanup_table(xcb_connection_t *conn, Workspace *workspace) {
- LOG("cleanup_table()\n");
+ DLOG("cleanup_table()\n");
/* Check for empty columns if we got more than one column */
for (int cols = 0; (workspace->cols > 1) && (cols < workspace->cols);) {
break;
}
if (completely_empty) {
- LOG("Removing completely empty column %d\n", cols);
+ DLOG("Removing completely empty column %d\n", cols);
if (cols < (workspace->cols - 1))
move_columns_from(conn, workspace, cols+1);
else {
/* Check for empty rows if we got more than one row */
for (int rows = 0; (workspace->rows > 1) && (rows < workspace->rows);) {
bool completely_empty = true;
- LOG("Checking row %d\n", rows);
+ DLOG("Checking row %d\n", rows);
for (int cols = 0; cols < workspace->cols; cols++)
if (workspace->table[cols][rows]->currently_focused != NULL) {
completely_empty = false;
break;
}
if (completely_empty) {
- LOG("Removing completely empty row %d\n", rows);
+ DLOG("Removing completely empty row %d\n", rows);
if (rows < (workspace->rows - 1))
move_rows_from(conn, workspace, rows+1);
else {
*
*/
void fix_colrowspan(xcb_connection_t *conn, Workspace *workspace) {
- LOG("Fixing col/rowspan\n");
+ DLOG("Fixing col/rowspan\n");
FOR_TABLE(workspace) {
Container *con = workspace->table[cols][rows];
if (con->colspan > 1) {
- LOG("gots one with colspan %d (at %d c, %d r)\n", con->colspan, cols, rows);
+ DLOG("gots one with colspan %d (at %d c, %d r)\n", con->colspan, cols, rows);
while (con->colspan > 1 &&
(!cell_exists(cols + (con->colspan-1), rows) ||
workspace->table[cols + (con->colspan - 1)][rows]->currently_focused != NULL))
con->colspan--;
- LOG("fixed it to %d\n", con->colspan);
+ DLOG("fixed it to %d\n", con->colspan);
}
if (con->rowspan > 1) {
- LOG("gots one with rowspan %d (at %d c, %d r)\n", con->rowspan, cols, rows);
+ DLOG("gots one with rowspan %d (at %d c, %d r)\n", con->rowspan, cols, rows);
while (con->rowspan > 1 &&
(!cell_exists(cols, rows + (con->rowspan - 1)) ||
workspace->table[cols][rows + (con->rowspan - 1)]->currently_focused != NULL))
con->rowspan--;
- LOG("fixed it to %d\n", con->rowspan);
+ DLOG("fixed it to %d\n", con->rowspan);
}
}
}
#include "util.h"
#include "xcb.h"
#include "client.h"
+#include "log.h"
static iconv_t conversion_descriptor = 0;
struct keyvalue_table_head by_parent = TAILQ_HEAD_INITIALIZER(by_parent);
return (a > b ? a : b);
}
-/*
- * Logs the given message to stdout while prefixing the current time to it.
- * This is to be called by LOG() which includes filename/linenumber
- *
- */
-void slog(char *fmt, ...) {
- va_list args;
- char timebuf[64];
-
- va_start(args, fmt);
- /* Get current time */
- time_t t = time(NULL);
- /* Convert time to local time (determined by the locale) */
- struct tm *tmp = localtime(&t);
- /* Generate time prefix */
- strftime(timebuf, sizeof(timebuf), "%x %X - ", tmp);
- printf("%s", timebuf);
- vprintf(fmt, args);
- va_end(args);
-}
-
/*
* The s* functions (safe) are wrappers around malloc, strdup, …, which exits if one of
* the called functions returns NULL, meaning that there is no more memory available
Client *last_focused = get_last_focused_client(conn, client->container, client);
if (last_focused != NULL) {
- LOG("raising above frame %p / child %p\n", last_focused->frame, last_focused->child);
+ DLOG("raising above frame %p / child %p\n", last_focused->frame, last_focused->child);
uint32_t values[] = { last_focused->frame, XCB_STACK_MODE_ABOVE };
xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
}
/* If the last client was a floating client, we need to go to the next
* tiling client in stack and re-decorate it. */
if (old_client != NULL && client_is_floating(old_client)) {
- LOG("Coming from floating client, searching next tiling...\n");
+ DLOG("Coming from floating client, searching next tiling...\n");
Client *current;
SLIST_FOREACH(current, &(client->workspace->focus_stack), focus_clients) {
if (client_is_floating(current))
continue;
- LOG("Found window: %p / child %p\n", current->frame, current->child);
+ DLOG("Found window: %p / child %p\n", current->frame, current->child);
redecorate_window(conn, current);
break;
}
if (client == container->currently_focused || client == last_focused)
continue;
- LOG("setting %08x below %08x / %08x\n", client->frame, container->currently_focused->frame);
+ DLOG("setting %08x below %08x / %08x\n", client->frame, container->currently_focused->frame);
uint32_t values[] = { container->currently_focused->frame, XCB_STACK_MODE_BELOW };
xcb_configure_window(conn, client->frame,
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
}
if (last_focused != NULL) {
- LOG("Putting last_focused directly underneath the currently focused\n");
+ DLOG("Putting last_focused directly underneath the currently focused\n");
uint32_t values[] = { container->currently_focused->frame, XCB_STACK_MODE_BELOW };
xcb_configure_window(conn, last_focused->frame,
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);
goto done;
}
- LOG("Getting clients for class \"%s\" / title \"%s\"\n", to_class, to_title);
+ DLOG("Getting clients for class \"%s\" / title \"%s\"\n", to_class, to_title);
Workspace *ws;
TAILQ_FOREACH(ws, workspaces, workspaces) {
if (ws->screen == NULL)
Client *client;
SLIST_FOREACH(client, &(ws->focus_stack), focus_clients) {
- LOG("Checking client with class=%s, name=%s\n", client->window_class, client->name);
+ DLOG("Checking client with class=%s, name=%s\n", client->window_class, client->name);
if (!client_matches_class_name(client, to_class, to_title, to_title_ucs, to_title_ucs_len))
continue;
#include "layout.h"
#include "workspace.h"
#include "client.h"
+#include "log.h"
/*
* Returns a pointer to the workspace with the given number (starting at 0),
/* If we are still there, we could not find the requested workspace. */
int last_ws = TAILQ_LAST(workspaces, workspaces_head)->num;
- LOG("We need to initialize that one, last ws = %d\n", last_ws);
+ DLOG("We need to initialize that one, last ws = %d\n", last_ws);
for (int c = last_ws; c < number; c++) {
- LOG("Creating new ws\n");
+ DLOG("Creating new ws\n");
ws = scalloc(sizeof(Workspace));
ws->num = c+1;
TAILQ_INSERT_TAIL(workspaces, ws, workspaces);
}
- LOG("done\n");
+ DLOG("done\n");
return ws;
}
/* t_ws (to workspace) is just a convenience pointer to the workspace we’re switching to */
Workspace *t_ws = workspace_get(workspace-1);
- LOG("show_workspace(%d)\n", workspace);
+ DLOG("show_workspace(%d)\n", workspace);
/* Store current_row/current_col */
c_ws->current_row = current_row;
if (c_ws->screen != t_ws->screen) {
/* We need to switch to the other screen first */
- LOG("moving over to other screen.\n");
+ DLOG("moving over to other screen.\n");
/* Store the old client */
Client *old_client = CUR_CELL->currently_focused;
current_row = c_ws->current_row;
current_col = c_ws->current_col;
- LOG("new current row = %d, current col = %d\n", current_row, current_col);
+ DLOG("new current row = %d, current col = %d\n", current_row, current_col);
workspace_map_clients(conn, c_ws);
char *rest;
int preferred_screen = strtol(preference, &rest, 10);
- LOG("Getting screen for preference \"%s\" (%d)\n", preference, preferred_screen);
+ DLOG("Getting screen for preference \"%s\" (%d)\n", preference, preferred_screen);
if ((rest == preference) || (preferred_screen >= num_screens)) {
int x = INT_MAX, y = INT_MAX;
x = atoi(preference);
}
- LOG("Looking for screen at %d x %d\n", x, y);
+ DLOG("Looking for screen at %d x %d\n", x, y);
TAILQ_FOREACH(screen, slist, screens)
if ((x == INT_MAX || screen->rect.x == x) &&
(y == INT_MAX || screen->rect.y == y)) {
- LOG("found %p\n", screen);
+ DLOG("found %p\n", screen);
return screen;
}
- LOG("none found\n");
+ DLOG("none found\n");
return NULL;
} else {
int c = 0;
*/
void workspace_initialize(Workspace *ws, i3Screen *screen) {
if (ws->screen != NULL) {
- LOG("Workspace already initialized\n");
+ DLOG("Workspace already initialized\n");
return;
}
}
if (result == NULL) {
- LOG("No existing free workspace found to assign, creating a new one\n");
+ DLOG("No existing free workspace found to assign, creating a new one\n");
Workspace *ws;
int last_ws = 0;
int unmapped_clients = 0;
FOR_TABLE(u_ws)
CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) {
- LOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child);
+ DLOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child);
client_unmap(conn, client);
unmapped_clients++;
}
if (!client_is_floating(client))
continue;
- LOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child);
+ DLOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child);
client_unmap(conn, client);
unmapped_clients++;
if (unmapped_clients == 0 && u_ws != c_ws) {
/* Re-assign the workspace of all dock clients which use this workspace */
Client *dock;
- LOG("workspace %p is empty\n", u_ws);
+ DLOG("workspace %p is empty\n", u_ws);
SLIST_FOREACH(dock, &(u_ws->screen->dock_clients), dock_clients) {
if (dock->workspace != u_ws)
continue;
- LOG("Re-assigning dock client to c_ws (%p)\n", c_ws);
+ DLOG("Re-assigning dock client to c_ws (%p)\n", c_ws);
dock->workspace = c_ws;
}
u_ws->screen = NULL;
#include "i3.h"
#include "util.h"
#include "xcb.h"
+#include "log.h"
TAILQ_HEAD(cached_fonts_head, Font) cached_fonts = TAILQ_HEAD_INITIALIZER(cached_fonts);
unsigned int xcb_numlock_mask;
*
*/
void cached_pixmap_prepare(xcb_connection_t *conn, struct Cached_Pixmap *pixmap) {
- LOG("preparing pixmap\n");
+ DLOG("preparing pixmap\n");
/* If the Rect did not change, the pixmap does not need to be recreated */
if (memcmp(&(pixmap->rect), pixmap->referred_rect, sizeof(Rect)) == 0)
memcpy(&(pixmap->rect), pixmap->referred_rect, sizeof(Rect));
if (pixmap->id == 0 || pixmap->gc == 0) {
- LOG("Creating new pixmap...\n");
+ DLOG("Creating new pixmap...\n");
pixmap->id = xcb_generate_id(conn);
pixmap->gc = xcb_generate_id(conn);
} else {
- LOG("Re-creating this pixmap...\n");
+ DLOG("Re-creating this pixmap...\n");
xcb_free_gc(conn, pixmap->gc);
xcb_free_pixmap(conn, pixmap->id);
}
#include "xcb.h"
#include "config.h"
#include "workspace.h"
+#include "log.h"
/* This TAILQ of i3Screens stores the virtual screens, used for handling overlapping screens
* (xrandr --same-as) */
i3Screen *get_screen_containing(int x, int y) {
i3Screen *screen;
TAILQ_FOREACH(screen, virtual_screens, screens) {
- LOG("comparing x=%d y=%d with x=%d and y=%d width %d height %d\n",
+ DLOG("comparing x=%d y=%d with x=%d and y=%d width %d height %d\n",
x, y, screen->rect.x, screen->rect.y, screen->rect.width, screen->rect.height);
if (x >= screen->rect.x && x < (screen->rect.x + screen->rect.width) &&
y >= screen->rect.y && y < (screen->rect.y + screen->rect.height))
SLIST_INIT(&(screen->dock_clients));
- LOG("that is virtual screen at %d x %d with %d x %d\n",
+ DLOG("that is virtual screen at %d x %d with %d x %d\n",
screen->rect.x, screen->rect.y, screen->rect.width, screen->rect.height);
}
while ((time(NULL) - before_trying) < 10) {
reply = xcb_xinerama_query_screens_reply(conn, xcb_xinerama_query_screens_unchecked(conn), NULL);
if (!reply) {
- LOG("Couldn't get Xinerama screens\n");
+ DLOG("Couldn't get Xinerama screens\n");
return;
}
screen_info = xcb_xinerama_query_screens_screen_info(reply);
num_screens++;
}
- LOG("found Xinerama screen: %d x %d at %d x %d\n",
+ DLOG("found Xinerama screen: %d x %d at %d x %d\n",
screen_info[screen].width, screen_info[screen].height,
screen_info[screen].x_org, screen_info[screen].y_org);
}
free(reply);
if (num_screens == 0) {
- LOG("No screens found. This is weird. Trying again...\n");
+ DLOG("No screens found. This is weird. Trying again...\n");
/* Give the scheduler a chance to do something else
* and don’t hog the CPU */
usleep(250);
}
if (num_screens == 0) {
- LOG("No screens found for 10 seconds. Please fix your setup. i3 will exit now.\n");
+ DLOG("No screens found for 10 seconds. Please fix your setup. i3 will exit now.\n");
exit(0);
}
}
TAILQ_INIT(virtual_screens);
if (!xcb_get_extension_data(conn, &xcb_xinerama_id)->present) {
- LOG("Xinerama extension not found, disabling.\n");
+ DLOG("Xinerama extension not found, disabling.\n");
disable_xinerama(conn);
} else {
xcb_xinerama_is_active_reply_t *reply;
reply = xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL);
if (reply == NULL || !reply->state) {
- LOG("Xinerama is not active (in your X-Server), disabling.\n");
+ DLOG("Xinerama is not active (in your X-Server), disabling.\n");
disable_xinerama(conn);
} else
query_screens(conn, virtual_screens);
it change when I move the --right-of video projector to --left-of? */
if (!xinerama_enabled) {
- LOG("Xinerama is disabled\n");
+ DLOG("Xinerama is disabled\n");
return;
}
if (old_screen->num != screen_count)
continue;
- LOG("Found a matching screen\n");
+ DLOG("Found a matching screen\n");
/* Use the same workspace */
screen->current_workspace = old_screen->current_workspace;
/* Re-use the old bar window */
screen->bar = old_screen->bar;
screen->bargc = old_screen->bargc;
- LOG("old_screen->bar = %p\n", old_screen->bar);
+ DLOG("old_screen->bar = %p\n", old_screen->bar);
Rect bar_rect = {screen->rect.x,
screen->rect.y + screen->rect.height - (font->height + 6),
screen->rect.x + screen->rect.width,
font->height + 6};
- LOG("configuring bar to be at %d x %d with %d x %d\n",
+ DLOG("configuring bar to be at %d x %d with %d x %d\n",
bar_rect.x, bar_rect.y, bar_rect.height, bar_rect.width);
xcb_configure_window(conn, screen->bar, XCB_CONFIG_WINDOW_X |
XCB_CONFIG_WINDOW_Y |
if (ws->screen != old_screen)
continue;
- LOG("re-assigning ws %d\n", ws->num);
+ DLOG("re-assigning ws %d\n", ws->num);
memcpy(&(ws->rect), &(screen->rect), sizeof(Rect));
ws->screen = screen;
ws->reassigned = true;
/* Find the first unused workspace, preferring the ones
* which are assigned to this screen and initialize
* the screen with it. */
- LOG("getting first ws for screen %p\n", screen);
+ DLOG("getting first ws for screen %p\n", screen);
Workspace *ws = get_first_workspace_for_screen(new_screens, screen);
initialize_screen(conn, screen, ws);
ws->reassigned = true;
if (SLIST_EMPTY(&(old_screen->dock_clients)))
continue;
- LOG("dock_clients out of bounds at screen %p, reassigning\n", old_screen);
+ DLOG("dock_clients out of bounds at screen %p, reassigning\n", old_screen);
if (SLIST_EMPTY(&(first->dock_clients))) {
first->dock_clients = old_screen->dock_clients;
continue;
Client *client;
- LOG("Closing bar window (%p)\n", ws->screen->bar);
+ DLOG("Closing bar window (%p)\n", ws->screen->bar);
xcb_destroy_window(conn, ws->screen->bar);
- LOG("Workspace %d's screen out of bounds, assigning to first screen\n", ws->num + 1);
+ DLOG("Workspace %d's screen out of bounds, assigning to first screen\n", ws->num + 1);
ws->screen = first;
memcpy(&(ws->rect), &(first->rect), sizeof(Rect));
workspace_unmap_clients(conn, ws);
if (c_ws == ws) {
- LOG("Need to adjust c_ws...\n");
+ DLOG("Need to adjust c_ws...\n");
c_ws = first->current_workspace;
}
}
virtual_screens = new_screens;
- LOG("Current workspace is now: %d\n", first->current_workspace);
+ DLOG("Current workspace is now: %d\n", first->current_workspace);
render_layout(conn);
}