Skip to content

Commit

Permalink
Bugfix - Regression: PR #445 caused a blank screen on startup (#456)
Browse files Browse the repository at this point in the history
* Add back 'needsRender' in the more limited 'isFirstRender' form

* Formatting

* Switch from ref -> mutable to match other fields
  • Loading branch information
bryphe authored Apr 13, 2019
1 parent 1f36278 commit 3de4d76
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Core/App.re
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let noop = () => ();
type t('s, 'a) = {
mutable windows: list(Window.t),
mutable idleCount: int,
mutable isFirstRender: bool,
onIdle: idleFunc,
};

Expand Down Expand Up @@ -46,7 +47,12 @@ let _checkAndCloseWindows = (app: t('s, 'a)) => {
};

let start = (~onIdle=noop, initFunc: appInitFunc('s, 'a)) => {
let appInstance: t('s, 'a) = {windows: [], idleCount: 0, onIdle};
let appInstance: t('s, 'a) = {
windows: [],
idleCount: 0,
isFirstRender: true,
onIdle,
};

let _ = Glfw.glfwInit();
let _ = initFunc(appInstance);
Expand All @@ -57,10 +63,11 @@ let start = (~onIdle=noop, initFunc: appInitFunc('s, 'a)) => {

_checkAndCloseWindows(appInstance);

if (_anyWindowsDirty(appInstance)) {
if (appInstance.isFirstRender || _anyWindowsDirty(appInstance)) {
Performance.bench("renderWindows", () => {
List.iter(w => Window.render(w), getWindows(appInstance));
appInstance.idleCount = 0;
appInstance.isFirstRender = false;
});
} else {
appInstance.idleCount = appInstance.idleCount + 1;
Expand Down

0 comments on commit 3de4d76

Please sign in to comment.