- Timestamp:
- 09/17/18 11:36:12 (6 years ago)
- Location:
- trunk/src/org/expeditee/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Browser.java
r1117 r1140 183 183 } 184 184 185 MessageBay.showDelayedMessages();185 DisplayController.requestRefresh(false, () -> { MessageBay.showDelayedMessages(); return true; }); 186 186 } 187 187 … … 243 243 Text.InitFonts(); 244 244 245 Frame userProfile = loadProfiles(); 245 246 Settings.Init(); 246 Frame userProfile = loadProfiles();247 247 248 248 // Listen for save status to display during and after runtime -
trunk/src/org/expeditee/gui/DisplayController.java
r1137 r1140 26 26 import java.util.List; 27 27 import java.util.Stack; 28 import java.util.function.BooleanSupplier; 28 29 29 30 import org.expeditee.core.Clip; … … 1225 1226 * requestRefresh(boolean) to ensure no infinite refresh call loops are created. 1226 1227 */ 1227 private static voidrefresh(boolean useInvalidation)1228 private static boolean refresh(boolean useInvalidation) 1228 1229 { 1229 1230 Frame currentFrame = getCurrentFrame(); 1230 1231 if(currentFrame == null) { 1231 return; 1232 } 1232 return false; 1233 } 1234 //For Monday; at this point, the DisplayController is ready to do something 1235 //RequestRefesh could have a callback method 1233 1236 1234 1237 // Always get the clip as it clears at the same time … … 1236 1239 1237 1240 // No damaged areas 1238 if (useInvalidation && clip.isFullyClipped()) return ;1241 if (useInvalidation && clip.isFullyClipped()) return true; 1239 1242 1240 1243 GraphicsManager g = EcosystemManager.getGraphicsManager(); … … 1306 1309 g.popDrawingSurface(); 1307 1310 g.drawImage(_refreshBuffer, Point.ORIGIN); 1311 return true; 1308 1312 } 1309 1313 … … 1371 1375 /** Runnable which ensures overlapping refresh requests are joined. */ 1372 1376 private static RenderRequestMarsheller _requestMarsheller = new RenderRequestMarsheller(); 1373 1377 1374 1378 /** 1375 1379 * If wanting to refresh from another thread - other than the main thread … … 1377 1381 * Use this method for thread safety. 1378 1382 */ 1379 public static synchronized void requestRefresh(boolean useInvalidation) 1380 { 1383 public static synchronized void requestRefresh(boolean useInvalidation) { 1384 requestRefresh(useInvalidation, () -> false); 1385 } 1386 1387 public static synchronized void requestRefresh(final boolean useInvalidation, final BooleanSupplier callback) { 1381 1388 try { 1382 _requestMarsheller.enqueue(useInvalidation );1389 _requestMarsheller.enqueue(useInvalidation, callback); 1383 1390 } catch (Throwable e) { 1384 1391 e.printStackTrace(); … … 1398 1405 private Boolean _requeueWithInvalidation = null; 1399 1406 private Object _lock = new Object(); 1407 private BooleanSupplier callback; 1400 1408 1401 1409 /** Enqueues a redraw on the GIO thread, or remembers to do so once the current redraw finishes. */ 1402 public void enqueue( boolean useInvalidation)1410 public void enqueue(final boolean useInvalidation, final BooleanSupplier callback) 1403 1411 { 1404 1412 synchronized (_lock) { 1405 1413 if (!_enqueued) { 1406 1414 _enqueued = true; 1415 this.callback = callback; 1407 1416 _useInvalidation = useInvalidation; 1408 1417 EcosystemManager.getMiscManager().runOnGIOThread(this); … … 1416 1425 { 1417 1426 try { 1418 refresh(_useInvalidation); 1427 if(refresh(_useInvalidation) && callback != null) { 1428 callback.getAsBoolean(); 1429 callback = null; 1430 } 1419 1431 } catch (Throwable e) { 1420 1432 e.printStackTrace();
Note:
See TracChangeset
for help on using the changeset viewer.