+ /* check if the window needs WM_TAKE_FOCUS */
+ cwindow->needs_take_focus = window_supports_protocol(cwindow->id, A_WM_TAKE_FOCUS);
+
+ /* Where to start searching for a container that swallows the new one? */
+ Con *search_at = croot;
+
+ xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, wm_type_cookie, NULL);
+ if (xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_DOCK)) {
+ LOG("This window is of type dock\n");
+ Output *output = get_output_containing(geom->x, geom->y);
+ if (output != NULL) {
+ DLOG("Starting search at output %s\n", output->name);
+ search_at = output->con;
+ }
+
+ /* find out the desired position of this dock window */
+ if (cwindow->reserved.top > 0 && cwindow->reserved.bottom == 0) {
+ DLOG("Top dock client\n");
+ cwindow->dock = W_DOCK_TOP;
+ } else if (cwindow->reserved.top == 0 && cwindow->reserved.bottom > 0) {
+ DLOG("Bottom dock client\n");
+ cwindow->dock = W_DOCK_BOTTOM;
+ } else {
+ DLOG("Ignoring invalid reserved edges (_NET_WM_STRUT_PARTIAL), using position as fallback:\n");
+ if (geom->y < (search_at->rect.height / 2)) {
+ DLOG("geom->y = %d < rect.height / 2 = %d, it is a top dock client\n",
+ geom->y, (search_at->rect.height / 2));
+ cwindow->dock = W_DOCK_TOP;
+ } else {
+ DLOG("geom->y = %d >= rect.height / 2 = %d, it is a bottom dock client\n",
+ geom->y, (search_at->rect.height / 2));
+ cwindow->dock = W_DOCK_BOTTOM;
+ }
+ }
+ }
+
+ DLOG("Initial geometry: (%d, %d, %d, %d)\n", geom->x, geom->y, geom->width, geom->height);
+
+ Con *nc = NULL;