- Drop text-input and keyboard focus references when a client destroys a wl_surface, without sending leave for it - Skip wl_keyboard.leave and zwp_text_input_v3.leave/enter for surfaces the client no longer has - Skip pointer enter/leave for missing subsurfaces or toplevels - Add a regression test: closing a second toplevel (e.g. OAuth popup) must return focus to the main window without leaving stale events
This commit is contained in:
1 parent
444d67ac79
commit
aa92aaac6f
3 files changed
+128
-16
No files matched your search
@@ -737,6 +737,10 @@ fn WaylandServer::dispatch_msg(
|
||||
}
|
||||
}
|
||||
self.dnd_icon_gone(c, sid, events)
|
||||
text_inputs_surface_gone(c, sid)
|
||||
if self.kbd_surface == Some((c.client_id, sid)) {
|
||||
self.kbd_surface = None
|
||||
}
|
||||
c.surfaces.remove(sid)
|
||||
c.objects.remove(sid)
|
||||
send_delete_id(c, sid)
|
||||
@@ -1974,16 +1978,21 @@ fn fixed(v : Double) -> Int {
|
||||
pub fn WaylandServer::pointer_enter(self : WaylandServer, win_id : UInt64, x : Double, y : Double, sub? : UInt = 0U) -> Unit {
|
||||
match self.win_client(win_id) {
|
||||
None => ()
|
||||
Some((c, tl)) =>
|
||||
Some((c, tl)) => {
|
||||
let target = if sub != 0U && c.surfaces.contains(sub) { sub } else { tl.wl_surface_id }
|
||||
if !c.surfaces.contains(target) {
|
||||
return
|
||||
}
|
||||
for pid in c.pointer_ids {
|
||||
let w = WireWriter::new()
|
||||
w.u32(self.next_serial())
|
||||
w.u32(if sub != 0U && c.surfaces.contains(sub) { sub } else { tl.wl_surface_id })
|
||||
w.u32(target)
|
||||
w.i32(fixed(x))
|
||||
w.i32(fixed(y))
|
||||
c.send_msg(w.finish_msg(pid, 0U))
|
||||
self.pointer_frame(c, pid)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1991,17 +2000,19 @@ pub fn WaylandServer::pointer_enter(self : WaylandServer, win_id : UInt64, x : D
|
||||
pub fn WaylandServer::pointer_leave(self : WaylandServer, win_id : UInt64, sub? : UInt = 0U) -> Unit {
|
||||
match self.win_client(win_id) {
|
||||
None => ()
|
||||
Some((c, tl)) =>
|
||||
Some((c, tl)) => {
|
||||
let target = if sub != 0U { sub } else { tl.wl_surface_id }
|
||||
if !c.surfaces.contains(target) {
|
||||
return
|
||||
}
|
||||
for pid in c.pointer_ids {
|
||||
if sub != 0U && !c.surfaces.contains(sub) {
|
||||
continue // the subsurface is gone: nothing to leave
|
||||
}
|
||||
let w = WireWriter::new()
|
||||
w.u32(self.next_serial())
|
||||
w.u32(if sub != 0U { sub } else { tl.wl_surface_id })
|
||||
w.u32(target)
|
||||
c.send_msg(w.finish_msg(pid, 1U))
|
||||
self.pointer_frame(c, pid)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2089,6 +2100,9 @@ pub fn WaylandServer::keyboard_enter(self : WaylandServer, win_id : UInt64) -> U
|
||||
match self.win_client(win_id) {
|
||||
None => ()
|
||||
Some((c, tl)) => {
|
||||
if !c.surfaces.contains(tl.wl_surface_id) {
|
||||
return
|
||||
}
|
||||
self.kbd_client = Some(c.client_id)
|
||||
self.kbd_surface = Some((c.client_id, tl.wl_surface_id))
|
||||
self.send_selection(c)
|
||||
@@ -2110,11 +2124,13 @@ pub fn WaylandServer::keyboard_leave(self : WaylandServer, win_id : UInt64) -> U
|
||||
match self.win_client(win_id) {
|
||||
None => ()
|
||||
Some((c, tl)) => {
|
||||
for kid in c.keyboard_ids {
|
||||
let w = WireWriter::new()
|
||||
w.u32(self.next_serial())
|
||||
w.u32(tl.wl_surface_id)
|
||||
c.send_msg(w.finish_msg(kid, 2U))
|
||||
if c.surfaces.contains(tl.wl_surface_id) {
|
||||
for kid in c.keyboard_ids {
|
||||
let w = WireWriter::new()
|
||||
w.u32(self.next_serial())
|
||||
w.u32(tl.wl_surface_id)
|
||||
c.send_msg(w.finish_msg(kid, 2U))
|
||||
}
|
||||
}
|
||||
text_inputs_leave(c, tl.wl_surface_id)
|
||||
if self.kbd_surface == Some((c.client_id, tl.wl_surface_id)) {
|
||||
|
||||
Reference in new issue
Block a user