{"action":"created","issue":{"url":"https://api.github.com/repos/Cloudef/wlc/issues/153","repository_url":"https://api.github.com/repos/Cloudef/wlc","labels_url":"https://api.github.com/repos/Cloudef/wlc/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/Cloudef/wlc/issues/153/comments","events_url":"https://api.github.com/repos/Cloudef/wlc/issues/153/events","html_url":"https://github.com/Cloudef/wlc/issues/153","id":149013290,"number":153,"title":"random key sym captured in bool (*key)(wlc_handle view, uint32_t time, const struct wlc_modifiers*, uint32_t key, enum wlc_key_state);","user":{"login":"xeechou","id":5506916,"avatar_url":"https://avatars.githubusercontent.com/u/5506916?v=3","gravatar_id":"","url":"https://api.github.com/users/xeechou","html_url":"https://github.com/xeechou","followers_url":"https://api.github.com/users/xeechou/followers","following_url":"https://api.github.com/users/xeechou/following{/other_user}","gists_url":"https://api.github.com/users/xeechou/gists{/gist_id}","starred_url":"https://api.github.com/users/xeechou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xeechou/subscriptions","organizations_url":"https://api.github.com/users/xeechou/orgs","repos_url":"https://api.github.com/users/xeechou/repos","events_url":"https://api.github.com/users/xeechou/events{/privacy}","received_events_url":"https://api.github.com/users/xeechou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-18T01:01:06Z","updated_at":"2016-04-18T06:10:13Z","closed_at":null,"body":"Hi,\r\n\r\nI am writing code to test key press event, and I found if I only pressed modifiers, I would get random key symbol,\r\nthe code is here:\r\n\r\n    bool\r\n    keyboard_key(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, uint32_t key, enum wlc_key_state state)\r\n    {\r\n\t(void)time, (void)key;\r\n\r\n\tconst uint32_t sym = wlc_keyboard_get_keysym_for_key(key, NULL);\r\n\r\n\tif (state == WLC_KEY_STATE_PRESSED) {\r\n\t\t//debug\r\n\t\tfprintf(glog_file, \"KEYKEY: modifiers: %d, leds:%d,  key: %c\\n\", modifiers->mods, modifiers->leds, sym);\r\n\t\tstruct wlc_modifiers test_modifiers;\r\n\t\tuint32_t test_key;\r\n\t\tuint64_t code;\r\n\t\tcode = keysym_encode(modifiers, sym);\r\n\t\tkeysym_decode(&test_modifiers, &test_key, code);\r\n\t\tif (test_modifiers.leds != modifiers->leds ||\r\n\t\t    test_modifiers.mods != modifiers->mods ||\r\n\t\t    test_key != sym) {\r\n\t\t\tfprintf(glog_file, \"KEYKEY: encode\\\\decode is buggy\\n\");\r\n\t\t}\r\n\t\t//debug\r\n\r\nIn the log file, I found the last `key` field in `fprintf` is random key if no key is pressed. Is it normal?"},"comment":{"url":"https://api.github.com/repos/Cloudef/wlc/issues/comments/211220217","html_url":"https://github.com/Cloudef/wlc/issues/153#issuecomment-211220217","issue_url":"https://api.github.com/repos/Cloudef/wlc/issues/153","id":211220217,"user":{"login":"Cloudef","id":480330,"avatar_url":"https://avatars.githubusercontent.com/u/480330?v=3","gravatar_id":"","url":"https://api.github.com/users/Cloudef","html_url":"https://github.com/Cloudef","followers_url":"https://api.github.com/users/Cloudef/followers","following_url":"https://api.github.com/users/Cloudef/following{/other_user}","gists_url":"https://api.github.com/users/Cloudef/gists{/gist_id}","starred_url":"https://api.github.com/users/Cloudef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cloudef/subscriptions","organizations_url":"https://api.github.com/users/Cloudef/orgs","repos_url":"https://api.github.com/users/Cloudef/repos","events_url":"https://api.github.com/users/Cloudef/events{/privacy}","received_events_url":"https://api.github.com/users/Cloudef/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T06:10:13Z","updated_at":"2016-04-18T06:10:13Z","body":"You are printing uint32_t as %c. I'm not sure what you mean by \"random key\", but the keysym isn't ASCII character."}}