Bug 265002 - Unreachable code in okular/ui/pageview.cpp (related to drag scroll)
Summary: Unreachable code in okular/ui/pageview.cpp (related to drag scroll)
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-31 21:15 UTC by Denis Pesotsky
Modified: 2011-01-31 23:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Pesotsky 2011-01-31 21:15:49 UTC
Version:           unspecified
OS:                Linux

Following code is probably unreachable in pageview.cpp:

// If the delta is huge it probably means we just wrapped in that direction
const QPoint absDelta(abs(delta.x()), abs(delta.y()));
if ( absDelta.y() > mouseContainer.height() / 2 )
{
   delta.setY(mouseContainer.height() - absDelta.y());
}
if ( absDelta.x() > mouseContainer.width() / 2 )
{
   delta.setX(mouseContainer.width() - absDelta.x());
}

It's unreachable coze delta is equal to d->mouseGrabPos - mousePos, and d->mouseGrabPos is updated anyways when we wrapped.

Haven't tested it however.

Reproducible: Didn't try
Comment 1 Denis Pesotsky 2011-01-31 21:36:12 UTC
it is richable if we move mouse quickly, but it doesn't do anything good if we reach it.
Comment 2 Albert Astals Cid 2011-01-31 22:04:44 UTC
Can you explain why "it doesn't do anything good if we reach it."?
Comment 3 Denis Pesotsky 2011-01-31 22:09:31 UTC
If mouse moves very fast (more that half of screen between 2 event loops), we reach this code and it fucks up delta. So document is dragged less than mouse actually moved. Sorry for bad English.
Comment 4 Albert Astals Cid 2011-01-31 23:02:44 UTC
You are reading the code wrong.

if ( absDelta.y() > mouseContainer.height() / 2 ) happens not when you move the mouse very fast but when cursor wraps from the top to the bottom of the screen as the comment says. Anyway if you wish to continue discussing this please subscribe to okular-devel mailing list and post there.