From 4c0b710fa619cdc7bc709b827c655b60ace61edc Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sun, 5 Aug 2007 18:33:38 +0000 Subject: [PATCH] Slightly changed debug output on Create event (X11GLNative) Corrected event hooking in X11Input. --- Source/OpenTK/Platform/X11/X11GLNative.cs | 2 +- Source/OpenTK/Platform/X11/X11Input.cs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index dfd2030f..3de7ebe2 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -283,8 +283,8 @@ namespace OpenTK.Platform.X11 { if (this.Create != null) { + Debug.Print("Create event fired from window: {0}", info.ToString()); this.Create(this, e); - Debug.Print("OnCreate fired, from window: {0}", info.ToString()); } } diff --git a/Source/OpenTK/Platform/X11/X11Input.cs b/Source/OpenTK/Platform/X11/X11Input.cs index 9bf7e136..60188589 100644 --- a/Source/OpenTK/Platform/X11/X11Input.cs +++ b/Source/OpenTK/Platform/X11/X11Input.cs @@ -18,6 +18,7 @@ namespace OpenTK.Platform.X11 Event e = new Event(); KeyEvent keyEvent = new KeyEvent(); + int pending; #region --- Constructors --- @@ -115,16 +116,31 @@ namespace OpenTK.Platform.X11 #endregion + /// + /// Consumes to keyboard, mouse, etc events, routing them to their + /// respective drivers. + /// public void ProcessEvents() { + pending = API.Pending(window.Display); + + if (pending == 0) + return; + API.PeekEvent(window.Display, e); + switch (e.Type) { case EventType.KeyPress: case EventType.KeyRelease: + Debug.WriteLine("Key event consumed"); API.NextEvent(window.Display, keyEvent); keyboardDriver.ProcessKeyboardEvent(keyEvent); break; + + default: + API.NextEvent(window.Display, e); + break; } }