Skip to content

Minimized windows continue to get mouse events from "ghost area" #14725

@metayan

Description

@metayan

After minimizing a window, mouse movement in the area where it used to be is sent as events to the minimized window.

To reproduce:

diff --git a/test/testwm.c b/test/testwm.c
index b46ee435c..1c5c0906a 100644
--- a/test/testwm.c
+++ b/test/testwm.c
@@ -166,6 +166,8 @@ static void loop(void)
     while (SDL_PollEvent(&event)) {
         SDLTest_CommonEvent(state, &event, &done);
         SDL_ConvertEventToRenderCoordinates(SDL_GetRenderer(SDL_GetWindowFromEvent(&event)), &event);
+       printf("Got Event %d\n", event.type);
+       fflush(stdout);
 
         if (event.type == SDL_EVENT_WINDOW_RESIZED) {
             SDL_Window *window = SDL_GetWindowFromEvent(&event);

Run test/testwm from a terminal.
Minimize the window, then move the mouse in the area where the window used to be.

This could also be the cause for why events are sent to a window before it is actually shown on the screen, as in Genymobile/scrcpy#6568 .

Tested with testwm on macOS with SDL 3.3.6 - the scrcpy issue also shows the same behavior with 3.2.28 and 2.3.x .

Note:
Some applications that are in the background when the window is minimized seem to do something to prevent this, for example Vivaldi and Mail.
Finder, Emacs, and the terminal program kitty, let the mouse movement through to the minimized window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions