File tree Expand file tree Collapse file tree 1 file changed +23
-15
lines changed
src/Windowing/Silk.NET.Windowing.Glfw Expand file tree Collapse file tree 1 file changed +23
-15
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ internal unsafe class GlfwWindow : WindowImplementationBase, IVkSurface
3838 private string _localTitleCache ; // glfw doesn't let us get the window title.
3939 private GlfwContext ? _glContext ;
4040 private string _windowClass ;
41- private bool _inDoEvents ;
41+ private bool _inRefresh ;
4242
4343 /// <summary>
4444 /// The action passed to <see cref="Run"/>.
@@ -633,23 +633,15 @@ public override Vector2D<int> FramebufferSize
633633
634634 public override void DoEvents ( )
635635 {
636- if ( ! _inDoEvents )
636+ if ( ! _inRefresh )
637637 {
638- try
638+ if ( IsEventDriven )
639639 {
640- _inDoEvents = true ;
641- if ( IsEventDriven )
642- {
643- _glfw . WaitEvents ( ) ;
644- }
645- else
646- {
647- _glfw . PollEvents ( ) ;
648- }
640+ _glfw . WaitEvents ( ) ;
649641 }
650- finally
642+ else
651643 {
652- _inDoEvents = false ;
644+ _glfw . PollEvents ( ) ;
653645 }
654646 }
655647 }
@@ -709,7 +701,23 @@ protected override void RegisterCallbacks()
709701 FramebufferResize ? . Invoke ( new ( width , height ) ) ;
710702 } ;
711703
712- _onRefresh = ( window ) => _onFrame ? . Invoke ( ) ;
704+ _onRefresh = ( window ) =>
705+ {
706+ if ( _inRefresh )
707+ {
708+ return ;
709+ }
710+
711+ try
712+ {
713+ _inRefresh = true ;
714+ _onFrame ? . Invoke ( ) ;
715+ }
716+ finally
717+ {
718+ _inRefresh = false ;
719+ }
720+ } ;
713721
714722 _onClosing = window => Closing ? . Invoke ( ) ;
715723
You can’t perform that action at this time.
0 commit comments