mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-24 00:50:42 +01:00
touchpad: invert an if condition to allow for early return
if (foo) {
everything
}
changed to :
if (!foo)
return
everything
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6b99fabfe8
commit
fb787e7a7e
1 changed files with 15 additions and 14 deletions
|
|
@ -2076,22 +2076,23 @@ tp_pair_tablet_mode_switch(struct evdev_device *touchpad,
|
|||
if ((tablet_mode_switch->tags & EVDEV_TAG_TABLET_MODE_SWITCH) == 0)
|
||||
return;
|
||||
|
||||
if (tp->tablet_mode_switch.tablet_mode_switch == NULL) {
|
||||
evdev_log_debug(touchpad,
|
||||
"tablet_mode_switch: activated for %s<->%s\n",
|
||||
touchpad->devname,
|
||||
tablet_mode_switch->devname);
|
||||
if (tp->tablet_mode_switch.tablet_mode_switch)
|
||||
return;
|
||||
|
||||
libinput_device_add_event_listener(&tablet_mode_switch->base,
|
||||
&tp->tablet_mode_switch.listener,
|
||||
tp_switch_event, tp);
|
||||
tp->tablet_mode_switch.tablet_mode_switch = tablet_mode_switch;
|
||||
evdev_log_debug(touchpad,
|
||||
"tablet_mode_switch: activated for %s<->%s\n",
|
||||
touchpad->devname,
|
||||
tablet_mode_switch->devname);
|
||||
|
||||
if (evdev_device_switch_get_state(tablet_mode_switch,
|
||||
LIBINPUT_SWITCH_TABLET_MODE)
|
||||
== LIBINPUT_SWITCH_STATE_ON) {
|
||||
tp_suspend(tp, touchpad);
|
||||
}
|
||||
libinput_device_add_event_listener(&tablet_mode_switch->base,
|
||||
&tp->tablet_mode_switch.listener,
|
||||
tp_switch_event, tp);
|
||||
tp->tablet_mode_switch.tablet_mode_switch = tablet_mode_switch;
|
||||
|
||||
if (evdev_device_switch_get_state(tablet_mode_switch,
|
||||
LIBINPUT_SWITCH_TABLET_MODE)
|
||||
== LIBINPUT_SWITCH_STATE_ON) {
|
||||
tp_suspend(tp, touchpad);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue