git://git.nikiroo.be
/
nikiroo-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e820d5d
)
#37 reduce calls to resizeToScreen
author
Kevin Lamonte
<kevin.lamonte@gmail.com>
Sat, 10 Aug 2019 11:24:32 +0000
(06:24 -0500)
committer
Kevin Lamonte
<kevin.lamonte@gmail.com>
Sat, 10 Aug 2019 11:24:32 +0000
(06:24 -0500)
src/jexer/TApplication.java
patch
|
blob
|
blame
|
history
diff --git
a/src/jexer/TApplication.java
b/src/jexer/TApplication.java
index bffe38e455f13658b4c7988c776e4c6af8d9b12a..fdbc0e39ad964318a801a211a71972f3a7f4bdb0 100644
(file)
--- a/
src/jexer/TApplication.java
+++ b/
src/jexer/TApplication.java
@@
-294,6
+294,11
@@
public class TApplication implements Runnable {
*/
private List<Runnable> invokeLaters = new LinkedList<Runnable>();
*/
private List<Runnable> invokeLaters = new LinkedList<Runnable>();
+ /**
+ * The last time the screen was resized.
+ */
+ private long screenResizeTime = 0;
+
/**
* WidgetEventHandler is the main event consumer loop. There are at most
* two such threads in existence: the primary for normal case and a
/**
* WidgetEventHandler is the main event consumer loop. There are at most
* two such threads in existence: the primary for normal case and a
@@
-1025,8
+1030,14
@@
public class TApplication implements Runnable {
if (event instanceof TResizeEvent) {
TResizeEvent resize = (TResizeEvent) event;
synchronized (getScreen()) {
if (event instanceof TResizeEvent) {
TResizeEvent resize = (TResizeEvent) event;
synchronized (getScreen()) {
- getScreen().setDimensions(resize.getWidth(),
- resize.getHeight());
+ if ((System.currentTimeMillis() - screenResizeTime >= 15)
+ || (resize.getWidth() < getScreen().getWidth())
+ || (resize.getHeight() < getScreen().getHeight())
+ ) {
+ getScreen().setDimensions(resize.getWidth(),
+ resize.getHeight());
+ screenResizeTime = System.currentTimeMillis();
+ }
desktopBottom = getScreen().getHeight() - 1;
mouseX = 0;
mouseY = 0;
desktopBottom = getScreen().getHeight() - 1;
mouseX = 0;
mouseY = 0;