+
+ /* Some clients (like GIMP’s color picker window) get mapped
+ * 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");
+ Client *leader = table_get(&by_child, new->leader);
+ if (leader == NULL) {
+ LOG("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);
+ } else {
+ x = leader->rect.x + (leader->rect.width / 2) - (new->rect.width / 2);
+ y = leader->rect.y + (leader->rect.height / 2) - (new->rect.height / 2);
+ }
+ }
+ new->floating_rect.x = new->rect.x = x;
+ new->floating_rect.y = new->rect.y = y;