Pressing on ImGui doesn't cancel input to app
asdhuman-dev opened this issue · 2 comments
Any touch events processed both by imgui and target game. Something wrong with event processing
Its obvious why that happens, check out the Android Input Consumer event
Hey @fedes1to
I am at the same problem also and I didn't understand it. I don't want a copy&paste help. Therefore I've two questions:
Why you know to hook _ZN7android13InputConsumer21initializeMotionEventEPNS_11MotionEventEPKNS_12InputMessageE
. How do I find such cryptical symbol-names and what they do? I googled it and just found a libinput.so analytics database without any further documentation. So its hard for me to step forward looking whats going up in the hook. :(
Now I tried to find out whether I am hovering the imgui or not. But if I don't call the original-method it crashed. And furthermore the imgui is crazyly snapping arround if I touch the screen.
HOOKAF(void, Input, void *thiz, void *ex_ab, void *ex_ac) {
bool wantToCaptureMouse = false;
auto ctx = ImGui::GetCurrentContext();
LOGD("Input -> Checking for CTX");
if (ctx) {
LOGD("Input -> has CTX");
auto io = ImGui::GetIO();
wantToCaptureMouse = io.WantCaptureMouse;
LOGD("Input -> io.WantCaptureMouse %i", io.WantCaptureMouse);
ImGui_ImplAndroid_HandleInputEvent((AInputEvent *) thiz);
}
if (!wantToCaptureMouse) {
origInput(thiz, ex_ab, ex_ac);
}
}