Kristian Lyngstøl's Blog

Mouse cursor scaling and drawing

Posted on 2007-05-30

The zoom plugin can now draw and scale it's own mouse cursor, using XFixes to fetch the graphic. So far, it's not very advanced as far as settings and such goes, but this also opened up a door for panning.

Since we can't redirect the input, and the cursor is drawn by X it self, we are so far bound to the original placement and movement of the un-zoomed cursor. However, Quinn told me about an idea Dennis (onestone) had a while back while doing the inputzoom plugin for Beryl. The idea is simple: Instead of syncing the cursor and zoomed area, hide the original cursor and draw a magnified version of it where it would be if zoomed in. The result is that we don't have to move the zoomed area around whenever the mouse moves, because the user can see where he is clicking anyway.

That might sound cryptic, so let's try again: Zoom in to a window, move the mouse, it moves fairly quick (because it's the original un-zoomed mouse movement) but the zoomed area does not shift, thus allowing you to focus on a window and click anywhere without having parts of the window go off-screen.

This is basicly a side-effect of drawing the mouse cursor in the plugin, and makes the plugin much more comfortable to use. There will be some improvements on this area over the next few days to make panning more natural and to avoid loosing the mouse outside the zoomed area.

PS: To test this, you have to turn OFF mouse syncing, and turn on drawing of a scaled mouse pointer. (And hide the original pointer if you like your sanity).