pyglet 2.1.3__py3-none-any.whl → 2.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyglet/__init__.py +21 -9
- pyglet/__init__.pyi +3 -1
- pyglet/app/cocoa.py +6 -3
- pyglet/display/win32.py +14 -15
- pyglet/display/xlib_vidmoderestore.py +1 -1
- pyglet/extlibs/earcut.py +2 -2
- pyglet/font/__init__.py +3 -3
- pyglet/font/base.py +118 -51
- pyglet/font/dwrite/__init__.py +1381 -0
- pyglet/font/dwrite/d2d1_lib.py +637 -0
- pyglet/font/dwrite/d2d1_types_lib.py +60 -0
- pyglet/font/dwrite/dwrite_lib.py +1577 -0
- pyglet/font/fontconfig.py +79 -16
- pyglet/font/freetype.py +252 -77
- pyglet/font/freetype_lib.py +234 -125
- pyglet/font/harfbuzz/__init__.py +275 -0
- pyglet/font/harfbuzz/harfbuzz_lib.py +212 -0
- pyglet/font/quartz.py +432 -112
- pyglet/font/user.py +18 -11
- pyglet/font/win32.py +9 -1
- pyglet/gl/wgl.py +94 -87
- pyglet/gl/wglext_arb.py +472 -218
- pyglet/gl/wglext_nv.py +410 -188
- pyglet/gui/widgets.py +6 -1
- pyglet/image/codecs/bmp.py +3 -5
- pyglet/image/codecs/gdiplus.py +28 -9
- pyglet/image/codecs/wic.py +198 -489
- pyglet/image/codecs/wincodec_lib.py +413 -0
- pyglet/input/base.py +3 -2
- pyglet/input/macos/darwin_hid.py +28 -2
- pyglet/input/win32/directinput.py +2 -1
- pyglet/input/win32/xinput.py +10 -9
- pyglet/lib.py +14 -2
- pyglet/libs/darwin/cocoapy/cocoalibs.py +74 -3
- pyglet/libs/darwin/coreaudio.py +0 -2
- pyglet/libs/win32/__init__.py +4 -2
- pyglet/libs/win32/com.py +65 -12
- pyglet/libs/win32/constants.py +1 -0
- pyglet/libs/win32/dinput.py +1 -9
- pyglet/libs/win32/types.py +72 -8
- pyglet/media/codecs/coreaudio.py +1 -0
- pyglet/media/codecs/wmf.py +93 -72
- pyglet/media/devices/win32.py +5 -4
- pyglet/media/drivers/directsound/lib_dsound.py +4 -4
- pyglet/media/drivers/xaudio2/interface.py +21 -17
- pyglet/media/drivers/xaudio2/lib_xaudio2.py +42 -25
- pyglet/shapes.py +1 -1
- pyglet/text/document.py +7 -53
- pyglet/text/formats/attributed.py +3 -1
- pyglet/text/formats/plaintext.py +1 -1
- pyglet/text/formats/structured.py +1 -1
- pyglet/text/layout/base.py +76 -68
- pyglet/text/layout/incremental.py +38 -8
- pyglet/text/layout/scrolling.py +1 -1
- pyglet/text/runlist.py +2 -114
- pyglet/window/win32/__init__.py +1 -3
- {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/METADATA +1 -1
- {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/RECORD +60 -54
- pyglet/font/directwrite.py +0 -2798
- {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/LICENSE +0 -0
- {pyglet-2.1.3.dist-info → pyglet-2.1.4.dist-info}/WHEEL +0 -0
|
@@ -16,12 +16,14 @@ if lib is None:
|
|
|
16
16
|
cf = cdll.LoadLibrary(lib)
|
|
17
17
|
|
|
18
18
|
kCFStringEncodingUTF8 = 0x08000100
|
|
19
|
+
kCFAllocatorDefault = None
|
|
19
20
|
|
|
20
21
|
CFAllocatorRef = c_void_p
|
|
21
22
|
CFStringEncoding = c_uint32
|
|
22
23
|
CFURLRef = c_void_p
|
|
23
24
|
CFStringRef = c_void_p
|
|
24
25
|
CFURLPathStyle = c_int
|
|
26
|
+
CFDataRef = c_void_p
|
|
25
27
|
|
|
26
28
|
cf.CFStringCreateWithCString.restype = c_void_p
|
|
27
29
|
cf.CFStringCreateWithCString.argtypes = [CFAllocatorRef, c_char_p, CFStringEncoding]
|
|
@@ -46,7 +48,11 @@ cf.CFAttributedStringCreate.argtypes = [CFAllocatorRef, c_void_p, c_void_p]
|
|
|
46
48
|
|
|
47
49
|
# Core Foundation type to Python type conversion functions
|
|
48
50
|
|
|
49
|
-
def CFSTR(string):
|
|
51
|
+
def CFSTR(string: str):
|
|
52
|
+
"""Create a CFStringRef object.
|
|
53
|
+
|
|
54
|
+
This must eventually be released by CFRelease.
|
|
55
|
+
"""
|
|
50
56
|
return cf.CFStringCreateWithCString(None, string.encode('utf8'), kCFStringEncodingUTF8)
|
|
51
57
|
|
|
52
58
|
# Other possible names for this method:
|
|
@@ -72,6 +78,9 @@ cf.CFDataCreate.argtypes = [c_void_p, c_void_p, CFIndex]
|
|
|
72
78
|
cf.CFDataGetBytes.restype = None
|
|
73
79
|
cf.CFDataGetBytes.argtypes = [c_void_p, CFRange, c_void_p]
|
|
74
80
|
|
|
81
|
+
cf.CFDataGetBytePtr.restype = POINTER(c_uint8)
|
|
82
|
+
cf.CFDataGetBytePtr.argtypes = [CFDataRef]
|
|
83
|
+
|
|
75
84
|
cf.CFDataGetLength.restype = CFIndex
|
|
76
85
|
cf.CFDataGetLength.argtypes = [c_void_p]
|
|
77
86
|
|
|
@@ -340,8 +349,6 @@ kCGImageAlphaNoneSkipLast = 5
|
|
|
340
349
|
kCGImageAlphaNoneSkipFirst = 6
|
|
341
350
|
kCGImageAlphaOnly = 7
|
|
342
351
|
|
|
343
|
-
kCGImageAlphaPremultipliedLast = 1
|
|
344
|
-
|
|
345
352
|
kCGBitmapAlphaInfoMask = 0x1F
|
|
346
353
|
kCGBitmapFloatComponents = 1 << 8
|
|
347
354
|
|
|
@@ -379,6 +386,9 @@ quartz = cdll.LoadLibrary(lib)
|
|
|
379
386
|
CGDirectDisplayID = c_uint32 # CGDirectDisplay.h
|
|
380
387
|
CGError = c_int32 # CGError.h
|
|
381
388
|
CGBitmapInfo = c_uint32 # CGImage.h
|
|
389
|
+
CGContextRef = c_void_p
|
|
390
|
+
CGFontRef = c_void_p
|
|
391
|
+
CTFontRef = c_void_p
|
|
382
392
|
|
|
383
393
|
# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/...
|
|
384
394
|
# ImageIO.framework/Headers/CGImageProperties.h
|
|
@@ -389,6 +399,15 @@ kCGImagePropertyGIFDelayTime = c_void_p.in_dll(quartz, 'kCGImagePropertyGIFDelay
|
|
|
389
399
|
# CoreGraphics.framework/Headers/CGColorSpace.h
|
|
390
400
|
kCGRenderingIntentDefault = 0
|
|
391
401
|
|
|
402
|
+
kCGTextFill = 0
|
|
403
|
+
kCGTextStroke = 1
|
|
404
|
+
kCGTextFillStroke = 2
|
|
405
|
+
kCGTextInvisible = 3
|
|
406
|
+
kCGTextFillClip = 4
|
|
407
|
+
kCGTextStrokeClip = 5
|
|
408
|
+
kCGTextFillStrokeClip = 6
|
|
409
|
+
kCGTextClip = 7
|
|
410
|
+
|
|
392
411
|
quartz.CGDisplayIDToOpenGLDisplayMask.restype = c_uint32
|
|
393
412
|
quartz.CGDisplayIDToOpenGLDisplayMask.argtypes = [c_uint32]
|
|
394
413
|
|
|
@@ -490,6 +509,9 @@ quartz.CGDataProviderRelease.argtypes = [c_void_p]
|
|
|
490
509
|
quartz.CGColorSpaceRelease.restype = None
|
|
491
510
|
quartz.CGColorSpaceRelease.argtypes = [c_void_p]
|
|
492
511
|
|
|
512
|
+
quartz.CGContextFillRect.restype = None
|
|
513
|
+
quartz.CGContextFillRect.argtypes = [c_void_p, CGRect]
|
|
514
|
+
|
|
493
515
|
quartz.CGWarpMouseCursorPosition.restype = CGError
|
|
494
516
|
quartz.CGWarpMouseCursorPosition.argtypes = [CGPoint]
|
|
495
517
|
|
|
@@ -511,6 +533,24 @@ quartz.CGFontCreateWithDataProvider.argtypes = [c_void_p]
|
|
|
511
533
|
quartz.CGFontCreateWithFontName.restype = c_void_p
|
|
512
534
|
quartz.CGFontCreateWithFontName.argtypes = [c_void_p]
|
|
513
535
|
|
|
536
|
+
quartz.CGContextSetFont.restype = None
|
|
537
|
+
quartz.CGContextSetFont.argtypes = [CGContextRef, CGFontRef]
|
|
538
|
+
|
|
539
|
+
quartz.CGContextSetFontSize.restype = None
|
|
540
|
+
quartz.CGContextSetFontSize.argtypes = [CGContextRef, CGFloat]
|
|
541
|
+
|
|
542
|
+
quartz.CGContextShowGlyphsAtPositions.restype = None
|
|
543
|
+
quartz.CGContextShowGlyphsAtPositions.argtypes = [CGContextRef, POINTER(CGGlyph), POINTER(CGPoint), c_size_t]
|
|
544
|
+
|
|
545
|
+
quartz.CTFontDrawGlyphs.restype = None
|
|
546
|
+
quartz.CTFontDrawGlyphs.argtypes = [CTFontRef, POINTER(CGGlyph), POINTER(CGPoint), c_size_t, CGContextRef]
|
|
547
|
+
|
|
548
|
+
quartz.CGContextTranslateCTM.restype = None
|
|
549
|
+
quartz.CGContextTranslateCTM.argtypes = [CGContextRef, CGFloat, CGFloat]
|
|
550
|
+
|
|
551
|
+
quartz.CGContextScaleCTM.restype = None
|
|
552
|
+
quartz.CGContextScaleCTM.argtypes = [CGContextRef, CGFloat, CGFloat]
|
|
553
|
+
|
|
514
554
|
quartz.CGContextDrawImage.restype = None
|
|
515
555
|
quartz.CGContextDrawImage.argtypes = [c_void_p, CGRect, c_void_p]
|
|
516
556
|
|
|
@@ -523,6 +563,23 @@ quartz.CGContextSetTextPosition.argtypes = [c_void_p, CGFloat, CGFloat]
|
|
|
523
563
|
quartz.CGContextSetShouldAntialias.restype = None
|
|
524
564
|
quartz.CGContextSetShouldAntialias.argtypes = [c_void_p, c_bool]
|
|
525
565
|
|
|
566
|
+
quartz.CGContextSetTextDrawingMode.restype = None
|
|
567
|
+
quartz.CGContextSetTextDrawingMode.argtypes = [c_void_p, c_int32]
|
|
568
|
+
|
|
569
|
+
quartz.CGContextSetRGBFillColor.restype = None
|
|
570
|
+
quartz.CGContextSetRGBFillColor.argtypes = [c_void_p, CGFloat, CGFloat, CGFloat, CGFloat]
|
|
571
|
+
|
|
572
|
+
quartz.CGFontCopyTableTags.restype = c_void_p
|
|
573
|
+
quartz.CGFontCopyTableTags.argtypes = [c_void_p]
|
|
574
|
+
|
|
575
|
+
quartz.CGFontCopyTableForTag.restype = c_void_p
|
|
576
|
+
quartz.CGFontCopyTableForTag.argtypes = [c_void_p, c_uint32]
|
|
577
|
+
|
|
578
|
+
quartz.CTFontCopyGraphicsFont.restype = c_void_p
|
|
579
|
+
quartz.CTFontCopyGraphicsFont.argtypes = [c_void_p, c_void_p]
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
526
583
|
######################################################################
|
|
527
584
|
|
|
528
585
|
# CORETEXT
|
|
@@ -543,7 +600,12 @@ kCTFontAttributeName = c_void_p.in_dll(ct, 'kCTFontAttributeName')
|
|
|
543
600
|
kCTFontFamilyNameAttribute = c_void_p.in_dll(ct, 'kCTFontFamilyNameAttribute')
|
|
544
601
|
kCTFontSymbolicTrait = c_void_p.in_dll(ct, 'kCTFontSymbolicTrait')
|
|
545
602
|
kCTFontWeightTrait = c_void_p.in_dll(ct, 'kCTFontWeightTrait')
|
|
603
|
+
kCTFontWidthTrait = c_void_p.in_dll(ct, 'kCTFontWidthTrait')
|
|
604
|
+
kCTFontSlantTrait = c_void_p.in_dll(ct, 'kCTFontSlantTrait')
|
|
546
605
|
kCTFontTraitsAttribute = c_void_p.in_dll(ct, 'kCTFontTraitsAttribute')
|
|
606
|
+
kCTForegroundColorAttributeName = c_void_p.in_dll(ct, 'kCTForegroundColorAttributeName')
|
|
607
|
+
kCTForegroundColorFromContextAttributeName = c_void_p.in_dll(ct, 'kCTForegroundColorFromContextAttributeName')
|
|
608
|
+
kCFBooleanTrue = c_void_p.in_dll(ct, 'kCFBooleanTrue')
|
|
547
609
|
|
|
548
610
|
# constants from CTFontTraits.h
|
|
549
611
|
kCTFontItalicTrait = (1 << 0)
|
|
@@ -594,6 +656,15 @@ ct.CTFontDescriptorCreateWithAttributes.argtypes = [c_void_p]
|
|
|
594
656
|
ct.CTFontDescriptorCopyAttribute.restype = c_void_p
|
|
595
657
|
ct.CTFontDescriptorCopyAttribute.argtypes = [c_void_p, CFStringRef]
|
|
596
658
|
|
|
659
|
+
ct.CTFontDescriptorCreateWithNameAndSize.restype = c_void_p
|
|
660
|
+
ct.CTFontDescriptorCreateWithNameAndSize.argtypes = [CFStringRef, CGFloat]
|
|
661
|
+
|
|
662
|
+
ct.CTFontDescriptorCreateMatchingFontDescriptor.restype = c_void_p
|
|
663
|
+
ct.CTFontDescriptorCreateMatchingFontDescriptor.argtypes = [c_void_p, c_void_p]
|
|
664
|
+
|
|
665
|
+
ct.CTFontCopyTraits.restype = c_void_p
|
|
666
|
+
ct.CTFontCopyTraits.argtypes = [c_void_p]
|
|
667
|
+
|
|
597
668
|
kCTFontURLAttribute = c_void_p.in_dll(ct, 'kCTFontURLAttribute')
|
|
598
669
|
|
|
599
670
|
######################################################################
|
pyglet/libs/darwin/coreaudio.py
CHANGED
|
@@ -111,8 +111,6 @@ ca.ExtAudioFileDispose.argtypes = [ExtAudioFileRef]
|
|
|
111
111
|
ca.AudioFileClose.restype = OSStatus
|
|
112
112
|
ca.AudioFileClose.argtypes = [AudioFileID]
|
|
113
113
|
|
|
114
|
-
kCFAllocatorDefault = None
|
|
115
|
-
|
|
116
114
|
|
|
117
115
|
def c_literal(mnemonic: str) -> int:
|
|
118
116
|
"""Pack a tiny ASCII string into a 32-bit int.
|
pyglet/libs/win32/__init__.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import atexit
|
|
2
2
|
import struct
|
|
3
3
|
import warnings
|
|
4
|
+
from ctypes import HRESULT
|
|
5
|
+
from ctypes.wintypes import ATOM, HFONT, HGDIOBJ, HGLOBAL, HMENU, HMODULE, INT, LPVOID, PUINT
|
|
4
6
|
|
|
5
7
|
import pyglet
|
|
6
|
-
|
|
7
|
-
from . import constants
|
|
8
|
+
|
|
9
|
+
from . import com, constants
|
|
8
10
|
from .types import *
|
|
9
11
|
|
|
10
12
|
IS64 = struct.calcsize("P") == 8
|
pyglet/libs/win32/com.py
CHANGED
|
@@ -33,9 +33,12 @@ the return value.
|
|
|
33
33
|
Don't forget to manually manage memory... call Release() when you're done with
|
|
34
34
|
an interface.
|
|
35
35
|
"""
|
|
36
|
+
from __future__ import annotations
|
|
36
37
|
|
|
37
|
-
import sys
|
|
38
38
|
import ctypes
|
|
39
|
+
import re
|
|
40
|
+
import sys
|
|
41
|
+
from typing import Sequence
|
|
39
42
|
|
|
40
43
|
from pyglet.util import debug_print
|
|
41
44
|
|
|
@@ -53,23 +56,43 @@ class GUID(ctypes.Structure):
|
|
|
53
56
|
('Data4', ctypes.c_ubyte * 8),
|
|
54
57
|
]
|
|
55
58
|
|
|
56
|
-
def __init__(self, l, w1, w2
|
|
59
|
+
def __init__(self, l: int, w1: int, w2: int,
|
|
60
|
+
b1: int, b2: int, b3: int, b4: int, b5: int, b6: int, b7: int, b8: int) -> None:
|
|
57
61
|
self.Data1 = l
|
|
58
62
|
self.Data2 = w1
|
|
59
63
|
self.Data3 = w2
|
|
60
64
|
self.Data4[:] = (b1, b2, b3, b4, b5, b6, b7, b8)
|
|
61
65
|
|
|
62
|
-
def __repr__(self):
|
|
66
|
+
def __repr__(self) -> str:
|
|
63
67
|
b1, b2, b3, b4, b5, b6, b7, b8 = self.Data4
|
|
64
|
-
return 'GUID(
|
|
65
|
-
self.Data1, self.Data2, self.Data3, b1, b2, b3, b4, b5, b6, b7, b8)
|
|
68
|
+
return f'GUID({self.Data1:x}, {self.Data2:x}, {self.Data3:x}, {b1:x}, {b2:x}, {b3:x}, {b4:x}, {b5:x}, {b6:x}, {b7:x}, {b8:x})'
|
|
66
69
|
|
|
67
|
-
def __eq__(self, other):
|
|
70
|
+
def __eq__(self, other: object) -> bool:
|
|
68
71
|
return isinstance(other, GUID) and bytes(self) == bytes(other)
|
|
69
72
|
|
|
70
|
-
def __hash__(self):
|
|
73
|
+
def __hash__(self) -> int:
|
|
71
74
|
return hash(bytes(self))
|
|
72
75
|
|
|
76
|
+
@classmethod
|
|
77
|
+
def from_string(cls, text: str) -> GUID:
|
|
78
|
+
"""Convert a GUID string into a GUID object.
|
|
79
|
+
|
|
80
|
+
Valid: 'bd4ec2d2-0662-4bee-ba8e-6f29f032e096' and '{bd4ec2d2-0662-4bee-ba8e-6f29f032e096}'
|
|
81
|
+
"""
|
|
82
|
+
match = re.match(
|
|
83
|
+
r'^\{?([0-9A-Fa-f]{8})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})-([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})\}?$', text)
|
|
84
|
+
if not match:
|
|
85
|
+
msg = f"Invalid GUID format: {text}"
|
|
86
|
+
raise ValueError(msg)
|
|
87
|
+
|
|
88
|
+
# Convert matched hex values into integers
|
|
89
|
+
d1 = int(match.group(1), 16)
|
|
90
|
+
d2 = int(match.group(2), 16)
|
|
91
|
+
d3 = int(match.group(3), 16)
|
|
92
|
+
d4 = [int(match.group(i), 16) for i in range(4, 12)]
|
|
93
|
+
|
|
94
|
+
return cls(d1, d2, d3, *d4)
|
|
95
|
+
|
|
73
96
|
|
|
74
97
|
LPGUID = ctypes.POINTER(GUID)
|
|
75
98
|
IID = GUID
|
|
@@ -195,7 +218,7 @@ class _pInterfaceMeta(_PointerMeta):
|
|
|
195
218
|
# instead of
|
|
196
219
|
# RegisterCallback(callback_obj)
|
|
197
220
|
# could make it obsolete.
|
|
198
|
-
from ctypes import _pointer_type_cache
|
|
221
|
+
from ctypes import _pointer_type_cache # noqa
|
|
199
222
|
_pointer_type_cache[target] = pointer_type
|
|
200
223
|
|
|
201
224
|
return pointer_type
|
|
@@ -204,12 +227,13 @@ class _pInterfaceMeta(_PointerMeta):
|
|
|
204
227
|
class Interface(ctypes.Structure, metaclass=_InterfaceMeta, create_pointer_type=False):
|
|
205
228
|
@classmethod
|
|
206
229
|
def get_interface_inheritance(cls):
|
|
207
|
-
"""
|
|
208
|
-
|
|
230
|
+
"""Return a reverse iterator over the interfaces implemented by this interface,
|
|
231
|
+
ranging from just after the base type `Interface` to this type.
|
|
209
232
|
`Interface` does not represent an actual interface, but merely the base concept of
|
|
210
|
-
them
|
|
233
|
+
them. Viewing it as part of an interface's inheritance chain is meaningless, so
|
|
234
|
+
it is excluded.
|
|
211
235
|
"""
|
|
212
|
-
return cls.__mro__[:cls.__mro__.index(Interface)]
|
|
236
|
+
return reversed(cls.__mro__[:cls.__mro__.index(Interface)])
|
|
213
237
|
|
|
214
238
|
|
|
215
239
|
class pInterface(_DummyPointerType, metaclass=_pInterfaceMeta):
|
|
@@ -397,3 +421,32 @@ class COMObject:
|
|
|
397
421
|
raise TypeError(f"Does not implement {interface_type}")
|
|
398
422
|
|
|
399
423
|
return ctypes.byref(self._struct, offset)
|
|
424
|
+
|
|
425
|
+
def is_available(interface: pInterface | Interface, guid: GUID, target_interface: pInterface | Interface,
|
|
426
|
+
errors: Sequence[int] = (E_NOTIMPL, E_NOINTERFACE)) -> bool:
|
|
427
|
+
"""
|
|
428
|
+
Determine if the target interface is available from the source.
|
|
429
|
+
|
|
430
|
+
Args:
|
|
431
|
+
interface:
|
|
432
|
+
The interface to query from.
|
|
433
|
+
guid:
|
|
434
|
+
The GUID of the target interface.
|
|
435
|
+
target_interface:
|
|
436
|
+
The interface object to query from.
|
|
437
|
+
errors:
|
|
438
|
+
Acceptable errors to consider as caught.
|
|
439
|
+
|
|
440
|
+
Returns:
|
|
441
|
+
If the query was successful, returns True. If so, the target interface object is available.
|
|
442
|
+
"""
|
|
443
|
+
try:
|
|
444
|
+
interface.QueryInterface(guid, ctypes.byref(target_interface))
|
|
445
|
+
return True
|
|
446
|
+
except OSError as e:
|
|
447
|
+
for error in errors:
|
|
448
|
+
if error & 0xFFFFFFFF: # to unsigned.
|
|
449
|
+
return False
|
|
450
|
+
|
|
451
|
+
msg = f"Failed to Query Interface {interface} with GUID: {guid}."
|
|
452
|
+
raise Exception(msg)
|
pyglet/libs/win32/constants.py
CHANGED
|
@@ -5036,6 +5036,7 @@ WINDOWS_8_OR_GREATER = sys.getwindowsversion() >= (6, 2)
|
|
|
5036
5036
|
WINDOWS_8_1_OR_GREATER = sys.getwindowsversion() >= (6, 3)
|
|
5037
5037
|
WINDOWS_10_ANNIVERSARY_UPDATE_OR_GREATER = sys.getwindowsversion() >= (10, 0, 14393) # 1607
|
|
5038
5038
|
WINDOWS_10_CREATORS_UPDATE_OR_GREATER = sys.getwindowsversion() >= (10, 0, 15063) # 1703
|
|
5039
|
+
WINDOWS_10_1809_OR_GREATER = sys.getwindowsversion() >= (10, 0, 17763) # 1809
|
|
5039
5040
|
|
|
5040
5041
|
MSGFLT_ALLOW = 1
|
|
5041
5042
|
MSGFLT_DISALLOW = 2
|
pyglet/libs/win32/dinput.py
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import ctypes
|
|
4
|
+
from ctypes.wintypes import BOOL, DWORD, HANDLE, HWND, LPDWORD, LPVOID, UINT, WCHAR, WORD
|
|
4
5
|
|
|
5
6
|
from pyglet.libs.win32 import com
|
|
6
7
|
|
|
7
8
|
lib = ctypes.oledll.dinput8
|
|
8
9
|
|
|
9
|
-
LPVOID = ctypes.c_void_p
|
|
10
|
-
WORD = ctypes.c_uint16
|
|
11
|
-
DWORD = ctypes.c_uint32
|
|
12
|
-
LPDWORD = ctypes.POINTER(DWORD)
|
|
13
|
-
BOOL = ctypes.c_int
|
|
14
|
-
WCHAR = ctypes.c_wchar
|
|
15
|
-
UINT = ctypes.c_uint
|
|
16
|
-
HWND = ctypes.c_uint32
|
|
17
|
-
HANDLE = LPVOID
|
|
18
10
|
MAX_PATH = 260
|
|
19
11
|
|
|
20
12
|
DIENUM_STOP = 0
|
pyglet/libs/win32/types.py
CHANGED
|
@@ -1,12 +1,68 @@
|
|
|
1
1
|
import ctypes
|
|
2
2
|
import sys
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
from ctypes import (
|
|
4
|
+
POINTER,
|
|
5
|
+
WINFUNCTYPE,
|
|
6
|
+
Structure,
|
|
7
|
+
Union,
|
|
8
|
+
c_byte,
|
|
9
|
+
c_char,
|
|
10
|
+
c_char_p,
|
|
11
|
+
c_int,
|
|
12
|
+
c_int8,
|
|
13
|
+
c_int16,
|
|
14
|
+
c_int32,
|
|
15
|
+
c_int64,
|
|
16
|
+
c_long,
|
|
17
|
+
c_short,
|
|
18
|
+
c_size_t,
|
|
19
|
+
c_ubyte,
|
|
20
|
+
c_uint,
|
|
21
|
+
c_uint8,
|
|
22
|
+
c_uint16,
|
|
23
|
+
c_uint32,
|
|
24
|
+
c_uint64,
|
|
25
|
+
c_wchar,
|
|
26
|
+
c_wchar_p,
|
|
27
|
+
cast,
|
|
28
|
+
sizeof,
|
|
29
|
+
)
|
|
30
|
+
from ctypes.wintypes import (
|
|
31
|
+
BOOL,
|
|
32
|
+
BYTE,
|
|
33
|
+
DOUBLE, # noqa: F401
|
|
34
|
+
DWORD,
|
|
35
|
+
FILETIME,
|
|
36
|
+
HANDLE,
|
|
37
|
+
HBITMAP,
|
|
38
|
+
HBRUSH,
|
|
39
|
+
HDC,
|
|
40
|
+
HICON,
|
|
41
|
+
HINSTANCE,
|
|
42
|
+
HMONITOR,
|
|
43
|
+
HRGN,
|
|
44
|
+
HWND,
|
|
45
|
+
LARGE_INTEGER,
|
|
46
|
+
LONG,
|
|
47
|
+
LPARAM,
|
|
48
|
+
LPCWSTR,
|
|
49
|
+
LPOLESTR,
|
|
50
|
+
LPWSTR,
|
|
51
|
+
MSG,
|
|
52
|
+
POINT,
|
|
53
|
+
POINTL,
|
|
54
|
+
RECT,
|
|
55
|
+
UINT,
|
|
56
|
+
ULARGE_INTEGER,
|
|
57
|
+
ULONG,
|
|
58
|
+
USHORT,
|
|
59
|
+
WCHAR,
|
|
60
|
+
WORD,
|
|
61
|
+
WPARAM,
|
|
62
|
+
)
|
|
6
63
|
|
|
7
64
|
from . import com
|
|
8
65
|
|
|
9
|
-
|
|
10
66
|
_int_types = (c_int16, c_int32)
|
|
11
67
|
if hasattr(ctypes, 'c_int64'):
|
|
12
68
|
# Some builds of ctypes apparently do not have c_int64
|
|
@@ -45,13 +101,11 @@ def POINTER_(obj):
|
|
|
45
101
|
|
|
46
102
|
|
|
47
103
|
c_void_p = POINTER_(c_void)
|
|
48
|
-
|
|
49
|
-
LPVOID = c_void_p
|
|
104
|
+
|
|
50
105
|
HCURSOR = HANDLE
|
|
51
106
|
LRESULT = LPARAM
|
|
52
107
|
COLORREF = DWORD
|
|
53
108
|
PVOID = c_void_p
|
|
54
|
-
WCHAR = c_wchar
|
|
55
109
|
BCHAR = c_wchar
|
|
56
110
|
LPRECT = POINTER(RECT)
|
|
57
111
|
LPPOINT = POINTER(POINT)
|
|
@@ -63,7 +117,17 @@ LPTSTR = LPWSTR
|
|
|
63
117
|
LPSTREAM = c_void_p
|
|
64
118
|
CLSID = com.GUID
|
|
65
119
|
|
|
66
|
-
|
|
120
|
+
INT8 = c_int8
|
|
121
|
+
UINT8 = c_uint8
|
|
122
|
+
INT16 = c_int16
|
|
123
|
+
UINT16 = c_uint16
|
|
124
|
+
INT32 = c_int32
|
|
125
|
+
UINT32 = c_uint32
|
|
126
|
+
INT64 = c_int64
|
|
127
|
+
UINT64 = c_uint64
|
|
128
|
+
VOID = None
|
|
129
|
+
|
|
130
|
+
# Fixed in python 3.12. Ctypes defined BYTE as c_byte in previous versions.
|
|
67
131
|
# Ensure it's the same across all versions.
|
|
68
132
|
if sys.version_info < (3, 12):
|
|
69
133
|
BYTE = c_ubyte
|
pyglet/media/codecs/coreaudio.py
CHANGED
|
@@ -54,6 +54,7 @@ class CoreAudioSource(StreamingSource):
|
|
|
54
54
|
url_ref = cf.CFURLCreateWithFileSystemPath(None, fn_str, kCFURLPOSIXPathStyle, False)
|
|
55
55
|
|
|
56
56
|
err_check(ca.ExtAudioFileOpenURL(url_ref, byref(audref)))
|
|
57
|
+
cf.CFRelease(fn_str)
|
|
57
58
|
else:
|
|
58
59
|
self.file_obj = MemoryFileObject(file)
|
|
59
60
|
|