Emacs scroll bar renders incorrectly

As the title says, in emacs, the scroll bar renders incorrectly. Old positions are never erased. I also can't click and drag the scroll bar. I've tried searching but can't find anything about this. Any ideas what may be the cause?

Running 17.04, standard emacs package.

Example:

example


Solution 1:

I had the same problem and solved it by changing the GTK theme from Ambiance that is default for Ubunty to Adwaita the default for Gnome. One may change the GTK theme installing gnome-tweaks. I think this is a persistent problem with Ubuntu default theme and Emacs and affects a few of the latest versions of both.

Solution 2:

Not an optimal solution, but you can make the scroll bar background non-transparent as a workaround. That will make it visible (albeit slightly glitched) without changing its behavior notably in other apps.

To do this, you need to create a new theme with a slightly tweaked CSS file:

$ cp -r /usr/share/themes/Ambiance ~/.themes/AmbianceWithScrollbars
$ cd ~/.themes/AmbianceWithScrollbars
$ sed -i 's/Ambiance/AmbianceWithScrollbars/' index.theme

Now open gtk-3.20/gtk-widgets.css, scroll to the .scrollbar.contents, scrollbar contents selector, and replace background-color: transparent; with background-color: @backdrop_selected_bg_color; (or any color you like such as white, rgb(200, 200, 200) or @bg_color) Finally, apply the new theme:

$ gsettings set org.gnome.desktop.interface gtk-theme AmbianceWithScrollbars

There will still be minor artifacts due to the slider (you can disable it if you like) but the main scrollbar area WILL be refreshed properly.

Alternatively you can just tweak that line in-place in the default theme, although that change will be overwritten once the theme package is updated.

PS I know there's a stylesheet for GTK at ~/.config/gtk-3.20/.. but for some reason I couldn't make it work that way. :(