Archive 17/01/2023.

GetMouseButtonDown(Urho3D::MOUSEB_LEFT) not working

simple

Somebody have same problem like me with newest version of urho3d?

If i bind engine’s externalWindow with QWidget->winId() (which is parented with QMainWindow) or wxControl->GetHandle() then GetMouseButtonDown(Urho3D::MOUSEB_LEFT) doesnt work.
If I bind engine’s externalWindow wirh QMainWindow->winId() then GetMouseButtonDown(Urho3D::MOUSEB_LEFT) works.
Not sure with earlier version of urho3d, but I earlier also use wxWidgets and use wxControl (as child window) then GetMouseButtonDown(Urho3D::MOUSEB_LEFT) works, now not working.
(probably externalWindow with wxFrame->GetHandle() will also work (anyway this not tested))

maybe GetMouseButtonDown(Urho3D::MOUSEB_LEFT) not working with all window childrens, only works with main windows???

cadaver

I recommend to debug inside Urho’s Input class: are you getting the SDL mouse event? If yes, is it being discarded because the inputFocus_ flag is false (or some other reason)?

simple

I was debugged app, and i found problem with SDL_WINDOW_INPUT_FOCUS.
This flag is always zero.
So urho3d GainFocus and just after LoseFocus because of this line:

if (inputFocus_ && (flags & SDL_WINDOW_INPUT_FOCUS) == 0)
LoseFocus();

So problem was widget was not focused, but QWidget::setFocus(), QWidget::activateWindow(),SetActiveWindow(this->GetHandle()) and wxControl::SetFocus()
doesnt send window-message WM_ACTIVATE where SDL_WINDOW_INPUT_FOCUS is set by SDL_SetKeyboardFocus(data->window);
I decided send this message maually by this code (is little dirty but work):
SendMessageA((HWND)this->winId(),WM_ACTIVATE,WA_ACTIVE,0);

cadaver

Thanks for the debugging. It looks like we should perhaps always assume SDL_WINDOW_INPUT_FOCUS for external windows.