Mouse outside the window changes position even after setting relative mouse mode

I see that even after enabling relative mouse mode, the original mouse(outside the application) is impacted with any mouse moves that happen within the window. For eg,

  • keep mouse positioned at some (x, y) on desktop
  • run testrelative
  • now cursor gets hidden
  • move mouse randomly within the window
  • cmd-tab to get out of the window and observe that mouse on desktop is not at (x, y) anymore.

Once CGAssociateMouseAndMouseCursorPosition(NO) is called, I was expecting that cursor outside will remain at (x, y). Is my understanding correct?