Bugfix: Correctly cleanup stack_windows when setting clients to floating

This fixes ticket #44
This commit is contained in:
Michael Stapelberg 2009-05-30 11:35:32 +02:00
parent ac6561019b
commit b1eb93326f
5 changed files with 9 additions and 7 deletions

View File

@ -20,7 +20,7 @@
* one or because it was unmapped
*
*/
void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container);
void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container, bool remove_from_focusstack);
/**
* Warps the pointer into the given client (in the middle of it, to be specific), therefore

View File

@ -29,9 +29,10 @@
* one or because it was unmapped
*
*/
void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container) {
void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container, bool remove_from_focusstack) {
CIRCLEQ_REMOVE(&(container->clients), client, clients);
if (remove_from_focusstack)
SLIST_REMOVE(&(container->workspace->focus_stack), client, Client, focus_clients);
/* If the container will be empty now and is in stacking mode, we need to

View File

@ -242,7 +242,7 @@ static void move_current_window(xcb_connection_t *conn, direction_t direction) {
}
/* Remove it from the old container and put it into the new one */
client_remove_from_container(conn, current_client, container);
client_remove_from_container(conn, current_client, container, true);
if (new->currently_focused != NULL)
CIRCLEQ_INSERT_AFTER(&(new->clients), new->currently_focused, current_client, clients);
@ -505,7 +505,7 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
assert(to_container != NULL);
client_remove_from_container(conn, current_client, container);
client_remove_from_container(conn, current_client, container, true);
if (container->workspace->fullscreen_client == current_client)
container->workspace->fullscreen_client = NULL;

View File

@ -23,6 +23,7 @@
#include "xcb.h"
#include "debug.h"
#include "layout.h"
#include "client.h"
/* On which border was the dragging initiated? */
typedef enum { BORDER_LEFT, BORDER_RIGHT, BORDER_TOP, BORDER_BOTTOM} border_t;
@ -78,7 +79,7 @@ void toggle_floating_mode(xcb_connection_t *conn, Client *client) {
LOG("Entering floating for client %08x\n", client->child);
/* Remove the client of its container */
CIRCLEQ_REMOVE(&(con->clients), client, clients);
client_remove_from_container(conn, client, con, false);
client->container = NULL;
if (con->currently_focused == client) {

View File

@ -534,7 +534,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
con->workspace->fullscreen_client = NULL;
/* Remove the client from the list of clients */
client_remove_from_container(conn, client, con);
client_remove_from_container(conn, client, con, true);
/* Set focus to the last focused client in this container */
con->currently_focused = get_last_focused_client(conn, con, NULL);