Unconditionally set input focus on activation
Wine windows had WM_HINTS.input set to False, and expected use of the WM_TAKE_FOCUS protocol, but Wayland input is much more absolute, so this protocol is useless to us. Always focusing windows seems to be fine, so just do that. Should fix #35.
This commit is contained in:
parent
891d056497
commit
03a0e1754d
3 changed files with 22 additions and 95 deletions
|
|
@ -482,68 +482,22 @@ fn input_focus() {
|
|||
let mut f = Fixture::new();
|
||||
let mut connection = Connection::new(&f.display);
|
||||
|
||||
fn tst(
|
||||
f: &mut Fixture,
|
||||
connection: &mut Connection,
|
||||
set_props: impl FnOnce(&mut Connection, x::Window),
|
||||
check: impl FnOnce(/* win: */ x::Window, /* focus: */ x::Window),
|
||||
) {
|
||||
let win = connection.new_window(connection.root, 0, 0, 20, 20, false);
|
||||
set_props(connection, win);
|
||||
connection.map_window(win);
|
||||
f.wait_and_dispatch();
|
||||
let surface = f
|
||||
.testwl
|
||||
.last_created_surface_id()
|
||||
.expect("No surface created!");
|
||||
f.configure_and_verify_new_toplevel(connection, win, surface);
|
||||
let win = connection.new_window(connection.root, 0, 0, 20, 20, false);
|
||||
connection.map_window(win);
|
||||
f.wait_and_dispatch();
|
||||
let surface = f
|
||||
.testwl
|
||||
.last_created_surface_id()
|
||||
.expect("No surface created!");
|
||||
f.configure_and_verify_new_toplevel(&mut connection, win, surface);
|
||||
|
||||
let focus = connection
|
||||
.wait_for_reply(connection.send_request(&x::GetInputFocus {}))
|
||||
.unwrap()
|
||||
.focus();
|
||||
check(win, focus);
|
||||
let focus = connection
|
||||
.wait_for_reply(connection.send_request(&x::GetInputFocus {}))
|
||||
.unwrap()
|
||||
.focus();
|
||||
assert_eq!(win, focus);
|
||||
|
||||
f.close_toplevel(connection, win, surface);
|
||||
}
|
||||
|
||||
// Input field unset
|
||||
tst(
|
||||
&mut f,
|
||||
&mut connection,
|
||||
|_, _| {},
|
||||
|win, focus| assert_eq!(win, focus),
|
||||
);
|
||||
|
||||
// Input field set to false
|
||||
tst(
|
||||
&mut f,
|
||||
&mut connection,
|
||||
|connection, win| {
|
||||
connection.set_property(
|
||||
win,
|
||||
x::ATOM_WM_HINTS,
|
||||
x::ATOM_WM_HINTS,
|
||||
&[WmHintsFlags::Input.bits(), 0],
|
||||
);
|
||||
},
|
||||
|win, focus| assert_ne!(win, focus),
|
||||
);
|
||||
|
||||
// Input field set to true
|
||||
tst(
|
||||
&mut f,
|
||||
&mut connection,
|
||||
|connection, win| {
|
||||
connection.set_property(
|
||||
win,
|
||||
x::ATOM_WM_HINTS,
|
||||
x::ATOM_WM_HINTS,
|
||||
&[WmHintsFlags::Input.bits(), 1],
|
||||
);
|
||||
},
|
||||
|win, focus| assert_eq!(win, focus),
|
||||
);
|
||||
f.close_toplevel(&mut connection, win, surface);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -558,12 +512,6 @@ fn quick_delete() {
|
|||
.testwl
|
||||
.last_created_surface_id()
|
||||
.expect("No surface created");
|
||||
connection.set_property(
|
||||
window,
|
||||
x::ATOM_WM_HINTS,
|
||||
x::ATOM_WM_HINTS,
|
||||
&[WmHintsFlags::Input.bits(), 0],
|
||||
);
|
||||
connection.set_property(
|
||||
window,
|
||||
x::ATOM_STRING,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue