]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Set focus when table was shrinked and CUR_CELL might have been shrinked
authorMichael Stapelberg <michael+git@stapelberg.de>
Sat, 28 Feb 2009 00:12:05 +0000 (01:12 +0100)
committerMichael Stapelberg <michael+git@stapelberg.de>
Sat, 28 Feb 2009 00:12:05 +0000 (01:12 +0100)
include/table.h
src/commands.c
src/handlers.c
src/table.c

index 24605b72f0d6727551c8762bb74951f29560b645..884e2c8c9f523710b6f896af395e6160a594d607 100644 (file)
@@ -10,6 +10,8 @@
  */
 #include <stdbool.h>
 
+#include <xcb/xcb.h>
+
 #include "data.h"
 
 #ifndef _TABLE_H
@@ -27,6 +29,6 @@ void init_table();
 void expand_table_rows(Workspace *workspace);
 void expand_table_cols(Workspace *workspace);
 bool cell_exists(int col, int row);
-void cleanup_table(Workspace *workspace);
+void cleanup_table(xcb_connection_t *conn, Workspace *workspace);
 
 #endif
index 0871baf8fb527ded6d0e2ba0ad84925eee9a95a4..e583b0ab80b4fe42908207bf78ba92d49cfd8512 100644 (file)
@@ -176,7 +176,7 @@ static void move_current_window(xcb_connection_t *connection, direction_t direct
         new->currently_focused = current_client;
 
         /* delete all empty columns/rows */
-        cleanup_table(container->workspace);
+        cleanup_table(connection, container->workspace);
         render_layout(connection);
 
         set_focus(connection, current_client);
index 6303bb91ed9c99653b65ba8ee3ec74add93ed01b..2a390c056a39e80e70eb8fbe647ee18da24a4ed3 100644 (file)
@@ -359,7 +359,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *c, xcb_unmap_notify_
         xcb_flush(c);
         table_remove(byParent, client->frame);
 
-        cleanup_table(client->container->workspace);
+        cleanup_table(c, client->container->workspace);
 
         free(client);
 
index 0c4a1be100ee43e1119bf57c81fb45a672612f2d..2844574a6baeae72d3ea7e7c454d6fc14f1d2d86 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "data.h"
 #include "table.h"
+#include "util.h"
 
 int current_workspace = 0;
 Workspace workspaces[10];
@@ -128,7 +129,7 @@ static void move_rows_from(Workspace *workspace, int rows) {
  * Shrinks the table by "compacting" it, that is, removing completely empty rows/columns
  *
  */
-void cleanup_table(Workspace *workspace) {
+void cleanup_table(xcb_connection_t *conn, Workspace *workspace) {
         /* Check for empty columns */
         for (int cols = 0; cols < workspace->cols;) {
                 bool completely_empty = true;
@@ -167,4 +168,7 @@ void cleanup_table(Workspace *workspace) {
 
         if (current_row >= c_ws->rows)
                 current_row = c_ws->rows-1;
+
+        if (CUR_CELL->currently_focused != NULL)
+                set_focus(conn, CUR_CELL->currently_focused);
 }