Comment 35 for bug 373367

robertb (h2) wrote :

I agree that it would be difficult to fix the mouse grab issue within X. I find that the only issue is when I click the mouse, so I don't click the mouse. I find the edge first, without the mouse clicked, then I click the mouse and move away from the edge. It would be nice to handle the action directly, but again, I don't think X provides any notification to the window when it is entered while the mouse is attached to another window (the clicked in window).

Anyhow, I tweaked the code further. However, I left in 'modes' for those that want that behavior, but I changed the default (no mode specified) to block on all edges. I also fixed the need to specify a void that doesn't exactly match the offscreen size. It is still possible to sneak the mouse past the edge, but it is much less likely now, and the simply solution is to just drag the mouse horizontal or vertically (depending on the void orientation) and the mouse will come back (not actually stuck, just lost...). Making the void bigger in the negative space may help too (I didn't try it because I found it very difficult to lose the mouse anymore). I added a makefile, just type 'make' to build (or 'make debug' if you want more verbose output from the executable...).

I think there is already a mouse capture project under SourceForge, and that may provide a more robust solution, but I stuck with XCreateMouseVoid because it is so small...and I'm providing my tweaks because it appears to work better on my machine now...