mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-20 20:00:40 +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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user