Draw stacking borders correctly
This commit is contained in:
parent
df402bacf7
commit
6868534fcb
@ -454,6 +454,15 @@ int handle_expose_event(void *data, xcb_connection_t *conn, xcb_expose_event_t *
|
|||||||
printf("handle_expose_event()\n");
|
printf("handle_expose_event()\n");
|
||||||
if (client->container->mode != MODE_STACK)
|
if (client->container->mode != MODE_STACK)
|
||||||
decorate_window(conn, client, client->frame, client->titlegc, 0);
|
decorate_window(conn, client, client->frame, client->titlegc, 0);
|
||||||
|
else {
|
||||||
|
xcb_change_gc_single(conn, client->titlegc, XCB_GC_FOREGROUND,
|
||||||
|
get_colorpixel(conn, client, client->frame, "#285577"));
|
||||||
|
|
||||||
|
xcb_rectangle_t rect = {0, 0, client->rect.width, client->rect.height};
|
||||||
|
xcb_poly_fill_rectangle(conn, client->frame, client->titlegc, 1, &rect);
|
||||||
|
|
||||||
|
xcb_flush(conn);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
src/layout.c
33
src/layout.c
@ -108,7 +108,7 @@ void decorate_window(xcb_connection_t *conn, Client *client, xcb_drawable_t draw
|
|||||||
- Draw the window’s title
|
- Draw the window’s title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Draw a green rectangle around the window */
|
/* Draw a rectangle in background color around the window */
|
||||||
xcb_change_gc_single(conn, gc, XCB_GC_FOREGROUND, background_color);
|
xcb_change_gc_single(conn, gc, XCB_GC_FOREGROUND, background_color);
|
||||||
|
|
||||||
xcb_rectangle_t rect = {0, offset, client->rect.width, offset + client->rect.height};
|
xcb_rectangle_t rect = {0, offset, client->rect.width, offset + client->rect.height};
|
||||||
@ -165,17 +165,26 @@ static void resize_client(xcb_connection_t *connection, Client *client) {
|
|||||||
XCB_CONFIG_WINDOW_WIDTH |
|
XCB_CONFIG_WINDOW_WIDTH |
|
||||||
XCB_CONFIG_WINDOW_HEIGHT;
|
XCB_CONFIG_WINDOW_HEIGHT;
|
||||||
Rect rect;
|
Rect rect;
|
||||||
if (client->titlebar_position == TITLEBAR_OFF ||
|
switch (client->container->mode) {
|
||||||
client->container->mode == MODE_STACK) {
|
case MODE_STACK:
|
||||||
rect.x = 0;
|
rect.x = 2;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = client->rect.width;
|
rect.width = client->rect.width - (2 + 2);
|
||||||
rect.height = client->rect.height;
|
rect.height = client->rect.height - 2;
|
||||||
} else {
|
break;
|
||||||
rect.x = 2;
|
default:
|
||||||
rect.y = font->height + 2 + 2;
|
if (client->titlebar_position == TITLEBAR_OFF) {
|
||||||
rect.width = client->rect.width - (2 + 2);
|
rect.x = 0;
|
||||||
rect.height = client->rect.height - ((font->height + 2 + 2) + 2);
|
rect.y = 0;
|
||||||
|
rect.width = client->rect.width;
|
||||||
|
rect.height = client->rect.height;
|
||||||
|
} else {
|
||||||
|
rect.x = 2;
|
||||||
|
rect.y = font->height + 2 + 2;
|
||||||
|
rect.width = client->rect.width - (2 + 2);
|
||||||
|
rect.height = client->rect.height - ((font->height + 2 + 2) + 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("child will be at %dx%d with size %dx%d\n", rect.x, rect.y, rect.width, rect.height);
|
printf("child will be at %dx%d with size %dx%d\n", rect.x, rect.y, rect.width, rect.height);
|
||||||
|
Loading…
Reference in New Issue
Block a user