Skip to content

Commit

Permalink
fix wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Aug 8, 2024
1 parent 4f88c28 commit 601352d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/ruisapp/glue/linux/glue_wayland.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,9 @@ struct window_wrapper : public utki::destructable {

void swap_frame_buffers()
{
// std::cout << "eglSwapBuffers" << std::endl;
eglSwapBuffers(this->egl_display, this->egl_surface);
// std::cout << "eglSwapBuffers done" << std::endl;
}
} egl_context;

Expand Down Expand Up @@ -2321,7 +2323,10 @@ application::application(std::string name, const window_params& wp) :
void application::swap_frame_buffers()
{
auto& ww = get_impl(this->window_pimpl);

// std::cout << "swap framebuffers" << std::endl;
ww.egl_context.swap_frame_buffers();
// std::cout << "framebuffers swapped" << std::endl;
}

void application::set_mouse_cursor_visible(bool visible)
Expand Down Expand Up @@ -2385,6 +2390,13 @@ int main(int argc, const char** argv)
while (!ww.quit_flag.load()) {
// std::cout << "loop" << std::endl;

// sequence:
// - update updateables
// - render
// - wait for events/next cycle
auto to_wait_ms = app.gui.update();
render(app);

// prepare wayland queue for waiting for events
while (wl_display_prepare_read(ww.display.disp) != 0) {
// there are events in wayland queue, dispatch them, as we need empty queue
Expand Down Expand Up @@ -2412,12 +2424,8 @@ int main(int argc, const char** argv)
wait_set.change(ww.waitable, {opros::ready::read}, &ww.waitable);
}

// sequence:
// - update updateables
// - render
// - wait for events/next cycle
auto to_wait_ms = app.gui.update();
render(app);
// std::cout << "wait for " << to_wait_ms << "ms" << std::endl;

wait_set.wait(to_wait_ms);

// std::cout << "waited" << std::endl;
Expand Down

0 comments on commit 601352d

Please sign in to comment.