Johannes wrote:
On Wed, Apr 23, 2008 at 06:08:27AM +0000, corvid wrote:
Johannes wrote:
On Tue, Apr 22, 2008 at 02:05:43PM +0000, corvid wrote:
Speaking of motionNotify, the other day I was looking into getting the link in the status bar to change when scrolling. I'd gotten as far as figuring out that maybe *checks notes* Layout::scrollPosChanged could call Layout::motionNotify, but then I got stuck because I didn't know where to get current cursor coordinates from.
In fltk one can call get_mouse(int &x, int &y). But I'm not sure how to wrap this properly. Perhaps adding a similar method to Platform? What about different views, can they all have separate pointer devices? Just checked dillo1. It handles at least the scrolling case properly.
Ah, indeed. It turns out that old dillo sets viewport->mouse_[xy] in Dw_gtk_viewport_motion_notify() and then has a static void Dw_gtk_viewport_adj_changed (GtkAdjustment *adj, GtkDwViewport *viewport) { Dw_gtk_viewport_mouse_event (GTK_WIDGET (viewport), viewport->mouse_x, viewport->mouse_y, NULL); }
Attached is a patch similar to this.
It works for scrolling and when I close a window that had been obscuring the viewport (it gets ENTER and FOCUS. I chose ENTER). It does not work when I page around with my window manager because the only event the viewport handler sees is KEYUP, and I didn't like the idea of using KEYUP for this.
Nice! But there is still other cases, like going back with <Backspace> such that the cursor ends up over a link. Or incremental rendering such that the cursor ends up over a link ( (to reproduce go to a slow page, move the cursor over a link and press <Ctrl>-r to reload).
I'm not sure how to handle these cases where the movement is initiated by the layout rather than the view.
I ignored it at the time because I figured it was probably hard to deal with. It also incorrectly shows links when text searching causes scrolling. I have this case fixed in my copy now. And it could be made to deal with moving into scrollbars, although that's probably for a separate patch at some point (with cursor resetting as well).
I'd like to have a general mechanism like Layout::canvasMousePosChanged () that can be called in all these cases.
I'll at least try to figure out something...