- /* Focus the new window if we’re not in fullscreen mode */
- if (CUR_CELL->workspace->fullscreen_client == NULL) {
- CUR_CELL->currently_focused = new;
- xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, new->child, XCB_CURRENT_TIME);
- } else {
- /* If we are in fullscreen, we should lower the window to not be annoying */
- uint32_t values[] = { XCB_STACK_MODE_BELOW };
- xcb_configure_window(conn, new->frame, XCB_CONFIG_WINDOW_STACK_MODE, values);
- }
-
- /* Get _NET_WM_WINDOW_TYPE (to see if it’s a dock) */
- xcb_atom_t *atom;
- xcb_get_property_reply_t *preply = xcb_get_property_reply(conn, wm_type_cookie, NULL);
- 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");
- new->dock = true;
- new->titlebar_position = TITLEBAR_OFF;
- new->force_reconfigure = true;
- new->container = NULL;
- SLIST_INSERT_HEAD(&(c_ws->dock_clients), new, dock_clients);
- }
- }
-
- /* Get _NET_WM_STRUT_PARTIAL to determine the client’s requested height */
- uint32_t *strut;
- preply = xcb_get_property_reply(conn, strut_cookie, NULL);
- if (preply != NULL && preply->value_len > 0 && (strut = xcb_get_property_value(preply))) {
- /* We only use a subset of the provided values, namely the reserved space at the top/bottom
- of the screen. This is because the only possibility for bars is at to be at the top/bottom
- with maximum horizontal size.
- TODO: bars at the top */
- new->desired_height = strut[3];
- LOG("the client wants to be %d pixels height\n", new->desired_height);
- }
-
- /* Insert into the currently active container, if it’s not a dock window */
- if (!new->dock) {
- /* Insert after the old active client, if existing. If it does not exist, the
- container is empty and it does not matter, where we insert it */
- if (old_focused != NULL)
- CIRCLEQ_INSERT_AFTER(&(CUR_CELL->clients), old_focused, new, clients);
- else CIRCLEQ_INSERT_TAIL(&(CUR_CELL->clients), new, clients);
-
- SLIST_INSERT_HEAD(&(new->container->workspace->focus_stack), new, focus_clients);
- }
-
- render_layout(conn);