X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTApplication.java;h=ec93629b0b17f9584336ff855f0d1010660121be;hb=bfa37f3b2ef87d39c15fad7d565c00cbabd92acf;hp=bffe38e455f13658b4c7988c776e4c6af8d9b12a;hpb=e820d5dd4e52a787e7f53f6409bb6ff334c3ef7b;p=fanfix.git diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index bffe38e..ec93629 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -294,6 +294,11 @@ public class TApplication implements Runnable { */ private List invokeLaters = new LinkedList(); + /** + * 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 @@ -924,7 +929,7 @@ public class TApplication implements Runnable { openImage(); return true; } - if (menu.getId() == TMenu.MID_CHANGE_FONT) { + if (menu.getId() == TMenu.MID_SCREEN_OPTIONS) { new TFontChooserWindow(this); return true; } @@ -1025,8 +1030,14 @@ public class TApplication implements Runnable { 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; @@ -1712,12 +1723,12 @@ public class TApplication implements Runnable { } } } - assert (cell.getWidth() == Cell.Width.RIGHT); - - if (x > 0) { - Cell leftHalf = getScreen().getCharXY(x - 1, y); - if (leftHalf.getWidth() == Cell.Width.LEFT) { - invertCell(x - 1, y, true); + if (cell.getWidth() == Cell.Width.RIGHT) { + if (x > 0) { + Cell leftHalf = getScreen().getCharXY(x - 1, y); + if (leftHalf.getWidth() == Cell.Width.LEFT) { + invertCell(x - 1, y, true); + } } } } @@ -3121,7 +3132,7 @@ public class TApplication implements Runnable { TMenu toolMenu = addMenu(i18n.getString("toolMenuTitle")); toolMenu.addDefaultItem(TMenu.MID_REPAINT); toolMenu.addDefaultItem(TMenu.MID_VIEW_IMAGE); - toolMenu.addDefaultItem(TMenu.MID_CHANGE_FONT); + toolMenu.addDefaultItem(TMenu.MID_SCREEN_OPTIONS); TStatusBar toolStatusBar = toolMenu.newStatusBar(i18n. getString("toolMenuStatus")); toolStatusBar.addShortcutKeypress(kbF1, cmHelp, i18n.getString("Help"));