Skip to content

Support for Windows Pointer Events? #3453

@acidicoala

Description

@acidicoala

Config/Build Information

Dear ImGui 1.78 (17800)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1927
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000000
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigWindowsMemoryCompactTimer = 60.0f
io.BackendFlags: 0x0000000E
 HasMouseCursors
 HasSetMousePos
 RendererHasVtxOffset
--------------------------------
io.Fonts: 2 fonts, Flags: 0x00000000, TexSize: 512,1024
io.DisplaySize: 1262.00,753.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

My Issue/Question:

Hello there. Some windows instead of sending typical mouse input messages that ImGui expects (MS docs reference), send pointer event messages (MS docs reference). Therefore mouse input does not get processed with ImGui_ImplWin32_WndProcHandler. On my end I am using a hacky fix in which I substitute pointer events with mouse input messages that ImGui expects. For example:

LRESULT __stdcall WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	// ...
	switch(uMsg)
	{
		case WM_POINTERDOWN:
			uMsg = WM_LBUTTONDOWN;
			break;
		case WM_POINTERUP:
			uMsg = WM_LBUTTONUP;
			break;
		case WM_POINTERWHEEL:
			uMsg = WM_MOUSEWHEEL;
			break;
		case WM_POINTERUPDATE:
			uMsg = WM_SETCURSOR;
			break;
	}
	ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
	// ...
}

I was wondering if there are any plans to support such pointer event messages in the future? Or does it already exist and I've just missed it?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions