]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Use gettimeofday() and struct timevals instead of time()
[i3/i3] / src / handlers.c
index a1f90ba626389a017a764334c480e63cdf4bccca..1fb2bdd466014a464026704f91296a251b3bf8a8 100644 (file)
@@ -11,6 +11,7 @@
 #include "all.h"
 
 #include <time.h>
+#include <sys/time.h>
 #include <xcb/randr.h>
 #include <X11/XKBlib.h>
 #define SN_API_NOT_YET_FROZEN 1
@@ -118,9 +119,12 @@ static void handle_key_press(xcb_key_press_event_t *event) {
         }
     }
 
-    char *json_result = parse_command(bind->command);
-    FREE(json_result);
-    return;
+    struct CommandResult *command_output = parse_command(bind->command);
+
+    if (command_output->needs_tree_render)
+        tree_render();
+
+    free(command_output->json_output);
 }
 
 /*
@@ -841,12 +845,22 @@ static bool handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_
 
     if (!con->urgent && focused == con) {
         DLOG("Ignoring urgency flag for current client\n");
+        con->window->urgent.tv_sec = 0;
+        con->window->urgent.tv_usec = 0;
         goto end;
     }
 
     /* Update the flag on the client directly */
     con->urgent = (xcb_icccm_wm_hints_get_urgency(&hints) != 0);
     //CLIENT_LOG(con);
+    if (con->window) {
+        if (con->urgent) {
+            gettimeofday(&con->window->urgent, NULL);
+        } else {
+            con->window->urgent.tv_sec = 0;
+            con->window->urgent.tv_usec = 0;
+        }
+    }
     LOG("Urgency flag changed to %d\n", con->urgent);
 
     Con *ws;