Skip to content

Commit

Permalink
fix assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvsk committed Jul 10, 2023
1 parent e226b78 commit c87107f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 27 deletions.
4 changes: 3 additions & 1 deletion PreciseThreeFingersDrag.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<PlatformTarget>x64</PlatformTarget>
<ApplicationIcon>AppIcon.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<VersionPrefix>1.0.1</VersionPrefix>

</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
Expand All @@ -29,7 +31,7 @@

<ItemGroup>
<PackageReference Include="H.NotifyIcon" Version="2.0.108" />
<PackageReference Include="RawInput.Sharp" Version="0.1.1" PrivateAssets="all" />
<PackageReference Include="RawInput.Sharp" Version="0.1.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
Expand Down
28 changes: 16 additions & 12 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,25 @@ namespace PreciseThreeFingersDrag
{
internal static class Program
{
private static TrayIcon ui;
private static readonly InputMessageLoop input;
private static readonly TouchProcessor touch;
private static TrayIcon? ui;
private static InputMessageLoop? input;
private static TouchProcessor? touch;

public static Configuration GetConfig()
{
return ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
}

static Program()

[STAThread]
private static void Main()
{
ui = new TrayIcon();
input = new InputMessageLoop(OnInputEvent);
touch = new TouchProcessor();
}

[STAThread]
private static void Main()
{
var createdNew = false;
var singleInstanceMutex = new Mutex(true, "precise-three-fingers-drag", out createdNew);
new Mutex(true, "precise-three-fingers-drag", out createdNew);
if (!createdNew)
{
return;
Expand All @@ -37,8 +35,6 @@ private static void Main()

touch.Register(hwnd);
touch.StateChange += Touch_StateChange;

ui = new TrayIcon();
ui.Created += Ui_Created;
ui.QuitMenuItem.Click += Quit;
ui.UseStandardTooltip = true;
Expand Down Expand Up @@ -86,7 +82,10 @@ private static void Ui_Created(object? sender, EventArgs e)

private static void Ui_DelayChanged(TouchProcessor.CooldownDelay delay)
{
touch.DragCooldownDelay = delay;
if (touch != null)
{
touch.DragCooldownDelay = delay;
}

Configuration config = GetConfig();
KeyValueConfigurationElement? delayCfg = config.AppSettings.Settings["delay"];
Expand All @@ -104,6 +103,11 @@ private static void Ui_DelayChanged(TouchProcessor.CooldownDelay delay)

private static void Ui_AutostartToggle(object? sender, EventArgs e)
{
if (ui == null)
{
return;
}

if (AutostartHelper.IsEnabled)
{
AutostartHelper.Disable();
Expand Down
13 changes: 0 additions & 13 deletions TouchProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public enum State
FOUR_OR_MORE,
};

public bool threeFingerClickIsFree = false;

private State state = State.CLEAR;

private double accumulatedDistance;
Expand All @@ -50,24 +48,13 @@ public CooldownDelay DragCooldownDelay
private RawInputDigitizerContact[] previousContacts;
private Point? previousCenterPoint;

private readonly BlockingCollection<RawInputDigitizerData> updatesQueue;

public double DragCooldownMilliseconds
{
get => dragCooldownTimer.Interval;
set => dragCooldownTimer.Interval = value;
}

public TouchProcessor()
{
dragCooldownTimer = new System.Timers.Timer((double)CooldownDelay.Short)
{
AutoReset = false
};
dragCooldownTimer.Elapsed += DragCooldownTimer_Elapsed;
updatesQueue = new BlockingCollection<RawInputDigitizerData>(
new ConcurrentQueue<RawInputDigitizerData>()
);
previousContacts = new RawInputDigitizerContact[] { };
}

Expand Down
3 changes: 2 additions & 1 deletion app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<assemblyIdentity version="1.0.1.0" name="MyApplication.app"/>

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down

0 comments on commit c87107f

Please sign in to comment.