[okular] [Bug 443404] Mousewheel scroll does not work in full page size and non-continous mode for some mouses
Zack
bugzilla_noreply at kde.org
Mon Jul 18 17:23:22 BST 2022
https://bugs.kde.org/show_bug.cgi?id=443404
--- Comment #11 from Zack <smallmak113 at gmail.com> ---
I looked into the source code and added few lines to the pageview.cpp to handle
the small "delta" value reported in the PageView::wheelEvent for my mice. And
now I could scroll in pages in full page view and non-continous mode. (only
tested on libinput mode but not in evdev mode)
I don't know how I should request code change. Here's the few lines that I
added. Maybe the developers see this and test it or possibly merge into the
main branch.
--- okular-21.12.3/part/pageview_orig.cpp 2022-02-28 02:11:02.000000000
+0800
+++ okular-21.12.3/part/pageview.cpp 2022-07-19 00:07:04.332931401 +0800
@@ -3170,22 +3170,32 @@
if ((e->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
d->controlWheelAccumulatedDelta += delta;
if (d->controlWheelAccumulatedDelta <=
-QWheelEvent::DefaultDeltasPerStep) {
slotZoomOut();
d->controlWheelAccumulatedDelta = 0;
} else if (d->controlWheelAccumulatedDelta >=
QWheelEvent::DefaultDeltasPerStep) {
slotZoomIn();
d->controlWheelAccumulatedDelta = 0;
}
} else {
- d->controlWheelAccumulatedDelta = 0;
-
+ if (d->controlWheelAccumulatedDelta * delta < 0) {
+ d->controlWheelAccumulatedDelta = 0;
+ }
+ d->controlWheelAccumulatedDelta += delta;
+ if (abs(d->controlWheelAccumulatedDelta) >=
QWheelEvent::DefaultDeltasPerStep){
+ delta = d->controlWheelAccumulatedDelta > 0 ?
QWheelEvent::DefaultDeltasPerStep : -QWheelEvent::DefaultDeltasPerStep;
+ d->controlWheelAccumulatedDelta = 0;
+ }
+ else {
+ delta = 0;
+ }
+
if (delta <= -QWheelEvent::DefaultDeltasPerStep &&
!getContinuousMode() && vScroll == verticalScrollBar()->maximum()) {
// go to next page
if ((int)d->document->currentPage() < d->items.count() - 1) {
// more optimized than document->setNextPage and then move
view to top
Okular::DocumentViewport newViewport =
d->document->viewport();
newViewport.pageNumber += viewColumns();
if (newViewport.pageNumber >= (int)d->items.count())
newViewport.pageNumber = d->items.count() - 1;
newViewport.rePos.enabled = true;
newViewport.rePos.normalizedY = 0.0;
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Okular-devel
mailing list