Bugfix: Reconfigure x/y of stack_windows when necessary
This commit is contained in:
parent
8fe84697f3
commit
03e48b8bfe
|
@ -101,7 +101,7 @@ struct Colorpixel {
|
||||||
struct Stack_Window {
|
struct Stack_Window {
|
||||||
xcb_window_t window;
|
xcb_window_t window;
|
||||||
xcb_gcontext_t gc;
|
xcb_gcontext_t gc;
|
||||||
uint32_t width, height;
|
Rect rect;
|
||||||
|
|
||||||
/* Backpointer to the container this stack window is in */
|
/* Backpointer to the container this stack window is in */
|
||||||
Container *container;
|
Container *container;
|
||||||
|
|
|
@ -31,6 +31,7 @@ char *sstrdup(const char *str);
|
||||||
void start_application(const char *command);
|
void start_application(const char *command);
|
||||||
void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie, char *err_message);
|
void check_error(xcb_connection_t *conn, xcb_void_cookie_t cookie, char *err_message);
|
||||||
void set_focus(xcb_connection_t *conn, Client *client);
|
void set_focus(xcb_connection_t *conn, Client *client);
|
||||||
|
void leave_stack_mode(xcb_connection_t *conn, Container *container);
|
||||||
void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode);
|
void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode);
|
||||||
void warp_pointer_into(xcb_connection_t *conn, Client *client);
|
void warp_pointer_into(xcb_connection_t *conn, Client *client);
|
||||||
void toggle_fullscreen(xcb_connection_t *conn, Client *client);
|
void toggle_fullscreen(xcb_connection_t *conn, Client *client);
|
||||||
|
|
|
@ -436,7 +436,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
|
||||||
correctly resize the stack_win */
|
correctly resize the stack_win */
|
||||||
if (con->currently_focused == NULL && con->mode == MODE_STACK) {
|
if (con->currently_focused == NULL && con->mode == MODE_STACK) {
|
||||||
struct Stack_Window *stack_win = &(con->stack_win);
|
struct Stack_Window *stack_win = &(con->stack_win);
|
||||||
stack_win->height = 0;
|
stack_win->rect.height = 0;
|
||||||
xcb_unmap_window(conn, stack_win->window);
|
xcb_unmap_window(conn, stack_win->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
src/layout.c
21
src/layout.c
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
static int old_value_1;
|
static int old_value_1;
|
||||||
static int old_value_2;
|
static int old_value_2;
|
||||||
|
static int old_value_3;
|
||||||
|
static int old_value_4;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gets the unoccupied space (= space which is available for windows which were resized by the user)
|
* Gets the unoccupied space (= space which is available for windows which were resized by the user)
|
||||||
|
@ -279,17 +281,24 @@ void render_container(xcb_connection_t *conn, Container *container) {
|
||||||
|
|
||||||
/* Check if we need to remap our stack title window, it gets unmapped when the container
|
/* Check if we need to remap our stack title window, it gets unmapped when the container
|
||||||
is empty in src/handlers.c:unmap_notify() */
|
is empty in src/handlers.c:unmap_notify() */
|
||||||
if (stack_win->height == 0)
|
if (stack_win->rect.height == 0)
|
||||||
xcb_map_window(conn, stack_win->window);
|
xcb_map_window(conn, stack_win->window);
|
||||||
|
|
||||||
/* Check if we need to reconfigure our stack title window */
|
/* Check if we need to reconfigure our stack title window */
|
||||||
if (HAS_CHANGED(old_value_1, stack_win->width, container->width) |
|
if (HAS_CHANGED(old_value_1, stack_win->rect.x, container->x) |
|
||||||
HAS_CHANGED(old_value_2, stack_win->height, decoration_height * num_clients)) {
|
HAS_CHANGED(old_value_2, stack_win->rect.y, container->y) |
|
||||||
uint32_t values[] = { stack_win->width, stack_win->height, XCB_STACK_MODE_ABOVE };
|
HAS_CHANGED(old_value_3, stack_win->rect.width, container->width) |
|
||||||
|
HAS_CHANGED(old_value_4, stack_win->rect.height, decoration_height * num_clients)) {
|
||||||
|
|
||||||
|
uint32_t values[] = { stack_win->rect.x, stack_win->rect.y,
|
||||||
|
stack_win->rect.width, stack_win->rect.height,
|
||||||
|
XCB_STACK_MODE_ABOVE };
|
||||||
|
|
||||||
xcb_configure_window(conn, stack_win->window,
|
xcb_configure_window(conn, stack_win->window,
|
||||||
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT | XCB_CONFIG_WINDOW_STACK_MODE,
|
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
|
||||||
values);
|
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
|
||||||
|
XCB_CONFIG_WINDOW_STACK_MODE,
|
||||||
|
values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reconfigure the currently focused client, if necessary. It is the only visible one */
|
/* Reconfigure the currently focused client, if necessary. It is the only visible one */
|
||||||
|
|
16
src/table.c
16
src/table.c
|
@ -118,12 +118,8 @@ static void move_columns_from(xcb_connection_t *conn, Workspace *workspace, int
|
||||||
CIRCLEQ_FOREACH(client, &(old_container->clients), clients)
|
CIRCLEQ_FOREACH(client, &(old_container->clients), clients)
|
||||||
client->container = new_container;
|
client->container = new_container;
|
||||||
|
|
||||||
struct Stack_Window *stack_win;
|
if (old_container->mode == MODE_STACK)
|
||||||
SLIST_FOREACH(stack_win, &stack_wins, stack_windows)
|
leave_stack_mode(conn, old_container);
|
||||||
if (stack_win == &(old_container->stack_win)) {
|
|
||||||
xcb_destroy_window(conn, stack_win->window);
|
|
||||||
SLIST_REMOVE(&stack_wins, stack_win, Stack_Window, stack_windows);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(old_container);
|
free(old_container);
|
||||||
|
|
||||||
|
@ -148,12 +144,8 @@ static void move_rows_from(xcb_connection_t *conn, Workspace *workspace, int row
|
||||||
CIRCLEQ_FOREACH(client, &(old_container->clients), clients)
|
CIRCLEQ_FOREACH(client, &(old_container->clients), clients)
|
||||||
client->container = new_container;
|
client->container = new_container;
|
||||||
|
|
||||||
struct Stack_Window *stack_win;
|
if (old_container->mode == MODE_STACK)
|
||||||
SLIST_FOREACH(stack_win, &stack_wins, stack_windows)
|
leave_stack_mode(conn, old_container);
|
||||||
if (stack_win == &(old_container->stack_win)) {
|
|
||||||
xcb_destroy_window(conn, stack_win->window);
|
|
||||||
SLIST_REMOVE(&stack_wins, stack_win, Stack_Window, stack_windows);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(old_container);
|
free(old_container);
|
||||||
|
|
||||||
|
|
32
src/util.c
32
src/util.c
|
@ -156,6 +156,24 @@ void set_focus(xcb_connection_t *conn, Client *client) {
|
||||||
redecorate_window(conn, client);
|
redecorate_window(conn, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called when the user switches to another mode or when the container is
|
||||||
|
* destroyed and thus needs to be cleaned up.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void leave_stack_mode(xcb_connection_t *conn, Container *container) {
|
||||||
|
/* When going out of stacking mode, we need to close the window */
|
||||||
|
struct Stack_Window *stack_win = &(container->stack_win);
|
||||||
|
|
||||||
|
SLIST_REMOVE(&stack_wins, stack_win, Stack_Window, stack_windows);
|
||||||
|
|
||||||
|
xcb_free_gc(conn, stack_win->gc);
|
||||||
|
xcb_destroy_window(conn, stack_win->window);
|
||||||
|
|
||||||
|
stack_win->rect.width = -1;
|
||||||
|
stack_win->rect.height = -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Switches the layout of the given container taking care of the necessary house-keeping
|
* Switches the layout of the given container taking care of the necessary house-keeping
|
||||||
*
|
*
|
||||||
|
@ -194,18 +212,8 @@ void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode)
|
||||||
|
|
||||||
SLIST_INSERT_HEAD(&stack_wins, stack_win, stack_windows);
|
SLIST_INSERT_HEAD(&stack_wins, stack_win, stack_windows);
|
||||||
} else {
|
} else {
|
||||||
if (container->mode == MODE_STACK) {
|
if (container->mode == MODE_STACK)
|
||||||
/* When going out of stacking mode, we need to close the window */
|
leave_stack_mode(conn, container);
|
||||||
struct Stack_Window *stack_win = &(container->stack_win);
|
|
||||||
|
|
||||||
SLIST_REMOVE(&stack_wins, stack_win, Stack_Window, stack_windows);
|
|
||||||
|
|
||||||
xcb_free_gc(conn, stack_win->gc);
|
|
||||||
xcb_destroy_window(conn, stack_win->window);
|
|
||||||
|
|
||||||
stack_win->width = -1;
|
|
||||||
stack_win->height = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
container->mode = mode;
|
container->mode = mode;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue