* @param y row position
*/
private void invertCell(final int x, final int y) {
- synchronized (getScreen()) {
- CellAttributes attr = getScreen().getAttrXY(x, y);
- attr.setForeColor(attr.getForeColor().invert());
- attr.setBackColor(attr.getBackColor().invert());
- getScreen().putAttrXY(x, y, attr, false);
+ if (debugThreads) {
+ System.err.printf("invertCell() %d %d\n", x, y);
}
+ CellAttributes attr = getScreen().getAttrXY(x, y);
+ attr.setForeColor(attr.getForeColor().invert());
+ attr.setBackColor(attr.getBackColor().invert());
+ getScreen().putAttrXY(x, y, attr, false);
}
/**
}
if (!repaint) {
- if ((oldMouseX != mouseX) || (oldMouseY != mouseY)) {
- // The only thing that has happened is the mouse moved.
- // Clear the old position and draw the new position.
- invertCell(oldMouseX, oldMouseY);
- invertCell(mouseX, mouseY);
- oldMouseX = mouseX;
- oldMouseY = mouseY;
+ if (debugThreads) {
+ System.err.printf("drawAll() !repaint\n");
}
- if (getScreen().isDirty()) {
- backend.flushScreen();
+ synchronized (getScreen()) {
+ if ((oldMouseX != mouseX) || (oldMouseY != mouseY)) {
+ // The only thing that has happened is the mouse moved.
+ // Clear the old position and draw the new position.
+ invertCell(oldMouseX, oldMouseY);
+ invertCell(mouseX, mouseY);
+ oldMouseX = mouseX;
+ oldMouseY = mouseY;
+ }
+ if (getScreen().isDirty()) {
+ backend.flushScreen();
+ }
+ return;
}
- return;
}
if (debugThreads) {
// Draw the mouse pointer
invertCell(mouseX, mouseY);
+ oldMouseX = mouseX;
+ oldMouseY = mouseY;
// Place the cursor if it is visible
TWidget activeWidget = null;
}
// Flush the screen contents
- backend.flushScreen();
+ if (getScreen().isDirty()) {
+ backend.flushScreen();
+ }
repaint = false;
}
// wait until either the backend or the consumer threads have
// something to do.
try {
+ if (debugThreads) {
+ System.err.println("sleep " + timeout + " millis");
+ }
synchronized (this) {
this.wait(timeout);
}