Lines Matching refs:button

35     """Represents whether a button is pressed on the stylus"""
60 self, touch: BtnTouch, tool: Optional[ToolType], button: Optional[bool]
64 self.button = button # type: ignore
70 button = False
87 # we take only the provided button into account
89 button = bool(evdev.value[test_button.value])
92 # the button will be released after
94 button = False
96 return cls((touch, tool, button)) # type: ignore
107 button = self.button
128 button = bool(ev.value)
131 # the button will be released after
133 button = False
135 new_state = PenState((touch, tool, button)) # type: ignore
338 we now have a button.
341 "hover-button": (PenState.PEN_IS_IN_RANGE_WITH_BUTTON,),
342 "hover-button -> out-of-range": (
346 "in-range -> button-press": (
350 "in-range -> button-press -> button-release": (
355 "in-range -> touch -> button-press -> button-release": (
361 "in-range -> touch -> button-press -> release -> button-release": (
368 "in-range -> button-press -> touch -> release -> button-release": (
375 "in-range -> button-press -> touch -> button-release -> release": (
416 For example, a pen that has the eraser button might wobble between
500 def assert_expected_input_events(self, evdev, button):
510 if button is not None:
511 buttons.remove(button)
515 assert self.current_state == PenState.from_evdev(evdev, button)
543 def move_to(self, pen, state, button):
586 assert button is not None
587 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
588 pen.secondarybarrelswitch = button == BtnPressed.SECONDARY_PRESSED
594 assert button is not None
595 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
596 pen.secondarybarrelswitch = button == BtnPressed.SECONDARY_PRESSED
614 def event(self, pen, button):
662 self, from_state, pen, evdev, events, allow_intermediate_states, button
665 pen.assert_expected_input_events(evdev, button)
678 state = state.apply(sync_events, not allow_intermediate_states, button)
681 state = state.apply(sync_events, not allow_intermediate_states, button)
684 self, state_list, scribble, allow_intermediate_states, button=None
698 uhdev.move_to(p, PenState.PEN_IS_OUT_OF_RANGE, button)
699 events = self.post(uhdev, p, button)
701 cur_state, p, evdev, events, allow_intermediate_states, button
710 events = self.post(uhdev, p, button)
712 cur_state, p, evdev, events, allow_intermediate_states, button
715 uhdev.move_to(p, state, button)
719 events = self.post(uhdev, p, button)
721 cur_state, p, evdev, events, allow_intermediate_states, button
764 """Rework the transition state machine by adding the primary button."""
769 button=BtnPressed.PRIMARY_PRESSED,
785 """Rework the transition state machine by adding the secondary button."""
790 button=BtnPressed.SECONDARY_PRESSED,
806 """Rework the transition state machine by adding the secondary button."""
811 button=BtnPressed.THIRD_PRESSED,
866 For example, a pen that has the eraser button might wobble between
904 the second button as an eraser
922 def move_to(self, pen, state, button):
961 assert button is not None
962 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
963 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
968 assert button is not None
969 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
970 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
1024 def move_to(self, pen, state, button, debug=True):
1062 assert button is not None
1063 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1064 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
1069 assert button is not None
1070 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1071 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
1075 def send_intermediate_state(self, pen, state, button):
1077 self.move_to(intermediate_pen, state, button, debug=False)
1078 return super().event(intermediate_pen, button)
1080 def event(self, pen, button):
1087 self.send_intermediate_state(pen, PenState.PEN_IS_IN_RANGE, button)
1090 if button == BtnPressed.SECONDARY_PRESSED:
1095 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1103 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1111 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1116 pen, PenState.PEN_IS_IN_RANGE_WITH_BUTTON, button
1124 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1129 pen, PenState.PEN_IS_IN_RANGE, button
1133 rs.extend(super().event(pen, button))
1141 and 3rd button through Invert
1161 def move_to(self, pen, state, button, debug=True):
1202 assert button is not None
1203 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1204 pen.secondarytipswitch = button == BtnPressed.SECONDARY_PRESSED
1205 pen.invert = button == BtnPressed.THIRD_PRESSED
1210 assert button is not None
1211 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1212 pen.secondarytipswitch = button == BtnPressed.SECONDARY_PRESSED
1213 pen.invert = button == BtnPressed.THIRD_PRESSED
1247 def event(self, pen, button):
1265 self.send_intermediate_state(pen, PenState.PEN_IS_OUT_OF_RANGE, button)
1281 self.send_intermediate_state(pen, PenState.PEN_IS_OUT_OF_RANGE, button)
1287 self.send_intermediate_state(pen, PenState.PEN_IS_IN_RANGE, button)
1290 rs.extend(super().event(pen, button))