Lines Matching full:pen
29 PEN = libevdev.EV_KEY.BTN_TOOL_PEN variable in ToolType
42 """Pen states according to Microsoft reference:
43 https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
49 PEN_IS_IN_RANGE = BtnTouch.UP, ToolType.PEN, False
50 PEN_IS_IN_RANGE_WITH_BUTTON = BtnTouch.UP, ToolType.PEN, True
51 PEN_IS_IN_CONTACT = BtnTouch.DOWN, ToolType.PEN, False
52 PEN_IS_IN_CONTACT_WITH_BUTTON = BtnTouch.DOWN, ToolType.PEN, True
272 """This is the first half of the Windows Pen Implementation state machine:
274 … https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
298 """This is the second half of the Windows Pen Implementation state machine:
301 … https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
336 """We revisit the Windows Pen Implementation state machine:
385 """This is not adhering to the Windows Pen Implementation state machine
398 """This is the second half of the Windows Pen Implementation state machine:
401 … https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
415 For example, a pen that has the eraser button might wobble between
450 class Pen(object): class
523 application="Pen",
542 def move_to(self, pen, state, button): argument
544 if pen.current_state == PenState.PEN_IS_OUT_OF_RANGE:
545 pen.restore()
547 print(f"\n *** pen is moving to {state} ***")
550 pen.backup()
551 pen.x = 0
552 pen.y = 0
553 pen.tipswitch = False
554 pen.tippressure = 0
555 pen.azimuth = 0
556 pen.inrange = False
557 pen.width = 0
558 pen.height = 0
559 pen.invert = False
560 pen.eraser = False
561 pen.xtilt = 0
562 pen.ytilt = 0
563 pen.twist = 0
564 pen.barrelswitch = False
565 pen.secondarybarrelswitch = False
567 pen.tipswitch = False
568 pen.inrange = True
569 pen.invert = False
570 pen.eraser = False
571 pen.barrelswitch = False
572 pen.secondarybarrelswitch = False
574 pen.tipswitch = True
575 pen.inrange = True
576 pen.invert = False
577 pen.eraser = False
578 pen.barrelswitch = False
579 pen.secondarybarrelswitch = False
581 pen.tipswitch = False
582 pen.inrange = True
583 pen.invert = False
584 pen.eraser = False
586 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
587 pen.secondarybarrelswitch = button == BtnPressed.SECONDARY_PRESSED
589 pen.tipswitch = True
590 pen.inrange = True
591 pen.invert = False
592 pen.eraser = False
594 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
595 pen.secondarybarrelswitch = button == BtnPressed.SECONDARY_PRESSED
597 pen.tipswitch = False
598 pen.inrange = True
599 pen.invert = True
600 pen.eraser = False
601 pen.barrelswitch = False
602 pen.secondarybarrelswitch = False
604 pen.tipswitch = False
605 pen.inrange = True
606 pen.invert = False
607 pen.eraser = True
608 pen.barrelswitch = False
609 pen.secondarybarrelswitch = False
611 pen.current_state = state
613 def event(self, pen, button): argument
615 r = self.create_report(application=self.cur_application, data=pen)
654 def post(self, uhdev, pen, test_button): argument
655 r = uhdev.event(pen, test_button)
661 self, from_state, pen, evdev, events, allow_intermediate_states, button argument
664 pen.assert_expected_input_events(evdev, button)
689 to wobble a little the X,Y coordinates of the pen
696 p = Pen(50, 60)
730 """This is the first half of the Windows Pen Implementation state machine:
732 … https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
745 """This is not adhering to the Windows Pen Implementation state machine
826 """This is the second half of the Windows Pen Implementation state machine:
829 … https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
846 """This is the second half of the Windows Pen Implementation state machine:
849 … https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states
865 For example, a pen that has the eraser button might wobble between
872 def event(self, pen, test_button): argument
876 internal_pen = copy.copy(pen)
878 # bug in the controller: when the pen touches the
880 # the pen moves in-range gets reverted to 0
881 if pen.tipswitch and self.prev_tip_state:
884 self.prev_tip_state = pen.tipswitch
886 # another bug in the controller: when the pen is
888 # the pen touches the surface, eraser is correctly
890 if pen.eraser:
902 Pen with two buttons and a rubber end, but which reports
911 application="Pen",
921 def move_to(self, pen, state, button): argument
923 if pen.current_state == PenState.PEN_IS_OUT_OF_RANGE:
924 pen.restore()
926 print(f"\n *** pen is moving to {state} ***")
929 pen.backup()
930 pen.x = 0
931 pen.y = 0
932 pen.tipswitch = False
933 pen.tippressure = 0
934 pen.azimuth = 0
935 pen.inrange = False
936 pen.width = 0
937 pen.height = 0
938 pen.invert = False
939 pen.eraser = False
940 pen.xtilt = 0
941 pen.ytilt = 0
942 pen.twist = 0
943 pen.barrelswitch = False
945 pen.tipswitch = False
946 pen.inrange = True
947 pen.invert = False
948 pen.eraser = False
949 pen.barrelswitch = False
951 pen.tipswitch = True
952 pen.inrange = True
953 pen.invert = False
954 pen.eraser = False
955 pen.barrelswitch = False
957 pen.tipswitch = False
958 pen.inrange = True
959 pen.invert = False
961 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
962 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
964 pen.tipswitch = True
965 pen.inrange = True
966 pen.invert = False
968 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
969 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
971 pen.tipswitch = False
972 pen.inrange = True
973 pen.invert = True
974 pen.eraser = False
975 pen.barrelswitch = False
977 pen.tipswitch = True
978 pen.inrange = True
979 pen.invert = True
980 pen.eraser = False
981 pen.barrelswitch = False
983 pen.current_state = state
985 def event(self, pen, test_button): argument
988 pen_copy = copy.copy(pen)
1004 Pen that reports secondary barrel switch through eraser
1012 application="Pen",
1023 def move_to(self, pen, state, button, debug=True): argument
1025 if pen.current_state == PenState.PEN_IS_OUT_OF_RANGE:
1026 pen.restore()
1029 print(f"\n *** pen is moving to {state} ***")
1032 pen.backup()
1033 pen.tipswitch = False
1034 pen.tippressure = 0
1035 pen.azimuth = 0
1036 pen.inrange = False
1037 pen.width = 0
1038 pen.height = 0
1039 pen.invert = False
1040 pen.eraser = False
1041 pen.xtilt = 0
1042 pen.ytilt = 0
1043 pen.twist = 0
1044 pen.barrelswitch = False
1046 pen.tipswitch = False
1047 pen.inrange = True
1048 pen.invert = False
1049 pen.eraser = False
1050 pen.barrelswitch = False
1052 pen.tipswitch = True
1053 pen.inrange = True
1054 pen.invert = False
1055 pen.eraser = False
1056 pen.barrelswitch = False
1058 pen.tipswitch = False
1059 pen.inrange = True
1060 pen.invert = False
1062 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1063 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
1065 pen.tipswitch = True
1066 pen.inrange = True
1067 pen.invert = False
1069 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1070 pen.eraser = button == BtnPressed.SECONDARY_PRESSED
1072 pen.current_state = state
1074 def send_intermediate_state(self, pen, state, button): argument
1075 intermediate_pen = copy.copy(pen)
1079 def event(self, pen, button): argument
1082 # the pen reliably sends in-range events in a normal case (non emulation of eraser mode)
1084 if pen.current_state == PenState.PEN_IS_OUT_OF_RANGE:
1086 self.send_intermediate_state(pen, PenState.PEN_IS_IN_RANGE, button)
1091 if pen.current_state == PenState.PEN_IS_IN_RANGE_WITH_BUTTON:
1094 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1099 if pen.current_state == PenState.PEN_IS_IN_RANGE:
1102 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1107 if pen.current_state == PenState.PEN_IS_IN_CONTACT_WITH_BUTTON:
1110 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1115 pen, PenState.PEN_IS_IN_RANGE_WITH_BUTTON, button
1120 if pen.current_state == PenState.PEN_IS_IN_CONTACT:
1123 pen, PenState.PEN_IS_OUT_OF_RANGE, button
1128 pen, PenState.PEN_IS_IN_RANGE, button
1132 rs.extend(super().event(pen, button))
1133 self.previous_state = pen.current_state
1139 Pen that reports secondary barrel switch through secondary TipSwtich
1160 def move_to(self, pen, state, button, debug=True): argument
1162 if pen.current_state == PenState.PEN_IS_OUT_OF_RANGE:
1163 pen.restore()
1166 print(f"\n *** pen is moving to {state} ***")
1169 pen.backup()
1170 pen.tipswitch = False
1171 pen.tippressure = 0
1172 pen.azimuth = 0
1173 pen.inrange = False
1174 pen.width = 0
1175 pen.height = 0
1176 pen.invert = False
1177 pen.eraser = False
1178 pen.xtilt = 0
1179 pen.ytilt = 0
1180 pen.twist = 0
1181 pen.barrelswitch = False
1182 pen.secondarytipswitch = False
1184 pen.tipswitch = False
1185 pen.inrange = True
1186 pen.invert = False
1187 pen.eraser = False
1188 pen.barrelswitch = False
1189 pen.secondarytipswitch = False
1191 pen.tipswitch = True
1192 pen.inrange = True
1193 pen.invert = False
1194 pen.eraser = False
1195 pen.barrelswitch = False
1196 pen.secondarytipswitch = False
1198 pen.tipswitch = False
1199 pen.inrange = True
1200 pen.eraser = False
1202 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1203 pen.secondarytipswitch = button == BtnPressed.SECONDARY_PRESSED
1204 pen.invert = button == BtnPressed.THIRD_PRESSED
1206 pen.tipswitch = True
1207 pen.inrange = True
1208 pen.eraser = False
1210 pen.barrelswitch = button == BtnPressed.PRIMARY_PRESSED
1211 pen.secondarytipswitch = button == BtnPressed.SECONDARY_PRESSED
1212 pen.invert = button == BtnPressed.THIRD_PRESSED
1214 pen.tipswitch = False
1215 pen.inrange = True
1216 pen.invert = True
1217 pen.eraser = False
1218 pen.barrelswitch = False
1219 pen.secondarytipswitch = False
1221 pen.tipswitch = False
1222 pen.inrange = True
1223 pen.invert = False
1224 pen.eraser = True
1225 pen.barrelswitch = False
1226 pen.secondarytipswitch = False
1228 pen.current_state = state
1241 def send_intermediate_state(self, pen, state, test_button): argument
1242 intermediate_pen = copy.copy(pen)
1246 def event(self, pen, button): argument
1251 # the tail of the pen
1257 ) and pen.current_state in (
1264 self.send_intermediate_state(pen, PenState.PEN_IS_OUT_OF_RANGE, button)
1273 ) and pen.current_state in (
1280 self.send_intermediate_state(pen, PenState.PEN_IS_OUT_OF_RANGE, button)
1284 if pen.current_state == PenState.PEN_IS_IN_RANGE_WITH_BUTTON:
1286 self.send_intermediate_state(pen, PenState.PEN_IS_IN_RANGE, button)
1289 rs.extend(super().event(pen, button))
1290 self.previous_state = pen.current_state
1451 # Windows 8 compatible devices with USI Pen