emacinnes's picture

GameWindow inconsistent use of Width/Height on Windows

Project:The Open Toolkit library
Category:bug report

In my application, I am trying to restore the Width and Height of the Window based off saved values. I am using the Onresize event to record down any size change to the Window, however on restoring these values back, I do not get a Window back that is the same size, I get one slightly smaller, (16 pixels smaller horizontally, and around 26 pixels smaller vertically, the size of the window frame), so that after 6 runs the window is noticeably smaller and the user has to manually resize it.

Is there a workaround/way to fix this?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


Status:open» fixed

The Width and Height parameters reflect to the whole window, not just the client area. The ability to set the client area directly has been added to OpenTK 0.9.9: use the ClientRectangle and ClientSize properties.

emacinnes's picture


that will help with resolution setting, but won't fix the inconsistent results with Width/Height, i.e. regardless of whether it is client area or window area, if I read values in the Resize event, I should be able to get the same size window back if I set the Width/Height on loading, however I don't.


When I load the GameWindow, I am setting the Width/Height to:
8:53:49 PM 93ms - 10> Main Window Width: 1322
8:53:49 PM 93ms - 10> Main Window Height: 1046

However, the information I get in the Resize event is (from e.Width and e.Height respectively):
8:53:50 PM 781ms - 10> Resized Main Window Width: 1306
8:53:50 PM 781ms - 10> Resized Main Window Height: 1012

Which is a difference of 16,34 for width and height respectively, so when the user resizes the Window, it all goes pear-shaped on restoring the screen to it's former size (fullscreen and back again, or just load/edit/quit/restart).

the Fiddler's picture


Does this issue still occur with OpenTK 0.9.8 or 0.9.9?

emacinnes's picture


I'll check it out and let you know if that's still an issue.

the Fiddler's picture


Version:0.9.2» 0.9.9-2b
Status:fixed» closed

Closing issues fixed in 0.9.9-2.