New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth scrolling (Linux) #5359

Open
oktayacikalin opened this Issue Feb 2, 2015 · 53 comments

Comments

Projects
None yet
@oktayacikalin
Copy link

oktayacikalin commented Feb 2, 2015

I've seen some work in improving the smoothness of scrolling so far. But I'm wondering if it's actually possible to get real smooth scrolling or at least if it's planned for the near future?
Just reducing the scroll sensitivity to 1 line at a time is not a real solution...

@50Wliu 50Wliu added the enhancement label Feb 2, 2015

@benogle benogle added the linux label Feb 2, 2015

@benogle

This comment has been minimized.

Copy link
Contributor

benogle commented Feb 2, 2015

@nathansobo will be soon working on new rendering techniques that will hopefully speed up typing and scrolling performance, which should make things smoother.

@oktayacikalin

This comment was marked as spam.

Copy link

oktayacikalin commented Feb 3, 2015

Awesome to hear that :)

@Ehsanizadi

This comment was marked as spam.

Copy link

Ehsanizadi commented Jul 19, 2015

When do you expect smooth scrolling to be added to atom text editor?

@Tenrys

This comment was marked as outdated.

Copy link

Tenrys commented Aug 11, 2015

For now, put this in your style sheet:

atom-text-editor::shadow .editor--private .tile {
    transition: -webkit-transform .05s ease-out; // customize the duration.
}

Courtesy of @Lixquid.

@UltCombo

This comment has been minimized.

Copy link

UltCombo commented Nov 5, 2015

Looks like @Tenrys's selector no longer works, so I've modified it:

atom-text-editor::shadow .scroll-view > .lines > div > div:not(.cursor) {
  transition: -webkit-transform .1s linear;
}

This is still an ugly hack, and does not work very well when scrolling up.

Chrome has a smooth scroll flag under chrome://flags/#enable-smooth-scrolling, I wonder if this flag can be enabled in Electron? If so, Atom could add a setting to enable this flag.

@ebkalderon

This comment was marked as spam.

Copy link

ebkalderon commented Nov 25, 2015

Thanks for the information, @UltCombo. Any word on when smooth scrolling will work natively?

@kuba-orlik

This comment was marked as spam.

Copy link

kuba-orlik commented Nov 30, 2015

👍 I'd love to see that implemented, as well :)

@thedaniel

This comment has been minimized.

Copy link
Contributor

thedaniel commented Nov 30, 2015

@zcbenz any comments on the Chrome smooth scroll flag and whether it's available / relevant in Electron?

@ArniPL

This comment was marked as spam.

Copy link

ArniPL commented Mar 16, 2016

Is this still in the works? I'd love Atom to do smooth scrolling like Sublime does. That CSS hack just isn't cutting it. Thanks! :)

@alvarolm

This comment has been minimized.

Copy link

alvarolm commented Apr 8, 2016

interested as well, btw that css hack doesnt seems to be working on 1.7 beta 5

@alvarolm

This comment has been minimized.

Copy link

alvarolm commented Apr 10, 2016

@kevinrambaud

This comment was marked as spam.

Copy link

kevinrambaud commented May 2, 2016

Bump, same thing on OS X El Captain, it's the only feature I miss from Sublime text, the current Atom scroll attacks my eyes 😁

@TheBrenny

This comment has been minimized.

Copy link

TheBrenny commented Jun 15, 2016

@UltCombo, Getting that lovely MS Word feel when you include the cursor though!

atom-text-editor::shadow {
  .scroll-view > .lines > div > div {
    transition: -webkit-transform 0.05s linear;
  }
}

ryanjcruz added a commit to ryanjcruz/atom-customizations that referenced this issue Jul 21, 2016

initial commit - added smooth scrolling hack
smooth scrolling hack in atom stylesheet from @TheBrenny atom github
issue
atom/atom#5359

@pratyushbarik pratyushbarik referenced this issue Aug 4, 2016

Merged

Update Electron to 0.37 #11474

6 of 6 tasks complete
@pratyushbarik

This comment has been minimized.

Copy link

pratyushbarik commented Aug 4, 2016

Upgrade to 1.9. It's using Electron 0.37. I can confirm this resolves the smooth scrolling issue on Ubuntu 14.04.

@50Wliu

This comment has been minimized.

Copy link
Member

50Wliu commented Aug 4, 2016

Thanks for the update @pratyushbarik! If someone can still reproduce this on Atom 1.9.0 please comment here.

@50Wliu 50Wliu closed this Aug 4, 2016

@UltCombo

This comment has been minimized.

Copy link

UltCombo commented Aug 4, 2016

@50Wliu The issue is still reproducible on OS X when using a non-Apple mouse (any mouse with a real scroll wheel instead of touch scrolling).

In any case, I believe this is a Chromium/Blink issue as the same choppy scrolling also happens on Chrome for Mac when using a mouse with scroll wheel.

@alexandernst

This comment was marked as spam.

Copy link

alexandernst commented Aug 4, 2016

I'm with @UltCombo . This isn't fixed.

@UltCombo

This comment has been minimized.

Copy link

UltCombo commented Aug 4, 2016

I'll reinforce this is only a problem when using a mouse with scroll wheel on a Mac. The smooth scrolling has been working since forever when using pointing devices with touch scrolling, such as the MacBook's touchpad, a Magic Trackpad or Magic Mouse.

Please star this Blink issue if you'd like Blink (and therefore Electron) to have smooth scrolling for mouse wheel on Mac.

@jonas-schievink

This comment has been minimized.

Copy link

jonas-schievink commented Aug 4, 2016

Also still an issue on Linux (x86-64 Arch Linux, X11, Atom 1.9.0) using a regular mouse

@50Wliu 50Wliu reopened this Aug 4, 2016

@luco

This comment was marked as spam.

Copy link

luco commented Sep 26, 2016

+1

@Menci

This comment has been minimized.

Copy link

Menci commented Sep 27, 2016

@UltCombo How to apply that to line numbers? Thanks.

@UltCombo

This comment has been minimized.

Copy link

UltCombo commented Sep 28, 2016

I've pretty much gave up on the CSS hacks already; Setting Atom's scroll sensitivity to 10 provides a decent experience for me at least.

@alvarolm

This comment has been minimized.

Copy link

alvarolm commented Sep 29, 2016

@hemedani

This comment has been minimized.

Copy link

hemedani commented Oct 8, 2016

Please notice this Add-on for chrome smooth scroll and this add-on for Firefox.
Please be sure to add that options for smooth scrolling in Atom.
tnx

@damianmoore

This comment has been minimized.

Copy link

damianmoore commented Nov 29, 2016

There are several different parts that contribute to a smooth scroll effect but the biggest thing from my perspective (being a touchpad user) is making use of XInput 2.1 events. This is often referred to as "pixel-perfect" scrolling.

With traditional mouse wheels the you cannot scroll an arbitrary amount - the wheel physically settles into a resting position at fixed angles causing button presses 4 & 5 to be triggered which all applications can handle. With a touchpad (or I assume rarer types of fee flowing mouse wheel) scrolling can happen even for just a tiny distance (equivalent to a pixel or two). XInput had to be enhanced to pass through these new types of events.

I've been trying to get all the applications I commonly use to handle this and Atom is the only one left for me. Native GTK3 applications handle it by default, Firefox requires setting an environment variable https://support.mozilla.org/en-US/questions/1091627 and Chromium introduced it recently in version 54 https://bugs.chromium.org/p/chromium/issues/detail?id=384970

Given that Atom is based on Electron, which is in turn based on Chromium, I think smooth scrolling will be enabled when Electron updates the version of Chromium it uses to 54 and then Atom upgrades to this version of Electron. Not sure how long that will take but is see there is at least a branch called 'chrome54' which has been pushed to today: https://github.com/electron/electron/compare/chrome54

@UltCombo

This comment has been minimized.

Copy link

UltCombo commented Nov 30, 2016

@damianmoore Just to make sure: you are talking about touchpad on Linux specifically, right?

For scroll wheel users, I believe the problem will not be fixed by any Chromium/Electron update.

Atom on Windows already uses an Electron version with mouse wheel smooth scrolling enabled, you can see that the Settings view will have a nice smooth scroll. However, the editor view still does not have smooth scrolling. I believe that's because Atom's ScrollView intercepts and reimplements scrolling in order to only render the content currently displayed in the viewport.

@damianmoore

This comment has been minimized.

Copy link

damianmoore commented Dec 1, 2016

@UltCombo Touchpads mainly, yes, but also mouse wheels that move freely rather that locking into discrete positions. Those are probably rare though and I don't have one to test.

I gather that for you (using a standard mouse scroll wheel) smooth scrolling would be implemented by adding animation frames for 100ms or so as the view changes from one position to another. This may help eyes to follow the scroll better but I believe it is not a good enough solution for touchpad users.

I don't know enough details about the implementation of scrolling code in Atom but it seems you're right about the implementation not using standard Chromium/Electron scrolling. In my Atom settings on Linux I can also see that there is animation between scroll positions (but not "pixel-perfect" scrolling). I am now under the impression that when Atom gets updated to Electron based on Chromium v54, the settings view will get "pixel-perfect" scrolling for devices that support XInput 2.1 but it will not benefit the main code view.

I guess all of this will need to be re-implemented in Atom's non-standard code scroll view. I'd assume adding animation between scroll positions will be the easiest to implement first but pixel-perfect scrolling being kept in mind for after.

@alexandernst

This comment has been minimized.

Copy link

alexandernst commented Dec 1, 2016

I don't understand how XInput has anything to do with this bug. Sublime has smooth scrolling on Linux and it doesn't depend on XInput 2.1 and whatnot.

@damianmoore

This comment has been minimized.

Copy link

damianmoore commented Dec 1, 2016

@alexandernst There are different types of smooth scrolling:

  • The first (and simpler) type of smooth scrolling is when animation is added between the scroll view being in two positions. Scroll events are just button presses. Most mice will do this and so do touchpads for applications that don't support the second type.
  • The second type allows much more fine-grained scrolling. You can literally scroll by just one or two pixels in apps that support XInput 2.1. This gives a much more responsive feel - similar to how scrolling feels when you use a smartphone or tablet. Mac OS users are very familiar with this. Example: https://youtu.be/IF475wLGYdM?t=57s
@ilyahoilik

This comment has been minimized.

Copy link

ilyahoilik commented Feb 12, 2017

@Menci this code works with pagination:

atom-text-editor.editor {
	.scroll-view > .lines > div:not( .cursors ) > div,
	.gutter-container > div > div > div {
		transition: -webkit-transform 0.09s linear;
	}
}

But the bug described above is still present, unfortunately. And I don't know easy way to fix it.

@ffxsam

This comment was marked as spam.

Copy link

ffxsam commented Jul 15, 2017

Any updates/progress on this?

@damianmoore

This comment has been minimized.

Copy link

damianmoore commented Aug 9, 2017

I just upgraded to v1.19 and can confirm proper smooth scrolling is working for my touchpad 💯. Presumably because of the upgrade of Electron to a version that supports XInput 2.1.

If others can confirm the same then I guess this issue is resolved.

@50Wliu

This comment has been minimized.

Copy link
Member

50Wliu commented Aug 10, 2017

Thanks for giving us an update @damianmoore. However, I'll be a bit more careful this time and wait for more reports of smooth scrolling working before closing this issue again.

@ConsoleTVs

This comment has been minimized.

Copy link

ConsoleTVs commented Aug 19, 2017

Atom 1.19 - Stylesheet

Smooth scrolling for mouse wheel:

atom-text-editor.editor > div > .scroll-view > div,
atom-text-editor.editor > div > .gutter-container > div {
    transition: -webkit-transform .15s ease;
}
@hagrid67

This comment has been minimized.

Copy link

hagrid67 commented Sep 5, 2017

Hi ConsoleTVs - would you be able to suggest how to increase the scroll speed please? Can it be made to accelerate?

I'm using a Microsoft Comfort Mouse 4500 on Ubuntu 16.04 (long-time windows user switching to Linux). I'm looking for an editor with smooth scrolling; VS Code and Eclipse are not currently doing it. This mouse doesn't have a physical clicky scrolling like many - the position of the wheel is analog not discrete - but I think it only generates events on discrete angles. (At least, once it gets through the various drivers)

I'm getting nice smooth wheel scrolling in the Atom Settings pages etc; the text editor windows are not doing it by default, but adding ConsoleTVs' stylesheet fix above helped: it scrolls smoothly, just too slowly. Now I would like to amplify the scrolling a bit, or better, to have accelerating scrolling (Chrome does this using the Chromium Wheel Smooth Scroller).

The xinput configuration is a bit clunky: this sets it to super slow, 1 line of text in other editors, but only 1 pixel (yes!) in Atom:
xinput set-prop 10 "Evdev Scrolling Distance" 7 1 1
This sets it to the maximum: 7 lines in other editors, and about 7 pixels in Atom:
xinput set-prop 10 "Evdev Scrolling Distance" 1 1 1

(I think the 2nd and 3rd numbers do nothing)

non-integers seem to get rounded down in xinput.

Any ideas?

Many thanks

Atom 1.19.5 x64.

jwpc12:~/Downloads$ xinput list-props 10

Device 'Microsoft Microsoft® Comfort Mouse 4500':
	Device Enabled (136):	1
	Coordinate Transformation Matrix (138):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (265):	0
	Device Accel Constant Deceleration (266):	1.000000
	Device Accel Adaptive Deceleration (267):	1.000000
	Device Accel Velocity Scaling (268):	5.000000
	Device Product ID (256):	1118, 1900
	Device Node (257):	"/dev/input/event6"
	Evdev Axis Inversion (269):	0, 0
	Evdev Axes Swap (271):	0
	Axis Labels (272):	"Rel X" (146), "Rel Y" (147), "Rel Horiz Wheel" (263), "Rel Vert Wheel" (264)
	Button Labels (273):	"Button Left" (139), "Button Middle" (140), "Button Right" (141), "Button Wheel Up" (142), "Button Wheel Down" (143), "Button Horiz Wheel Left" (144), "Button Horiz Wheel Right" (145), "Button Side" (261), "Button Extra" (262), "Button Unknown" (259), "Button Unknown" (259), "Button Unknown" (259), "Button Unknown" (259)
	Evdev Scrolling Distance (274):	1, 1, 1
	Evdev Middle Button Emulation (275):	0
	Evdev Middle Button Timeout (276):	50
	Evdev Middle Button Button (277):	2
	Evdev Third Button Emulation (278):	0
	Evdev Third Button Emulation Timeout (279):	1000
	Evdev Third Button Emulation Button (280):	3
	Evdev Third Button Emulation Threshold (281):	20
	Evdev Wheel Emulation (282):	0
	Evdev Wheel Emulation Axes (283):	0, 0, 4, 5
	Evdev Wheel Emulation Inertia (284):	10
	Evdev Wheel Emulation Timeout (285):	200
	Evdev Wheel Emulation Button (286):	4
	Evdev Drag Lock Buttons (287):	0

@ConsoleTVs

This comment has been minimized.

Copy link

ConsoleTVs commented Sep 5, 2017

You may decreese the numer .15 to make it faster or change ease to linear for example

@hagrid67

This comment has been minimized.

Copy link

hagrid67 commented Sep 5, 2017

Hey thanks ConsoleTVs;

These seem to just change the timing of the scroll-increment, but the size of the increment stays the same. I seem to be getting a single pixel per mouse-wheel scroll event. By default using xinput (1 1 1) I get 7 events per mouse-wheel event, which is 7 lines in other editors, but seems to be 7 pixels in atom right now, ie barely a single line. I can only adjust this down in xinput (7 1 1 gives a single pixel, completely useless :) )

I've had a quick google for webkit transition etc but I'm not familiar with CSS.

If I go back to an empty styles.less, I still seem to get the same one-pixel-per-event, but now it's not smooth.

Might there be a way to tell electron / whatever to scale them up? (Or even better, accelerate...)

Many thanks.

@hagrid67

This comment was marked as off-topic.

Copy link

hagrid67 commented Sep 5, 2017

May I also ask if you use Atom on Linux - can you recommend a mouse? These cheap ~$15 mice have been fine for me on Windows but happy to trade up to a touchpad mouse if this works better here. Sorry to bend the topic somewhat.

@ConsoleTVs

This comment has been minimized.

Copy link

ConsoleTVs commented Sep 5, 2017

Scroll speed can't be controlled using css. This is something controlled by your mouse drivers. I use linux on my laptop without any mouses. In windows I use a razer mouse and windows is able to change the lines / scroll. I guess this feature is also available in xinput.

However atom already have soemthing called scroll sensitivity. Check the atom settings, on the editor tab and look for this:

image

@hagrid67

This comment has been minimized.

Copy link

hagrid67 commented Sep 5, 2017

Great - that seems to do it. (Sorry this is also the first time I've tried atom, I should have found that myself.)
Yes Linux / Xorg seems a bit behind windows in mouse-wheel configuration. Trying to use it seriously has made it more of an issue for me.
Thanks again.

@ConsoleTVs

This comment has been minimized.

Copy link

ConsoleTVs commented Sep 5, 2017

You're welcome :)

@lucaspar

This comment has been minimized.

Copy link

lucaspar commented Sep 6, 2017

Here's the setting I'm using. It smooths the scrolling and eases a little bit the cursor movements, but not at the same rate, so it doesn't become too slow when typing fast.

atom-text-editor::shadow {

    .scroll-view > .lines > div {

        div.cursor {
            transition: -webkit-transform 0.04s ease-out;
        }

        div:not(.cursor) {
            transition: -webkit-transform .15s ease;
        }
        
    }

}
@nathansobo

This comment has been minimized.

Copy link
Contributor

nathansobo commented Oct 27, 2017

screen shot 2017-10-27 at 5 53 26 pm

Investigated the scrolling experience this afternoon on Linux a bit. Our problems seem to stem from the fact that, at least on my virtual machine, the deltaY of scroll events is always the same no matter how fast I am scrolling. On macOS, that value varies based on my interaction with the touchpad.

I can imagine a solution in which we faked smooth scrolling by taking each wheel event as an acceleration to a velocity that also degrades with friction over several frames. My concern with that is it might not match the behavior of other applications and expectations of all users. This is very unknown territory for me.

@damianmoore

This comment has been minimized.

Copy link

damianmoore commented Oct 28, 2017

@nathansobo I don't think you need to worry. There has been a lot of confusion in this thread with people discussing adding transitions to fake smooth scrolling between steps. It's hard to find the right terminology to discuss these movements and I assume quite a few people here are not used to using touchpads.

I can confirm that with recent Linux distributions and touchpads the smooth motion works correctly in Atom, the same as with other more native apps (since my post on 9th August). I think this is inherited behaviour from the Chromium project (using XInput2) which has had it properly implemented for about a year. See my previous posts for my understanding on this.

What I guess is happening for you is that your virtual machine software is not translating your MacOS smooth scroll events into Linux's XInput2 smooth scroll events. Instead I guess it falls back to the lowest common denominator and sends those less frequent up/down events to Linux instead. If you try running Linux natively I think you will find the scrolling smooth and the same as native MacOS apps.

One thing I have not had a chance to test yet is whether this behaviour still works under Wayland display server which is now the default in the latest version of Ubuntu. I should get around to trying that in the next week.

@Ben3eeE

This comment has been minimized.

Copy link
Member

Ben3eeE commented Oct 28, 2017

@damianmoore Thank you for this information this is really helpful to us 🙇 We have had a lot of recent reports in various issues about smooth scrolling, inertial scrolling and other things being wrong with the scrolling experience on Linux.

@alexandernst

This comment has been minimized.

Copy link

alexandernst commented Oct 28, 2017

@damianmoore You mention that this has been fixed with recent Linux distributions and touchpads, but does smooth scrolling work with regular mouses? IMHO that is what people are complaining about.

@Ben3eeE

This comment has been minimized.

Copy link
Member

Ben3eeE commented Oct 28, 2017

Smooth scrolling with a regular mouse doesn't work on Windows for me.

@damianmoore

This comment has been minimized.

Copy link

damianmoore commented Oct 28, 2017

@alexandernst I was replying to @nathansobo which was about touchpads - "On macOS, that value varies based on my interaction with the touchpad". I can't say what happens with regular mice as I don't have one to test with (they give me wrist pain). I think there will always be complaints with regular mice not appearing smooth as there's lots of faking and animating to do when the wheel just doesn't have anywhere near the resolution. I was more interested in getting the continuous positioning stream of event data through to Atom so that the content moves according to your exact finger position.

@ssfrr

This comment has been minimized.

Copy link

ssfrr commented Oct 2, 2018

I'm using Atom 1.32.0-beta1 on Linux and not seeing the precision scrolling behavior. As @damianmoore mentioned above this is a separate issue from "smooth" scrolling by adding animation between the discrete steps (and TBH it makes it confusing that these two things are conflated). It seems that the scroll window moves only in increments of about 2 lines. Is there some setting that needs to be enabled?

I'm using Gnome Shell (Wayland).

@ariasuni

This comment has been minimized.

Copy link
Contributor

ariasuni commented Dec 17, 2018

Just to sum the situation up:

When using a mouse wheel, the scrolling is not smooth: the view jumps immediately without animation, unlike settings or project view for example.

(I personally don’t have any problem with pixel-perfect touchpad scrolling)

If I understand correctly, it’s a matter of adding an animation but it’s not that simple because of the editor view performance tricks.

@ssfrr ssfrr referenced this issue Dec 17, 2018

Open

Precision scrolling on Linux with Wayland #18592

1 of 1 task complete
@ssfrr

This comment has been minimized.

Copy link

ssfrr commented Dec 17, 2018

@ariasuni that's not the problem I'm having, but this issue seems to have a mix of smooth scrolling and precision scrolling, so I created a separate issue (#18592) to focus on precision scrolling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment