Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
36d25951
Commit
36d25951
authored
7 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
Fix scrolling flickering on backwards pagination
parent
95c492ba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/TimelineView.h
+5
-1
5 additions, 1 deletion
include/TimelineView.h
src/TimelineView.cc
+16
-6
16 additions, 6 deletions
src/TimelineView.cc
with
21 additions
and
7 deletions
include/TimelineView.h
+
5
−
1
View file @
36d25951
...
...
@@ -111,12 +111,16 @@ private:
bool
isInitialized
=
false
;
bool
isTimelineFinished
=
false
;
bool
isInitialSync
=
true
;
bool
isPaginationScrollPending_
=
false
;
const
int
SCROLL_BAR_GAP
=
3
00
;
const
int
SCROLL_BAR_GAP
=
4
00
;
int
scroll_height_
=
0
;
int
previous_max_height_
=
0
;
int
oldPosition_
;
int
oldHeight_
;
QList
<
PendingMessage
>
pending_msgs_
;
QSharedPointer
<
MatrixClient
>
client_
;
};
This diff is collapsed.
Click to expand it.
src/TimelineView.cc
+
16
−
6
View file @
36d25951
...
...
@@ -58,6 +58,15 @@ void TimelineView::sliderRangeChanged(int min, int max)
if
(
max
-
scroll_area_
->
verticalScrollBar
()
->
value
()
<
SCROLL_BAR_GAP
)
scroll_area_
->
verticalScrollBar
()
->
setValue
(
max
);
if
(
isPaginationScrollPending_
)
{
isPaginationScrollPending_
=
false
;
int
currentHeight
=
scroll_widget_
->
size
().
height
();
int
diff
=
currentHeight
-
oldHeight_
;
scroll_area_
->
verticalScrollBar
()
->
setValue
(
oldPosition_
+
diff
);
}
}
void
TimelineView
::
scrollDown
()
...
...
@@ -88,17 +97,14 @@ void TimelineView::sliderMoved(int position)
return
;
// Prevent user from moving up when there is pagination in progress.
if
(
isPaginationInProgress_
)
{
scroll_area_
->
verticalScrollBar
()
->
setValue
(
SCROLL_BAR_GAP
);
// TODO: Keep a map of the event ids to filter out duplicates.
if
(
isPaginationInProgress_
)
return
;
}
isPaginationInProgress_
=
true
;
scroll_height_
=
scroll_area_
->
verticalScrollBar
()
->
value
();
previous_max_height_
=
scroll_area_
->
verticalScrollBar
()
->
maximum
();
// FIXME: Maybe move this to TimelineViewManager to remove the extra calls?
client_
.
data
()
->
messages
(
room_id_
,
prev_batch_token_
);
client_
->
messages
(
room_id_
,
prev_batch_token_
);
}
}
...
...
@@ -130,11 +136,15 @@ void TimelineView::addBackwardsEvents(const QString &room_id, const RoomMessages
// Reverse again to render them.
std
::
reverse
(
items
.
begin
(),
items
.
end
());
oldPosition_
=
scroll_area_
->
verticalScrollBar
()
->
value
();
oldHeight_
=
scroll_widget_
->
size
().
height
();
for
(
const
auto
&
item
:
items
)
addTimelineItem
(
item
,
TimelineDirection
::
Top
);
prev_batch_token_
=
msgs
.
end
();
isPaginationInProgress_
=
false
;
isPaginationScrollPending_
=
true
;
}
TimelineItem
*
TimelineView
::
parseMessageEvent
(
const
QJsonObject
&
event
,
TimelineDirection
direction
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment