pyglet 2.0.14__tar.gz → 2.1.dev1__tar.gz
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-2.0.14 → pyglet-2.1.dev1}/PKG-INFO +1 -1
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/__init__.py +32 -46
- pyglet-2.1.dev1/pyglet/__init__.pyi +13 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/app/__init__.py +17 -12
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/app/base.py +4 -2
- pyglet-2.1.dev1/pyglet/customtypes.py +23 -0
- {pyglet-2.0.14/pyglet/canvas → pyglet-2.1.dev1/pyglet/display}/__init__.py +16 -18
- {pyglet-2.0.14/pyglet/canvas → pyglet-2.1.dev1/pyglet/display}/base.py +25 -26
- {pyglet-2.0.14/pyglet/canvas → pyglet-2.1.dev1/pyglet/display}/cocoa.py +37 -23
- {pyglet-2.0.14/pyglet/canvas → pyglet-2.1.dev1/pyglet/display}/win32.py +35 -1
- {pyglet-2.0.14/pyglet/canvas → pyglet-2.1.dev1/pyglet/display}/xlib.py +24 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/__init__.py +1 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/__init__.py +5 -1
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/base.py +4 -9
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/cocoa.py +6 -12
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/headless.py +5 -12
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/win32.py +8 -16
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/xlib.py +6 -12
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/graphics/shader.py +3 -2
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/graphics/vertexbuffer.py +89 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/graphics/vertexdomain.py +9 -5
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gui/frame.py +37 -11
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gui/widgets.py +82 -20
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/__init__.py +19 -38
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/buffer.py +29 -15
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/info.py +1 -1
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/__init__.py +5 -5
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/base.py +205 -199
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/controller.py +17 -16
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/linux/x11_xinput.py +1 -1
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/win32/directinput.py +7 -4
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/win32/xinput.py +9 -6
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/darwin/cocoapy/cocoalibs.py +6 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/__init__.py +26 -1
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/constants.py +4 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/types.py +17 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/x11/xlib.py +18 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/math.py +146 -205
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/xaudio2/lib_xaudio2.py +1 -1
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/shapes.py +71 -52
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/sprite.py +28 -15
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/__init__.py +30 -34
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/caret.py +12 -5
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/document.py +34 -40
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/formats/structured.py +59 -11
- pyglet-2.1.dev1/pyglet/text/layout/__init__.py +132 -0
- pyglet-2.0.14/pyglet/text/layout.py → pyglet-2.1.dev1/pyglet/text/layout/base.py +420 -1577
- pyglet-2.1.dev1/pyglet/text/layout/incremental.py +1006 -0
- pyglet-2.1.dev1/pyglet/text/layout/scrolling.py +271 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/__init__.py +39 -5
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/cocoa/__init__.py +30 -4
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/cocoa/pyglet_delegate.py +26 -13
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/headless/__init__.py +1 -1
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/win32/__init__.py +106 -11
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/xlib/__init__.py +13 -35
- pyglet-2.0.14/pyglet/customtypes.py +0 -16
- {pyglet-2.0.14 → pyglet-2.1.dev1}/LICENSE +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/README.md +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/app/cocoa.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/app/win32.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/app/xlib.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/clock.py +0 -0
- {pyglet-2.0.14/pyglet/canvas → pyglet-2.1.dev1/pyglet/display}/headless.py +0 -0
- {pyglet-2.0.14/pyglet/canvas → pyglet-2.1.dev1/pyglet/display}/xlib_vidmoderestore.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/event.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/experimental/README.md +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/experimental/geoshader_sprite.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/experimental/hidraw.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/experimental/net.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/extlibs/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/extlibs/png.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/base.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/directwrite.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/fontconfig.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/freetype.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/freetype_lib.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/quartz.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/ttf.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/user.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/font/win32.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/agl.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/gl.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/gl_compat.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/gl_info.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/glx.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/glx_info.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/glxext_arb.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/glxext_mesa.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/glxext_nv.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/lib.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/lib_agl.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/lib_glx.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/lib_wgl.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/wgl.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/wgl_info.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/wglext_arb.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gl/wglext_nv.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/graphics/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/graphics/allocation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/graphics/vertexarray.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/gui/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/animation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/atlas.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/bmp.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/dds.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/gdiplus.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/gdkpixbuf2.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/gif.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/pil.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/png.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/quartz.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/s3tc.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/image/codecs/wic.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/controller_db.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/linux/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/linux/evdev.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/linux/evdev_constants.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/linux/x11_xinput_tablet.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/macos/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/macos/darwin_hid.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/win32/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/input/win32/wintab.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/lib.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/darwin/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/darwin/cocoapy/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/darwin/cocoapy/cocoatypes.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/darwin/cocoapy/runtime.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/darwin/coreaudio.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/darwin/quartzkey.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/egl/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/egl/egl.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/egl/eglext.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/egl/lib.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/wayland/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/wayland/gbm.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/wayland/xkbcommon.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/com.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/context_managers.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/dinput.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/libwintab.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/win32/winkey.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/x11/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/x11/cursorfont.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/x11/xf86vmode.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/x11/xinerama.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/x11/xinput.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/libs/x11/xsync.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/buffered_logger.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/base.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/coreaudio.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg_lib/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg_lib/compat.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg_lib/libavcodec.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg_lib/libavformat.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg_lib/libavutil.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg_lib/libswresample.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/ffmpeg_lib/libswscale.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/gstreamer.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/pyogg.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/wave.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/codecs/wmf.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/devices/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/devices/base.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/devices/win32.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/base.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/directsound/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/directsound/adaptation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/directsound/exceptions.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/directsound/interface.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/directsound/lib_dsound.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/listener.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/openal/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/openal/adaptation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/openal/interface.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/openal/lib_alc.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/openal/lib_openal.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/pulse/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/pulse/adaptation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/pulse/interface.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/pulse/lib_pulseaudio.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/silent/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/silent/adaptation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/xaudio2/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/xaudio2/adaptation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/drivers/xaudio2/interface.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/exceptions.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/instrumentation.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/player.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/player_worker_thread.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/media/synthesis.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/model/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/model/codecs/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/model/codecs/gltf.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/model/codecs/obj.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/resource.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/formats/__init__.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/formats/attributed.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/formats/html.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/formats/plaintext.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/text/runlist.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/util.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/cocoa/pyglet_textview.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/cocoa/pyglet_view.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/cocoa/pyglet_window.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/cocoa/systemcursor.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/event.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/key.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyglet/window/mouse.py +0 -0
- {pyglet-2.0.14 → pyglet-2.1.dev1}/pyproject.toml +0 -0
|
@@ -6,10 +6,10 @@ More information is available at http://www.pyglet.org
|
|
|
6
6
|
import os
|
|
7
7
|
import sys
|
|
8
8
|
|
|
9
|
-
from typing import TYPE_CHECKING
|
|
9
|
+
from typing import TYPE_CHECKING, Dict
|
|
10
10
|
|
|
11
11
|
#: The release version
|
|
12
|
-
version = '2.
|
|
12
|
+
version = '2.1.dev1'
|
|
13
13
|
__version__ = version
|
|
14
14
|
|
|
15
15
|
MIN_PYTHON_VERSION = 3, 8
|
|
@@ -93,15 +93,6 @@ if getattr(sys, 'frozen', None):
|
|
|
93
93
|
#: this option overrides it (to either force vsync on or off). If unset,
|
|
94
94
|
#: or set to None, the `pyglet.window.Window.vsync` property behaves
|
|
95
95
|
#: as documented.
|
|
96
|
-
#: xsync
|
|
97
|
-
#: If set (the default), pyglet will attempt to synchronise the drawing of
|
|
98
|
-
#: double-buffered windows to the border updates of the X11 window
|
|
99
|
-
#: manager. This improves the appearance of the window during resize
|
|
100
|
-
#: operations. This option only affects double-buffered windows on
|
|
101
|
-
#: X11 servers supporting the Xsync extension with a window manager
|
|
102
|
-
#: that implements the _NET_WM_SYNC_REQUEST protocol.
|
|
103
|
-
#:
|
|
104
|
-
#: .. versionadded:: 1.1
|
|
105
96
|
#: search_local_libs
|
|
106
97
|
#: If False, pyglet won't try to search for libraries in the script
|
|
107
98
|
#: directory and its `lib` subdirectory. This is useful to load a local
|
|
@@ -130,10 +121,9 @@ options = {
|
|
|
130
121
|
'debug_x11': False,
|
|
131
122
|
'shadow_window': True,
|
|
132
123
|
'vsync': None,
|
|
133
|
-
'xsync': True,
|
|
134
|
-
'xlib_fullscreen_override_redirect': False,
|
|
135
124
|
'search_local_libs': True,
|
|
136
125
|
'win32_gdi_font': False,
|
|
126
|
+
'scale_with_dpi': False,
|
|
137
127
|
'headless': False,
|
|
138
128
|
'headless_device': 0,
|
|
139
129
|
'win32_disable_shaping': False,
|
|
@@ -163,10 +153,9 @@ _option_types = {
|
|
|
163
153
|
'debug_x11': bool,
|
|
164
154
|
'shadow_window': bool,
|
|
165
155
|
'vsync': bool,
|
|
166
|
-
'xsync': bool,
|
|
167
|
-
'xlib_fullscreen_override_redirect': bool,
|
|
168
156
|
'search_local_libs': bool,
|
|
169
157
|
'win32_gdi_font': bool,
|
|
158
|
+
'scale_with_dpi': bool,
|
|
170
159
|
'headless': bool,
|
|
171
160
|
'headless_device': int,
|
|
172
161
|
'win32_disable_shaping': bool,
|
|
@@ -196,16 +185,15 @@ if compat_platform == 'cygwin':
|
|
|
196
185
|
# DirectSound support.
|
|
197
186
|
import ctypes
|
|
198
187
|
|
|
199
|
-
ctypes.windll = ctypes.cdll
|
|
200
|
-
ctypes.oledll = ctypes.cdll
|
|
188
|
+
ctypes.windll = ctypes.cdll # type: ignore
|
|
189
|
+
ctypes.oledll = ctypes.cdll # type: ignore
|
|
201
190
|
ctypes.WINFUNCTYPE = ctypes.CFUNCTYPE
|
|
202
|
-
ctypes.HRESULT = ctypes.c_long
|
|
203
|
-
|
|
191
|
+
ctypes.HRESULT = ctypes.c_long # type: ignore
|
|
204
192
|
|
|
205
193
|
# Call tracing
|
|
206
194
|
# ------------
|
|
207
195
|
|
|
208
|
-
_trace_filename_abbreviations = {}
|
|
196
|
+
_trace_filename_abbreviations: Dict[str, str] = {}
|
|
209
197
|
_trace_thread_count = 0
|
|
210
198
|
_trace_args = options['debug_trace_args']
|
|
211
199
|
_trace_depth = options['debug_trace_depth']
|
|
@@ -301,7 +289,7 @@ def _install_trace():
|
|
|
301
289
|
class _ModuleProxy:
|
|
302
290
|
_module = None
|
|
303
291
|
|
|
304
|
-
def __init__(self, name):
|
|
292
|
+
def __init__(self, name: str):
|
|
305
293
|
self.__dict__['_module_name'] = name
|
|
306
294
|
|
|
307
295
|
def __getattr__(self, name):
|
|
@@ -333,20 +321,19 @@ class _ModuleProxy:
|
|
|
333
321
|
setattr(module, name, value)
|
|
334
322
|
|
|
335
323
|
|
|
336
|
-
# Lazily load all modules, except if performing
|
|
337
|
-
# type checking or code inspection.
|
|
324
|
+
# Lazily load all modules, except if performing type checking or code inspection.
|
|
338
325
|
if TYPE_CHECKING:
|
|
339
326
|
from . import app
|
|
340
|
-
from . import canvas
|
|
341
327
|
from . import clock
|
|
342
328
|
from . import customtypes
|
|
329
|
+
from . import display
|
|
343
330
|
from . import event
|
|
344
331
|
from . import font
|
|
345
332
|
from . import gl
|
|
346
333
|
from . import graphics
|
|
347
334
|
from . import gui
|
|
348
|
-
from . import input
|
|
349
335
|
from . import image
|
|
336
|
+
from . import input
|
|
350
337
|
from . import lib
|
|
351
338
|
from . import math
|
|
352
339
|
from . import media
|
|
@@ -357,27 +344,26 @@ if TYPE_CHECKING:
|
|
|
357
344
|
from . import text
|
|
358
345
|
from . import window
|
|
359
346
|
else:
|
|
360
|
-
app = _ModuleProxy('app')
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
event = _ModuleProxy('event')
|
|
365
|
-
font = _ModuleProxy('font')
|
|
366
|
-
gl = _ModuleProxy('gl')
|
|
367
|
-
graphics = _ModuleProxy('graphics')
|
|
368
|
-
gui = _ModuleProxy('gui')
|
|
369
|
-
image = _ModuleProxy('image')
|
|
370
|
-
input = _ModuleProxy('input')
|
|
371
|
-
lib = _ModuleProxy('lib')
|
|
372
|
-
math = _ModuleProxy('math')
|
|
373
|
-
media = _ModuleProxy('media')
|
|
374
|
-
model = _ModuleProxy('model')
|
|
375
|
-
resource = _ModuleProxy('resource')
|
|
376
|
-
sprite = _ModuleProxy('sprite')
|
|
377
|
-
shapes = _ModuleProxy('shapes')
|
|
378
|
-
text = _ModuleProxy('text')
|
|
379
|
-
window = _ModuleProxy('window')
|
|
380
|
-
|
|
347
|
+
app = _ModuleProxy('app') # type: ignore
|
|
348
|
+
clock = _ModuleProxy('clock') # type: ignore
|
|
349
|
+
customtypes = _ModuleProxy('customtypes') # type: ignore
|
|
350
|
+
display = _ModuleProxy('display')
|
|
351
|
+
event = _ModuleProxy('event') # type: ignore
|
|
352
|
+
font = _ModuleProxy('font') # type: ignore
|
|
353
|
+
gl = _ModuleProxy('gl') # type: ignore
|
|
354
|
+
graphics = _ModuleProxy('graphics') # type: ignore
|
|
355
|
+
gui = _ModuleProxy('gui') # type: ignore
|
|
356
|
+
image = _ModuleProxy('image') # type: ignore
|
|
357
|
+
input = _ModuleProxy('input') # type: ignore
|
|
358
|
+
lib = _ModuleProxy('lib') # type: ignore
|
|
359
|
+
math = _ModuleProxy('math') # type: ignore
|
|
360
|
+
media = _ModuleProxy('media') # type: ignore
|
|
361
|
+
model = _ModuleProxy('model') # type: ignore
|
|
362
|
+
resource = _ModuleProxy('resource') # type: ignore
|
|
363
|
+
sprite = _ModuleProxy('sprite') # type: ignore
|
|
364
|
+
shapes = _ModuleProxy('shapes') # type: ignore
|
|
365
|
+
text = _ModuleProxy('text') # type: ignore
|
|
366
|
+
window = _ModuleProxy('window') # type: ignore
|
|
381
367
|
|
|
382
368
|
# Call after creating proxies:
|
|
383
369
|
if options['debug_trace']:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from typing import Any, Tuple, Dict
|
|
2
|
+
|
|
3
|
+
from . import app as app, canvas as canvas, clock as clock, customtypes as customtypes, font as font, gl as gl, \
|
|
4
|
+
graphics as graphics, gui as gui, image as image, input as input, math as math, media as media, model as model, \
|
|
5
|
+
resource as resource, shapes as shapes, sprite as sprite, text as text, window as window
|
|
6
|
+
|
|
7
|
+
version: str
|
|
8
|
+
MIN_PYTHON_VERSION: Tuple[int, int]
|
|
9
|
+
MIN_PYTHON_VERSION_STR: str
|
|
10
|
+
compat_platform: str
|
|
11
|
+
env: str
|
|
12
|
+
value: str
|
|
13
|
+
options: Dict[str, Any]
|
|
@@ -29,14 +29,18 @@ default policy is to wait until all windows are closed)::
|
|
|
29
29
|
.. versionadded:: 1.1
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
|
-
import platform
|
|
33
32
|
import sys
|
|
34
33
|
import weakref
|
|
34
|
+
import platform
|
|
35
|
+
|
|
36
|
+
from typing import Union
|
|
35
37
|
|
|
36
38
|
import pyglet
|
|
39
|
+
|
|
37
40
|
from pyglet import compat_platform
|
|
38
41
|
from pyglet.app.base import EventLoop
|
|
39
42
|
|
|
43
|
+
|
|
40
44
|
_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
|
|
41
45
|
|
|
42
46
|
if _is_pyglet_doc_run:
|
|
@@ -65,37 +69,38 @@ the set when they are no longer referenced or are closed explicitly.
|
|
|
65
69
|
"""
|
|
66
70
|
|
|
67
71
|
|
|
68
|
-
def run(interval=1
|
|
69
|
-
"""Begin processing events, scheduled functions and window updates.
|
|
72
|
+
def run(interval: Union[float, None] = 1/60) -> None:
|
|
73
|
+
"""Begin processing events, scheduled functions, and window updates.
|
|
70
74
|
|
|
71
75
|
This is a convenience function, equivalent to::
|
|
72
76
|
|
|
73
|
-
pyglet.app.event_loop.run()
|
|
77
|
+
pyglet.app.event_loop.run(interval)
|
|
74
78
|
|
|
75
79
|
"""
|
|
76
80
|
event_loop.run(interval)
|
|
77
81
|
|
|
78
82
|
|
|
79
|
-
def exit():
|
|
83
|
+
def exit() -> None:
|
|
80
84
|
"""Exit the application event loop.
|
|
81
85
|
|
|
82
|
-
Causes the application event loop to finish
|
|
83
|
-
running.
|
|
84
|
-
be additional code following the `run`
|
|
86
|
+
Causes the application event loop to finish if it's currenting
|
|
87
|
+
running. This call does not specifically exit the application.
|
|
88
|
+
For example, there may be additional code following the `run`
|
|
89
|
+
invocation.
|
|
85
90
|
|
|
86
91
|
This is a convenience function, equivalent to::
|
|
87
92
|
|
|
88
|
-
event_loop.exit()
|
|
93
|
+
pyglet.app.event_loop.exit()
|
|
89
94
|
|
|
90
95
|
"""
|
|
91
96
|
event_loop.exit()
|
|
92
97
|
|
|
93
98
|
|
|
94
|
-
#: The global event loop.
|
|
99
|
+
#: The global event loop. Applications can replace this
|
|
95
100
|
#: with their own subclass of :class:`EventLoop` before calling
|
|
96
101
|
#: :meth:`EventLoop.run`.
|
|
97
102
|
event_loop = EventLoop()
|
|
98
103
|
|
|
99
|
-
#: The platform-dependent event loop. Applications
|
|
100
|
-
|
|
104
|
+
#: The platform-dependent event loop. Applications are strongly discouraged
|
|
105
|
+
#: from subclassing or replacing this :class:`PlatformEventLoop` object.
|
|
101
106
|
platform_event_loop = PlatformEventLoop()
|
|
@@ -2,6 +2,8 @@ import sys
|
|
|
2
2
|
import queue
|
|
3
3
|
import threading
|
|
4
4
|
|
|
5
|
+
from typing import Union
|
|
6
|
+
|
|
5
7
|
from pyglet import app
|
|
6
8
|
from pyglet import clock
|
|
7
9
|
from pyglet import event
|
|
@@ -119,7 +121,7 @@ class EventLoop(event.EventDispatcher):
|
|
|
119
121
|
window.dispatch_event('on_refresh', dt)
|
|
120
122
|
window.flip()
|
|
121
123
|
|
|
122
|
-
def run(self, interval=1/60):
|
|
124
|
+
def run(self, interval: Union[float, None] = 1/60) -> None:
|
|
123
125
|
"""Begin processing events, scheduled functions and window updates.
|
|
124
126
|
|
|
125
127
|
:Parameters:
|
|
@@ -137,7 +139,7 @@ class EventLoop(event.EventDispatcher):
|
|
|
137
139
|
implementation is platform-specific.
|
|
138
140
|
"""
|
|
139
141
|
if interval is None:
|
|
140
|
-
# User
|
|
142
|
+
# User will schedule Window.draw manually
|
|
141
143
|
pass
|
|
142
144
|
elif interval == 0:
|
|
143
145
|
self.clock.schedule(self._redraw_windows)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Holds type aliases used throughout the codebase."""
|
|
2
|
+
import ctypes
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from typing import Union, Literal
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
if sys.version_info >= (3, 12):
|
|
9
|
+
from collections.abc import Buffer
|
|
10
|
+
else:
|
|
11
|
+
# Best-effort placeholder for older Python versions
|
|
12
|
+
Buffer = Union[bytes, bytearray, memoryview, ctypes.Array]
|
|
13
|
+
|
|
14
|
+
HorizontalAlign = Literal["left", "center", "right"]
|
|
15
|
+
AnchorX = Literal["left", "center", "right"]
|
|
16
|
+
AnchorY = Literal["top", "bottom", "center", "baseline"]
|
|
17
|
+
ContentVAlign = Literal["left", "center", "top"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"Buffer", "HorizontalAlign", "AnchorX", "AnchorY", "ContentVAlign"
|
|
23
|
+
]
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"""Display and screen management.
|
|
2
2
|
|
|
3
|
-
Rendering is performed on a :class:`
|
|
4
|
-
|
|
5
|
-
entire screen. Currently, canvases can only be created with windows (though
|
|
6
|
-
windows can be set fullscreen).
|
|
3
|
+
Rendering is performed on the content area of a :class:`pyglet.window.Window`,
|
|
4
|
+
or an entire screen.
|
|
7
5
|
|
|
8
|
-
Windows
|
|
6
|
+
Windows must belong to a :class:`Display`. On Microsoft Windows and macOS,
|
|
9
7
|
there is only one display, which can be obtained with :func:`get_display`.
|
|
10
8
|
Linux supports multiple displays, corresponding to discrete X11 display
|
|
11
9
|
connections and screens. :func:`get_display` on Linux returns the default
|
|
@@ -60,22 +58,22 @@ def get_display():
|
|
|
60
58
|
|
|
61
59
|
|
|
62
60
|
if _is_pyglet_doc_run:
|
|
63
|
-
from pyglet.
|
|
61
|
+
from pyglet.display.base import Display, Screen, Canvas, ScreenMode
|
|
64
62
|
else:
|
|
65
63
|
from pyglet import compat_platform, options
|
|
66
64
|
if options['headless']:
|
|
67
|
-
from pyglet.
|
|
68
|
-
from pyglet.
|
|
69
|
-
from pyglet.
|
|
65
|
+
from pyglet.display.headless import HeadlessDisplay as Display
|
|
66
|
+
from pyglet.display.headless import HeadlessScreen as Screen
|
|
67
|
+
from pyglet.display.headless import HeadlessCanvas as Canvas
|
|
70
68
|
elif compat_platform == 'darwin':
|
|
71
|
-
from pyglet.
|
|
72
|
-
from pyglet.
|
|
73
|
-
from pyglet.
|
|
69
|
+
from pyglet.display.cocoa import CocoaDisplay as Display
|
|
70
|
+
from pyglet.display.cocoa import CocoaScreen as Screen
|
|
71
|
+
from pyglet.display.cocoa import CocoaCanvas as Canvas
|
|
74
72
|
elif compat_platform in ('win32', 'cygwin'):
|
|
75
|
-
from pyglet.
|
|
76
|
-
from pyglet.
|
|
77
|
-
from pyglet.
|
|
73
|
+
from pyglet.display.win32 import Win32Display as Display
|
|
74
|
+
from pyglet.display.win32 import Win32Screen as Screen
|
|
75
|
+
from pyglet.display.win32 import Win32Canvas as Canvas
|
|
78
76
|
else:
|
|
79
|
-
from pyglet.
|
|
80
|
-
from pyglet.
|
|
81
|
-
from pyglet.
|
|
77
|
+
from pyglet.display.xlib import XlibDisplay as Display
|
|
78
|
+
from pyglet.display.xlib import XlibScreen as Screen
|
|
79
|
+
from pyglet.display.xlib import XlibCanvas as Canvas
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
from pyglet import gl
|
|
2
2
|
from pyglet import app
|
|
3
3
|
from pyglet import window
|
|
4
|
-
from pyglet import
|
|
4
|
+
from pyglet import display
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class Display:
|
|
8
|
-
"""A display device supporting one or more screens.
|
|
9
|
-
|
|
10
|
-
.. versionadded:: 1.2
|
|
11
|
-
"""
|
|
8
|
+
"""A display device supporting one or more screens."""
|
|
12
9
|
|
|
13
|
-
name =
|
|
14
|
-
"""Name of this display, if applicable.
|
|
15
|
-
|
|
16
|
-
:type: str
|
|
17
|
-
"""
|
|
10
|
+
name: str = ""
|
|
11
|
+
"""Name of this display, if applicable."""
|
|
18
12
|
|
|
19
|
-
x_screen = None
|
|
20
|
-
"""The X11 screen number of this display, if applicable.
|
|
13
|
+
x_screen: int = None
|
|
14
|
+
"""The X11 screen number of this display, if applicable."""
|
|
21
15
|
|
|
22
|
-
:
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
def __init__(self, name=None, x_screen=None):
|
|
16
|
+
def __init__(self, name: str = "", x_screen: int = None):
|
|
26
17
|
"""Create a display connection for the given name and screen.
|
|
27
18
|
|
|
28
19
|
On X11, :attr:`name` is of the form ``"hostname:display"``, where the
|
|
@@ -34,19 +25,13 @@ class Display:
|
|
|
34
25
|
Note that TwinView, Xinerama, xrandr and other extensions present
|
|
35
26
|
multiple monitors on a single X screen; this is usually the preferred
|
|
36
27
|
mechanism for working with multiple monitors under X11 and allows each
|
|
37
|
-
screen to be accessed through a single pyglet`~pyglet.
|
|
28
|
+
screen to be accessed through a single pyglet`~pyglet.display.Display`
|
|
38
29
|
|
|
39
30
|
On platforms other than X11, :attr:`name` and :attr:`x_screen` are
|
|
40
31
|
ignored; there is only a single display device on these systems.
|
|
41
32
|
|
|
42
|
-
:Parameters:
|
|
43
|
-
name : str
|
|
44
|
-
The name of the display to connect to.
|
|
45
|
-
x_screen : int
|
|
46
|
-
The X11 screen number to use.
|
|
47
|
-
|
|
48
33
|
"""
|
|
49
|
-
|
|
34
|
+
display._displays.add(self)
|
|
50
35
|
|
|
51
36
|
def get_screens(self):
|
|
52
37
|
"""Get the available screens.
|
|
@@ -81,7 +66,7 @@ class Display:
|
|
|
81
66
|
|
|
82
67
|
:rtype: sequence of :class:`~pyglet.window.Window`
|
|
83
68
|
"""
|
|
84
|
-
return [
|
|
69
|
+
return [win for win in app.windows if window.display is self]
|
|
85
70
|
|
|
86
71
|
|
|
87
72
|
class Screen:
|
|
@@ -106,7 +91,7 @@ class Screen:
|
|
|
106
91
|
"""
|
|
107
92
|
|
|
108
93
|
:parameters:
|
|
109
|
-
`display` : `~pyglet.
|
|
94
|
+
`display` : `~pyglet.display.Display`
|
|
110
95
|
:attr:`display`
|
|
111
96
|
`x` : int
|
|
112
97
|
Left edge :attr:`x`
|
|
@@ -267,6 +252,20 @@ class Screen:
|
|
|
267
252
|
"""
|
|
268
253
|
raise NotImplementedError('abstract')
|
|
269
254
|
|
|
255
|
+
def get_dpi(self):
|
|
256
|
+
"""Get the DPI of the screen.
|
|
257
|
+
|
|
258
|
+
:rtype: int
|
|
259
|
+
"""
|
|
260
|
+
raise NotImplementedError('abstract')
|
|
261
|
+
|
|
262
|
+
def get_scale(self):
|
|
263
|
+
"""Get the pixel scale ratio of the screen.
|
|
264
|
+
|
|
265
|
+
:rtype: float
|
|
266
|
+
"""
|
|
267
|
+
raise NotImplementedError('abstract')
|
|
268
|
+
|
|
270
269
|
|
|
271
270
|
class ScreenMode:
|
|
272
271
|
"""Screen resolution and display settings.
|
|
@@ -4,8 +4,12 @@ from ctypes import *
|
|
|
4
4
|
|
|
5
5
|
from .base import Display, Screen, ScreenMode, Canvas
|
|
6
6
|
|
|
7
|
-
from pyglet.libs.darwin.cocoapy import CGDirectDisplayID, quartz, cf
|
|
7
|
+
from pyglet.libs.darwin.cocoapy import CGDirectDisplayID, quartz, cf, ObjCClass, get_NSString
|
|
8
8
|
from pyglet.libs.darwin.cocoapy import cfstring_to_string, cfarray_to_list
|
|
9
|
+
from pyglet.libs.darwin import NSDeviceResolution
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
NSScreen = ObjCClass('NSScreen')
|
|
9
13
|
|
|
10
14
|
|
|
11
15
|
class CocoaDisplay(Display):
|
|
@@ -31,28 +35,38 @@ class CocoaScreen(Screen):
|
|
|
31
35
|
self._cg_display_id = displayID
|
|
32
36
|
# Save the default mode so we can restore to it.
|
|
33
37
|
self._default_mode = self.get_mode()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
38
|
+
self._ns_screen = self.get_nsscreen()
|
|
39
|
+
|
|
40
|
+
def get_nsscreen(self):
|
|
41
|
+
"""Returns the NSScreen instance that matches our CGDirectDisplayID."""
|
|
42
|
+
# Get a list of all currently active NSScreens and then search through
|
|
43
|
+
# them until we find one that matches our CGDisplayID.
|
|
44
|
+
screen_array = NSScreen.screens()
|
|
45
|
+
count = screen_array.count()
|
|
46
|
+
for i in range(count):
|
|
47
|
+
nsscreen = screen_array.objectAtIndex_(i)
|
|
48
|
+
screenInfo = nsscreen.deviceDescription()
|
|
49
|
+
displayID = screenInfo.objectForKey_(get_NSString('NSScreenNumber'))
|
|
50
|
+
displayID = displayID.intValue()
|
|
51
|
+
if displayID == self._cg_display_id:
|
|
52
|
+
return nsscreen
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
def get_dpi(self):
|
|
56
|
+
desc = self._ns_screen.deviceDescription()
|
|
57
|
+
rsize = desc.objectForKey_(NSDeviceResolution).sizeValue()
|
|
58
|
+
return int(rsize.width)
|
|
59
|
+
|
|
60
|
+
def get_scale(self):
|
|
61
|
+
ratio = 1.0
|
|
62
|
+
if self._ns_screen:
|
|
63
|
+
pts = self._ns_screen.frame()
|
|
64
|
+
pixels = self._ns_screen.convertRectToBacking_(pts)
|
|
65
|
+
ratio = pixels.size.width / pts.size.width
|
|
66
|
+
else:
|
|
67
|
+
print("Could not initialize NSScreen to retrieve DPI. Using default.")
|
|
68
|
+
|
|
69
|
+
return ratio
|
|
56
70
|
|
|
57
71
|
def get_matching_configs(self, template):
|
|
58
72
|
canvas = CocoaCanvas(self.display, self, None)
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
from .base import Display, Screen, ScreenMode, Canvas
|
|
2
2
|
|
|
3
|
-
from pyglet.libs.win32 import _user32
|
|
3
|
+
from pyglet.libs.win32 import _user32, _shcore, _gdi32
|
|
4
4
|
from pyglet.libs.win32.constants import *
|
|
5
5
|
from pyglet.libs.win32.types import *
|
|
6
6
|
from pyglet.libs.win32.context_managers import device_context
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
def set_dpi_awareness():
|
|
10
|
+
"""
|
|
11
|
+
Setting DPI varies per Windows version.
|
|
12
|
+
Note: DPI awareness needs to be set before Window, Display, or Screens are initialized.
|
|
13
|
+
"""
|
|
14
|
+
if WINDOWS_10_CREATORS_UPDATE_OR_GREATER:
|
|
15
|
+
_user32.SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)
|
|
16
|
+
elif WINDOWS_8_1_OR_GREATER: # 8.1 and above allows per monitor DPI.
|
|
17
|
+
_shcore.SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE)
|
|
18
|
+
elif WINDOWS_VISTA_OR_GREATER: # Only System wide DPI
|
|
19
|
+
_user32.SetProcessDPIAware()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
set_dpi_awareness()
|
|
23
|
+
|
|
24
|
+
|
|
9
25
|
class Win32Display(Display):
|
|
10
26
|
def get_screens(self):
|
|
11
27
|
screens = []
|
|
@@ -46,6 +62,24 @@ class Win32Screen(Screen):
|
|
|
46
62
|
_user32.GetMonitorInfoW(self._handle, byref(info))
|
|
47
63
|
return info.szDevice
|
|
48
64
|
|
|
65
|
+
def get_dpi(self):
|
|
66
|
+
if WINDOWS_8_1_OR_GREATER:
|
|
67
|
+
xdpi = UINT()
|
|
68
|
+
ydpi = UINT()
|
|
69
|
+
_shcore.GetDpiForMonitor(self._handle, 0, byref(xdpi), byref(ydpi))
|
|
70
|
+
xdpi, ydpi = xdpi.value, ydpi.value
|
|
71
|
+
else:
|
|
72
|
+
dc = _user32.GetDC(None)
|
|
73
|
+
xdpi = _gdi32.GetDeviceCaps(dc, LOGPIXELSX)
|
|
74
|
+
ydpi = _gdi32.GetDeviceCaps(dc, LOGPIXELSY)
|
|
75
|
+
_user32.ReleaseDC(0, dc)
|
|
76
|
+
|
|
77
|
+
return xdpi
|
|
78
|
+
|
|
79
|
+
def get_scale(self):
|
|
80
|
+
xdpi = self.get_dpi()
|
|
81
|
+
return xdpi / USER_DEFAULT_SCREEN_DPI
|
|
82
|
+
|
|
49
83
|
def get_modes(self):
|
|
50
84
|
device_name = self.get_device_name()
|
|
51
85
|
i = 0
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import ctypes
|
|
2
2
|
from ctypes import *
|
|
3
3
|
|
|
4
|
+
from pyglet.util import asbytes
|
|
5
|
+
|
|
4
6
|
from pyglet import app
|
|
5
7
|
from pyglet.app.xlib import XlibSelectDevice
|
|
6
8
|
from .base import Display, Screen, ScreenMode, Canvas
|
|
@@ -177,6 +179,28 @@ class XlibScreen(Screen):
|
|
|
177
179
|
super(XlibScreen, self).__init__(display, x, y, width, height)
|
|
178
180
|
self._xinerama = xinerama
|
|
179
181
|
|
|
182
|
+
def get_dpi(self):
|
|
183
|
+
resource = xlib.XResourceManagerString(self.display._display)
|
|
184
|
+
dpi = 96
|
|
185
|
+
if resource:
|
|
186
|
+
xlib.XrmInitialize()
|
|
187
|
+
|
|
188
|
+
db = xlib.XrmGetStringDatabase(resource)
|
|
189
|
+
if db:
|
|
190
|
+
rs_type = c_char_p()
|
|
191
|
+
value = xlib.XrmValue()
|
|
192
|
+
if xlib.XrmGetResource(db, asbytes("Xft.dpi"), asbytes("Xft.dpi"),
|
|
193
|
+
byref(rs_type), byref(value)):
|
|
194
|
+
if value.addr and rs_type.value == b'String':
|
|
195
|
+
dpi = int(value.addr)
|
|
196
|
+
|
|
197
|
+
xlib.XrmDestroyDatabase(db)
|
|
198
|
+
|
|
199
|
+
return dpi
|
|
200
|
+
|
|
201
|
+
def get_scale(self):
|
|
202
|
+
return self.get_dpi() / 96
|
|
203
|
+
|
|
180
204
|
def get_matching_configs(self, template):
|
|
181
205
|
canvas = XlibCanvas(self.display, None)
|
|
182
206
|
configs = template.match(canvas)
|
|
@@ -98,6 +98,7 @@ def have_font(name: str) -> bool:
|
|
|
98
98
|
def load(name: Optional[Union[str, Iterable[str]]] = None, size: Optional[float] = None, bold: bool = False,
|
|
99
99
|
italic: bool = False, stretch: bool = False, dpi: Optional[float] = None):
|
|
100
100
|
"""Load a font for rendering.
|
|
101
|
+
|
|
101
102
|
:Parameters:
|
|
102
103
|
`name` : str, or list of str
|
|
103
104
|
Font family, for example, "Times New Roman". If a list of names
|
|
@@ -50,7 +50,7 @@ from pyglet.gl import gl_info
|
|
|
50
50
|
from pyglet.gl.gl_compat import GL_LUMINANCE, GL_INTENSITY
|
|
51
51
|
|
|
52
52
|
from pyglet import compat_platform
|
|
53
|
-
from .base import ObjectSpace,
|
|
53
|
+
from .base import ObjectSpace, DisplayConfig, Context
|
|
54
54
|
|
|
55
55
|
import sys as _sys
|
|
56
56
|
_is_pyglet_doc_run = hasattr(_sys, "is_pyglet_doc_run") and _sys.is_pyglet_doc_run
|
|
@@ -162,6 +162,10 @@ def _create_shadow_window():
|
|
|
162
162
|
"""Shadow window does not need a projection."""
|
|
163
163
|
pass
|
|
164
164
|
|
|
165
|
+
def on_resize(self, width, height):
|
|
166
|
+
"""No projection and not required."""
|
|
167
|
+
pass
|
|
168
|
+
|
|
165
169
|
_shadow_window = ShadowWindow()
|
|
166
170
|
_shadow_window.switch_to()
|
|
167
171
|
|