Skip to content

Commit

Permalink
lcdui: Display: Formatting changes, drop hideNotify call as well
Browse files Browse the repository at this point in the history
I don't know if that call is really necessary, all i've seen it
do so far is break Harry Potter - Find Scabbers (Motorola, 176x208)
which was crashing before even reaching the menu.
  • Loading branch information
AShiningRay committed Oct 13, 2024
1 parent dcc0c8b commit 845d06e
Showing 1 changed file with 14 additions and 34 deletions.
48 changes: 14 additions & 34 deletions src/javax/microedition/lcdui/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class Display
public static final int COLOR_BORDER = 4;
public static final int COLOR_HIGHLIGHTED_BORDER = 5;


private Displayable current;

private static Display display;
Expand Down Expand Up @@ -77,11 +76,8 @@ public Display()
public void callSerially(Runnable r)
{
LCDUILock.lock();
try {
serialCalls.add(r);
} finally {
LCDUILock.unlock();
}
try { serialCalls.add(r); }
finally { LCDUILock.unlock(); }
}
private class SerialCallTimerTask extends TimerTask
{
Expand All @@ -94,13 +90,12 @@ public void run()
synchronized (calloutLock)
{
LCDUILock.lock();
try {
try
{
Runnable call = serialCalls.get(0);
serialCalls.removeElementAt(0);
call.run();
} finally {
LCDUILock.unlock();
}
} finally { LCDUILock.unlock(); }
}
}
catch (Exception e) { }
Expand All @@ -121,10 +116,7 @@ public int getBestImageHeight(int imageType)
return Mobile.getPlatform().lcdHeight;
}

public int getBestImageWidth(int imageType)
{
return Mobile.getPlatform().lcdWidth;
}
public int getBestImageWidth(int imageType) { return Mobile.getPlatform().lcdWidth; }

public int getBorderStyle(boolean highlighted) { return 0; }

Expand Down Expand Up @@ -154,30 +146,20 @@ public int getColor(int colorSpecifier)

public void setCurrent(Displayable next)
{
if (next == null){
return;
}
if (next == null){ return; }
if (current == next || insideSetCurrent) { return; }

LCDUILock.lock();
try {
if (current == next || insideSetCurrent)
{
return;
}

try
{
try
{
insideSetCurrent = true;

try {
if (current != null) {
current.hideNotify();
}
try
{
Mobile.getPlatform().keyState = 0; // reset keystate
next.showNotify();
} finally {
insideSetCurrent = false;
}
} finally { insideSetCurrent = false; }

current = next;
current.notifySetCurrent();
Expand All @@ -189,9 +171,7 @@ public void setCurrent(Displayable next)
System.out.println("Problem with setCurrent(next)");
e.printStackTrace();
}
} finally {
LCDUILock.unlock();
}
} finally { LCDUILock.unlock(); }
}

public void setCurrent(Alert alert, Displayable next)
Expand Down

0 comments on commit 845d06e

Please sign in to comment.