Mercurial > cgi-bin > hgweb.cgi > ClipMan
comparison src/name/blackcap/clipman/PasteboardQueue.kt @ 67:d35b8478e089 default tip
Remove redundant event dispatch thread task submissions.
author | David Barts <n5jrn@me.com> |
---|---|
date | Sun, 12 Jan 2025 16:26:11 -0800 |
parents | 19d9da731c43 |
children |
comparison
equal
deleted
inserted
replaced
66:a8b04aa874e3 | 67:d35b8478e089 |
---|---|
53 /** | 53 /** |
54 * Add a QueueItem to the end of the queue. | 54 * Add a QueueItem to the end of the queue. |
55 * @param item QueueItem to add | 55 * @param item QueueItem to add |
56 */ | 56 */ |
57 @Synchronized fun add(item: QueueItem) { | 57 @Synchronized fun add(item: QueueItem) { |
58 inSwingThread { | 58 parent.add(item.view.contents) |
59 parent.add(item.view.contents) | 59 validate() |
60 validate() | |
61 } | |
62 queue.addLast(item) | 60 queue.addLast(item) |
63 truncate() | 61 truncate() |
64 } | 62 } |
65 | 63 |
66 /** | 64 /** |
147 if (_maxSize > 0) { | 145 if (_maxSize > 0) { |
148 var size = queue.size | 146 var size = queue.size |
149 var dirty = false | 147 var dirty = false |
150 while (size > _maxSize) { | 148 while (size > _maxSize) { |
151 var extra = queue.removeFirst().view | 149 var extra = queue.removeFirst().view |
152 inSwingThread { | 150 if (extra.searchable.selected) { |
153 if (extra.searchable.selected) { | 151 Application.anyRequired.disable() |
154 Application.anyRequired.disable() | 152 Application.styledRequired.disable() |
155 Application.styledRequired.disable() | |
156 } | |
157 parent.remove(extra.contents) | |
158 } | 153 } |
154 parent.remove(extra.contents) | |
159 dirty = true | 155 dirty = true |
160 size -= 1 | 156 size -= 1 |
161 } | 157 } |
162 if (dirty) { | 158 if (dirty) { |
163 inSwingThread { validate() } | 159 validate() |
164 } | 160 } |
165 } | 161 } |
166 } | 162 } |
167 | 163 |
168 private fun validate() | 164 private fun validate() |