In `internal/uidriver/glfw/run_notsinglethread.go`, if the `UserInterface.init()` function returns an error, the `loop` is
executed regardless and the error is discarded. This behavior will hide the error returned by `init()` and might trigger
some crashes (see #1688).
A partial fix was implemented in 6c4edf8 , however that commit alone is not enough: the code now is correctly returning
the error via the `ch` channel, but it still executes the `loop()` function. This merge request skips `loop()` call if `init()`
had an error.
Updates #1688
IsWindowBeingClosed reports whether the window is being closed by
the user.
SetWindowClosingHandled sets whether the window closing is handled
or not. If the state is true, the window is not closed immediately
by the user and the game can handle the closing state. In this case,
the Update function should return an error in order to end the game.
This change also adds examples/windowclosing.
Closes#1574
Callbacks created by NewCallbackCDecl were never released and then
they are leaked, especially when the window size was changed by
SetWindowSize on Windows.
This change defines new callback ID types with uintptr, and reuse
the callbacks.
Closes#1672
glfw.PollEvents might invoke multiple FramebufferSize callbacks in
theory, this is very rare though. In this case, the sending an object
to the channel never ends.
This change fixes this deadlock by using 'select'.
Closes#1618
When the window is fullscreen, calling MaximizeWindow never returned.
Apparently the attribute glfw.Maximized can never be true on the
fullscreen mode.
This change fixes the issue by checking the fullscreen state.
On Linux (and probably other UNIX OSes), glfwRestore, glfwMaximize,
and glfwIconify returns even though the window state has not changed.
Wait for its finish by a for loop and glfw.PollEvents.
Closes#1608
At the initial phase, GLFW window's GetSize seems unreliable. Do not
call it on Linux. On the other hand, this is still necessary on macOS.
Updates #1606Closes#1609
Before this change, setWindowSize converts the size in device-
independent pixels once, invokes adjustWindowSizeBasedOnSizeLimitsInDP,
and then restore the values in device-dependent pixels. This might
introduce a slight error and then SetSize be unexpectedly invoked.
Such SetSize call with a slightly different size might not invoke
the FramebufferSize callback, and then this blocked forever when
maximizing the window.
This change fixes this by adjusting the size limits instead of the
window size so that the window size is not modified unexpectedly.
Closes#1577
At least on macOS, Maximize invokes the SetSize callback in the game's
Update. This change fixes this issue by unregisting the callback
temporarily like what #1505 did.
Closes#1576
This change adds APIs to enable to use system cursor shapes other
than the default shape (an arrow).
This change doesn't add these cursors since they seem a little
different on macOS from the other platforms.
* GLFW_HRESIZE_CURSOR
* GLFW_VRESIZE_CURSOR
Closes#995
Before the initialization finishes, AdjustPosition could return Inf
values and in this case AdjustPosition's returning values don't make
sense. Let's return NaN in this case.
Closes#1545