Skip to content

Commit 0f5a4d0

Browse files
committed
some glfw fixes and bump version
1 parent f15c4f5 commit 0f5a4d0

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/include/sndx/data/version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <string>
44

55
#define SNDXLIB_MAJOR 0
6-
#define SNDXLIB_MINOR 2
6+
#define SNDXLIB_MINOR 3
77
#define SNDXLIB_PATCH 1
88

99
#define SNDX_AS_STRING(macro) #macro

src/include/sndx/glfw/mouse.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ namespace sndx::glfw {
2525
explicit Cursor(int shape) noexcept :
2626
m_cursor(glfwCreateStandardCursor(shape)) {}
2727

28-
Cursor(const render::ImageData& img, int xhot, int yhot) noexcept {
28+
Cursor(const render::ImageData& img, int xhot, int yhot) {
2929
if (img.channels() == 4) {
3030
GLFWimage gimg{
3131
int(img.width()), int(img.height()), (unsigned char*)(img.data())
3232
};
3333

3434
m_cursor = glfwCreateCursor(&gimg, xhot, yhot);
3535
}
36+
else [[unlikely]] {
37+
throw std::logic_error("Provided cursor image does not have 4 channels");
38+
}
3639
}
3740

3841
Cursor(const Cursor&) = delete;

src/include/sndx/glfw/window.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <stdexcept>
1212
#include <optional>
1313
#include <unordered_map>
14+
#include <utility>
1415

1516

1617
namespace sndx::glfw {
@@ -289,9 +290,17 @@ namespace sndx::glfw {
289290
[[nodiscard]]
290291
auto build() const {
291292
bool visible = !m_hints || m_hints->getHintOr(GLFW_VISIBLE, GLFW_TRUE) == GLFW_TRUE;
293+
294+
if (m_hints) {
295+
m_hints->apply();
296+
}
297+
292298
if (!visible || this->m_xpos || this->m_ypos) {
293299
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
294300
}
301+
else {
302+
glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE);
303+
}
295304

296305
auto window = glfwCreateWindow(this->m_width, this->m_height, this->m_title.c_str(), m_monitor, m_share);
297306
if (!window)

0 commit comments

Comments
 (0)