mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix: the touchpad moves a game's own cursor when it locks the pointer (#772)
This commit is contained in:
1 parent
48adf4d1ff
commit
3ad5f936bf
2 files changed
+32
-2
No files matched your search
@@ -2194,6 +2194,7 @@ struct constraint {
|
||||
int pending_region_set;
|
||||
int hint_set, pending_hint_set;
|
||||
double hint_x, hint_y, pending_hint_x, pending_hint_y;
|
||||
int gave_keys;
|
||||
};
|
||||
static struct wl_list g_constraints;
|
||||
static struct constraint *g_active_constraint;
|
||||
@@ -2272,6 +2273,14 @@ static void constraint_end(struct constraint *k, int tell_client, const char *wh
|
||||
g_ptr_y = oy + k->hint_y;
|
||||
}
|
||||
g_raw_valid = 0;
|
||||
if (k->gave_keys) {
|
||||
k->gave_keys = 0;
|
||||
for (int i = 0; i < g_nkbs; i++) {
|
||||
if (!k->surface || g_kbs[i].focus != k->surface->resource) continue;
|
||||
wl_keyboard_send_leave(g_kbs[i].kb, wl_display_next_serial(g_display), g_kbs[i].focus);
|
||||
g_kbs[i].focus = NULL;
|
||||
}
|
||||
}
|
||||
if (tell_client) constraint_send_state(k, 0);
|
||||
constraint_describe(k, name, sizeof(name));
|
||||
droiddeck_log("pointer", "%s: %s (%s), pointer at %d,%d", k->is_lock ? "unlocked" : "unconfined",
|
||||
@@ -2290,6 +2299,12 @@ static void constraint_activate(struct constraint *k) {
|
||||
if (!k->is_lock) confine_clamp(k, &g_ptr_x, &g_ptr_y);
|
||||
constraint_origin(k, &ox, &oy);
|
||||
pointer_focus(k->surface->resource, wl_fixed_from_double(g_ptr_x - ox), wl_fixed_from_double(g_ptr_y - oy));
|
||||
int focused = 0;
|
||||
for (int i = 0; i < g_nkbs; i++) if (g_kbs[i].focus) focused = 1;
|
||||
if (k->is_lock && !focused && keyboard_for(wl_resource_get_client(k->surface->resource))) {
|
||||
keyboard_focus(k->surface->resource);
|
||||
k->gave_keys = 1;
|
||||
}
|
||||
constraint_send_state(k, 1);
|
||||
constraint_describe(k, name, sizeof(name));
|
||||
if (k->is_lock)
|
||||
|
||||
Reference in new issue
Block a user