Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wl_seat: send frame event after pointer leave #6074

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/managers/SeatManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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");

Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/managers/SeatManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading