I'm trying to limit mouse in one screen use rust.(if moved other screen, set it back.)
I want to get the mouse move event of the global macos system(not the window, so crate winit is not useful for me). Then according to the returned mouse position to limit its moving range, I tried crate core-graphics,
like this:
loop {
// do something
sleep(time)
}
I found that this would not get the point of each mouse movement, then i try sleep(0), and it not work.
i find out https://stackoverflow.com/questions/8188193/limiting-mouse-to-one-display-on-mac-potentially-using-cocoa,
then think should use event callback,and i find apple developer page of coregraphics have CGEventTapCreate could use callback,
but crate core_graphics not have CGEventTapCreate .
so I considered that it should be done through the callback of the mouse event loop, but I did not find a suitable one. What should I do?