commit 98df7a6

Michael Forney  ·  2014-08-01 03:06:46 +0000 UTC
parent 590c6d7
Style
1 files changed,  +7, -12
+7, -12
 1@@ -59,25 +59,22 @@ static void leave(struct input_focus_handler * handler,
 2 static bool client_handle_key(struct keyboard * keyboard, uint32_t time,
 3                               struct press * press, uint32_t state)
 4 {
 5-    uint32_t * client_key;
 6+    uint32_t * key;
 7 
 8     if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
 9     {
10-        client_key = wl_array_add(&keyboard->client_keys, sizeof *client_key);
11-
12-        if (!client_key)
13+        if (!(key = wl_array_add(&keyboard->client_keys, sizeof *key)))
14             return false;
15 
16-        *client_key = press->value;
17+        *key = press->value;
18     }
19     else
20     {
21-        wl_array_for_each(client_key, &keyboard->client_keys)
22+        wl_array_for_each(key, &keyboard->client_keys)
23         {
24-            if (*client_key == press->value)
25+            if (*key == press->value)
26             {
27-                swc_array_remove(&keyboard->client_keys,
28-                                 client_key, sizeof *client_key);
29+                swc_array_remove(&keyboard->client_keys, key, sizeof *key);
30                 break;
31             }
32         }
33@@ -257,9 +254,7 @@ void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
34     if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
35         return;
36 
37-    key = wl_array_add(&keyboard->keys, sizeof *key);
38-
39-    if (!key)
40+    if (!(key = wl_array_add(&keyboard->keys, sizeof *key)))
41         goto update_xkb_state;
42 
43     key->press.value = value;