wl_seat: send frame event after pointer leave (#6074)

This commit is contained in:
Sungyoon Cho 2024-05-15 20:17:56 +09:00 committed by GitHub
parent 94c20a1863
commit 31890026ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -186,10 +186,13 @@ void CSeatManager::setPointerFocus(wlr_surface* surf, const Vector2D& local) {
}
}
auto lastPointerFocusResource = state.pointerFocusResource;
state.pointerFocusResource.reset();
state.pointerFocus = surf;
if (!surf) {
sendPointerFrame(lastPointerFocusResource);
events.pointerFocusChange.emit();
return;
}
@ -209,6 +212,11 @@ void CSeatManager::setPointerFocus(wlr_surface* surf, const Vector2D& local) {
}
}
if (state.pointerFocusResource != lastPointerFocusResource)
sendPointerFrame(lastPointerFocusResource);
sendPointerFrame();
hyprListener_pointerSurfaceDestroy.initCallback(
&surf->events.destroy, [this](void* owner, void* data) { setPointerFocus(nullptr, {}); }, nullptr, "CSeatManager");
@ -245,7 +253,14 @@ void CSeatManager::sendPointerFrame() {
if (!state.pointerFocusResource)
return;
for (auto& p : state.pointerFocusResource->pointers) {
sendPointerFrame(state.pointerFocusResource);
}
void CSeatManager::sendPointerFrame(WP<CWLSeatResource> pResource) {
if (!pResource)
return;
for (auto& p : pResource->pointers) {
if (!p)
continue;

View File

@ -63,6 +63,7 @@ class CSeatManager {
void sendPointerMotion(uint32_t timeMs, const Vector2D& local);
void sendPointerButton(uint32_t timeMs, uint32_t key, wl_pointer_button_state state);
void sendPointerFrame();
void sendPointerFrame(WP<CWLSeatResource> pResource);
void sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double value, int32_t discrete, wl_pointer_axis_source source, wl_pointer_axis_relative_direction relative);
void sendTouchDown(wlr_surface* surf, uint32_t timeMs, int32_t id, const Vector2D& local);