Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support WM_XBUTTONUP WM_XBUTTONDOWN #2264

Closed
frederich opened this issue Jan 6, 2019 · 3 comments
Closed

Support WM_XBUTTONUP WM_XBUTTONDOWN #2264

frederich opened this issue Jan 6, 2019 · 3 comments
Labels

Comments

@frederich
Copy link

ImGui_ImplWin32_WndProcHandler doesn't handle WM_XBUTTONUP WM_XBUTTONDOWN, therefore io.MouseDown[3] and [4] doesn't work.

Version: newest
Branch: master

@ocornut
Copy link
Owner

ocornut commented Jan 6, 2019

Hello Frederich,
That’s correct.
Happy to see a pull request for it!

@frederich
Copy link
Author

frederich commented Jan 6, 2019

case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK:
{
int button = 1;
if (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONDBLCLK) button = GET_XBUTTON_WPARAM(wParam);

    if (!ImGui::IsAnyMouseDown() && ::GetCapture() == NULL)
        ::SetCapture(hwnd);
    button += 2;
    io.MouseDown[button] = true;
    return 0;
}
case WM_XBUTTONUP:
{
    int button = 1;
    if (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONDBLCLK) button = GET_XBUTTON_WPARAM(wParam);

    button += 2;
    io.MouseDown[button] = false;
    if (!ImGui::IsAnyMouseDown() && ::GetCapture() == hwnd)
        ::ReleaseCapture();
    return 0;
}

@ocornut
Copy link
Owner

ocornut commented Jan 17, 2019

Added the proper code to handle XBUTTON 4 and 5 now.

@ocornut ocornut closed this as completed Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants