* Pretty-prints the client’s information into the logfile.
*
*/
-void client_log(Client *client);
+#define CLIENT_LOG(client) do { \
+ LOG("Window: frame 0x%08x, child 0x%08x\n", client->frame, client->child); \
+ } while (0)
#endif
xcb_map_window(conn, client->frame);
}
-
-/*
- * Pretty-prints the client’s information into the logfile.
- *
- */
-void client_log(Client *client) {
- LOG("Window: frame 0x%08x, child 0x%08x\n", client->frame, client->child);
-}
continue;
}
}
-
- LOG("--- done ---\n");
}
/* To prevent endless recursions when the user makes an error configuring,
* we stop after 100 replacements. That should be vastly more than enough. */
int c = 0;
- LOG("Replacing %s with %s\n", key, value);
while ((pos = strcasestr(buffer, key)) != NULL && c++ < 100) {
- LOG("replacing variable %s in \"%s\" with \"%s\"\n", key, buffer, value);
char *rest = pos + strlen(key);
*pos = '\0';
char *replaced;
}
/* We need to translate the symbol to a keycode */
- LOG("Translating symbol to keycode (\"%s\")\n", bind->symbol);
xcb_keysym_t keysym = XStringToKeysym(bind->symbol);
if (keysym == NoSymbol) {
LOG("Could not translate string to key symbol: \"%s\"\n", bind->symbol);
last_keycode = *walk;
bind->number_keycodes++;
}
- LOG("Got %d different keycodes\n", bind->number_keycodes);
+ LOG("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);
event->sequence = sequence;
event->added = time(NULL);
- LOG("Adding sequence %d to ignorelist\n", sequence);
-
SLIST_INSERT_HEAD(&ignore_events, event, ignore_events);
}
SLIST_FOREACH(event, &ignore_events, ignore_events) {
if (event->sequence == sequence) {
- LOG("Ignoring event (sequence %d)\n", sequence);
SLIST_REMOVE(&ignore_events, event, Ignore_Event, ignore_events);
free(event);
return true;
*
*/
int handle_key_release(void *ignored, xcb_connection_t *conn, xcb_key_release_event_t *event) {
- LOG("got key release, just passing\n");
xcb_allow_events(conn, XCB_ALLOW_REPLAY_KEYBOARD, event->time);
xcb_flush(conn);
return 1;
int handle_configure_event(void *prophs, xcb_connection_t *conn, xcb_configure_notify_event_t *event) {
xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root;
- LOG("event->x = %d, ->y = %d, ->width = %d, ->height = %d\n", event->x, event->y, event->width, event->height);
-
/* We ignore this sequence twice because events for child and frame should be ignored */
add_ignore_event(event->sequence);
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");
/* FIXME: Somehow, this is occuring too often. Therefore, we check for 0/0,
but is there a better way? */
/* First, we need to check if the client is awaiting an unmap-request which
was generated by us reparenting the window. In that case, we just ignore it. */
if (client != NULL && client->awaiting_useless_unmap) {
- LOG("Dropping this unmap request, it was generated by reparenting\n");
client->awaiting_useless_unmap = false;
return 1;
}
client->window_class = new_class;
FREE(old_class);
- if (!client->initialized) {
- LOG("Client is not yet initialized, not putting it to floating\n");
+ if (!client->initialized)
return 1;
- }
if (strcmp(new_class, "tools") == 0 || strcmp(new_class, "Dialog") == 0) {
LOG("tool/dialog window, should we put it floating?\n");
}
xcb_size_hints_t size_hints;
- client_log(client);
+ CLIENT_LOG(client);
/* If the hints were already in this event, use them, if not, request them */
if (reply != NULL)
xcb_get_wm_normal_hints_reply(conn, xcb_get_wm_normal_hints_unchecked(conn, client->child), &size_hints, NULL);
if ((size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE)) {
- LOG("Minimum size: %d (width) x %d (height)\n", size_hints.min_width, size_hints.min_height);
+ // TODO: Minimum size is not yet implemented
+ //LOG("Minimum size: %d (width) x %d (height)\n", size_hints.min_width, size_hints.min_height);
}
if ((size_hints.flags & XCB_SIZE_HINT_P_RESIZE_INC)) {
client->width_increment = size_hints.width_inc;
if (size_hints.height_inc > 0)
client->height_increment = size_hints.height_inc;
-
- LOG("Updated client's width_increment to %d px, heigh_increment to %d px\n",
- client->width_increment, client->height_increment);
}
/* If no aspect ratio was set or if it was invalid, we ignore the hints */
return 1;
xcb_window_t *leader = xcb_get_property_value(prop);
- if (leader == NULL)
+ if (leader == NULL || *leader == 0)
return 1;
LOG("Client leader changed to %08x\n", *leader);
if (client->dock)
return;
- LOG("redecorating child %08x\n", client->child);
last_focused = SLIST_FIRST(&(client->workspace->focus_stack));
if (client_is_floating(client)) {
if (last_focused == client)
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);
floating_assign_to_workspace(client, &workspaces[screen->current_workspace]);
- LOG("fixed that\n");
}
/*
num_clients++;
if (container->mode == MODE_DEFAULT) {
- LOG("got %d clients in this default container.\n", num_clients);
CIRCLEQ_FOREACH(client, &(container->clients), clients) {
/* If the client is in fullscreen mode, it does not get reconfigured */
if (container->workspace->fullscreen_client == client) {
/* Space for the internal bar */
height -= (font->height + 6);
- LOG("got %d rows and %d cols\n", r_ws->rows, r_ws->cols);
-
int xoffset[r_ws->rows];
int yoffset[r_ws->cols];
/* Initialize offsets */
for (int rows = 0; rows < r_ws->rows; rows++)
xoffset[rows] = r_ws->rect.x;
- dump_table(conn, r_ws);
-
ignore_enter_notify_forall(conn, r_ws, true);
/* Go through the whole table and render what’s necessary */
FOR_TABLE(r_ws) {
Container *container = r_ws->table[cols][rows];
int single_width = -1, single_height;
- LOG("\n");
- LOG("========\n");
- LOG("container has %d colspan, %d rowspan\n",
- container->colspan, container->rowspan);
- LOG("container at %d, %d\n", xoffset[rows], yoffset[cols]);
/* Update position of the container */
container->row = rows;
container->col = cols;
xoffset[rows] += single_width;
yoffset[cols] += single_height;
- LOG("==========\n");
}
ignore_enter_notify_forall(conn, r_ws, false);
void render_layout(xcb_connection_t *conn) {
i3Screen *screen;
- TAILQ_FOREACH(screen, virtual_screens, screens) {
- LOG("Rendering screen %d\n", screen->num);
+ TAILQ_FOREACH(screen, virtual_screens, screens)
render_workspace(conn, screen, &(workspaces[screen->current_workspace]));
- }
xcb_flush(conn);
}
void manage_window(xcb_property_handlers_t *prophs, xcb_connection_t *conn,
xcb_window_t window, xcb_get_window_attributes_cookie_t cookie,
bool needs_to_be_mapped) {
- LOG("managing window.\n");
xcb_drawable_t d = { window };
xcb_get_geometry_cookie_t geomc;
xcb_get_geometry_reply_t *geom;
return;
}
- if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) {
- LOG("Window not mapped, not managing\n");
+ if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE)
goto out;
- }
/* Don’t manage clients with the override_redirect flag */
- if (attr->override_redirect) {
- LOG("override_redirect set, not managing\n");
+ if (attr->override_redirect)
goto out;
- }
/* Check if the window is already managed */
if (table_get(&by_child, window))
/* Events for already managed windows should already be filtered in manage_window() */
assert(new == NULL);
- LOG("reparenting new client\n");
+ LOG("Reparenting window 0x%08x\n", child);
LOG("x = %d, y = %d, width = %d, height = %d\n", x, y, width, height);
new = calloc(sizeof(Client), 1);
new->force_reconfigure = true;
mask |= XCB_CW_EVENT_MASK;
values[1] = FRAME_EVENT_MASK;
- LOG("Reparenting 0x%08x under 0x%08x.\n", child, new->frame);
-
i3Font *font = load_font(conn, config.font);
width = min(width, c_ws->rect.x + c_ws->rect.width);
height = min(height, c_ws->rect.y + c_ws->rect.height);
preply = xcb_get_property_reply(conn, leader_cookie, NULL);
handle_clientleader_change(NULL, conn, 0, new->child, atoms[WM_CLIENT_LEADER], preply);
- LOG("DEBUG: should have all infos now\n");
struct Assignment *assign;
TAILQ_FOREACH(assign, &assignments, assignments) {
if (get_matching_client(conn, assign->windowclass_title, new) == NULL)
/* Map the window first to avoid flickering */
xcb_map_window(conn, child);
- if (map_frame) {
- LOG("Mapping client\n");
+ if (map_frame)
client_map(conn, new);
- }
+
if (CUR_CELL->workspace->fullscreen_client == NULL && !new->dock) {
/* Focus the new window if we’re not in fullscreen mode and if it is not a dock window */
if (new->workspace->fullscreen_client == NULL) {
Client *old_client = SLIST_FIRST(&(c_ws->focus_stack));
/* Check if the focus needs to be changed at all */
- if (!set_anyways && (old_client == client)) {
- LOG("old_client == client, not changing focus\n");
+ if (!set_anyways && (old_client == client))
return;
- }
/* Store current_row/current_col */
c_ws->current_row = current_row;
current_row = client->container->row;
}
- LOG("set_focus(frame %08x, child %08x, name %s)\n", client->frame, client->child, client->name);
+ CLIENT_LOG(client);
/* Set focus to the entered window, and flush xcb buffer immediately */
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, client->child, XCB_CURRENT_TIME);
//xcb_warp_pointer(conn, XCB_NONE, client->child, 0, 0, 0, 0, 10, 10);
xcb_send_event(conn, false, window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (char*)&generated_event);
xcb_flush(conn);
-
- LOG("Told the client it is at %dx%d with %dx%d\n", r.x, r.y, r.width, r.height);
}
/*