Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for get_default_screen() #717

Merged
merged 1 commit into from Dec 4, 2022

Conversation

caffeinepills
Copy link
Collaborator

@caffeinepills caffeinepills commented Dec 2, 2022

display.get_default_screen() doesn't get the primary monitor. It just gets the first monitor in the list, which is not guaranteed to be the primary.

From what I have found in testing, the display at position 0, 0 is considered the primary in almost all cases.

I have tested in a 3 monitor setup and my primary is on "Display 2", but my default prior to the fix was always considered Display 1. After testing, (on Windows) now, even if I switch to Display 3 being primary, Display 3 becomes 0, 0 and is properly recognized.

If the primary is not found for whatever reason, it will fallback to default behavior of choosing first in the list.

This just needs confirmation on Linux and Mac that the behavior is the same.

This can be backported to 1.5

…e first monitor in the list, which is not guaranteed to be the primary.

From what I have found, the display at position 0, 0 is considered the primary in most cases.
@benmoran56
Copy link
Member

Thanks. I though we fixed this in the past, but maybe that was Linux or macOS. I should probably check on Linux to confirm.

@benmoran56 benmoran56 merged commit df76bff into pyglet:master Dec 4, 2022
caffeinepills added a commit to caffeinepills/pyglet that referenced this pull request Aug 10, 2023
…e first monitor in the list, which is not guaranteed to be the primary. (pyglet#717)

From what I have found, the display at position 0, 0 is considered the primary in most cases.

(cherry picked from commit df76bff)
benmoran56 added a commit that referenced this pull request Aug 28, 2023
* Skip calling CGDisplaySetDisplayMode if the current screen mode is the (#891)

same as the default screen mode.

(cherry picked from commit f125c93)

* DW: Enable color font only for supported OS's

D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT is only supported on Windows 8.1 or higher.
https://learn.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_draw_text_options

(cherry picked from commit 5926587)

* ffmpeg: remove duplicate code blocks.

(cherry picked from commit 2f57b18)

* New TIMECAPS structure.
Minor cleanup.

(cherry picked from commit 2aeb170)

* Windows: set higher timer precision when starting PlatformEventLoop.

(cherry picked from commit eff4c85)

* get_default_screen() doesn't get the primary monitor. It just gets the first monitor in the list, which is not guaranteed to be the primary. (#717)

From what I have found, the display at position 0, 0 is considered the primary in most cases.

(cherry picked from commit df76bff)

* DW Enhancements (#737)

* DW Enhancements:
- Legacy font naming parser. (option:dw_legacy_naming)
- Filename access to collections.

* Fix for possible hanging reading buffer.

Co-authored-by: caffeinepills <>

(cherry picked from commit fdf5fe2)

* Fix debug_win32 - LoadLibrary implementation was broken and gave false positives due to not being able to define argtypes and restypes. Fix for uncovered bugs due to fixed debug function (#748)

LoadIconW deprecated -> Use LoadImageW
SetClassLongW deprecated -> Use SetClassLongPtrW
Caption needs to be set after context switch.
Mouse needs to be set visible before window is destroyed.
Unregister hotkey for exclusive keyboard only if it was set prior.

(cherry picked from commit d473d56)

* Fix 32 bit crashes with DirectWrite. (#771)

Potential fix for Win 8.1

(cherry picked from commit c7d16ee)

* Support F16-24 on Windows and F21-24 on Linux. Mac limited to max of F20. (#773)

Co-authored-by: caffeinepills <>
(cherry picked from commit 1016a29)

* Initialize the AudioDriver when the media module is first used.

(cherry picked from commit 8d2215f)

* Various MacOSX improvements and fixes (#790)

* Fix memory leak with NSDate object returns.

* Disable keydown in text view. Doesn't seem to remove any functionality.

* Disable press and hold capability to prevent accent window from popping up.

* Support on_file_drop for Mac.

* Fix FFmpeg 4.0 not being found on MacOS

* Check platform to prevent unnecessary errors from other platforms when debugging.

* Initial support for CoreAudio decoder.

* Fix seeking loop for non-static sources.
Add Coreaudio to default decoders for MacOS.

* Additional steps to prevent memory leaks by improving AutoreleasePool behavior.
Cleanup and AutoreleasePool helper function.

* Cleanup

* Additional print

* More debugging

More debugging

* Attempt fix

* Attempt fix2

* Cleanup prints

* Further changes.

* Stupid chjange.

* Revert "Stupid chjange."

This reverts commit c6917c5.

* Remove encoding cache.

* Revert "Remove encoding cache."

This reverts commit a22a70d.

* Remove objcclass cache

* Remove cache methods

* Last Attempt

* Last Attempt2

* Last Attempt3

* Add filename support for QuartzFont

* Additional cleanup
Fix some memory leaks detected by leaks program

* Add filename support for QuartzFont

* Cleanup prints

* Remove unused imports.

(cherry picked from commit 28ad641)

* macOS alternate event loop (#794)

* Initial attempt at alternate event loop.

* Add osx_alt_loop pyglet option. This forces the alternate event loop (either for testing, or if needed in the future). This is defaulted for ARM64 programs.
Removal of pyglet-unique keyDown, keyUp, flagsChanged events for the default equivalents.
Cleanup.

(cherry picked from commit e374e81)

* Don't automatically create Audio Driver during documentation build.

(cherry picked from commit 72c273a)

* Add context manager wrapping GDI acquisition & release (#810)

* First polished draft of DeviceContext context manager

* Replace OOP manager with a contextlib decorator

* Replace brittle DC acqusition in Win32Font.__init__ with context manager

* Use context manager in Win32Font.get_logfont

* Use context manager in Win32Screen.get_matching_configs

* Use device_context context manager for font query function

* Replace PyCharm-inserted relative import with style-compliant absolute import

* Clean up imports in context managers

* Fix check to use falsiness rather than None-equivalnce

* Attempt to add tests despite no win32 install

* Use None for NULL pointer/handle per ctypes doc

* Phrasing + style polishing for context_managers module docstring

(cherry picked from commit a44e83a)

* fix broken packs/unpacks in ttf/png (#819)

(cherry picked from commit dbd866f)

* Added support for FFmpeg 6.0. Tested with versions 4.4, 5.1, and 6.0; both audio and video. (#835)

Added a warning if the loaded FFmpeg versions are not the expected versions we have tested with.
FFmpeg debug message now shows some extra information when FFmpeg is not available.
Added a missing print for OSError in the load_library to prevent hidden errors when loaded.
Removed mp4 extension from WMF. (Experimental in the first place, and had no acceleration. Just use MP4 for FFmpeg for smoothest experience)

(cherry picked from commit 515d7a5)

* Fix issue with TextView not able to receive events for text input purposes.
Add some estimates for fallback metric detection. This is incase the font being used does not have the glyphs requested and the system falls back to another font (such as Chinese).

(cherry picked from commit 74b6bc0)

* Sometimes zero length characters can be inserted as text. Add extra check.

(cherry picked from commit 7fc66ea)

* Fix: Xaudio2 crash when trying to remove a player that was deleted mid callback and it tries to refill a packet. (#877)

Fix: Wrong ctypes calls. Fixes names, descriptions being unknown, and freeing of resources in get_pkey_value.
Added: Now deletes and adds devices to the list as devices are added and removed. This keeps the cached device list up to date after initial enumeration.
Changed: Use debug_input for AudioDevices instead of media as it usually involves removing and adding devices.
Changed: Cleanup and changes to AudioDevices and added some typings.
Changed: on_default_changed now includes the DeviceFlow. Since the device can be None, the driver needs to know about the flow.

(cherry picked from commit 06202f8)

* Use the correct calculated pitch, image.pitch is unreliable for ImageRegions due to a bug as of 2.0.8. (#881)


(cherry picked from commit 955ea4f)

* Update version.
Fix codec incompat.
Move COM to windows lib.

* Fix: Xaudio2 crash when trying to remove a player that was deleted mid callback and it tries to refill a packet. (#877)

Fix: Wrong ctypes calls. Fixes names, descriptions being unknown, and freeing of resources in get_pkey_value.
Added: Now deletes and adds devices to the list as devices are added and removed. This keeps the cached device list up to date after initial enumeration.
Changed: Use debug_input for AudioDevices instead of media as it usually involves removing and adding devices.
Changed: Cleanup and changes to AudioDevices and added some typings.
Changed: on_default_changed now includes the DeviceFlow. Since the device can be None, the driver needs to know about the flow.
(cherry picked from commit 06202f8)

* Fix sharing multiple contexts on Windows. (#917)


(cherry picked from commit ec85277)

* Pass events to next responder (NSView) (#898)


(cherry picked from commit 23b80cb)

* Remove 2.0 loop changes.

* Test actions.

---------

Co-authored-by: Matt Wronkiewicz <wronkiew@gmail.com>
Co-authored-by: Benjamin Moran <benmoran@protonmail.com>
Co-authored-by: Paul <36696816+pushfoo@users.noreply.github.com>
Co-authored-by: Daniel Kilimnik <mail@kilimnik.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants