Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/video/cocoa/SDL_cocoawindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -1927,11 +1927,18 @@ - (void)mouseMoved:(NSEvent *)theEvent
if (@available(macOS 26.0, *)) {
// do for all windows for now, not just fullscreen spaces. And hopefully remove this code entirely soon.
//if ([_data.listener isInFullscreenSpace]) {
int posx = 0, posy = 0;
SDL_GetWindowPosition(window, &posx, &posy);
SDL_GetGlobalMouseState(&x, &y);
x -= posx;
y -= posy;
int windowRelativePosX = 0, windowRelativePosY = 0;
// If window is a popup, these coordinates are relative to the parent window.
SDL_GetWindowPosition(window, &windowRelativePosX, &windowRelativePosY);

int windowGlobalPosX = 0, windowGlobalPosY = 0;
// For the popup case
SDL_RelativeToGlobalForWindow(window, windowRelativePosX, windowRelativePosY, &windowGlobalPosX, &windowGlobalPosY);

float globalMouseX = 0.0f, globalMouseY = 0.0f;
SDL_GetGlobalMouseState(&globalMouseX, &globalMouseY);
x = globalMouseX - windowGlobalPosX;
y = globalMouseY - windowGlobalPosY;
//}
}

Expand Down