├── .gitattributes ├── .gitignore ├── .gitmodules ├── MouseGesturePlugin ├── MouseGesture.cs ├── MouseGesturePlugin.csproj └── Properties │ └── AssemblyInfo.cs ├── PluginBaseLib ├── PluginBase.cs ├── PluginBaseLib.csproj └── Properties │ └── AssemblyInfo.cs ├── README.md ├── SynapticsGesturePlugin ├── Properties │ └── AssemblyInfo.cs ├── SynapticsGesture.cs └── SynapticsGesturePlugin.csproj ├── SynapticsTester ├── App.config ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── SynapticsTester.csproj ├── TaskViewGestureToolkit.sln ├── TaskViewGestureToolkit ├── App.config ├── App.xaml ├── App.xaml.cs ├── AppMain.cs ├── Config │ ├── ConfigClass.cs │ └── ConfigSerialize.cs ├── Gesture │ └── GestureManager.cs ├── Log │ ├── LogListener.cs │ └── Logger.cs ├── Plugin │ └── PluginManager.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── TaskViewGestureToolkit.csproj ├── Tools │ └── STAThreadTool.cs ├── UI │ ├── StockIcon.cs │ ├── TaskTrayComponent.Designer.cs │ ├── TaskTrayComponent.cs │ ├── TaskTrayComponent.resx │ └── UIManager.cs ├── Updater │ ├── UpdateChecker.cs │ └── updateinfo.json ├── app.manifest └── packages.config ├── WacomGesturePlugin ├── Properties │ └── AssemblyInfo.cs ├── Utils.cs ├── WacomFeelMultiTouchAPI │ ├── FeelMultiTouchAPIConst.cs │ ├── MTAPI.cs │ └── MemoryUtil.cs ├── WacomGesture.cs └── WacomGesturePlugin.csproj └── WacomTester ├── App.config ├── Program.cs ├── Properties └── AssemblyInfo.cs └── WacomTester.csproj /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Microsoft Azure ApplicationInsights config file 170 | ApplicationInsights.config 171 | 172 | # Windows Store app package directory 173 | AppPackages/ 174 | BundleArtifacts/ 175 | 176 | # Visual Studio cache files 177 | # files ending in .cache can be ignored 178 | *.[Cc]ache 179 | # but keep track of directories ending in .cache 180 | !*.[Cc]ache/ 181 | 182 | # Others 183 | ClientBin/ 184 | [Ss]tyle[Cc]op.* 185 | ~$* 186 | *~ 187 | *.dbmdl 188 | *.dbproj.schemaview 189 | *.pfx 190 | *.publishsettings 191 | node_modules/ 192 | orleans.codegen.cs 193 | 194 | # RIA/Silverlight projects 195 | Generated_Code/ 196 | 197 | # Backup & report files from converting an old project file 198 | # to a newer Visual Studio version. Backup files are not needed, 199 | # because we have git ;-) 200 | _UpgradeReport_Files/ 201 | Backup*/ 202 | UpgradeLog*.XML 203 | UpgradeLog*.htm 204 | 205 | # SQL Server files 206 | *.mdf 207 | *.ldf 208 | 209 | # Business Intelligence projects 210 | *.rdl.data 211 | *.bim.layout 212 | *.bim_*.settings 213 | 214 | # Microsoft Fakes 215 | FakesAssemblies/ 216 | 217 | # GhostDoc plugin setting file 218 | *.GhostDoc.xml 219 | 220 | # Node.js Tools for Visual Studio 221 | .ntvs_analysis.dat 222 | 223 | # Visual Studio 6 build log 224 | *.plg 225 | 226 | # Visual Studio 6 workspace options file 227 | *.opt 228 | 229 | # Visual Studio LightSwitch build output 230 | **/*.HTMLClient/GeneratedArtifacts 231 | **/*.DesktopClient/GeneratedArtifacts 232 | **/*.DesktopClient/ModelManifest.xml 233 | **/*.Server/GeneratedArtifacts 234 | **/*.Server/ModelManifest.xml 235 | _Pvt_Extensions 236 | 237 | # LightSwitch generated files 238 | GeneratedArtifacts/ 239 | ModelManifest.xml 240 | 241 | # Paket dependency manager 242 | .paket/paket.exe 243 | 244 | # FAKE - F# Make 245 | .fake/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "VirtualDesktop"] 2 | path = VirtualDesktop 3 | url = https://github.com/kazukioishi/VirtualDesktop.git 4 | -------------------------------------------------------------------------------- /MouseGesturePlugin/MouseGesture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Forms; 10 | 11 | namespace MouseGesturePlugin 12 | { 13 | public class MouseGesture : PluginBaseLib.PluginBase 14 | { 15 | private Thread thread; 16 | public override string pluginName 17 | { 18 | get 19 | { 20 | return "MouseGesturePlugin"; 21 | } 22 | } 23 | 24 | public override void deletePlugin() 25 | { 26 | thread?.Abort(); 27 | } 28 | 29 | public override void initializePlugin() 30 | { 31 | thread = new Thread(mouseMoveChecker); 32 | thread.Start(); 33 | } 34 | 35 | private void mouseMoveChecker() 36 | { 37 | bool flag = false; 38 | while (true) 39 | { 40 | System.Drawing.Point point = Cursor.Position; 41 | foreach (var screen in Screen.AllScreens) 42 | { 43 | if(screen.Bounds.X <= point.X && screen.Bounds.Y <= point.Y && (screen.Bounds.X + screen.Bounds.Width) >= point.X && (screen.Bounds.Y + screen.Bounds.Height) >= point.Y) 44 | { 45 | //cursor is in this screen 46 | System.Drawing.Point screenCursorPos = new System.Drawing.Point(point.X - screen.Bounds.X,point.Y - screen.Bounds.Y); 47 | if(!flag && screenCursorPos.X >= screen.Bounds.Width - 5 && screenCursorPos.Y <= 5) 48 | { 49 | flag = true; 50 | callOnGesture(0, 0, EventType.OnGestureStart); 51 | callOnGesture(0, 10, EventType.OnGestureEnd); 52 | }else if (!(screenCursorPos.X >= screen.Bounds.Width - 5 && screenCursorPos.Y <= 5)) 53 | { 54 | flag = false; 55 | } 56 | } 57 | } 58 | Thread.Sleep(300); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /MouseGesturePlugin/MouseGesturePlugin.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46} 8 | Library 9 | Properties 10 | MouseGesturePlugin 11 | MouseGesturePlugin 12 | v4.6 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {2094fde0-20e3-48d7-8d62-2d7e7c2f38fd} 54 | PluginBaseLib 55 | 56 | 57 | 58 | 59 | copy $(TargetPath) $(SolutionDir)TaskViewGestureToolkit\bin\$(ConfigurationName)\plugin 60 | 61 | 68 | -------------------------------------------------------------------------------- /MouseGesturePlugin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("MouseGesturePlugin")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MouseGesturePlugin")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("1b2c73ef-d0d5-494e-b619-4d57b6fb9f46")] 24 | 25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // Revision 31 | // 32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /PluginBaseLib/PluginBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PluginBaseLib 8 | { 9 | public abstract class PluginBase 10 | { 11 | public enum EventType 12 | { 13 | OnGestureStart, 14 | OnGestureEnd 15 | } 16 | public delegate void gestureEventHandler(int x, int y, EventType etype); 17 | public event gestureEventHandler onGesture; 18 | protected virtual void callOnGesture(int x, int y, EventType etype) 19 | { 20 | onGesture(x, y, etype); 21 | } 22 | public abstract String pluginName { get; } 23 | 24 | public abstract void initializePlugin(); 25 | public abstract void deletePlugin(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /PluginBaseLib/PluginBaseLib.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD} 8 | Library 9 | Properties 10 | PluginBaseLib 11 | PluginBaseLib 12 | v4.6 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 55 | -------------------------------------------------------------------------------- /PluginBaseLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("PluginBaseLib")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PluginBaseLib")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("2094fde0-20e3-48d7-8d62-2d7e7c2f38fd")] 24 | 25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // Revision 31 | // 32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TaskViewGestureToolkit 2 | Windows10のタスクビューをタッチパッドを使いMac OS XのMission Control風に操作出来るようにするアプリケーション。 3 | 4 | ## 対応デバイス 5 | * Synaptics製タッチパッド(3本指以上でのタッチ対応のもの) 6 | * Wacom製ペンタブレット(Wacom feel™ Multi-Touch対応のもので4本指以上のタッチ対応のもの) 7 | 8 | 9 | Thinkpad X1 Carbon 4th genの内蔵タッチパッドとWacom Intuos pro Mにて動作確認しました。 10 | 11 | ## 使い方 12 | プログラムを起動するとpluginディレクトリ以下にある各ドライバーに対応したプラグインが読み込まれ初期化されます。 13 | (対応していないプラグインは自動的に除外され読み込まれません) 14 | Synapticsタッチパッドでは3本指での操作、Wacom製ペンタブレットでは4本指での操作で仮想デスクトップの切り替えが出来ます。 15 | ※ドライバー側で何らかの操作を割り当てている場合は外してください 16 | 17 | ## ダウンロード 18 | releasesからどうぞ 19 | -------------------------------------------------------------------------------- /SynapticsGesturePlugin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("SynapticsGesturePlugin")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SynapticsGesturePlugin")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("1e0b956c-9059-49ae-aaeb-fcc4161fd50a")] 24 | 25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // Revision 31 | // 32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SynapticsGesturePlugin/SynapticsGesture.cs: -------------------------------------------------------------------------------- 1 | using PluginBaseLib; 2 | using SYNCTRLLib; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | 11 | namespace SynapticsGesturePlugin 12 | { 13 | public class SynapticsGesture : PluginBase 14 | { 15 | private SynAPICtrl synApi; 16 | private SynDeviceCtrl synTouchPad; 17 | private int deviceHandle; 18 | private int[] lastState = {114514,114514}; 19 | //for position 20 | private int[] startPos; 21 | private int[] endPos; 22 | private class synPos{ public int nof, fstate, xd, yd, x, y; } 23 | private synPos lastPos = new synPos(); 24 | private bool isMoving = false; 25 | Mutex mx = new Mutex(); 26 | 27 | public override string pluginName 28 | { 29 | get 30 | { 31 | return "SynapticsGesturePlugin"; 32 | } 33 | } 34 | 35 | public override void deletePlugin() 36 | { 37 | synTouchPad.OnPacket -= SynTouchPad_OnPacket; 38 | synTouchPad.Deactivate(); 39 | synApi.Deactivate(); 40 | //System.Runtime.InteropServices.Marshal.ReleaseComObject(synTouchPad); 41 | //System.Runtime.InteropServices.Marshal.ReleaseComObject(synApi); 42 | } 43 | 44 | public override void initializePlugin() 45 | { 46 | synApi = new SynAPICtrl(); 47 | synTouchPad = new SynDeviceCtrl(); 48 | synApi.Initialize(); 49 | synApi.Activate(); 50 | deviceHandle = synApi.FindDevice(SynConnectionType.SE_ConnectionAny,SynDeviceType.SE_DeviceTouchPad,-1); 51 | synTouchPad.Select(deviceHandle); 52 | synTouchPad.Activate(); 53 | synTouchPad.OnPacket -= SynTouchPad_OnPacket; 54 | synTouchPad.OnPacket += SynTouchPad_OnPacket; 55 | } 56 | 57 | private void SynTouchPad_OnPacket() 58 | { 59 | mx.WaitOne(); 60 | SynPacketCtrl packet = new SynPacketCtrl(); 61 | synTouchPad.LoadPacket(packet); 62 | int nof = packet.GetLongProperty(SynPacketProperty.SP_ExtraFingerState) & 3; 63 | int fstate = packet.GetLongProperty(SynPacketProperty.SP_FingerState); 64 | int xd = packet.GetLongProperty(SynPacketProperty.SP_XDelta); 65 | int yd = packet.GetLongProperty(SynPacketProperty.SP_YDelta); 66 | int y = packet.GetLongProperty(SynPacketProperty.SP_Y); 67 | int x = packet.GetLongProperty(SynPacketProperty.SP_X); 68 | if (lastState.SequenceEqual(new int[] { nof, fstate, xd, yd, y, x })) 69 | { 70 | mx.ReleaseMutex(); 71 | return; 72 | } 73 | //Debug.WriteLine($"nof={nof},fstate={fstate},xd={xd},yd={yd},x={x},y={y}"); 74 | //nof=0 AND fstate=0 is invalid value for captureing 75 | if (fstate != 0 && nof != 0) 76 | { 77 | if (nof == 3) 78 | { 79 | if (!isMoving) 80 | { 81 | startPos = new int[] { x, y }; 82 | isMoving = true; 83 | callOnGesture(x, y, EventType.OnGestureStart); 84 | //Debug.WriteLine($"[START] nof={nof},fstate={fstate},xd={xd},yd={yd},x={x},y={y}"); 85 | } 86 | lastPos = new synPos { nof = nof,fstate = fstate,xd=xd,yd=yd,x=x,y=y }; 87 | } 88 | else if (nof < 3 && isMoving) 89 | { 90 | endPos = new int[] { x, y }; 91 | isMoving = false; 92 | callOnGesture(x, y, EventType.OnGestureEnd); 93 | //Debug.WriteLine($"[END] nof={nof},fstate={fstate},xd={xd},yd={yd},x={x},y={y}"); 94 | } 95 | }else if(nof == 0 && isMoving) 96 | { 97 | endPos = new int[] { lastPos.x, lastPos.y }; 98 | isMoving = false; 99 | callOnGesture(lastPos.x, lastPos.y, EventType.OnGestureEnd); 100 | //Debug.WriteLine($"[END] nof={lastPos.nof},fstate={lastPos.fstate},xd={lastPos.xd},yd={lastPos.yd},x={lastPos.x},y={lastPos.y}"); 101 | } 102 | lastState = new int[] { nof, fstate, xd, yd, y, x }; 103 | mx.ReleaseMutex(); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /SynapticsGesturePlugin/SynapticsGesturePlugin.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A} 8 | Library 9 | Properties 10 | SynapticsGesturePlugin 11 | SynapticsGesturePlugin 12 | v4.6 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | {E2489565-2CE5-4690-9111-76E79A9F6CCD} 50 | 2 51 | 0 52 | 0 53 | tlbimp 54 | False 55 | True 56 | 57 | 58 | {82D70786-7968-46EA-836D-203AEBCA4481} 59 | 1 60 | 0 61 | 0 62 | tlbimp 63 | False 64 | True 65 | 66 | 67 | 68 | 69 | {2094fde0-20e3-48d7-8d62-2d7e7c2f38fd} 70 | PluginBaseLib 71 | 72 | 73 | 74 | 75 | copy $(TargetPath) $(SolutionDir)TaskViewGestureToolkit\bin\$(ConfigurationName)\plugin 76 | 77 | 84 | -------------------------------------------------------------------------------- /SynapticsTester/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SynapticsTester/Program.cs: -------------------------------------------------------------------------------- 1 | using PluginBaseLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | namespace SynapticsTester 11 | { 12 | class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | PManager pman = new PManager(); 17 | Task.Run(() =>{ 18 | pman.init(); 19 | pman.plugin.onGesture += Plugin_onGesture; 20 | }); 21 | 22 | Console.WriteLine("Press Ctrl-C to terminate..."); 23 | using (ManualResetEvent manualResetEvent = new ManualResetEvent(false)) 24 | { 25 | manualResetEvent.WaitOne(); 26 | } 27 | } 28 | 29 | private static void Plugin_onGesture(int x, int y, PluginBase.EventType etype) 30 | { 31 | Console.WriteLine($"[{etype.ToString()}]x={x},y={y}"); 32 | } 33 | 34 | class PManager 35 | { 36 | public PluginBase plugin; 37 | public void init() 38 | { 39 | plugin = new SynapticsGesturePlugin.SynapticsGesture(); 40 | plugin.initializePlugin(); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SynapticsTester/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("SynapticsTester")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SynapticsTester")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("6bf793f5-4112-4a94-889c-dbf560bba10c")] 24 | 25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // Revision 31 | // 32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SynapticsTester/SynapticsTester.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6BF793F5-4112-4A94-889C-DBF560BBA10C} 8 | Exe 9 | Properties 10 | SynapticsTester 11 | SynapticsTester 12 | v4.6 13 | 512 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD} 56 | PluginBaseLib 57 | 58 | 59 | {1e0b956c-9059-49ae-aaeb-fcc4161fd50a} 60 | SynapticsGesturePlugin 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskViewGestureToolkit", "TaskViewGestureToolkit\TaskViewGestureToolkit.csproj", "{309C6C32-4FB6-4CAB-A297-0A5668ECBB27}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SynapticsGesturePlugin", "SynapticsGesturePlugin\SynapticsGesturePlugin.csproj", "{1E0B956C-9059-49AE-AAEB-FCC4161FD50A}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SynapticsTester", "SynapticsTester\SynapticsTester.csproj", "{6BF793F5-4112-4A94-889C-DBF560BBA10C}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginBaseLib", "PluginBaseLib\PluginBaseLib.csproj", "{2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WacomGesturePlugin", "WacomGesturePlugin\WacomGesturePlugin.csproj", "{80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WacomTester", "WacomTester\WacomTester.csproj", "{9BE2B62A-662A-47BB-B501-82EB487499A6}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualDesktop", "VirtualDesktop\source\VirtualDesktop\VirtualDesktop.csproj", "{AB848ECD-76AA-41C0-B63D-86A8591B25AA}" 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseGesturePlugin", "MouseGesturePlugin\MouseGesturePlugin.csproj", "{1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}" 21 | EndProject 22 | Global 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 24 | Debug|Any CPU = Debug|Any CPU 25 | Debug|x64 = Debug|x64 26 | Debug|x86 = Debug|x86 27 | Release|Any CPU = Release|Any CPU 28 | Release|x64 = Release|x64 29 | Release|x86 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Debug|x64.ActiveCfg = Debug|Any CPU 35 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Debug|x64.Build.0 = Debug|Any CPU 36 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Debug|x86.ActiveCfg = Debug|Any CPU 37 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Debug|x86.Build.0 = Debug|Any CPU 38 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Release|x64.ActiveCfg = Release|Any CPU 41 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Release|x64.Build.0 = Release|Any CPU 42 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Release|x86.ActiveCfg = Release|Any CPU 43 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27}.Release|x86.Build.0 = Release|Any CPU 44 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Debug|x64.ActiveCfg = Debug|Any CPU 47 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Debug|x64.Build.0 = Debug|Any CPU 48 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Debug|x86.ActiveCfg = Debug|Any CPU 49 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Debug|x86.Build.0 = Debug|Any CPU 50 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Release|Any CPU.ActiveCfg = Release|Any CPU 51 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Release|Any CPU.Build.0 = Release|Any CPU 52 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Release|x64.ActiveCfg = Release|Any CPU 53 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Release|x64.Build.0 = Release|Any CPU 54 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Release|x86.ActiveCfg = Release|Any CPU 55 | {1E0B956C-9059-49AE-AAEB-FCC4161FD50A}.Release|x86.Build.0 = Release|Any CPU 56 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 57 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Debug|Any CPU.Build.0 = Debug|Any CPU 58 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Debug|x64.ActiveCfg = Debug|Any CPU 59 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Debug|x64.Build.0 = Debug|Any CPU 60 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Debug|x86.ActiveCfg = Debug|Any CPU 61 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Debug|x86.Build.0 = Debug|Any CPU 62 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Release|Any CPU.ActiveCfg = Release|Any CPU 63 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Release|Any CPU.Build.0 = Release|Any CPU 64 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Release|x64.ActiveCfg = Release|Any CPU 65 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Release|x64.Build.0 = Release|Any CPU 66 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Release|x86.ActiveCfg = Release|Any CPU 67 | {6BF793F5-4112-4A94-889C-DBF560BBA10C}.Release|x86.Build.0 = Release|Any CPU 68 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 69 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Debug|Any CPU.Build.0 = Debug|Any CPU 70 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Debug|x64.ActiveCfg = Debug|Any CPU 71 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Debug|x64.Build.0 = Debug|Any CPU 72 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Debug|x86.ActiveCfg = Debug|Any CPU 73 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Debug|x86.Build.0 = Debug|Any CPU 74 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Release|Any CPU.ActiveCfg = Release|Any CPU 75 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Release|Any CPU.Build.0 = Release|Any CPU 76 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Release|x64.ActiveCfg = Release|Any CPU 77 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Release|x64.Build.0 = Release|Any CPU 78 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Release|x86.ActiveCfg = Release|Any CPU 79 | {2094FDE0-20E3-48D7-8D62-2D7E7C2F38FD}.Release|x86.Build.0 = Release|Any CPU 80 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 81 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Debug|Any CPU.Build.0 = Debug|Any CPU 82 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Debug|x64.ActiveCfg = Debug|Any CPU 83 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Debug|x64.Build.0 = Debug|Any CPU 84 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Debug|x86.ActiveCfg = Debug|Any CPU 85 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Debug|x86.Build.0 = Debug|Any CPU 86 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Release|Any CPU.ActiveCfg = Release|Any CPU 87 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Release|Any CPU.Build.0 = Release|Any CPU 88 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Release|x64.ActiveCfg = Release|Any CPU 89 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Release|x64.Build.0 = Release|Any CPU 90 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Release|x86.ActiveCfg = Release|Any CPU 91 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD}.Release|x86.Build.0 = Release|Any CPU 92 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 93 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Debug|Any CPU.Build.0 = Debug|Any CPU 94 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Debug|x64.ActiveCfg = Debug|Any CPU 95 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Debug|x64.Build.0 = Debug|Any CPU 96 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Debug|x86.ActiveCfg = Debug|Any CPU 97 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Debug|x86.Build.0 = Debug|Any CPU 98 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Release|Any CPU.ActiveCfg = Release|Any CPU 99 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Release|Any CPU.Build.0 = Release|Any CPU 100 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Release|x64.ActiveCfg = Release|Any CPU 101 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Release|x64.Build.0 = Release|Any CPU 102 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Release|x86.ActiveCfg = Release|Any CPU 103 | {9BE2B62A-662A-47BB-B501-82EB487499A6}.Release|x86.Build.0 = Release|Any CPU 104 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 105 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|Any CPU.Build.0 = Debug|Any CPU 106 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|x64.ActiveCfg = Debug|x64 107 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|x64.Build.0 = Debug|x64 108 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|x86.ActiveCfg = Debug|x86 109 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|x86.Build.0 = Debug|x86 110 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|Any CPU.ActiveCfg = Release|Any CPU 111 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|Any CPU.Build.0 = Release|Any CPU 112 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|x64.ActiveCfg = Release|x64 113 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|x64.Build.0 = Release|x64 114 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|x86.ActiveCfg = Release|x86 115 | {AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|x86.Build.0 = Release|x86 116 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 117 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Debug|Any CPU.Build.0 = Debug|Any CPU 118 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Debug|x64.ActiveCfg = Debug|Any CPU 119 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Debug|x64.Build.0 = Debug|Any CPU 120 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Debug|x86.ActiveCfg = Debug|Any CPU 121 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Debug|x86.Build.0 = Debug|Any CPU 122 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Release|Any CPU.ActiveCfg = Release|Any CPU 123 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Release|Any CPU.Build.0 = Release|Any CPU 124 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Release|x64.ActiveCfg = Release|Any CPU 125 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Release|x64.Build.0 = Release|Any CPU 126 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Release|x86.ActiveCfg = Release|Any CPU 127 | {1B2C73EF-D0D5-494E-B619-4D57B6FB9F46}.Release|x86.Build.0 = Release|Any CPU 128 | EndGlobalSection 129 | GlobalSection(SolutionProperties) = preSolution 130 | HideSolutionNode = FALSE 131 | EndGlobalSection 132 | EndGlobal 133 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace TaskViewGestureToolkit 10 | { 11 | /// 12 | /// App.xaml の相互作用ロジック 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/AppMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | using TaskViewGestureToolkit.Config; 8 | using TaskViewGestureToolkit.Gesture; 9 | using TaskViewGestureToolkit.Log; 10 | using TaskViewGestureToolkit.Plugin; 11 | using TaskViewGestureToolkit.UI; 12 | using TaskViewGestureToolkit.Updater; 13 | 14 | namespace TaskViewGestureToolkit 15 | { 16 | public class AppMain 17 | { 18 | public static ConfigClass config; 19 | public static UIManager uiman; 20 | 21 | [STAThread] 22 | public static void Main(string[] args) 23 | { 24 | //init UI 25 | uiman = new UIManager(); 26 | //load config 27 | config = ConfigSerialize.loadConfig(); 28 | Application.ApplicationExit += onApplicationExit; 29 | //init logger 30 | Logger.initLogger(); 31 | //init plugin 32 | PluginManager.loadFromPluginDir(); 33 | PluginManager.activateAllPlugins(); 34 | //start update checker 35 | UpdateChecker.checkUpdate(); 36 | //start app 37 | Application.Run(); 38 | } 39 | 40 | private static void onApplicationExit(object sender, EventArgs e) 41 | { 42 | ConfigSerialize.saveConfig(config); 43 | uiman.ttComponent.notifyIcon.Dispose(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Config/ConfigClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TaskViewGestureToolkit.Config 8 | { 9 | public class ConfigClass 10 | { 11 | public bool useAPI = false; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Config/ConfigSerialize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TaskViewGestureToolkit.Config 8 | { 9 | class ConfigSerialize 10 | { 11 | public const string CONFIG_FILE = "config.xml"; 12 | public static ConfigClass loadConfig() 13 | { 14 | if (!System.IO.File.Exists($"{System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)}\\{CONFIG_FILE}")) return new ConfigClass(); 15 | var serializer = new System.Xml.Serialization.XmlSerializer(typeof(ConfigClass)); 16 | var sr = new System.IO.StreamReader($"{System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)}\\{CONFIG_FILE}", new System.Text.UTF8Encoding(false)); 17 | ConfigClass cfg = (ConfigClass)serializer.Deserialize(sr); 18 | sr.Close(); 19 | sr.Dispose(); 20 | return cfg; 21 | } 22 | public static void saveConfig(ConfigClass config) 23 | { 24 | var serializer = new System.Xml.Serialization.XmlSerializer(typeof(ConfigClass)); 25 | var sw = new System.IO.StreamWriter($"{System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)}\\{CONFIG_FILE}", false, new System.Text.UTF8Encoding(false)); 26 | serializer.Serialize(sw, config); 27 | sw.Close(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Gesture/GestureManager.cs: -------------------------------------------------------------------------------- 1 | using PluginBaseLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using WindowsDesktop; 10 | using WindowsInput; 11 | using WindowsInput.Native; 12 | 13 | namespace TaskViewGestureToolkit.Gesture 14 | { 15 | public class GestureManager 16 | { 17 | public static bool useVirtualDesktopAPI = false; 18 | public PluginBase plugin; 19 | private bool isMoving = false; 20 | private int[] startPoint = { 0, 0 }; 21 | IInputSimulator inputSimulator = new InputSimulator(); 22 | 23 | public void onGestureAsync(int x, int y, PluginBase.EventType etype) 24 | { 25 | Tools.STAThreadTool.RunSTAThread(() => 26 | { 27 | onGesture(x, y, etype); 28 | }); 29 | } 30 | 31 | public void onGesture(int x, int y, PluginBase.EventType etype) 32 | { 33 | if (etype == PluginBase.EventType.OnGestureStart && !isMoving) 34 | { 35 | //start event 36 | isMoving = true; 37 | startPoint = new int[] { x, y }; 38 | Trace.WriteLine($"[{plugin.pluginName} START]"); 39 | } 40 | else if (etype == PluginBase.EventType.OnGestureStart && isMoving) 41 | { 42 | //something is wrong 43 | isMoving = false; 44 | } 45 | else if (etype == PluginBase.EventType.OnGestureEnd && isMoving) 46 | { 47 | //end event 48 | isMoving = false; 49 | int xDiff = x - startPoint[0]; 50 | int yDiff = y - startPoint[1]; 51 | Trace.WriteLine($"[{plugin.pluginName} END] ({xDiff},{yDiff})"); 52 | if (Math.Abs(xDiff) > Math.Abs(yDiff)) 53 | { 54 | if (xDiff < 0) 55 | { 56 | //left 57 | Trace.WriteLine($"[{plugin.pluginName} EVENT] LEFT"); 58 | if (useVirtualDesktopAPI) 59 | { 60 | VirtualDesktop.Current?.GetRight()?.Switch(); 61 | } 62 | else 63 | { 64 | inputSimulator.Keyboard.ModifiedKeyStroke(new VirtualKeyCode[] { VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL }, VirtualKeyCode.RIGHT); 65 | } 66 | } 67 | else if (xDiff > 0) 68 | { 69 | //right 70 | Trace.WriteLine($"[{plugin.pluginName} EVENT] RIGHT"); 71 | if (useVirtualDesktopAPI) 72 | { 73 | VirtualDesktop.Current?.GetLeft()?.Switch(); 74 | } 75 | else 76 | { 77 | inputSimulator.Keyboard.ModifiedKeyStroke(new VirtualKeyCode[] { VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL }, VirtualKeyCode.LEFT); 78 | } 79 | } 80 | } 81 | else 82 | { 83 | if (yDiff < 0) 84 | { 85 | //down 86 | Trace.WriteLine($"[{plugin.pluginName} EVENT] DOWN"); 87 | inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.TAB); 88 | } 89 | else if (yDiff > 0) 90 | { 91 | //up 92 | Trace.WriteLine($"[{plugin.pluginName} EVENT] UP"); 93 | inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.TAB); 94 | } 95 | } 96 | } 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Log/LogListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace TaskViewGestureToolkit.Log 9 | { 10 | public class LogListener : TraceListener 11 | { 12 | public StringBuilder logTextBuilder = new StringBuilder(); 13 | 14 | public override void Write(string message) 15 | { 16 | logTextBuilder.Append(message); 17 | } 18 | 19 | public override void WriteLine(string message) 20 | { 21 | logTextBuilder.AppendLine(message); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Log/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace TaskViewGestureToolkit.Log 9 | { 10 | public class Logger 11 | { 12 | static LogListener listener = new LogListener(); 13 | 14 | public static void initLogger() 15 | { 16 | if(!Trace.Listeners.Contains(listener)) Trace.Listeners.Add(listener); 17 | } 18 | 19 | public static void writeToLogfile() 20 | { 21 | var stream = new System.IO.FileStream($"{System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)}\\log.txt", System.IO.FileMode.Create); 22 | byte[] writebyte = Encoding.UTF8.GetBytes(listener.logTextBuilder.ToString()); 23 | stream.Write(writebyte, 0, writebyte.Count()); 24 | stream.Close(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Plugin/PluginManager.cs: -------------------------------------------------------------------------------- 1 | using PluginBaseLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using TaskViewGestureToolkit.Gesture; 10 | 11 | namespace TaskViewGestureToolkit.Plugin 12 | { 13 | public static class PluginManager 14 | { 15 | public static List pluginList = new List(); 16 | 17 | public static void loadPlugin(String path) 18 | { 19 | try 20 | { 21 | var asm = Assembly.LoadFrom(path); 22 | PluginBase inst = null; 23 | foreach (var t in asm.GetTypes()) 24 | { 25 | if (t.IsInterface) continue; 26 | if (t.IsAbstract) continue; 27 | if (t.BaseType.Name != "PluginBase") continue; 28 | inst = Activator.CreateInstance(t) as PluginBase; 29 | if (inst != null) break; 30 | } 31 | if (inst != null) 32 | { 33 | GestureManager gman = new GestureManager(); 34 | gman.plugin = inst; 35 | pluginList.Add(gman); 36 | Trace.WriteLine($"[PLUGIN]{inst.pluginName} loaded."); 37 | } 38 | }catch(Exception ex) 39 | { 40 | Trace.WriteLine($"[PLUGIN]{System.IO.Path.GetFileName(path)} load failed."); 41 | } 42 | 43 | } 44 | 45 | public static void loadFromPluginDir() 46 | { 47 | foreach (var path in System.IO.Directory.GetFiles(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\plugin")) 48 | { 49 | loadPlugin(path); 50 | } 51 | } 52 | 53 | public static void activateAllPlugins() 54 | { 55 | foreach(var p in pluginList) 56 | { 57 | try 58 | { 59 | p.plugin.onGesture -= p.onGestureAsync; 60 | p.plugin.onGesture += p.onGestureAsync; 61 | p.plugin.initializePlugin(); 62 | Trace.WriteLine($"[PLUGIN]{p.plugin.pluginName} init OK."); 63 | } 64 | catch(Exception ex) 65 | { 66 | Trace.WriteLine($"[PLUGIN]{p.plugin.pluginName} init failed."); 67 | } 68 | } 69 | } 70 | 71 | public static void deactivateAllPlugins() 72 | { 73 | foreach (var p in pluginList) 74 | { 75 | p.plugin.onGesture -= p.onGestureAsync; 76 | p.plugin.deletePlugin(); 77 | } 78 | } 79 | 80 | public static void clearAllPlugins() 81 | { 82 | pluginList.Clear(); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 8 | // アセンブリに関連付けられている情報を変更するには、 9 | // これらの属性値を変更してください。 10 | [assembly: AssemblyTitle("TaskViewGestureToolkit")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("TaskViewGestureToolkit")] 15 | [assembly: AssemblyCopyright("Copyright © 2016")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 20 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 21 | // その型の ComVisible 属性を true に設定してください。 22 | [assembly: ComVisible(false)] 23 | 24 | //ローカライズ可能なアプリケーションのビルドを開始するには、 25 | //.csproj ファイルの CultureYouAreCodingWith を 26 | // 内部で設定します。たとえば、 27 | //ソース ファイルで英語を使用している場合、 を en-US に設定します。次に、 28 | //下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を 29 | //プロジェクト ファイルの UICulture 設定と一致するよう更新します。 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 36 | //(リソースがページ、 37 | //またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) 38 | ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 39 | //(リソースがページ、 40 | //アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) 41 | )] 42 | 43 | 44 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 45 | // 46 | // メジャー バージョン 47 | // マイナー バージョン 48 | // ビルド番号 49 | // Revision 50 | // 51 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 52 | // 既定値にすることができます: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.1.0")] 55 | [assembly: AssemblyFileVersion("1.0.1.0")] 56 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TaskViewGestureToolkit.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TaskViewGestureToolkit.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TaskViewGestureToolkit.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/TaskViewGestureToolkit.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {309C6C32-4FB6-4CAB-A297-0A5668ECBB27} 8 | WinExe 9 | Properties 10 | TaskViewGestureToolkit 11 | TaskViewGestureToolkit 12 | v4.6 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | true 17 | 18 | 19 | 20 | AnyCPU 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | false 29 | 30 | 31 | AnyCPU 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | TaskViewGestureToolkit.AppMain 41 | 42 | 43 | app.manifest 44 | 45 | 46 | 47 | ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll 48 | True 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 4.0 62 | 63 | 64 | 65 | 66 | 67 | ..\packages\InputSimulator.1.0.4.0\lib\net20\WindowsInput.dll 68 | True 69 | 70 | 71 | 72 | 73 | MSBuild:Compile 74 | Designer 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | Component 84 | 85 | 86 | TaskTrayComponent.cs 87 | 88 | 89 | 90 | 91 | App.xaml 92 | Code 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | Code 101 | 102 | 103 | True 104 | True 105 | Resources.resx 106 | 107 | 108 | True 109 | Settings.settings 110 | True 111 | 112 | 113 | ResXFileCodeGenerator 114 | Resources.Designer.cs 115 | 116 | 117 | TaskTrayComponent.cs 118 | 119 | 120 | Designer 121 | 122 | 123 | 124 | SettingsSingleFileGenerator 125 | Settings.Designer.cs 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | {2094fde0-20e3-48d7-8d62-2d7e7c2f38fd} 137 | PluginBaseLib 138 | 139 | 140 | {ab848ecd-76aa-41c0-b63d-86a8591b25aa} 141 | VirtualDesktop 142 | 143 | 144 | 145 | 152 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Tools/STAThreadTool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace TaskViewGestureToolkit.Tools 9 | { 10 | public class STAThreadTool 11 | { 12 | public static void RunSTAThread(Func func) 13 | { 14 | var th = new Thread(() => func()); 15 | th.SetApartmentState(ApartmentState.STA); 16 | th.Start(); 17 | } 18 | 19 | public static void RunSTAThread(Action ac) 20 | { 21 | RunSTAThread(() => 22 | { 23 | ac(); 24 | return true; 25 | }); 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/UI/StockIcon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace TaskViewGestureToolkit.UI 10 | { 11 | public class StockIcon 12 | { 13 | public const UInt32 SHGSI_ICON = 0x000000100; 14 | public const UInt32 SHGSI_SMALLICON = 0x000000001; 15 | 16 | [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 17 | public struct SHSTOCKICONINFO 18 | { 19 | public Int32 cbSize; 20 | public IntPtr hIcon; 21 | public Int32 iSysImageIndex; 22 | public Int32 iIcon; 23 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] 24 | public string szPath; 25 | } 26 | 27 | [DllImport("shell32.dll", CharSet = CharSet.Unicode)] 28 | public static extern void SHGetStockIconInfo(UInt32 siid, UInt32 uFlags, ref SHSTOCKICONINFO sii); 29 | 30 | public static Icon getStackIcon() 31 | { 32 | SHSTOCKICONINFO sii = new SHSTOCKICONINFO(); 33 | sii.cbSize = Marshal.SizeOf(sii); 34 | SHGetStockIconInfo(55, SHGSI_ICON, ref sii); 35 | return (sii.hIcon != IntPtr.Zero) ? Icon.FromHandle(sii.hIcon) : null; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/UI/TaskTrayComponent.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TaskViewGestureToolkit.UI 2 | { 3 | partial class TaskTrayComponent 4 | { 5 | /// 6 | /// 必要なデザイナー変数です。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 使用中のリソースをすべてクリーンアップします。 12 | /// 13 | /// マネージ リソースを破棄する場合は true を指定し、その他の場合は false を指定します。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region コンポーネント デザイナーで生成されたコード 24 | 25 | /// 26 | /// デザイナー サポートに必要なメソッドです。このメソッドの内容を 27 | /// コード エディターで変更しないでください。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); 33 | this.nIconContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); 34 | this.reloadPluginMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 35 | this.useAPIStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 36 | this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); 37 | this.exitApplicationMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 38 | this.writeLogMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 39 | this.nIconContextMenuStrip.SuspendLayout(); 40 | // 41 | // notifyIcon 42 | // 43 | this.notifyIcon.ContextMenuStrip = this.nIconContextMenuStrip; 44 | this.notifyIcon.Text = "TaskViewGestureToolkit"; 45 | this.notifyIcon.Visible = true; 46 | // 47 | // nIconContextMenuStrip 48 | // 49 | this.nIconContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 50 | this.reloadPluginMenuItem, 51 | this.useAPIStripMenuItem, 52 | this.writeLogMenuItem, 53 | this.toolStripSeparator, 54 | this.exitApplicationMenuItem}); 55 | this.nIconContextMenuStrip.Name = "nIconContextMenuStrip"; 56 | this.nIconContextMenuStrip.Size = new System.Drawing.Size(211, 98); 57 | // 58 | // reloadPluginMenuItem 59 | // 60 | this.reloadPluginMenuItem.Name = "reloadPluginMenuItem"; 61 | this.reloadPluginMenuItem.Size = new System.Drawing.Size(210, 22); 62 | this.reloadPluginMenuItem.Text = "Reload plugins"; 63 | // 64 | // useAPIStripMenuItem 65 | // 66 | this.useAPIStripMenuItem.CheckOnClick = true; 67 | this.useAPIStripMenuItem.Name = "useAPIStripMenuItem"; 68 | this.useAPIStripMenuItem.Size = new System.Drawing.Size(210, 22); 69 | this.useAPIStripMenuItem.Text = "Use API to switch desktop"; 70 | // 71 | // toolStripSeparator 72 | // 73 | this.toolStripSeparator.Name = "toolStripSeparator"; 74 | this.toolStripSeparator.Size = new System.Drawing.Size(207, 6); 75 | // 76 | // exitApplicationMenuItem 77 | // 78 | this.exitApplicationMenuItem.Name = "exitApplicationMenuItem"; 79 | this.exitApplicationMenuItem.Size = new System.Drawing.Size(210, 22); 80 | this.exitApplicationMenuItem.Text = "Exit(&E)"; 81 | // 82 | // writeLogMenuItem 83 | // 84 | this.writeLogMenuItem.Name = "writeLogMenuItem"; 85 | this.writeLogMenuItem.Size = new System.Drawing.Size(210, 22); 86 | this.writeLogMenuItem.Text = "Write log to file"; 87 | this.nIconContextMenuStrip.ResumeLayout(false); 88 | 89 | } 90 | 91 | #endregion 92 | public System.Windows.Forms.NotifyIcon notifyIcon; 93 | public System.Windows.Forms.ContextMenuStrip nIconContextMenuStrip; 94 | public System.Windows.Forms.ToolStripMenuItem reloadPluginMenuItem; 95 | public System.Windows.Forms.ToolStripMenuItem exitApplicationMenuItem; 96 | public System.Windows.Forms.ToolStripMenuItem useAPIStripMenuItem; 97 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator; 98 | public System.Windows.Forms.ToolStripMenuItem writeLogMenuItem; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/UI/TaskTrayComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace TaskViewGestureToolkit.UI 10 | { 11 | public partial class TaskTrayComponent : Component 12 | { 13 | public TaskTrayComponent() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | public TaskTrayComponent(IContainer container) 19 | { 20 | container.Add(this); 21 | 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/UI/TaskTrayComponent.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 56 122 | 123 | 124 | 123, 17 125 | 126 | 127 | False 128 | 129 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/UI/UIManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | using TaskViewGestureToolkit.Config; 8 | using TaskViewGestureToolkit.Gesture; 9 | using TaskViewGestureToolkit.Log; 10 | using TaskViewGestureToolkit.Plugin; 11 | 12 | namespace TaskViewGestureToolkit.UI 13 | { 14 | public class UIManager 15 | { 16 | public UI.TaskTrayComponent ttComponent; 17 | 18 | public UIManager() 19 | { 20 | System.Windows.Forms.Application.EnableVisualStyles(); 21 | ttComponent = new UI.TaskTrayComponent(); 22 | ttComponent.notifyIcon.Icon = UI.StockIcon.getStackIcon(); 23 | ttComponent.exitApplicationMenuItem.Click += exitApplicationMenuItemOnClick; 24 | ttComponent.reloadPluginMenuItem.Click += reloadPluginMenuItemOnClick; 25 | ttComponent.useAPIStripMenuItem.Click += useAPIStripMenuItemOnClick; 26 | ttComponent.writeLogMenuItem.Click += writeLogMenuItemOnClick; 27 | } 28 | 29 | private void writeLogMenuItemOnClick(object sender, EventArgs e) 30 | { 31 | Logger.writeToLogfile(); 32 | } 33 | 34 | private void useAPIStripMenuItemOnClick(object sender, EventArgs e) 35 | { 36 | GestureManager.useVirtualDesktopAPI = ((ToolStripMenuItem)sender).Checked; 37 | } 38 | 39 | private void reloadPluginMenuItemOnClick(object sender, EventArgs e) 40 | { 41 | PluginManager.deactivateAllPlugins(); 42 | PluginManager.clearAllPlugins(); 43 | PluginManager.loadFromPluginDir(); 44 | PluginManager.activateAllPlugins(); 45 | } 46 | 47 | private void exitApplicationMenuItemOnClick(object sender, EventArgs e) 48 | { 49 | PluginManager.deactivateAllPlugins(); 50 | Application.Exit(); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Updater/UpdateChecker.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Net; 7 | using System.Reflection; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace TaskViewGestureToolkit.Updater 13 | { 14 | public class UpdateChecker 15 | { 16 | private const string UPDATE_JSON = "https://raw.githubusercontent.com/kazukioishi/TaskViewGestureToolkit/master/TaskViewGestureToolkit/Updater/updateinfo.json"; 17 | 18 | public async static void checkUpdate() 19 | { 20 | try 21 | { 22 | JObject updjson = null; 23 | await Task.Run(()=>{ 24 | updjson = JObject.Parse(new WebClient().DownloadString(UPDATE_JSON)); 25 | }); 26 | var newVer = new Version(updjson["version"].Value()); 27 | if(newVer > Assembly.GetEntryAssembly().GetName().Version) 28 | { 29 | //update available 30 | AppMain.uiman.ttComponent.notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; 31 | AppMain.uiman.ttComponent.notifyIcon.BalloonTipTitle = "TaskViewGestureToolkit"; 32 | AppMain.uiman.ttComponent.notifyIcon.BalloonTipText = updjson["message"].Value(); 33 | AppMain.uiman.ttComponent.notifyIcon.ShowBalloonTip(5000); 34 | var menuitem = new ToolStripMenuItem($"Update to version {newVer.ToString()}"); 35 | menuitem.Click += (sender, e) => 36 | { 37 | Process.Start(updjson["url"].Value()); 38 | }; 39 | AppMain.uiman.ttComponent.notifyIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator()); 40 | AppMain.uiman.ttComponent.notifyIcon.ContextMenuStrip.Items.Add(menuitem); 41 | } 42 | } 43 | catch(Exception ex) 44 | { 45 | 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/Updater/updateinfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "version" : "1.0.1.0", 3 | "message" : "New version available!!", 4 | "url" : "https://github.com/kazukioishi/TaskViewGestureToolkit/releases/tag/Ver1.0.1" 5 | } 6 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 59 | 60 | 61 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /TaskViewGestureToolkit/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /WacomGesturePlugin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("WacomGesturePlugin")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("WacomGesturePlugin")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("80111ffe-b4bf-44d3-8dcd-550c5e7a50fd")] 24 | 25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // Revision 31 | // 32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WacomGesturePlugin/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Wacom.FeelMultiTouch; 7 | 8 | namespace WacomGesturePlugin 9 | { 10 | public class Utils 11 | { 12 | public static int[] getFingerAvgPoint(WacomMTFinger[] fingers) 13 | { 14 | float X = 0; 15 | float Y = 0; 16 | foreach (var i in fingers) 17 | { 18 | X += (i.X <= 1) ? i.X * 1920 : i.X; 19 | Y += (i.Y <= 1) ? i.Y * 1080 : i.Y; 20 | } 21 | X = X / fingers.Count(); 22 | Y = Y / fingers.Count(); 23 | return new int[] { (int)X, (int)Y }; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /WacomGesturePlugin/WacomFeelMultiTouchAPI/FeelMultiTouchAPIConst.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace Wacom.FeelMultiTouch 8 | { 9 | 10 | public class WindowMessage 11 | { 12 | /// 13 | /// 14 | /// 15 | public const int WM_FINGERDATA = 0x6205; 16 | 17 | /// 18 | /// 19 | /// 20 | public const int WM_BLOBDATA = 0x6206; 21 | 22 | /// 23 | /// 24 | /// 25 | public const int WM_RAWDATA = 0x6207; 26 | } 27 | 28 | /// 29 | /// MultitouchAPI関数の戻り値 30 | /// 31 | public enum WacomMTError : int 32 | { 33 | WMTErrorSuccess = 0, // 呼び出しが成功 34 | WMTErrorDriverNotFound = 1, // ドライバが見つからない 35 | WMTErrorBadVersion = 2, // ドライバとAPIの互換性がない 36 | WMTErrorAPIOutdated = 3, // ドライバでサポートされていないデータ構造を要求 37 | WMTErrorInvalidParam = 4, // 無効なパラメータが指定された 38 | WMTErrorQuit = 5, // APIが正常に初期化されなかった 39 | WMTErrorBufferTooSmall = 6, // 指定したバッファが小さすぎる 40 | } 41 | 42 | /// 43 | /// デバイスの種別 44 | /// 45 | public enum WacomMTDeviceType : int 46 | { 47 | WMTDeviceTypeOpaque     = 0, // 液晶が組み込まれていないタブレット 48 | WMTDeviceTypeIntegrated = 1, // 液晶に組み込まれているタブレット 49 | } 50 | 51 | /// 52 | /// デバイスがサポートするデータの種別 53 | /// 54 | public enum WacomMTCapabilityFlags : int 55 | { 56 | WMTCapabilityFlagsRawAvailable = (1 << 0), // RAWデータ 57 | WMTCapabilityFlagsBlobAvailable = (1 << 1), // BLOBデータ 58 | WMTCapabilityFlagsSensitivityAvailable = (1 << 2), // フィンガーデータの感度データ 59 | WMTCapabilityFlagsReserved = (1 << 31), 60 | } 61 | 62 | /// 63 | /// 指の状態 64 | /// 65 | public enum WacomMTFingerState : int 66 | { 67 | WMTFingerStateNone = 0, 68 | WMTFingerStateDown = 1, // 指の接触が開始された 69 | WMTFingerStateHold = 2, // 指が接触し続けている 70 | WMTFingerStateUp = 3, // 指が離された 71 | } 72 | 73 | /// 74 | /// BLOBのデータ種別 75 | /// 76 | public enum WacomMTBlobType : int 77 | { 78 | WMTBlobTypePrimary = 0, // BLOBの輪郭 79 | WMTBlobTypeVoid = 1, // 内側のBLOBの輪郭 80 | } 81 | 82 | /// 83 | /// データの処理方法 84 | /// 85 | public enum WacomMTProcessingMode : int 86 | { 87 | WMTProcessingModeNone = 0, // コールバックに送信され、これ以上の処理は行われない 88 | WMTProcessingModeObserver = (1 << 0), // OSにも並行して送信される 89 | WMTProcessingModeReserved = (1 << 31), 90 | } 91 | 92 | /// 93 | /// タブレット情報の構造体 94 | /// 95 | [StructLayout(LayoutKind.Sequential)] 96 | public struct WacomMTCapability 97 | { 98 |    public Int32               Version; 99 | public Int32 DeviceID; 100 | public WacomMTDeviceType Type; 101 | public float LogicalOriginX; 102 | public float LogicalOriginY; 103 | public float LogicalWidth; 104 | public float LogicalHeight; 105 | public float PhysicalSizeX; 106 | public float PhysicalSizeY; 107 | public Int32 ReportedSizeX; 108 | public Int32 ReportedSizeY; 109 | public Int32 ScanSizeX; 110 | public Int32 ScanSizeY; 111 | public Int32 FingerMax; 112 | public Int32 BlobMax; 113 | public Int32 BlobPointsMax; 114 | public WacomMTCapabilityFlags CapabilityFlags; 115 | } 116 | 117 | /// 118 | /// フィンガーデータ構造体 119 | /// 120 | [StructLayout(LayoutKind.Sequential)] 121 | public struct WacomMTFinger 122 | { 123 | public int FingerID; 124 | public float X; 125 | public float Y; 126 | public float Width; 127 | public float Height; 128 | public UInt16 Sensitivity; 129 | public float Orientation; 130 | public bool Confidence; 131 | public WacomMTFingerState TouchState; 132 | } 133 | 134 | /// 135 | /// 複数フィンガーデータをまとめた構造体 136 | /// 137 | [StructLayout(LayoutKind.Sequential)] 138 | public struct WacomMTFingerCollection 139 | { 140 | public int Version; 141 | public int DeviceID; 142 | public int FrameNumber; 143 | public int FingerCount; 144 | public IntPtr FingerData; 145 | } 146 | 147 | /// 148 | /// HitRectの構造体 149 | /// 150 | [StructLayout(LayoutKind.Sequential)] 151 | public struct WacomMTHitRect 152 | { 153 | public float originX; 154 | public float originY; 155 | public float width; 156 | public float height; 157 | } 158 | 159 | /// 160 | /// フィンガーデータのコールバック 161 | /// 162 | /// 163 | /// 164 | /// 165 | public delegate int WMT_FINGER_CALLBACK(IntPtr fingerPacket, IntPtr userData); 166 | 167 | } 168 | -------------------------------------------------------------------------------- /WacomGesturePlugin/WacomFeelMultiTouchAPI/MTAPI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace Wacom.FeelMultiTouch 8 | { 9 | 10 | class MTAPI 11 | { 12 | /// 13 | /// APIバージョン 14 | /// 15 | public const int Version = 4; 16 | 17 | /** **************************************************************************************************************** 18 | * アンマネージドコードの定義 19 | * 20 | * 以下のメソッドはwacommt.dllからインポートしています。 21 | * wacommt.dllがインストールされていない場合は例外が発生するので、タブレットドライバをインストールしてください。 22 | * _[メソッド名]で定義しているものは、「_」を抜いたものを使いやすいように定義しています。 23 | * 24 | * ***************************************************************************************************************** 25 | */ 26 | 27 | /// 28 | /// 初期化処理 29 | /// 30 | /// 31 | /// 32 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WacomMTInitialize")] 33 | protected static extern WacomMTError _WacomMTInitialize(Int32 libraryAPIVersion); 34 | 35 | /// 36 | /// 終了処理 37 | /// 38 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] 39 | public static extern void WacomMTQuit(); 40 | 41 | /// 42 | /// 接続しているタブレットデバイスのIDを収得 43 | /// 44 | /// 45 | /// 46 | /// 47 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WacomMTGetAttachedDeviceIDs")] 48 | protected static extern int _WacomMTGetAttachedDeviceIDs(IntPtr deviceArray, UInt32 bufferSize); 49 | 50 | /// 51 | /// タブレットデバイスの情報取得 52 | /// 53 | /// 54 | /// 55 | /// 56 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WacomMTGetDeviceCapabilities")] 57 | protected static extern WacomMTError _WacomMTGetDeviceCapabilities(int deviceID, IntPtr capabilityBuffer); 58 | 59 | // **** 以下追加コード 60 | 61 | /// 62 | /// フィンガーデータ受信するウインドウハンドルを設定 63 | /// 64 | /// 65 | /// 66 | /// 67 | /// 68 | /// 69 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WacomMTRegisterFingerReadHWND")] 70 | public static extern WacomMTError WacomMTRegisterFingerReadHWND(int deviceID, WacomMTProcessingMode mode, IntPtr hWnd, int bufferDepth); 71 | 72 | /// 73 | /// フィンガーデータを受信するウインドウハンドルを解除 74 | /// 75 | /// 76 | /// 77 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WacomMTUnRegisterFingerReadHWND")] 78 | public static extern WacomMTError WacomMTUnRegisterFingerReadHWND(IntPtr hwnd); 79 | 80 | /// 81 | /// フィンガーデータを受け取るコールバックの設定 82 | /// 83 | /// 84 | /// 85 | /// 86 | /// 87 | /// 88 | /// 89 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WacomMTRegisterFingerReadCallback")] 90 | public static extern WacomMTError WacomMTRegisterFingerReadCallback(int deviceID, IntPtr hitRect, WacomMTProcessingMode mode, [MarshalAs(UnmanagedType.FunctionPtr)] WMT_FINGER_CALLBACK fingerCallback, IntPtr userData); 91 | 92 | /// 93 | /// フィンガーデータを受け取るコールバックの解除 94 | /// 95 | /// 96 | /// 97 | /// 98 | /// 99 | /// 100 | [DllImport("wacommt.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "WacomMTUnRegisterFingerReadCallback")] 101 | public static extern WacomMTError WacomMTUnRegisterFingerReadCallback(int deviceID, IntPtr hitRect, WacomMTProcessingMode mode, IntPtr userData); 102 | 103 | /** **************************************************************************************************************** 104 | * アンマネージドのメソッドはポインタをIntPtrで表しているため、IntPtr関連の処理を内部を行うようにしたメソッドを作っています。 105 | * ***************************************************************************************************************** 106 | */ 107 | 108 | /// 109 | /// 初期化処理 110 | /// 111 | /// 初期化の結果 112 | public static WacomMTError WacomMTInitialize() 113 | { 114 | // 定義しているバージョンを指定する 115 | return _WacomMTInitialize(Version); 116 | } 117 | 118 | /// 119 | /// 接続しているタブレットのID取得 120 | /// 121 | /// 認識しているタブレットのID配列 122 | public static int[] WacomMTGetAttachedDeviceIDs() 123 | { 124 | int[] idArray = new int[0]; 125 | int res = _WacomMTGetAttachedDeviceIDs(IntPtr.Zero, 0); 126 | 127 | if (res != 0) 128 | { 129 | IntPtr pIdArray = IntPtr.Zero; 130 | 131 | try 132 | { 133 | pIdArray = MemoryUtil.AllocUnmanagedBuffer(typeof(int), res); 134 | res = _WacomMTGetAttachedDeviceIDs(pIdArray, sizeof(int) * (UInt32)res); 135 | idArray = MemoryUtil.MarshalUnmanagedBufferArray(pIdArray, (uint)res); 136 | } 137 | catch (Exception ex) 138 | { 139 | throw ex; 140 | } 141 | finally 142 | { 143 | MemoryUtil.FreeUnmanagedBuffer(pIdArray); 144 | } 145 | } 146 | 147 | return idArray; 148 | } 149 | 150 | /// 151 | /// タブレットデバイスの情報取得 152 | /// 153 | /// タブレットデバイスのID 154 | /// タブレットデバイスの情報 155 | public static WacomMTCapability WacomMTGetDeviceCapabilities(int deviceID) 156 | { 157 | IntPtr capabilitiesPtr = IntPtr.Zero; 158 | WacomMTCapability capability; 159 | 160 | try 161 | { 162 | capabilitiesPtr = MemoryUtil.AllocUnmanagedBuffer(typeof(WacomMTCapability)); 163 | WacomMTError res = _WacomMTGetDeviceCapabilities(deviceID, capabilitiesPtr); 164 | 165 | if (res != WacomMTError.WMTErrorSuccess) 166 | { 167 | // 失敗した場合は例外を発生させる 168 | throw new Exception("WacomMTGetDeviceCapabilities : " + res); 169 | } 170 | 171 | capability = (WacomMTCapability)MemoryUtil.MarshalUnmanagedBuffer(capabilitiesPtr, typeof(WacomMTCapability)); 172 | } 173 | catch (Exception ex) 174 | { 175 | throw ex; 176 | } 177 | finally 178 | { 179 | MemoryUtil.FreeUnmanagedBuffer(capabilitiesPtr); 180 | } 181 | 182 | return capability; 183 | } 184 | 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /WacomGesturePlugin/WacomFeelMultiTouchAPI/MemoryUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace Wacom 8 | { 9 | /// 10 | /// アンマネージドメモリを管理するクラス 11 | /// 12 | class MemoryUtil 13 | { 14 | 15 | /// 16 | /// 対象タイプ分のメモリを確保する 17 | /// 18 | /// 確保するクラスのタイプ 19 | /// 20 | public static IntPtr AllocUnmanagedBuffer(Type t) 21 | { 22 | return Marshal.AllocHGlobal(Marshal.SizeOf(t)); 23 | } 24 | 25 | /// 26 | /// 対象のオブジェクト分のメモリを確保する 27 | /// 28 | /// 確保するオブジェクト 29 | /// 30 | public static IntPtr AllocUnmanagedBuffer(Object obj) 31 | { 32 | IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(obj)); 33 | Marshal.StructureToPtr(obj, p, false); 34 | return p; 35 | } 36 | 37 | /// 38 | /// 対象のタイプを指定数分メモリ確保する 39 | /// 40 | /// 確保するクラスのタイプ 41 | /// 指定数 42 | /// 43 | public static IntPtr AllocUnmanagedBuffer(Type t, int count) 44 | { 45 | return Marshal.AllocHGlobal(Marshal.SizeOf(t) * count); 46 | } 47 | 48 | /// 49 | /// 指定サイズ分のメモリを確保する 50 | /// 51 | /// 確保するメモリのサイズ 52 | /// 53 | public static IntPtr AllocUnmanagedBuffer(int sz) 54 | { 55 | return Marshal.AllocHGlobal(sz); 56 | } 57 | 58 | /// 59 | /// アンマネージドメモリの開放 60 | /// 61 | /// 62 | public static void FreeUnmanagedBuffer(IntPtr buf) 63 | { 64 | if (buf != IntPtr.Zero) 65 | { 66 | Marshal.FreeHGlobal(buf); 67 | buf = IntPtr.Zero; 68 | } 69 | } 70 | 71 | /// 72 | /// アンマネージドメモリを指定のオブジェクトに変換する 73 | /// 74 | /// 指定のタイプ 75 | /// ポインタ 76 | /// 77 | public static Object MarshalUnmanagedBuffer(IntPtr buf, Type t) 78 | { 79 | return Marshal.PtrToStructure(buf, t); 80 | } 81 | 82 | /// 83 | /// アンマネージドメモリをUTF8の文字列に変換する 84 | /// 85 | /// ポインタ 86 | /// サイズ 87 | /// 88 | public static string MarshalUnmanagedString(IntPtr buf, int sz) 89 | { 90 | return MarshalUnmanagedString(buf, sz, System.Text.Encoding.UTF8); 91 | } 92 | 93 | /// 94 | /// アンマネージドメモリを指定のエンコードの文字列に変換する 95 | /// 96 | /// ポインタ 97 | /// サイズ 98 | /// 文字エンコード 99 | /// 100 | public static string MarshalUnmanagedString(IntPtr buf, int sz, System.Text.Encoding encoding) 101 | { 102 | Byte[] byteArray = new Byte[sz]; 103 | Marshal.Copy(buf, byteArray, 0, sz); 104 | return encoding.GetString(byteArray); 105 | } 106 | 107 | /// 108 | /// アンマネージドメモリを指定のタイプの配列に変換する 109 | /// 110 | /// 指定のタイプ 111 | /// ポインタ 112 | /// 配列の要素数 113 | /// 114 | public static T[] MarshalUnmanagedBufferArray(IntPtr buf, uint count) 115 | { 116 | T[] result = new T[count]; 117 | 118 | IntPtr nowPtr = buf; 119 | for (int i = 0; i < count; i++) 120 | { 121 | result[i] = (T)Marshal.PtrToStructure(nowPtr, typeof(T)); 122 | nowPtr = (IntPtr)((int)nowPtr + Marshal.SizeOf(typeof(T))); 123 | } 124 | 125 | return result; 126 | } 127 | 128 | /// 129 | /// 対象のタイプのサイズ取得 130 | /// 131 | /// 対象のタイプ 132 | /// 133 | public static int SizeOf(Type t) 134 | { 135 | return Marshal.SizeOf(t); 136 | } 137 | 138 | /// 139 | /// 140 | /// 141 | /// 142 | /// 143 | public static void StructureToPtr(Object src, IntPtr dst) 144 | { 145 | Marshal.StructureToPtr(src, dst, false); 146 | } 147 | 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /WacomGesturePlugin/WacomGesture.cs: -------------------------------------------------------------------------------- 1 | using PluginBaseLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Wacom; 9 | using Wacom.FeelMultiTouch; 10 | 11 | namespace WacomGesturePlugin 12 | { 13 | public class WacomGesture : PluginBase 14 | { 15 | class WacomTab 16 | { 17 | private WacomGesture parent; 18 | public WMT_FINGER_CALLBACK callbackDelegate; 19 | public int deviceID; 20 | public IntPtr mHitRectPtr = IntPtr.Zero; 21 | private bool isMoving = false; 22 | private WacomMTFinger[] lastFingers; 23 | 24 | public WacomTab(WacomGesture wg) 25 | { 26 | parent = wg; 27 | } 28 | public int wmtFingerCallback(IntPtr fingerPacket, IntPtr userData) 29 | { 30 | WacomMTFingerCollection collection = (WacomMTFingerCollection)MemoryUtil.MarshalUnmanagedBuffer(fingerPacket, typeof(WacomMTFingerCollection)); 31 | WacomMTFinger[] fingers = MemoryUtil.MarshalUnmanagedBufferArray(collection.FingerData, (uint)collection.FingerCount); 32 | if (fingers.Count() != 0) lastFingers = fingers; 33 | if(fingers.Count() == 4 && !isMoving) 34 | { 35 | //gesture start 36 | isMoving = true; 37 | parent.callOnGesture(Utils.getFingerAvgPoint(fingers)[0], Utils.getFingerAvgPoint(fingers)[1],EventType.OnGestureStart); 38 | }else if(isMoving && fingers.Count() < 4 && fingers.Count() != 0) 39 | { 40 | //gesture end 41 | isMoving = false; 42 | parent.callOnGesture(Utils.getFingerAvgPoint(fingers)[0], Utils.getFingerAvgPoint(fingers)[1], EventType.OnGestureEnd); 43 | } 44 | else if(isMoving && fingers.Count() == 0) 45 | { 46 | //get last point 47 | isMoving = false; 48 | parent.callOnGesture(Utils.getFingerAvgPoint(lastFingers)[0], Utils.getFingerAvgPoint(lastFingers)[1], EventType.OnGestureEnd); 49 | } 50 | return 0; 51 | } 52 | } 53 | private List wacomTabList = new List(); 54 | 55 | public override string pluginName 56 | { 57 | get 58 | { 59 | return "WacomGesturePlugin"; 60 | } 61 | } 62 | 63 | public override void deletePlugin() 64 | { 65 | foreach (var tablet in wacomTabList) 66 | { 67 | MTAPI.WacomMTUnRegisterFingerReadCallback(tablet.deviceID, tablet.mHitRectPtr, WacomMTProcessingMode.WMTProcessingModeObserver, IntPtr.Zero); 68 | MemoryUtil.FreeUnmanagedBuffer(tablet.mHitRectPtr); 69 | } 70 | wacomTabList.Clear(); 71 | } 72 | 73 | public override void initializePlugin() 74 | { 75 | WacomMTError res = MTAPI.WacomMTInitialize(); 76 | if (res != WacomMTError.WMTErrorSuccess) return; 77 | int[] mIdAry = MTAPI.WacomMTGetAttachedDeviceIDs(); 78 | foreach (var id in mIdAry) 79 | { 80 | WacomMTHitRect hr; 81 | hr.originX = 0; 82 | hr.originY = 0; 83 | hr.width = 1920f; 84 | hr.height = 1080f; 85 | WacomTab wt = new WacomTab(this) { deviceID = id }; 86 | wt.mHitRectPtr = MemoryUtil.AllocUnmanagedBuffer(hr); 87 | wt.callbackDelegate = new WMT_FINGER_CALLBACK(wt.wmtFingerCallback); 88 | MTAPI.WacomMTRegisterFingerReadCallback(id, wt.mHitRectPtr, WacomMTProcessingMode.WMTProcessingModeObserver, wt.callbackDelegate, IntPtr.Zero); 89 | wacomTabList.Add(wt); 90 | } 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /WacomGesturePlugin/WacomGesturePlugin.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {80111FFE-B4BF-44D3-8DCD-550C5E7A50FD} 8 | Library 9 | Properties 10 | WacomGesturePlugin 11 | WacomGesturePlugin 12 | v4.6 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {2094fde0-20e3-48d7-8d62-2d7e7c2f38fd} 54 | PluginBaseLib 55 | 56 | 57 | 58 | 59 | copy $(TargetPath) $(SolutionDir)TaskViewGestureToolkit\bin\$(ConfigurationName)\plugin 60 | 61 | 68 | -------------------------------------------------------------------------------- /WacomTester/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /WacomTester/Program.cs: -------------------------------------------------------------------------------- 1 | using PluginBaseLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace WacomTester 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | PManager pman = new PManager(); 16 | Task.Run(() => { 17 | pman.init(); 18 | pman.plugin.onGesture += Plugin_onGesture; 19 | }); 20 | 21 | Console.WriteLine("Press Ctrl-C to terminate..."); 22 | using (ManualResetEvent manualResetEvent = new ManualResetEvent(false)) 23 | { 24 | manualResetEvent.WaitOne(); 25 | } 26 | } 27 | 28 | private static void Plugin_onGesture(int x, int y, PluginBase.EventType etype) 29 | { 30 | Console.WriteLine($"[{etype.ToString()}]x={x},y={y}"); 31 | } 32 | 33 | class PManager 34 | { 35 | public PluginBase plugin; 36 | public void init() 37 | { 38 | plugin = new WacomGesturePlugin.WacomGesture(); 39 | plugin.initializePlugin(); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /WacomTester/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 6 | // アセンブリに関連付けられている情報を変更するには、 7 | // これらの属性値を変更してください。 8 | [assembly: AssemblyTitle("WacomTester")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("WacomTester")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから 18 | // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 19 | // その型の ComVisible 属性を true に設定してください。 20 | [assembly: ComVisible(false)] 21 | 22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります 23 | [assembly: Guid("9be2b62a-662a-47bb-b501-82eb487499a6")] 24 | 25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています: 26 | // 27 | // メジャー バージョン 28 | // マイナー バージョン 29 | // ビルド番号 30 | // Revision 31 | // 32 | // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を 33 | // 既定値にすることができます: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WacomTester/WacomTester.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {9BE2B62A-662A-47BB-B501-82EB487499A6} 8 | Exe 9 | Properties 10 | WacomTester 11 | WacomTester 12 | v4.6 13 | 512 14 | true 15 | 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {2094fde0-20e3-48d7-8d62-2d7e7c2f38fd} 56 | PluginBaseLib 57 | 58 | 59 | {80111ffe-b4bf-44d3-8dcd-550c5e7a50fd} 60 | WacomGesturePlugin 61 | 62 | 63 | 64 | 71 | --------------------------------------------------------------------------------