Skip to content

Commit

Permalink
Fix dragndrop cursor getting stuck when main thread is busy
Browse files Browse the repository at this point in the history
  • Loading branch information
n00mkrad committed Nov 8, 2024
1 parent b1b7c0b commit 9bd1736
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
13 changes: 7 additions & 6 deletions CodeLegacy/Forms/Main/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,14 @@ private void licenseBtn_Click(object sender, EventArgs e)

private void Form1_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }

private void Form1_DragDrop(object sender, DragEventArgs e)
private async void Form1_DragDrop(object sender, DragEventArgs e)
{
DragDropHandler((string[])e.Data.GetData(DataFormats.FileDrop));
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
await Task.Delay(1); // Release drop
DragDropHandler(files);
}

public void DragDropHandler(string[] files)
public void DragDropHandler(string[] files, bool first = true)
{
if (Program.busy) return;

Expand All @@ -689,13 +691,12 @@ public void DragDropHandler(string[] files)
{
SetTab(interpOptsTab.Name);
queueBtn_Click(null, null);
if (BatchProcessing.currentBatchForm != null)
BatchProcessing.currentBatchForm.LoadDroppedPaths(files, start);
BatchProcessing.currentBatchForm?.LoadDroppedPaths(files, start);
}
else
{
SetTab(interpOptsTab.Name);
Logger.Log("Selected video/directory: " + Path.GetFileName(files[0]), true);
Logger.Log($"Selected video/directory: {Path.GetFileName(files[0])}", true);
inputTbox.Text = files[0];

bool resume = Directory.Exists(files[0]) && IoUtils.GetAmountOfFiles(Path.Combine(files[0], Paths.resumeDir), true, "*.json") > 0;
Expand Down
7 changes: 0 additions & 7 deletions CodeLegacy/Forms/PromptForm.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Flowframes.Forms
Expand Down
4 changes: 2 additions & 2 deletions CodeLegacy/Main/InterpolateUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ public static int GetRoundedInterpFramesPerInputFrame(float factor, bool roundDo

public static Fraction AskForFramerate(string mediaName, bool isImageSequence = true)
{
string text = $"Please enter an input frame rate to use for{(isImageSequence ? " the image sequence" : "")} '{mediaName.Trunc(80)}'.";
PromptForm form = new PromptForm("Enter Frame Rate", text, "15");
string text = $"Please enter the source frame rate for{(isImageSequence ? " the image sequence" : "")} '{mediaName.Trunc(80)}'.";
var form = new PromptForm("Enter Frame Rate", text, "15");
form.ShowDialog();
return new Fraction(form.EnteredText);
}
Expand Down

0 comments on commit 9bd1736

Please sign in to comment.