Do not print window title to debug stream inside the set_Title property. Instead, log an error only when the method call fails. Fixes issue [#1239]: "Debug.Print in Title property".

This commit is contained in:
the_fiddler 2009-10-17 22:02:08 +00:00
parent 158f1af9d3
commit c5464bc5d0

View file

@ -143,7 +143,7 @@ namespace OpenTK.Platform.Windows
switch (message)
{
#region Size / Move events
#region Size / Move / Style events
case WindowMessage.ACTIVATE:
break;
@ -781,17 +781,14 @@ namespace OpenTK.Platform.Windows
get
{
sb_title.Remove(0, sb_title.Length);
Functions.GetWindowText(window.WindowHandle, sb_title, sb_title.MaxCapacity);
if (Functions.GetWindowText(window.WindowHandle, sb_title, sb_title.MaxCapacity) == 0)
Debug.Print("Failed to retrieve window title (window:{0}, reason:{2}).", window.WindowHandle, Marshal.GetLastWin32Error());
return sb_title.ToString();
}
set
{
bool ret = Functions.SetWindowText(window.WindowHandle, value);
if (ret)
Debug.Print("Window {0} title changed to '{1}'.", window.WindowHandle, Title);
else
Debug.Print("Window {0} title failed to change to '{1}'.", window.WindowHandle, Title);
if (!Functions.SetWindowText(window.WindowHandle, value))
Debug.Print("Failed to change window title (window:{0}, new title:{1}, reason:{2}).", window.WindowHandle, value, Marshal.GetLastWin32Error());
}
}