1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Backends: OSX: ImGui_ImplOSX_HandleEvent() only process event for window containing our viewports. Amend 7ac99a4 for docking. (#8644)

This commit is contained in:
ocornut 2025-06-13 17:48:02 +02:00
parent 4cf85ee543
commit d896eab166

View file

@ -699,10 +699,15 @@ static ImGuiMouseSource GetMouseSource(NSEvent* event)
static bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
{
// Only process events from the window containing ImGui view
if (event.window != view.window)
void* event_handle = (__bridge void*)(event.window);
void* view_handle = (__bridge void*)(view.window);
if (event_handle == nullptr || view_handle == nullptr)
return false;
ImGuiViewport* viewport = ImGui::FindViewportByPlatformHandle(view_handle);
if (viewport == nullptr || viewport->PlatformHandleRaw != event_handle)
return false;
ImGuiIO& io = ImGui::GetIO();
ImGuiIO& io = ImGui::GetIO();
if (event.type == NSEventTypeLeftMouseDown || event.type == NSEventTypeRightMouseDown || event.type == NSEventTypeOtherMouseDown)
{
int button = (int)[event buttonNumber];