diff --git a/wayland_adapter/framework/core/wayland_pointer.cpp b/wayland_adapter/framework/core/wayland_pointer.cpp index 999b5cf8561992058075db7feeee662b68d42b2b..1c096541ce5e50b680a0389e123ae8a001afec36 100644 --- a/wayland_adapter/framework/core/wayland_pointer.cpp +++ b/wayland_adapter/framework/core/wayland_pointer.cpp @@ -67,6 +67,7 @@ void WaylandPointer::OnPointerButton(uint32_t time, uint32_t button, bool isPres uint32_t serial = wl_display_next_serial(display); uint32_t state = isPressed ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED; wl_pointer_send_button(pointer, serial, time, button, state); + wl_pointer_send_frame(pointer); } void WaylandPointer::OnPointerMotionAbsolute(uint32_t time, int32_t posX, int32_t posY) @@ -79,6 +80,7 @@ void WaylandPointer::OnPointerMotionAbsolute(uint32_t time, int32_t posX, int32_ } wl_pointer_send_motion(pointer, time, posFixedX, posFixedY); + wl_pointer_send_frame(pointer); } void WaylandPointer::OnPointerLeave(struct wl_resource *surface_resource) diff --git a/wayland_adapter/framework/core/wayland_surface.cpp b/wayland_adapter/framework/core/wayland_surface.cpp index 84ab33939b6d75b0dba70d4d83994cb1e12243f3..d8ac89176780b4dcf7dd97b88d1218aae0d26c0d 100644 --- a/wayland_adapter/framework/core/wayland_surface.cpp +++ b/wayland_adapter/framework/core/wayland_surface.cpp @@ -414,6 +414,14 @@ void WaylandSurface::Offset(int32_t x, int32_t y) } void WaylandSurface::HandleCommit() { + int32_t timeMs = 0; + struct timespec ts = { 0, 0 }; + if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { + timeMs = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000); + } else { + LOG_ERROR("failed to clock_gettime"); + } + if (new_.buffer != nullptr) { wl_shm_buffer *shm = wl_shm_buffer_get(new_.buffer); if (shm == nullptr) { @@ -426,16 +434,16 @@ void WaylandSurface::HandleCommit() { CopyBuffer(shm); wl_shm_buffer_end_access(shm); - wl_callback_send_done(new_.buffer, 0); + wl_callback_send_done(new_.buffer, timeMs); new_.buffer = nullptr; } if (new_.cb != nullptr) { - wl_callback_send_done(new_.cb->WlResource(), 0); + wl_callback_send_done(new_.cb->WlResource(), timeMs); wl_resource_destroy(new_.cb->WlResource()); new_.cb = nullptr; for (auto &cb : pengindCb_) { - wl_callback_send_done(cb->WlResource(), 0); + wl_callback_send_done(cb->WlResource(), timeMs); wl_resource_destroy(cb->WlResource()); } pengindCb_.clear();