Mouse coverage in win32 (windib or DirectX when not fullscreen)

Uhm… I think there are two ways for doing that…
I’d like to know what others programmers think about it.

First way:

  • At the window create:
    PreviousCapture = SetCapture (SDL_Window);
  • When message handler receive WM_MOUSEMOVE:
    test if mouse position is in the client area of the window
    when this state changes send SDL_APPMOUSEFOCUS flag
  • At the window destroy:
    SetCapture (PreviousCapture);

My comment: I don’t know if the function SetCapture works well.
I know that there can be only one window at a time that can have
total mouse capture (this means: if another window that use this
function starts, who has capture?)

Second way:

  • At the window create:
    SetTimer (SDL_Window, Timer_ID, Interval, NULL);
  • When message handler receive WM_TIMER:
    test if mouse position is in the client area of the window
    when this state changes send SDL_APPMOUSEFOCUS flag
  • At the window destroy:
    KillTimer (SDL_Window, Timer_ID);

My comment: this is not certainly the best way, but it can work.
Unfortunately in windows we have always to do tricks to get
something work. :slight_smile:
The other problem is: what is the correct value for Interval?

Thank for your comments.

Bye.
Enzo.