Implement correct rendering of floating windows (decoration color)
This commit is contained in:
parent
78b9e7f5ce
commit
5d14dca41d
20
src/layout.c
20
src/layout.c
@ -103,19 +103,27 @@ void decorate_window(xcb_connection_t *conn, Client *client, xcb_drawable_t draw
|
|||||||
i3Font *font = load_font(conn, config.font);
|
i3Font *font = load_font(conn, config.font);
|
||||||
int decoration_height = font->height + 2 + 2;
|
int decoration_height = font->height + 2 + 2;
|
||||||
struct Colortriple *color;
|
struct Colortriple *color;
|
||||||
|
Client *last_focused;
|
||||||
|
|
||||||
/* Clients without a container (docks) won’t get decorated */
|
/* Clients without a container (docks) won’t get decorated */
|
||||||
if (client->dock)
|
if (client->dock)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LOG("redecorating child %08x\n", client->child);
|
LOG("redecorating child %08x\n", client->child);
|
||||||
if (client_is_floating(client) || client->container->currently_focused == client) {
|
last_focused = SLIST_FIRST(&(client->workspace->focus_stack));
|
||||||
/* Distinguish if the window is currently focused… */
|
if (client_is_floating(client)) {
|
||||||
if (client_is_floating(client) || CUR_CELL->currently_focused == client)
|
if (last_focused == client)
|
||||||
color = &(config.client.focused);
|
color = &(config.client.focused);
|
||||||
/* …or if it is the focused window in a not focused container */
|
else color = &(config.client.unfocused);
|
||||||
else color = &(config.client.focused_inactive);
|
} else {
|
||||||
} else color = &(config.client.unfocused);
|
if (client->container->currently_focused == client) {
|
||||||
|
/* Distinguish if the window is currently focused… */
|
||||||
|
if (last_focused == client)
|
||||||
|
color = &(config.client.focused);
|
||||||
|
/* …or if it is the focused window in a not focused container */
|
||||||
|
else color = &(config.client.focused_inactive);
|
||||||
|
} else color = &(config.client.unfocused);
|
||||||
|
}
|
||||||
|
|
||||||
/* Our plan is the following:
|
/* Our plan is the following:
|
||||||
- Draw a rect around the whole client in color->background
|
- Draw a rect around the whole client in color->background
|
||||||
|
10
src/util.c
10
src/util.c
@ -348,11 +348,6 @@ void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways) {
|
|||||||
redecorate_window(conn, last_focused);
|
redecorate_window(conn, last_focused);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we’re in stacking mode, this renders the container to update changes in the title
|
|
||||||
bars and to raise the focused client */
|
|
||||||
if ((old_client != NULL) && (old_client != client) && !old_client->dock)
|
|
||||||
redecorate_window(conn, old_client);
|
|
||||||
|
|
||||||
/* If the last client was a floating client, we need to go to the next
|
/* If the last client was a floating client, we need to go to the next
|
||||||
* tiling client in stack and re-decorate it. */
|
* tiling client in stack and re-decorate it. */
|
||||||
if (old_client != NULL && client_is_floating(old_client)) {
|
if (old_client != NULL && client_is_floating(old_client)) {
|
||||||
@ -372,6 +367,11 @@ void set_focus(xcb_connection_t *conn, Client *client, bool set_anyways) {
|
|||||||
SLIST_REMOVE(&(client->workspace->focus_stack), client, Client, focus_clients);
|
SLIST_REMOVE(&(client->workspace->focus_stack), client, Client, focus_clients);
|
||||||
SLIST_INSERT_HEAD(&(client->workspace->focus_stack), client, focus_clients);
|
SLIST_INSERT_HEAD(&(client->workspace->focus_stack), client, focus_clients);
|
||||||
|
|
||||||
|
/* If we’re in stacking mode, this renders the container to update changes in the title
|
||||||
|
bars and to raise the focused client */
|
||||||
|
if ((old_client != NULL) && (old_client != client) && !old_client->dock)
|
||||||
|
redecorate_window(conn, old_client);
|
||||||
|
|
||||||
/* redecorate_window flushes, so we don’t need to */
|
/* redecorate_window flushes, so we don’t need to */
|
||||||
redecorate_window(conn, client);
|
redecorate_window(conn, client);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user