mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 00:41:28 +00:00
Fix sway_session_lock_has_surface
Before this commit, if the cursor is at screen center, and the lock is swaylock, the cursor would be at swaylock's subsurface(the indicator). Since it's not the lock surface, `handle_rebase` would refuse to rebase the cursor to there. Thereby the cursor enter event won't be sent to swaylock. This commit fix the issue.
This commit is contained in:
parent
625127d5d3
commit
97c2204a1a
22
sway/lock.c
22
sway/lock.c
|
@ -331,11 +331,31 @@ void sway_session_lock_add_output(struct sway_session_lock *lock,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct is_lock_surface_data {
|
||||||
|
struct wlr_surface *surface;
|
||||||
|
bool is_lock_surface;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void is_lock_surface(struct wlr_surface *surface, int sx, int sy, void *data) {
|
||||||
|
struct is_lock_surface_data *is_lock_surface_data = data;
|
||||||
|
if (is_lock_surface_data->surface == surface) {
|
||||||
|
is_lock_surface_data->is_lock_surface = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool sway_session_lock_has_surface(struct sway_session_lock *lock,
|
bool sway_session_lock_has_surface(struct sway_session_lock *lock,
|
||||||
struct wlr_surface *surface) {
|
struct wlr_surface *surface) {
|
||||||
struct sway_session_lock_output *lock_output;
|
struct sway_session_lock_output *lock_output;
|
||||||
wl_list_for_each(lock_output, &lock->outputs, link) {
|
wl_list_for_each(lock_output, &lock->outputs, link) {
|
||||||
if (lock_output->surface && lock_output->surface->surface == surface) {
|
if (!lock_output->surface) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
struct is_lock_surface_data data = {
|
||||||
|
.surface = surface,
|
||||||
|
.is_lock_surface = false,
|
||||||
|
};
|
||||||
|
wlr_surface_for_each_surface(lock_output->surface->surface, is_lock_surface, &data);
|
||||||
|
if (data.is_lock_surface) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue