static GlfwApp() { s_windowCloseCb = (GlfwWindowPtr wnd) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { //user can cancel window close here here bool userCancel = false; GlFwForm.InvokeOnClosing(found, ref userCancel); if (userCancel) { return; } //-------------------------------------- latestForm = null; latestGlWindowPtr = IntPtr.Zero; //user let this window close *** Glfw.SetWindowShouldClose(wnd, true); Glfw.DestroyWindow(wnd); //destroy this existingForms.Remove(wnd); exitingFormList.Remove(found); //-------------------------------------- } }; s_windowFocusCb = (GlfwWindowPtr wnd, bool focus) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.SetFocusState(found, focus); } }; s_windowIconifyCb = (GlfwWindowPtr wnd, bool iconify) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.SetIconifyState(found, iconify); } }; s_windowPosCb = (GlfwWindowPtr wnd, int x, int y) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeOnMove(found, x, y); } }; s_windowRefreshCb = (GlfwWindowPtr wnd) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeOnRefresh(found); } }; s_windowSizeCb = (GlfwWindowPtr wnd, int width, int height) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeOnSizeChanged(found, width, height); } }; s_windowCursorPosCb = (GlfwWindowPtr wnd, double x, double y) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeCursorPos(found, x, y); } }; s_windowCursorEnterCb = (GlfwWindowPtr wnd, bool enter) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.SetCursorEnterState(found, enter); } }; s_windowMouseButtonCb = (GlfwWindowPtr wnd, MouseButton btn, KeyActionKind keyAction) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeMouseButton(found, btn, keyAction); } }; s_scrollCb = (GlfwWindowPtr wnd, double xoffset, double yoffset) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeOnScroll(found, xoffset, yoffset); } }; s_windowKeyCb = (GlfwWindowPtr wnd, Key key, int scanCode, KeyActionKind action, KeyModifiers mods) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeKey(found, key, scanCode, action, mods); } }; s_windowCharCb = (GlfwWindowPtr wnd, char ch) => { GlFwForm found; if (GetGlfwForm(wnd, out found)) { GlFwForm.InvokeKeyPress(found, ch); } }; }