changeset 46:88066346f129

Fix display glitch when resizing queue truncates it.
author David Barts <n5jrn@me.com>
date Mon, 10 Feb 2020 16:40:09 -0700
parents ca8a23bae4fa
children 19d9da731c43
files src/name/blackcap/clipman/PasteboardQueue.kt
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/name/blackcap/clipman/PasteboardQueue.kt	Mon Feb 10 06:55:07 2020 -0700
+++ b/src/name/blackcap/clipman/PasteboardQueue.kt	Mon Feb 10 16:40:09 2020 -0700
@@ -57,10 +57,7 @@
     @Synchronized fun add(item: QueueItem) {
         inSwingThread {
             parent.add(item.view.contents)
-            scrollPane?.run {
-                validate()
-                verticalScrollBar.run { value = maximum + 1 }
-            }
+            validate()
         }
         queue.addLast(item)
         truncate()
@@ -163,7 +160,19 @@
                 size -= 1
             }
             if (dirty) {
-                inSwingThread { parent.validate() }
+                inSwingThread { validate() }
+            }
+        }
+    }
+
+    private fun validate()
+    {
+        if (scrollPane == null) {
+            parent.validate()
+        } else {
+            scrollPane!!.run {
+                validate()
+                verticalScrollBar.run { value = maximum + 1 }
             }
         }
     }