@@ -307,13 +307,17 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event)
307
307
{
308
308
case SDL_EVENT_MOUSE_MOTION:
309
309
{
310
+ if (event->motion .windowID != SDL_GetWindowID (bd->Window ))
311
+ return false ;
310
312
ImVec2 mouse_pos ((float )event->motion .x , (float )event->motion .y );
311
313
io.AddMouseSourceEvent (event->motion .which == SDL_TOUCH_MOUSEID ? ImGuiMouseSource_TouchScreen : ImGuiMouseSource_Mouse);
312
314
io.AddMousePosEvent (mouse_pos.x , mouse_pos.y );
313
315
return true ;
314
316
}
315
317
case SDL_EVENT_MOUSE_WHEEL:
316
318
{
319
+ if (event->wheel .windowID != SDL_GetWindowID (bd->Window ))
320
+ return false ;
317
321
// IMGUI_DEBUG_LOG("wheel %.2f %.2f, precise %.2f %.2f\n", (float)event->wheel.x, (float)event->wheel.y, event->wheel.preciseX, event->wheel.preciseY);
318
322
float wheel_x = -event->wheel .x ;
319
323
float wheel_y = event->wheel .y ;
@@ -327,6 +331,8 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event)
327
331
case SDL_EVENT_MOUSE_BUTTON_DOWN:
328
332
case SDL_EVENT_MOUSE_BUTTON_UP:
329
333
{
334
+ if (event->button .windowID != SDL_GetWindowID (bd->Window ))
335
+ return false ;
330
336
int mouse_button = -1 ;
331
337
if (event->button .button == SDL_BUTTON_LEFT) { mouse_button = 0 ; }
332
338
if (event->button .button == SDL_BUTTON_RIGHT) { mouse_button = 1 ; }
@@ -342,12 +348,16 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event)
342
348
}
343
349
case SDL_EVENT_TEXT_INPUT:
344
350
{
351
+ if (event->text .windowID != SDL_GetWindowID (bd->Window ))
352
+ return false ;
345
353
io.AddInputCharactersUTF8 (event->text .text );
346
354
return true ;
347
355
}
348
356
case SDL_EVENT_KEY_DOWN:
349
357
case SDL_EVENT_KEY_UP:
350
358
{
359
+ if (event->key .windowID != SDL_GetWindowID (bd->Window ))
360
+ return false ;
351
361
// IMGUI_DEBUG_LOG("SDL_EVENT_KEY_%d: key=%d, scancode=%d, mod=%X\n", (event->type == SDL_EVENT_KEY_DOWN) ? "DOWN" : "UP", event->key.key, event->key.scancode, event->key.mod);
352
362
ImGui_ImplSDL3_UpdateKeyModifiers ((SDL_Keymod)event->key .mod );
353
363
ImGuiKey key = ImGui_ImplSDL3_KeyEventToImGuiKey (event->key .key , event->key .scancode );
@@ -357,6 +367,8 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event)
357
367
}
358
368
case SDL_EVENT_WINDOW_MOUSE_ENTER:
359
369
{
370
+ if (event->window .windowID != SDL_GetWindowID (bd->Window ))
371
+ return false ;
360
372
bd->MouseWindowID = event->window .windowID ;
361
373
bd->MousePendingLeaveFrame = 0 ;
362
374
return true ;
@@ -367,13 +379,19 @@ bool ImGui_ImplSDL3_ProcessEvent(const SDL_Event* event)
367
379
// FIXME: Unconfirmed whether this is still needed with SDL3.
368
380
case SDL_EVENT_WINDOW_MOUSE_LEAVE:
369
381
{
382
+ if (event->window .windowID != SDL_GetWindowID (bd->Window ))
383
+ return false ;
370
384
bd->MousePendingLeaveFrame = ImGui::GetFrameCount () + 1 ;
371
385
return true ;
372
386
}
373
387
case SDL_EVENT_WINDOW_FOCUS_GAINED:
388
+ if (event->window .windowID != SDL_GetWindowID (bd->Window ))
389
+ return false ;
374
390
io.AddFocusEvent (true );
375
391
return true ;
376
392
case SDL_EVENT_WINDOW_FOCUS_LOST:
393
+ if (event->window .windowID != SDL_GetWindowID (bd->Window ))
394
+ return false ;
377
395
io.AddFocusEvent (false );
378
396
return true ;
379
397
case SDL_EVENT_GAMEPAD_ADDED:
0 commit comments