General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 28, 2003 04:06PM

In BrowserViewPanning.cpp scrolling is currently done using functions from nsIScrollable (GetCursorPos, GetCurScrollPos, SetCurScrollPosEx). I think if there's a way to get the current DOM window (or frame) and use the functions from nsIDOMWindow (GetScrollX, GetScrollY, ScrollTo or ScrollBy) instead then auto-scrolling should work for frames (bug 29) and the crash bug (bug 28) should be fixed also.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: MonkeeSage
Date: March 28, 2003 10:44PM

asmpgmr:

I tried it (see code below), and it was a darned good idea--I thought for sure it would work, cause it looks like that is the scrolling method used for scrolling to inline anchors in html pages; but it doesn't work. I mean--it does work--it just doesn't work with frames still, it's behavior is exactly the same as the other method.

I'm thinking it is a bug in Mozilla--most likely the same critter that causes the wrong menu to pop up when there is an image in the frames...but that's just my guess, who knows really, heh.

Since it does exactly like before, there isn't much use to update the code, I don't imagine. But here is what I tried:


BrowserViewPanning.cpp:
========
void CBrowserView::OnTimer(UINT nIDEvent)
{
switch(nIDEvent){
case 0x1:
if(m_panning) {
nsCOMPtr<nsIDOMWindow> s;
mWebBrowser->GetContentDOMWindow(getter_AddRefs(s));
if (!s) return;

POINT p;
GetCursorPos(&p);

int scroll_x,scroll_y;

s->GetScrollhot smiley&scroll_x);
s->GetScrollY(&scroll_y);

int dx = (p.x-m_panningPoint.x)/5;
int dy = (p.y-m_panningPoint.y)/5;

if(dy!=0) {
if(dy>0) scroll_y += dy*dy+7; // dy=1 => 8, which is the smallest number that makes it stcroll (it's in NS "twips", not pixels, apparently)
else scroll_y -= dy*dy+7;
s->ScrollTo(scroll_x, scroll_y);
}

if(dx!=0) {
if(dx>0) scroll_x += dx*dx+7;
else scroll_x -= dx*dx+7;
s->ScrollTo(scroll_x, scroll_y);
}

// ...
========

Hmmm...something else I just thought of, has anyone tried the panning with the the gfx scrollbars pref turned off?? I'm going to try that...


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 28, 2003 11:45PM

MonkeeSage,

Does the middle button autoscrolling work in Mozilla ? If so then maybe it isn't enough to only issue GetContentDOMWindow, maybe you have to check for frames and find the current frame though that doesn't seem very efficient. I'm guessing this might actually be the case because in BrowserView.cpp there's a function to change the font size (ChangeTextSize) and it uses GetContentDOMWindow and changing the font size affects the entire page, not just a frame.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 29, 2003 12:20AM

Maybe you need to use GetOwnerDoc ?

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: jsnj
Date: March 29, 2003 12:24AM

There's no autoscroll in Mozilla. There's an addon at http://autoscroll.mozdev.org/source.html that works within frames.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 29, 2003 12:35AM

That's lame especially considering typeahead find scrolls the page correctly to strings/links even within frames. I still think it can be made to work fully in K-Meleon.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 29, 2003 03:07PM

jsnj,

I just looked at the mozdev autoscroll source and it's all done via javascript and that wretched xul garbage so it's even lamer than I first thought.

MonkeeSage,

The function I mentioned should be GetOwnerDocument, that is what's used in BrowserFrameGlue to ultimately get the current frame URL.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 29, 2003 08:20PM

Also try GetDOMWindow instead of GetContentDOMWindow

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: MonkeeSage
Date: March 30, 2003 12:07AM

asmpgmr:

I'll try implementing both GetOwnerDocument and GetDOMWindow, in turn, and see how things turn out. I'll post the code and the results.


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: MonkeeSage
Date: March 30, 2003 12:24AM

These are the two COM pointers needed for GetOwnerDocument:

nsCOMPtr<nsIDOMNode> node;
aInfo->GetTargetNode(getter_AddRefs(node));

nsCOMPtr<nsIDOMDocument> domDoc;
node->GetOwnerDocument(getter_AddRefs(domDoc));

But aInfo looks like context menu info for the context menu hack that is used to get the current frame...I'm not good enough to follow what exactly is going on there and implement it for the panning.

Also the compiler complains that GetDOMWindow is not a member of mWebBrowser.


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 30, 2003 03:23PM

I don't have any other ideas for fixing bugs 28 and 29 at this time so the original OnTimer code should remain as is for now but I do have an idea for fixing bug 281 (moving mousewheel doesn't cancel autoscroll)


BOOL CBrowserView:tongue sticking out smileyreTranslateMessage(MSG* pMsg)
{
if(m_panning && (pMsg->message==WM_SETCURSOR || pMsg->message==WM_MOUSEMOVE))
return TRUE;

if(m_panning && (pMsg->message==WM_LBUTTONDOWN || pMsg->message==WM_RBUTTONDOWN || pMsg->message==WM_MOUSEWHEEL))
StopPanning();

return CWnd:tongue sticking out smileyreTranslateMessage(pMsg);
}

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: MonkeeSage
Date: March 30, 2003 08:03PM

Bug 28 is fixed with the change to nsIDOMWindow, so I guess there is a reason to change the code (I tried it with adobe acrobat plugin, I assume it is fixed for other as well). Still have no clue about 29 either. The fix to 281 works like a charm. smiling smiley


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 30, 2003 08:57PM

Could you post when you've updated the .exe with the fixes for 28, 281, and 433 (prefs panel). We should see about getting all of our fixes into the official build.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: MonkeeSage
Date: March 31, 2003 01:32AM

asmpgmr:

http://monkeesage.d2g.com/k-meleon.exe
http://monkeesage.d2g.com/macros.dll


See also the link at,

http://gratisDei.com/KM.htm

In regards to the 5 new macro commands that I have added in this build (tbtoggle, tbset, wait, autoload, stopautoload).


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 31, 2003 04:12AM

MonkeeSage,

I downloaded the updated .exe and everything works. I downloaded a diff utility and the current K-Meleon source so I can make diffs for all of my fixes and send them to the devs.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: itsr0y
Date: March 31, 2003 04:14PM

Hey, I just downloaded Mozi-Meleon 1.3 (03/31/2003) and it's working great! Thanks for the work.

One thing though. The autoscroll goes really fast, so if you go more than like 25 pixels, it jumps almost instantly to the top or bottom. Is there any way you can change the speed of the scrolling to slow it down a little. Even better, is there a way you could make a preference setting for it?

Thanks!

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: asmpgmr
Date: March 31, 2003 06:04PM

MonkeeSage,

I verified that the autoscrolling rate is faster than before. I guess the DOM functions use a different scale than the nsIScrollable functions.

Options: ReplyQuote
Re: Middle button scrolling issues (technical)
Posted by: MonkeeSage
Date: March 31, 2003 08:34PM

asmpgmr:

Ok, I rescaled it...

It is using 8 pannning point instead of 5:

int dx = (p.x-m_panningPoint.x)/8;
int dy = (p.y-m_panningPoint.y)/8;


With a 2 twip offset, instead of 7:

if(dy!=0) {
if(dy>0) scroll_y += dy*dy+2; // dy=1 => 8, which is the smallest number that makes it stcroll (it's in NS "twips", not pixels, apparently)
else scroll_y -= dy*dy+2;
s->ScrollTo(scroll_x, scroll_y);
}

if(dx!=0) {
if(dx>0) scroll_x += dx*dx+2;
else scroll_x -= dx*dx+2;
s->ScrollTo(scroll_x, scroll_y);
}


You can go from a crawl to super scrolling. Should be something for everybody. smiling smiley

http://monkeesage.d2g.com/k-meleon.exe


Ps. Installer packages will be updated shortly.


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote


K-Meleon forum is powered by Phorum.