* Rethrow exception from main event loop in SDL. Fixed #735 * Remove try-catch
This commit is contained in:
parent
8ec577b9ca
commit
067cd4a5bc
1 changed files with 59 additions and 65 deletions
|
@ -146,79 +146,73 @@ namespace OpenTK.Platform.SDL2
|
||||||
{
|
{
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
|
|
||||||
try
|
|
||||||
|
Sdl2NativeWindow window = null;
|
||||||
|
|
||||||
|
switch (ev.Type)
|
||||||
{
|
{
|
||||||
Sdl2NativeWindow window = null;
|
case EventType.WINDOWEVENT:
|
||||||
|
if (windows.TryGetValue(ev.Window.WindowID, out window))
|
||||||
|
{
|
||||||
|
ProcessWindowEvent(window, ev.Window);
|
||||||
|
processed = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
switch (ev.Type)
|
case EventType.TEXTINPUT:
|
||||||
{
|
if (windows.TryGetValue(ev.Text.WindowID, out window))
|
||||||
case EventType.WINDOWEVENT:
|
{
|
||||||
if (windows.TryGetValue(ev.Window.WindowID, out window))
|
ProcessTextInputEvent(window, ev.Text);
|
||||||
{
|
processed = true;
|
||||||
ProcessWindowEvent(window, ev.Window);
|
}
|
||||||
processed = true;
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EventType.TEXTINPUT:
|
case EventType.KEYDOWN:
|
||||||
if (windows.TryGetValue(ev.Text.WindowID, out window))
|
case EventType.KEYUP:
|
||||||
{
|
if (windows.TryGetValue(ev.Key.WindowID, out window))
|
||||||
ProcessTextInputEvent(window, ev.Text);
|
{
|
||||||
processed = true;
|
ProcessKeyEvent(window, ev);
|
||||||
}
|
processed = true;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case EventType.KEYDOWN:
|
case EventType.MOUSEBUTTONDOWN:
|
||||||
case EventType.KEYUP:
|
case EventType.MOUSEBUTTONUP:
|
||||||
if (windows.TryGetValue(ev.Key.WindowID, out window))
|
if (windows.TryGetValue(ev.Button.WindowID, out window))
|
||||||
{
|
{
|
||||||
ProcessKeyEvent(window, ev);
|
ProcessMouseButtonEvent(window, ev.Button);
|
||||||
processed = true;
|
processed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EventType.MOUSEBUTTONDOWN:
|
case EventType.MOUSEMOTION:
|
||||||
case EventType.MOUSEBUTTONUP:
|
if (windows.TryGetValue(ev.Motion.WindowID, out window))
|
||||||
if (windows.TryGetValue(ev.Button.WindowID, out window))
|
{
|
||||||
{
|
ProcessMouseMotionEvent(window, ev.Motion);
|
||||||
ProcessMouseButtonEvent(window, ev.Button);
|
processed = true;
|
||||||
processed = true;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case EventType.MOUSEMOTION:
|
case EventType.MOUSEWHEEL:
|
||||||
if (windows.TryGetValue(ev.Motion.WindowID, out window))
|
if (windows.TryGetValue(ev.Wheel.WindowID, out window))
|
||||||
{
|
{
|
||||||
ProcessMouseMotionEvent(window, ev.Motion);
|
ProcessMouseWheelEvent(window, ev.Wheel);
|
||||||
processed = true;
|
processed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EventType.MOUSEWHEEL:
|
case EventType.DROPFILE:
|
||||||
if (windows.TryGetValue(ev.Wheel.WindowID, out window))
|
if (windows.TryGetValue(ev.Drop.WindowID, out window))
|
||||||
{
|
{
|
||||||
ProcessMouseWheelEvent(window, ev.Wheel);
|
ProcessDropEvent(window, ev.Drop);
|
||||||
processed = true;
|
SDL.Free(ev.Drop.File);
|
||||||
}
|
processed = true;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case EventType.DROPFILE:
|
case EventType.QUIT:
|
||||||
if (windows.TryGetValue(ev.Drop.WindowID, out window))
|
Debug.WriteLine("Sdl2 application quit");
|
||||||
{
|
break;
|
||||||
ProcessDropEvent(window, ev.Drop);
|
|
||||||
SDL.Free(ev.Drop.File);
|
|
||||||
processed = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EventType.QUIT:
|
|
||||||
Debug.WriteLine("Sdl2 application quit");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Debug.Print(ex.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return processed ? 0 : 1;
|
return processed ? 0 : 1;
|
||||||
|
|
Loading…
Reference in a new issue