Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Keyboard NullPointerException fix #6

merged 1 commit into from

2 participants


Application would crash on start, so i figured i'd better open a pull request even though it's a tiny fix :)

@andykorth andykorth merged commit 2c3a639 into andykorth:master

Oops. Thanks a lot!

@Robmaister Robmaister referenced this pull request from a commit
@thefiddler thefiddler Added workaround for issue #6
The issue is that some display devices report a BitsPerPel value of 0.
It is not clear whether this is a bug in WinDisplayDevice.cs or some
strange windows issue. The implemented workaround adds an entry to the
debug log and hardcodes BitsPerPel to 32 whenever this condition is
encountered. More investigation required.
@Robmaister Robmaister referenced this pull request from a commit
@thefiddler thefiddler Switch to EnumDisplayModesEx
Use EnumDisplayModesEx instead of EnumDisplayModes. This might help
with issue #6.
@Robmaister Robmaister referenced this pull request from a commit
@thefiddler thefiddler Workaround for issues #4 and #6
GraphicsMode.Default used to be set to
(DisplayDevice.Default.BitsPerPixel, 16, 0, 0, 0, 2, false) for improved
compatibility with older systems. However, this appears to be causing
issues with specific modern GPUs. Switch the default mode to (32, 24, 8)
until a more proper solution can be found.
@AdamsLair AdamsLair referenced this pull request from a commit
@thefiddler thefiddler Made DPI-awareness configurable (issue #6)
It is now possible to indicate that an application is not DPI-aware. In
that case, OpenTK will let the operating system handle DPI scaling. This
results in worse visuals (pixel doubling) but allows non DPI-aware
applications to continue working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 26, 2013
  1. @jhauberg
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  Source/OpenTK/Platform/Windows/WinRawKeyboard.cs
2  Source/OpenTK/Platform/Windows/WinRawKeyboard.cs
@@ -108,7 +108,7 @@ public void RefreshDevices()
string deviceClassGUID = (string)regkey.GetValue("ClassGUID"); // for windows 8 support via OpenTK issue 3198
// making a guess at backwards compatability. Not sure what older windows returns in these cases...
- if(deviceClass != null || deviceClass.Equals(string.Empty)){
+ if(deviceClass == null || deviceClass.Equals(string.Empty)){
RegistryKey classGUIDKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Class\" + deviceClassGUID);
deviceClass = classGUIDKey != null ? (string) classGUIDKey.GetValue("Class") : string.Empty;
Something went wrong with that request. Please try again.