Fix bugs in wxGrid mouse handling and simplify the code. See https://github.com/wxWidgets/wxWidgets/pull/2018