Skip to content

Commit 4d2bea6

Browse files
committed
Allow unknown flags in high bits of NSButtonCell type field
1 parent 1ca5ec4 commit 4d2bea6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/typedstream/types/appkit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ def __repr__(self) -> str:
793793
class NSButtonCell(NSActionCell):
794794
shorts_unknown = typing.Tuple[int, int]
795795
type: NSButtonType
796+
type_flags: int
796797
flags: int
797798
key_equivalent: str
798799
image_1: typing.Any
@@ -814,7 +815,8 @@ def _init_from_unarchiver_(self, unarchiver: archiving.Unarchiver, class_version
814815
if self.shorts_unknown not in {(200, 25), (400, 75)}:
815816
raise ValueError(f"Unexpected value for unknown shorts: {self.shorts_unknown}")
816817

817-
self.type = NSButtonType(button_type)
818+
self.type = NSButtonType(button_type & 0xffffff)
819+
self.type_flags = button_type & 0xff000000
818820
self.flags = flags & 0xffffffff
819821

820822
if string_1 is not None and string_1.value:
@@ -830,6 +832,8 @@ def _as_multiline_string_body_(self) -> typing.Iterable[str]:
830832

831833
yield f"unknown shorts: {self.shorts_unknown!r}"
832834
yield f"button type: {self.type.name}"
835+
if self.type_flags != 0:
836+
yield f"button type flags: 0x{self.type_flags:>08x}"
833837
yield f"button flags: 0x{self.flags:>08x}"
834838

835839
if self.key_equivalent:

0 commit comments

Comments
 (0)