Scrolling in Draw
Andy S (2979) 504 posts |
I’ve almost completed a camera / scissor auto scroll function for the Paint bounty and along the way I had a good look at Draw’s auto scroll code that runs for example when you drag a select box to the edge of the window. I don’t want anyone to spend too long looking at this, but if you’re familiar with Draw’s source, I’m a bit puzzled by how it is managing to restrict the pointer position on drags to remain inside the window. I know the Wimp supports this via Wimp_DragBox, but Draw doesn’t seem to be using that here. I understand the code that scrolls the window just fine – it’s done in draw_null_event_handler() calling draw_open_wind() to scroll it, but the only code I can see that would obviously constrain mouse movement (draw_null_event_handler() from line 966) has been disabled with an “#if 0”! So how does it do it? I suspect I’m either missing something very obvious and need more coffee or there’s something constraining mouse drags in the build of Draw I am running that I just can’t see in the latest code. Recompiling doesn’t seem to change the behaviour though. Hmm. Anyone know the answer? |
Andy S (2979) 504 posts |
Never mind, I think I found it. It looks like it’s done from a function called claim_idle_for_null_owner() in DrawEnter that calls Bound_Pointer() which uses OS_Word 21 to define a bounding box for the pointer! Nice :) |
David Feugey (2125) 2709 posts |
Geek score: 200% |
Andy S (2979) 504 posts |
Why thank you David, I am most flattered! ;-) |