My findings with KEY_UP are that it is NOT platform independent at all. First of all, it depends which key is pressed. The arrow keys are generating press and release events for you. But if you wait for key release events for aplha keys, e.g. 'a', then you wait forever in X11. But if you use GTK then a key release event comes up: KEY_UP + 'A'. This means that the key symbols for press and release differ. I tried it with a "keyhook" in order to be at a lower level. No change.
You should not use ASCII (like 'A' + KEY_UP), but K_A|K_KEYUP.