SDL_SetRelativeMouseMode interacting with Warcraft III

When I have Warcraft III running in the background and my SDL2 program calls SDL_SetRelativeMouseMode(true), I get a weird effect. All this function call does is hide the mouse cursor in my window. But when the cursor gets out of the window, it is still visible and active. It looks like SDL2 is failing to constrain the mouse cursor within my window.

Note that this happens with the Windows version of SDL2 and Warcraft III, both Reign of Chaos and its expansion The Frozen Throne. I haven’t noticed this effect under any other circumstance. I have no idea what’s causing it, but I am going to assume that SDL and Warcarft III use similar code to do some low-level mouse and/or window handling tasks, which causes them to interfere with each other. Given the involvement of Sam Lantinga in the development of Warcraft III, this seems a reasonable guess.