diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 383f9d9b..b44191bc 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -316,7 +316,7 @@ namespace OpenTK /// Not used. protected virtual void OnLoad(EventArgs e) { - if (Load != null) Load(this, e); + Load(this, e); } #endregion @@ -329,7 +329,7 @@ namespace OpenTK /// Not used. protected virtual void OnUnload(EventArgs e) { - if (Unload != null) Unload(this, e); + Unload(this, e); } #endregion @@ -929,22 +929,22 @@ namespace OpenTK /// /// Occurs before the window is displayed for the first time. /// - public event EventHandler Load; + public event EventHandler Load = delegate { }; /// /// Occurs when it is time to render a frame. /// - public event EventHandler RenderFrame; + public event EventHandler RenderFrame = delegate { }; /// /// Occurs before the window is destroyed. /// - public event EventHandler Unload; + public event EventHandler Unload = delegate { }; /// /// Occurs when it is time to update a frame. /// - public event EventHandler UpdateFrame; + public event EventHandler UpdateFrame = delegate { }; #endregion @@ -973,7 +973,7 @@ namespace OpenTK /// protected virtual void OnRenderFrame(FrameEventArgs e) { - if (RenderFrame != null) RenderFrame(this, e); + RenderFrame(this, e); } #endregion @@ -989,7 +989,7 @@ namespace OpenTK /// protected virtual void OnUpdateFrame(FrameEventArgs e) { - if (UpdateFrame != null) UpdateFrame(this, e); + UpdateFrame(this, e); } #endregion diff --git a/Source/OpenTK/NativeWindow.cs b/Source/OpenTK/NativeWindow.cs index 681eb3ef..dd7467f9 100644 --- a/Source/OpenTK/NativeWindow.cs +++ b/Source/OpenTK/NativeWindow.cs @@ -566,72 +566,72 @@ namespace OpenTK /// /// Occurs after the window has closed. /// - public event EventHandler Closed; + public event EventHandler Closed = delegate { }; /// /// Occurs when the window is about to close. /// - public event EventHandler Closing; + public event EventHandler Closing = delegate { }; /// /// Occurs when the window is disposed. /// - public event EventHandler Disposed; + public event EventHandler Disposed = delegate { }; /// /// Occurs when the property of the window changes. /// - public event EventHandler FocusedChanged; + public event EventHandler FocusedChanged = delegate { }; /// /// Occurs when the property of the window changes. /// - public event EventHandler IconChanged; + public event EventHandler IconChanged = delegate { }; /// /// Occurs whenever a character is typed. /// - public event EventHandler KeyPress; + public event EventHandler KeyPress = delegate { }; /// /// Occurs whenever the window is moved. /// - public event EventHandler Move; + public event EventHandler Move = delegate { }; /// /// Occurs whenever the mouse cursor enters the window . /// - public event EventHandler MouseEnter; + public event EventHandler MouseEnter = delegate { }; /// /// Occurs whenever the mouse cursor leaves the window . /// - public event EventHandler MouseLeave; + public event EventHandler MouseLeave = delegate { }; /// /// Occurs whenever the window is resized. /// - public event EventHandler Resize; + public event EventHandler Resize = delegate { }; /// /// Occurs when the property of the window changes. /// - public event EventHandler TitleChanged; + public event EventHandler TitleChanged = delegate { }; /// /// Occurs when the property of the window changes. /// - public event EventHandler VisibleChanged; + public event EventHandler VisibleChanged = delegate { }; /// /// Occurs when the property of the window changes. /// - public event EventHandler WindowBorderChanged; + public event EventHandler WindowBorderChanged = delegate { }; /// /// Occurs when the property of the window changes. /// - public event EventHandler WindowStateChanged; + public event EventHandler WindowStateChanged = delegate { }; #endregion @@ -705,7 +705,7 @@ namespace OpenTK /// Not used. protected virtual void OnClosed(EventArgs e) { - if (Closed != null) Closed(this, e); + Closed(this, e); } #endregion @@ -720,7 +720,7 @@ namespace OpenTK /// Set e.Cancel to true in order to stop the NativeWindow from closing. protected virtual void OnClosing(CancelEventArgs e) { - if (Closing != null) Closing(this, e); + Closing(this, e); } #endregion @@ -733,7 +733,7 @@ namespace OpenTK /// Not used. protected virtual void OnDisposed(EventArgs e) { - if (Disposed != null) Disposed(this, e); + Disposed(this, e); } #endregion @@ -746,7 +746,7 @@ namespace OpenTK /// Not used. protected virtual void OnFocusedChanged(EventArgs e) { - if (FocusedChanged != null) FocusedChanged(this, e); + FocusedChanged(this, e); } #endregion @@ -759,7 +759,7 @@ namespace OpenTK /// Not used. protected virtual void OnIconChanged(EventArgs e) { - if (IconChanged != null) IconChanged(this, e); + IconChanged(this, e); } #endregion @@ -772,7 +772,7 @@ namespace OpenTK /// The for this event. protected virtual void OnKeyPress(KeyPressEventArgs e) { - if (KeyPress != null) KeyPress(this, e); + KeyPress(this, e); } #endregion @@ -785,7 +785,7 @@ namespace OpenTK /// Not used. protected virtual void OnMove(EventArgs e) { - if (Move != null) Move(this, e); + Move(this, e); } #endregion @@ -798,7 +798,7 @@ namespace OpenTK /// Not used. protected virtual void OnMouseEnter(EventArgs e) { - if (MouseEnter != null) MouseEnter(this, e); + MouseEnter(this, e); } #endregion @@ -811,7 +811,7 @@ namespace OpenTK /// Not used. protected virtual void OnMouseLeave(EventArgs e) { - if (MouseLeave != null) MouseLeave(this, e); + MouseLeave(this, e); } #endregion @@ -824,7 +824,7 @@ namespace OpenTK /// Not used. protected virtual void OnResize(EventArgs e) { - if (Resize != null) Resize(this, e); + Resize(this, e); } #endregion @@ -837,7 +837,7 @@ namespace OpenTK /// Not used. protected virtual void OnTitleChanged(EventArgs e) { - if (TitleChanged != null) TitleChanged(this, e); + TitleChanged(this, e); } #endregion @@ -850,7 +850,7 @@ namespace OpenTK /// Not used. protected virtual void OnVisibleChanged(EventArgs e) { - if (VisibleChanged != null) VisibleChanged(this, e); + VisibleChanged(this, e); } #endregion @@ -863,7 +863,7 @@ namespace OpenTK /// Not used. protected virtual void OnWindowBorderChanged(EventArgs e) { - if (WindowBorderChanged != null) WindowBorderChanged(this, e); + WindowBorderChanged(this, e); } #endregion @@ -876,7 +876,7 @@ namespace OpenTK /// Not used. protected virtual void OnWindowStateChanged(EventArgs e) { - if (WindowStateChanged != null) WindowStateChanged(this, e); + WindowStateChanged(this, e); } #endregion