Skip to content

Commit

Permalink
Disable minimize and fix various bugs with the launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Twometer committed Aug 24, 2020
1 parent 2b8443b commit ef756a8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
17 changes: 9 additions & 8 deletions NoFences/FenceWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions NoFences/FenceWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
using static NoFences.Win32.WindowUtil;

Expand Down Expand Up @@ -38,6 +39,8 @@ public partial class FenceWindow : Form
private ThrottledExecution throttledMove = new ThrottledExecution(TimeSpan.FromSeconds(4));
private ThrottledExecution throttledResize = new ThrottledExecution(TimeSpan.FromSeconds(4));

private DateTime lastRedraw = DateTime.Now;

public FenceWindow(FenceInfo fenceInfo)
{
InitializeComponent();
Expand Down Expand Up @@ -170,6 +173,7 @@ private void FenceWindow_Resize(object sender, EventArgs e)
fenceInfo.Height = isMinified ? prevHeight : Height;
Save();
});

Refresh();
}

Expand All @@ -182,8 +186,8 @@ private void FenceWindow_MouseEnter(object sender, EventArgs e)
{
if (minifyToolStripMenuItem.Checked && isMinified)
{
Height = prevHeight;
isMinified = false;
Height = prevHeight;
}
}

Expand Down Expand Up @@ -230,6 +234,10 @@ private void FenceWindow_DoubleClick(object sender, EventArgs e)

private void FenceWindow_Paint(object sender, PaintEventArgs e)
{
if ((DateTime.Now - lastRedraw).TotalMilliseconds < 1)
return;
lastRedraw = DateTime.Now;

e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

Expand Down Expand Up @@ -298,8 +306,19 @@ private void RenderFile(Graphics g, string file, int x, int y)

if (mouseOver && shouldRunDoubleClick)
{
Process.Start(file);
shouldRunDoubleClick = false;
Task.Run(() =>
{
// start asynchronously
try
{
Process.Start(file);
}
catch
{
// just ignore
}
});
}

if (selectedItem == file)
Expand Down

0 comments on commit ef756a8

Please sign in to comment.