]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Redecorate the last focused window of the container we are switching into
authorMichael Stapelberg <michael+x200@stapelberg.de>
Tue, 10 Mar 2009 23:56:39 +0000 (00:56 +0100)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Tue, 10 Mar 2009 23:56:39 +0000 (00:56 +0100)
src/util.c

index d44a2593ab695210fa3a3751c795fe424789fea0..0a3cd060ac9cee0f22705396d1dc30c50942ec6c 100644 (file)
@@ -171,9 +171,9 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen) {
        /* Convert our text */
        int rc = iconv(conversion_descriptor, (void*)&input, &input_size, &output, &output_size);
         if (rc == (size_t)-1) {
-               fprintf(stderr, "Converting to UCS-2 failed\n");
-                perror("erron\n");
-               exit(1);
+                perror("Converting to UCS-2 failed");
+               *real_strlen = 0;
+                return NULL;
        }
 
        *real_strlen = ((buffer_size - output_size) / 2) - 1;
@@ -231,6 +231,17 @@ void set_focus(xcb_connection_t *conn, Client *client) {
         xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT, client->child, XCB_CURRENT_TIME);
         //xcb_warp_pointer(conn, XCB_NONE, client->child, 0, 0, 0, 0, 10, 10);
 
+        /* Get the client which was last focused in this particular container, it may be a different
+           one than old_client */
+        Client *last_container_client;
+        SLIST_FOREACH(last_container_client, &(c_ws->focus_stack), focus_clients)
+                if (last_container_client->container == client->container) {
+                        /* But if it is the same one as old_client, we save us the unnecessary redecorate */
+                        if (last_container_client != old_client)
+                                redecorate_window(conn, last_container_client);
+                        break;
+                }
+
         /* 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)