Handling keyboard and mouse input

X is asynchronous: X commands will be executed in the order they are specified, but may be executed some time later. Commands are queued up, and only transmitted to the X server when the buffer fills up or when the buffer is flushed. This affects programming style in various ways: It has consequences for error handling, callbacks, and window refreshing. It sometimes necessitates "flushing", though ProXL always flushes all ProXL displays whenever it is going to wait for user input, including input to the Prolog prompt. This greatly cuts down on the need to explicitly flush a display.