all: use let chains
This commit is contained in:
parent
3d5d146d65
commit
286857971a
89 changed files with 1516 additions and 1574 deletions
|
|
@ -524,10 +524,10 @@ impl WlSeatGlobal {
|
|||
ei_seat.handle_motion_abs(time_usec, x, y);
|
||||
});
|
||||
let (x, y) = self.set_pointer_cursor_position(x, y);
|
||||
if let Some(c) = self.constraint.get() {
|
||||
if c.ty == ConstraintType::Lock || !c.contains(x.round_down(), y.round_down()) {
|
||||
c.deactivate(false);
|
||||
}
|
||||
if let Some(c) = self.constraint.get()
|
||||
&& (c.ty == ConstraintType::Lock || !c.contains(x.round_down(), y.round_down()))
|
||||
{
|
||||
c.deactivate(false);
|
||||
}
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_pointer_abs(self.id, time_usec, x, y);
|
||||
|
|
@ -839,16 +839,16 @@ impl WlSeatGlobal {
|
|||
if sym == self.revert_key.get().0 && mods == 0 {
|
||||
revert_pointer_to_default = true;
|
||||
}
|
||||
if !self.state.lock.locked.get() {
|
||||
if let Some(key_mods) = scs.get(&sym) {
|
||||
for (key_mods, mask) in key_mods {
|
||||
if mods & mask == key_mods {
|
||||
shortcuts.push(InvokedShortcut {
|
||||
unmasked_mods: Modifiers(mods),
|
||||
effective_mods: Modifiers(key_mods),
|
||||
sym: KeySym(sym),
|
||||
});
|
||||
}
|
||||
if !self.state.lock.locked.get()
|
||||
&& let Some(key_mods) = scs.get(&sym)
|
||||
{
|
||||
for (key_mods, mask) in key_mods {
|
||||
if mods & mask == key_mods {
|
||||
shortcuts.push(InvokedShortcut {
|
||||
unmasked_mods: Modifiers(mods),
|
||||
effective_mods: Modifiers(key_mods),
|
||||
sym: KeySym(sym),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1169,10 +1169,8 @@ impl WlSeatGlobal {
|
|||
p.send_button(serial, time, button, state)
|
||||
});
|
||||
self.surface_pointer_frame(surface);
|
||||
if pressed {
|
||||
if let Some(node) = surface.get_focus_node() {
|
||||
self.focus_node_with_serial(node, serial);
|
||||
}
|
||||
if pressed && let Some(node) = surface.get_focus_node() {
|
||||
self.focus_node_with_serial(node, serial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1225,10 +1223,10 @@ impl WlSeatGlobal {
|
|||
impl WlSeatGlobal {
|
||||
pub fn motion_surface(&self, n: &WlSurface, x: Fixed, y: Fixed) {
|
||||
'send_motion: {
|
||||
if let Some(constraint) = self.constraint.get() {
|
||||
if constraint.ty == ConstraintType::Lock {
|
||||
break 'send_motion;
|
||||
}
|
||||
if let Some(constraint) = self.constraint.get()
|
||||
&& constraint.ty == ConstraintType::Lock
|
||||
{
|
||||
break 'send_motion;
|
||||
}
|
||||
let time = (self.pos_time_usec.get() / 1000) as u32;
|
||||
self.surface_pointer_event(Version::ALL, n, |p| p.send_motion(time, x, y));
|
||||
|
|
@ -1299,10 +1297,10 @@ impl WlSeatGlobal {
|
|||
// Unfocus callbacks
|
||||
impl WlSeatGlobal {
|
||||
pub fn unfocus_surface(&self, surface: &WlSurface) {
|
||||
if let Some(ti) = self.text_input.take() {
|
||||
if let Some(con) = ti.connection.get() {
|
||||
con.disconnect(TextDisconnectReason::FocusLost);
|
||||
}
|
||||
if let Some(ti) = self.text_input.take()
|
||||
&& let Some(con) = ti.connection.get()
|
||||
{
|
||||
con.disconnect(TextDisconnectReason::FocusLost);
|
||||
}
|
||||
if let Some(tis) = self.text_inputs.borrow().get(&surface.client.id) {
|
||||
for ti in tis.lock().values() {
|
||||
|
|
|
|||
|
|
@ -530,10 +530,8 @@ impl PointerOwner for DndPointerOwner {
|
|||
}
|
||||
target.node_on_dnd_leave(&self.dnd);
|
||||
target.node_seat_state().remove_dnd_target(seat);
|
||||
if !should_drop {
|
||||
if let Some(src) = &self.dnd.src {
|
||||
ipc::detach_seat(&**src, seat);
|
||||
}
|
||||
if !should_drop && let Some(src) = &self.dnd.src {
|
||||
ipc::detach_seat(&**src, seat);
|
||||
}
|
||||
if let Some(icon) = self.icon.get() {
|
||||
icon.disable();
|
||||
|
|
|
|||
|
|
@ -97,17 +97,16 @@ impl WlSeatGlobal {
|
|||
group_idx: u32,
|
||||
mode: u32,
|
||||
) {
|
||||
if let Some(pad) = self.tablet.pads.get(&pad) {
|
||||
if let Some(group) = pad.groups.get(group_idx as usize) {
|
||||
if group.mode.replace(mode) != mode {
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_tablet_pad_mode_switch(self.id, pad.dev, time_usec, group_idx, mode)
|
||||
});
|
||||
if pad.tablet.is_some() {
|
||||
let node = pad.node.get();
|
||||
node.node_on_tablet_pad_mode_switch(&pad, group, time_usec, mode);
|
||||
}
|
||||
}
|
||||
if let Some(pad) = self.tablet.pads.get(&pad)
|
||||
&& let Some(group) = pad.groups.get(group_idx as usize)
|
||||
&& group.mode.replace(mode) != mode
|
||||
{
|
||||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_tablet_pad_mode_switch(self.id, pad.dev, time_usec, group_idx, mode)
|
||||
});
|
||||
if pad.tablet.is_some() {
|
||||
let node = pad.node.get();
|
||||
node.node_on_tablet_pad_mode_switch(&pad, group, time_usec, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -141,11 +140,11 @@ impl WlSeatGlobal {
|
|||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_tablet_pad_ring(self.id, pad.dev, time_usec, ring, source, angle)
|
||||
});
|
||||
if pad.tablet.is_some() {
|
||||
if let Some(ring) = pad.rings.get(ring as usize) {
|
||||
let node = self.keyboard_node.get();
|
||||
node.node_on_tablet_pad_ring(&pad, ring, source, angle, time_usec);
|
||||
}
|
||||
if pad.tablet.is_some()
|
||||
&& let Some(ring) = pad.rings.get(ring as usize)
|
||||
{
|
||||
let node = self.keyboard_node.get();
|
||||
node.node_on_tablet_pad_ring(&pad, ring, source, angle, time_usec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -162,11 +161,11 @@ impl WlSeatGlobal {
|
|||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_tablet_pad_strip(self.id, pad.dev, time_usec, strip, source, position)
|
||||
});
|
||||
if pad.tablet.is_some() {
|
||||
if let Some(strip) = pad.strips.get(strip as usize) {
|
||||
let node = pad.node.get();
|
||||
node.node_on_tablet_pad_strip(&pad, strip, source, position, time_usec);
|
||||
}
|
||||
if pad.tablet.is_some()
|
||||
&& let Some(strip) = pad.strips.get(strip as usize)
|
||||
{
|
||||
let node = pad.node.get();
|
||||
node.node_on_tablet_pad_strip(&pad, strip, source, position, time_usec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -182,11 +181,11 @@ impl WlSeatGlobal {
|
|||
self.state.for_each_seat_tester(|t| {
|
||||
t.send_tablet_pad_dial(self.id, pad.dev, time_usec, value120, dial)
|
||||
});
|
||||
if pad.tablet.is_some() {
|
||||
if let Some(dial) = pad.dials.get(dial as usize) {
|
||||
let node = self.keyboard_node.get();
|
||||
node.node_on_tablet_pad_dial(&pad, dial, value120, time_usec);
|
||||
}
|
||||
if pad.tablet.is_some()
|
||||
&& let Some(dial) = pad.dials.get(dial as usize)
|
||||
{
|
||||
let node = self.keyboard_node.get();
|
||||
node.node_on_tablet_pad_dial(&pad, dial, value120, time_usec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,12 +258,12 @@ impl TabletTool {
|
|||
tool.send_motion(x, y);
|
||||
tool.send_frame(time);
|
||||
});
|
||||
if let Some(changes) = changes {
|
||||
if changes.down == Some(true) {
|
||||
n.client.focus_stealing_serial.set(Some(serial.get()));
|
||||
if let Some(node) = n.get_focus_node() {
|
||||
self.tablet.seat.focus_node_with_serial(node, serial.get());
|
||||
}
|
||||
if let Some(changes) = changes
|
||||
&& changes.down == Some(true)
|
||||
{
|
||||
n.client.focus_stealing_serial.set(Some(serial.get()));
|
||||
if let Some(node) = n.get_focus_node() {
|
||||
self.tablet.seat.focus_node_with_serial(node, serial.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ impl ZwpTabletSeatV2 {
|
|||
obj.send_name(&tablet.name);
|
||||
obj.send_id(tablet.vid, tablet.pid);
|
||||
obj.send_path(&tablet.path);
|
||||
if obj.version >= BUSTYPE_SINCE {
|
||||
if let Some(bustype) = tablet.bustype {
|
||||
obj.send_bustype(bustype);
|
||||
}
|
||||
if obj.version >= BUSTYPE_SINCE
|
||||
&& let Some(bustype) = tablet.bustype
|
||||
{
|
||||
obj.send_bustype(bustype);
|
||||
}
|
||||
obj.send_done();
|
||||
tablet.bindings.add(self, &obj);
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@ impl ZwpTextInputManagerV3RequestHandler for ZwpTextInputManagerV3 {
|
|||
.entry(self.client.id)
|
||||
.or_default()
|
||||
.set(req.id, ti.clone());
|
||||
if let Some(surface) = seat.global.keyboard_node.get().node_into_surface() {
|
||||
if surface.client.id == self.client.id {
|
||||
ti.send_enter(&surface);
|
||||
ti.send_done();
|
||||
}
|
||||
if let Some(surface) = seat.global.keyboard_node.get().node_into_surface()
|
||||
&& surface.client.id == self.client.id
|
||||
{
|
||||
ti.send_enter(&surface);
|
||||
ti.send_done();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,11 +252,11 @@ impl ZwpTextInputV3RequestHandler for ZwpTextInputV3 {
|
|||
}
|
||||
let con = self.connection.get();
|
||||
if let Some(val) = pending.cursor_rect {
|
||||
if state.cursor_rectangle != val {
|
||||
if let Some(con) = &con {
|
||||
for (_, popup) in &con.input_method.popups {
|
||||
popup.schedule_positioning();
|
||||
}
|
||||
if state.cursor_rectangle != val
|
||||
&& let Some(con) = &con
|
||||
{
|
||||
for (_, popup) in &con.input_method.popups {
|
||||
popup.schedule_positioning();
|
||||
}
|
||||
}
|
||||
state.cursor_rectangle = val;
|
||||
|
|
@ -282,10 +282,8 @@ impl ZwpTextInputV3RequestHandler for ZwpTextInputV3 {
|
|||
}
|
||||
state.surrounding_text = val;
|
||||
}
|
||||
if sent_any {
|
||||
if let Some(con) = &con {
|
||||
con.input_method.send_done();
|
||||
}
|
||||
if sent_any && let Some(con) = &con {
|
||||
con.input_method.send_done();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue