[ui] a logic to override "always show thumb" property for transparent buttonless...
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Wed, 28 Oct 2015 15:15:01 +0000 (16:15 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Wed, 28 Oct 2015 15:15:01 +0000 (16:15 +0100)
On GTK+, the thumb fits entire width/height of a scroll bar when visible (see BasicScrollBarUI.layoutVScrollbar()). The fix detects such situations and resets thumb size, thus hiding the thumb when not needed.

platform/platform-api/src/com/intellij/util/ui/ButtonlessScrollBarUI.java

index 11cd115cc7341cf4c9ade80fe4a4d0a412066cd2..51aed0ba748568d195b5139cfc6ad8f66a8c9d09 100644 (file)
@@ -302,6 +302,13 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
    */
   @Override
   protected void setThumbBounds(int x, int y, int width, int height) {
+    if (width > 0 && height > 0 && UIManager.getBoolean("ScrollBar.alwaysShowThumb") && !alwaysShowTrack()) {
+      int w = scrollbar.getWidth(), h = scrollbar.getHeight();
+      if (w > h && w == width || w < h && h == height) {
+        x = y = width = height = 0;
+      }
+    }
+
     if (myRepaintCallback == null) {
       super.setThumbBounds(x, y, width, height);
     }