inputmethod: toggle the inputmethod if we get second show request
This is in a way working around bad protocol, input-method-unstable-v1 and also input-method-unstable-v2 does not have a way for input-method to mark itself as "deactivated". This can happen when e.g. user closes the virtual keyboard using swiping down or "close keyboard" button in keyboard.
When this happens, the state between compositor, text_input and input_method gets out of sync, compositor does not know that input method got deactivated and hence it will continue sending various events to it. The quick way around it is to change focus, which makes compositor send deactivate request to input-method, that puts compositor and input-method in sync again.
This patch aims to solve this by tracking the last state of input method, If we know that input method is active and text input sends us the show event, we toggle the input-method.
I will re-iterate that this is in no way proper solution, ideally input-method-unstable-v3 or input-method-unstable-v2 even (since it is not upstream anyway) gains the new request which essentially allows input-method to sync enabled/disabled state with compositor.