*/
bool client_is_floating(Client *client);
+/**
+ * Change the border type for the given client to normal (n), 1px border (p) or
+ * completely borderless (b).
+ *
+ */
+void client_change_border(xcb_connection_t *conn, Client *client, char border_type);
+
#endif
* initialization later */
enum { TITLEBAR_TOP = 0, TITLEBAR_LEFT, TITLEBAR_RIGHT, TITLEBAR_BOTTOM, TITLEBAR_OFF } titlebar_position;
+ /** Contains a bool specifying whether this window should not be drawn
+ * with the usual decorations */
+ bool borderless;
+
/** If a client is set as a dock, it is placed at the very bottom of
* the screen and its requested size is used */
bool dock;
bool client_is_floating(Client *client) {
return (client->floating >= FLOATING_AUTO_ON);
}
+
+/*
+ * Change the border type for the given client to normal (n), 1px border (p) or
+ * completely borderless (b).
+ *
+ */
+void client_change_border(xcb_connection_t *conn, Client *client, char border_type) {
+ switch (border_type) {
+ case 'n':
+ LOG("Changing to normal border\n");
+ client->titlebar_position = TITLEBAR_TOP;
+ client->borderless = false;
+ break;
+ case 'p':
+ LOG("Changing to 1px border\n");
+ client->titlebar_position = TITLEBAR_OFF;
+ client->borderless = false;
+ break;
+ case 'b':
+ LOG("Changing to borderless\n");
+ client->titlebar_position = TITLEBAR_OFF;
+ client->borderless = true;
+ break;
+ default:
+ LOG("Unknown border mode\n");
+ return;
+ }
+
+ /* Ensure that the child’s position inside our window gets updated */
+ client->force_reconfigure = true;
+
+ /* For clients inside a container, we can simply render the container.
+ * If the client is floating, we need to render the whole layout */
+ if (client->container != NULL)
+ render_container(conn, client->container);
+ else render_layout(conn);
+
+ redecorate_window(conn, client);
+}
return;
}
+ /* Is it 'bn' (border normal), 'bp' (border 1pixel) or 'bb' (border borderless)? */
+ if (command[0] == 'b') {
+ if (last_focused == NULL) {
+ LOG("No window focused, cannot change border type\n");
+ return;
+ }
+ client_change_border(conn, last_focused, command[1]);
+ return;
+ }
+
if (command[0] == 'H') {
LOG("Hiding all floating windows\n");
floating_toggle_hide(conn, c_ws);
xcb_poly_fill_rectangle(conn, client->frame, client->titlegc, 1, &crect);
}
- /* Draw the lines */
- xcb_draw_line(conn, drawable, gc, color->border, 0, offset, client->rect.width, offset);
- xcb_draw_line(conn, drawable, gc, color->border, 2, offset + font->height + 3,
- client->rect.width - 3, offset + font->height + 3);
+ if (client->titlebar_position != TITLEBAR_OFF) {
+ /* Draw the lines */
+ xcb_draw_line(conn, drawable, gc, color->border, 0, offset, client->rect.width, offset);
+ xcb_draw_line(conn, drawable, gc, color->border, 2, offset + font->height + 3,
+ client->rect.width - 3, offset + font->height + 3);
+ }
/* If the client has a title, we draw it */
if (client->name != NULL) {
rect->height = client->rect.height - 2;
break;
default:
- if (client->titlebar_position == TITLEBAR_OFF) {
+ if (client->titlebar_position == TITLEBAR_OFF && client->borderless) {
rect->x = 0;
rect->y = 0;
rect->width = client->rect.width;
rect->height = client->rect.height;
+ } else if (client->titlebar_position == TITLEBAR_OFF && !client->borderless) {
+ rect->x = 1;
+ rect->y = 1;
+ rect->width = client->rect.width - 1 - 1;
+ rect->height = client->rect.height - 1 - 1;
} else {
rect->x = 2;
rect->y = font->height + 2 + 2;