Window might be focused by mouse click in configuration of window manager
when focus is not following mouse.
Click could have been done on a button and depending on window manager settings
click would be passed to blender or not, but in any case button under cursor
should be activated. Currently the easiest way to activate button is to
generate mouse move event.
Not sure about OSX, but on windows it worked fine because OS is generating
WM_MOUSEMOVE event "automatically" so nothing special from blender side was
needed.