I suspect this may be because you get keycode from keysym using XKeysymToKeycode. This is not reliable because several keycodes can map to the same keysym, and the one you get with XKeysymToKeycode may not be the one sent by the keyboard. Another possible issue with that key, is that it only seems to generate a KeyRelease event with XNextEvent, whereas with other special keys like XF86AudioLowerVolume you first get a KeyPress.
Should be fixed in git master branch, please reopen if you still have the issue.