Skip to content

Commit

Permalink
fixed mac "open with" timing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Russ committed Nov 9, 2022
1 parent 0a466ea commit b9f8deb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
23 changes: 9 additions & 14 deletions UI/Common/Window/PlayerWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,20 @@ public void OnLoad()
// Create the animate controls timer
AnimateOutControlsTimer = new Timer(new TimerCallback(AnimateOutControls), null, TimeSpan.Zero, TimeSpan.FromSeconds(1.0));

// Handle "open with" after loading (Windows)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && NativeWindow.PlayerApplication.OpenOnStart != null && NativeWindow.PlayerApplication.OpenOnStart.Length > 0)
{
DropFiles(NativeWindow.PlayerApplication.OpenOnStart);
NativeWindow.PlayerApplication.OpenOnStart = null;
}

// Check for updates on startup
if (NetworkInterface.GetIsNetworkAvailable())
NativeWindow.PlayerApplication.CheckForUpdatesAsync(this);
}

public void OnReady()
{
if (NativeWindow.PlayerApplication.OpenOnStart != null && NativeWindow.PlayerApplication.OpenOnStart.Length > 0)
{
DropFiles(NativeWindow.PlayerApplication.OpenOnStart);
NativeWindow.PlayerApplication.OpenOnStart = null;
}
}

private void OnThemeChanged()
{
if (RenderContext != null)
Expand Down Expand Up @@ -955,13 +957,6 @@ public void OnRenderInit(GPU.Render.IContext renderContext)
RenderContext = renderContext;
RenderContext.BackgroundColor = Theme.EmptyBackground;
RenderContext.RedrawBackground = GPU.Render.RedrawBackground.Once;

// Handle open with after initisliation the renderer (macOS)
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && NativeWindow.PlayerApplication.OpenOnStart != null && NativeWindow.PlayerApplication.OpenOnStart.Length > 0 )
{
DropFiles(NativeWindow.PlayerApplication.OpenOnStart);
NativeWindow.PlayerApplication.OpenOnStart = null;
}
}

public void OnRenderFrame(double timeInterval)
Expand Down
1 change: 1 addition & 0 deletions UI/macOS/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public override void DidFinishLaunching(NSNotification notification)
});

FinishedLaunching = true;
PlayerWindowController.PlayerWindow.PlayerWindow.OnReady();
}

public override bool ApplicationShouldTerminateAfterLastWindowClosed(NSApplication sender)
Expand Down

0 comments on commit b9f8deb

Please sign in to comment.