X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTApplication.java;h=ee2e9de86664a04a238070b40637dff35a393176;hb=051e29138b18fb4b731a72f8727475b10e4c74e4;hp=f802e2bcbfffccf27af84216543ff94adeb6b8d6;hpb=43ad7b6c509c45c8f261e77ea059c10fed8c9f1c;p=fanfix.git diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index f802e2b..ee2e9de 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -1384,8 +1384,16 @@ public class TApplication implements Runnable { System.currentTimeMillis(), Thread.currentThread(), x, y); } CellAttributes attr = getScreen().getAttrXY(x, y); - attr.setForeColor(attr.getForeColor().invert()); - attr.setBackColor(attr.getBackColor().invert()); + if (attr.getForeColorRGB() < 0) { + attr.setForeColor(attr.getForeColor().invert()); + } else { + attr.setForeColorRGB(attr.getForeColorRGB() ^ 0x00ffffff); + } + if (attr.getBackColorRGB() < 0) { + attr.setBackColor(attr.getBackColor().invert()); + } else { + attr.setBackColorRGB(attr.getBackColorRGB() ^ 0x00ffffff); + } getScreen().putAttrXY(x, y, attr, false); } @@ -1902,11 +1910,12 @@ public class TApplication implements Runnable { } /** - * Add a window to my window list and make it active. + * Add a window to my window list and make it active. Note package + * private access. * * @param window new window to add */ - public final void addWindowToApplication(final TWindow window) { + final void addWindowToApplication(final TWindow window) { // Do not add menu windows to the window list. if (window instanceof TMenu) { @@ -1919,6 +1928,11 @@ public class TApplication implements Runnable { } synchronized (windows) { + if (windows.contains(window)) { + throw new IllegalArgumentException("Window " + window + + " is already in window list"); + } + // Whatever window might be moving/dragging, stop it now. for (TWindow w: windows) { if (w.inMovements()) {