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

Monitor callback only triggered by physical device events #53

Closed
elmindreda opened this issue Jun 17, 2013 · 1 comment
Closed

Monitor callback only triggered by physical device events #53

elmindreda opened this issue Jun 17, 2013 · 1 comment
Assignees
Labels
bug Bug reports and bugfix pull requests verified Reproduced or otherwise verified bugs Windows Win32 specific (not Cygwin or WSL)
Milestone

Comments

@elmindreda
Copy link
Member

This issue has been moved from SourceForge.

Tested under Windows 8, but probably exists for prior versions, _glfw.monitorCallback is only being called on physical device connects/disconnects. The cause of this is that it relies on the WM_DEVICECHANGE/DBT_DEVNODES_CHANGED message which is, of course, only sent when a physical device is connected or disconnected from the system. This means that enabling or disabling displays (e.g., turning extended display settings on/off) does not trigger a callback and cannot be re-enumerated without restarting the program.

By using Spy++ to watch notifications sent when displays were enabled/disabled I was able to identify a few notifications that are triggered through this action, of which WM_DISPLAYCHANGE is the most promising (the others tended to get sent multiple times). As a proof of concept, I modified windowProc in win32_window.c, but I have concerns about it's suitability as a permanent solution. Off the top of my head, though, I see two reasons why this solution might not be a good one:

  • it means that display connects/disconnects will result in _glfwInputMonitorChange being called twice as a result of handling both 'WM_DEVICECHANGEandWM_DISPLAYCHANGE`.
  • it means that initiating a video mode change will result in _glfwInputMonitorChange being called unnecessarily.

There is probably a better way of handling this scenario, but Windows isn't my thing and I don't really know how else to integrate support for handling display enabling/disabling with the existing methods for handling notifications.

Regardless, as enabling/disabling monitors without disconnecting them is a common usage scenario this is something that probably should be supported.

@elmindreda
Copy link
Member Author

This is related to #288.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports and bugfix pull requests verified Reproduced or otherwise verified bugs Windows Win32 specific (not Cygwin or WSL)
Projects
None yet
Development

No branches or pull requests

1 participant