From 845d06e7fca92ca850825705fceabe83f8c0fda8 Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sun, 13 Oct 2024 20:49:42 -0300 Subject: [PATCH] lcdui: Display: Formatting changes, drop hideNotify call as well 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. --- src/javax/microedition/lcdui/Display.java | 48 +++++++---------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/src/javax/microedition/lcdui/Display.java b/src/javax/microedition/lcdui/Display.java index ad803f1b..9f147301 100644 --- a/src/javax/microedition/lcdui/Display.java +++ b/src/javax/microedition/lcdui/Display.java @@ -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; @@ -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 { @@ -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) { } @@ -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; } @@ -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(); @@ -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)