Skip to content

Commit 9e69be3

Browse files
committed
Fix: windowing for wayland
1 parent 959e4d4 commit 9e69be3

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

examples/MultiDrawIndirect/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ int main()
192192
App.Run([&]()
193193
{
194194
const float aspectRatio = static_cast<float>(App.Window.Width) / static_cast<float>(App.Window.Height);
195-
if (isnan(aspectRatio)) return;
195+
if (std::isnan(aspectRatio)) return;
196196

197197
glm::mat4 m = glm::scale(glm::mat4(1.0f), glm::vec3(0.05f));
198198
const glm::mat4 mvp = App.MainCamera.GetViewProjectionMatrix(aspectRatio) * m;

src/window.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace EOS
88
/// Setup the error callback
99
glfwSetErrorCallback([](int error, const char* message)
1010
{
11-
//Logger->error("GLFW: {}, {}", error, message);
1211
printf(fmt::format("GLFW: {}, {}", error, message).c_str());
1312
});
1413

@@ -71,8 +70,8 @@ namespace EOS
7170
glfwSetWindowPos(GlfwWindow, x, y);
7271
}
7372

74-
// Get the actual window size and store it
7573
#if defined(EOS_PLATFORM_WINDOWS)
74+
// Get the actual window size and store it
7675
glfwGetFramebufferSize(GlfwWindow, &Width, &Height);
7776
#endif
7877

@@ -89,6 +88,7 @@ namespace EOS
8988
});
9089

9190
glfwSetInputMode(GlfwWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
91+
glfwFocusWindow(GlfwWindow);
9292

9393
#if defined(EOS_PLATFORM_WAYLAND)
9494
contextDescription.Window = static_cast<void*>(glfwGetWaylandWindow(GlfwWindow));
@@ -111,7 +111,6 @@ namespace EOS
111111
void Window::Poll()
112112
{
113113
glfwPollEvents();
114-
glfwGetFramebufferSize(GlfwWindow, &Width, &Height);
115114
}
116115

117116
bool Window::ShouldClose() const
@@ -121,7 +120,8 @@ namespace EOS
121120

122121
bool Window::IsFocused() const
123122
{
124-
return glfwGetWindowAttrib(GlfwWindow, GLFW_FOCUSED);
123+
glfwGetFramebufferSize(GlfwWindow, &Width, &Height);
124+
return Width || Height;
125125
}
126126
}
127127

0 commit comments

Comments
 (0)