Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
X-Mouse Controls, added from sources released to the official web page
git-svn-id: svn://localhost/X-Mouse Controls@577 e549bf12-f090-ff4b-a60d-830663ca835f
- Loading branch information
0 parents
commit 5f4d1fb
Showing
17 changed files
with
3,520 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
namespace SystemParametersInfo | ||
{ | ||
/// <summary> | ||
/// Wrapper for the SystemParametersInfo in user32.dll | ||
/// http://msdn2.microsoft.com/en-us/library/ms724947.aspx | ||
/// http://www.pinvoke.net/default.aspx/user32.SystemParametersInfo | ||
/// </summary> | ||
public class Helper | ||
{ | ||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)] | ||
public static extern bool SystemParametersInfoGet(uint action, uint param, ref uint vparam, uint init); | ||
|
||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)] | ||
public static extern bool SystemParametersInfoSet(uint action, uint param, uint vparam, uint init); | ||
|
||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)] | ||
public static extern bool SystemParametersInfoGet(uint action, uint param, ref bool vparam, uint init); | ||
|
||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)] | ||
public static extern bool SystemParametersInfoSet(uint action, uint param, bool vparam, uint init); | ||
|
||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)] | ||
public static extern bool SystemParametersInfoGet(uint action, uint param, ref string vparam, uint init); | ||
|
||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)] | ||
public static extern bool SystemParametersInfoSet(uint action, uint param, string vparam, uint init); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("SystemParametersInfoHelper")] | ||
[assembly: AssemblyDescription("A small helper to enable calls to SystemParametersInfo values in user32.dll")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Joel Purra")] | ||
[assembly: AssemblyProduct("SystemParametersInfoHelper")] | ||
[assembly: AssemblyCopyright("Copyright © Joel Purra 2007")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("a6de2274-0f6b-4437-b67e-4c04eff812eb")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>9.0.21022</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{F3CF4BFC-F128-4D95-8C29-037A76A728F5}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>SystemParametersInfoHelper</RootNamespace> | ||
<AssemblyName>SystemParametersInfoHelper</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Helper.cs" /> | ||
<Compile Include="SPI.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 10.00 | ||
# Visual Studio 2008 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "X-Mouse Controls", "X-Mouse Controls\X-Mouse Controls.csproj", "{5E79F702-0C7E-48F3-A8EB-BFC450BD6C45}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemParametersInfo", "SystemParametersInfoHelper\SystemParametersInfo.csproj", "{F3CF4BFC-F128-4D95-8C29-037A76A728F5}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{5E79F702-0C7E-48F3-A8EB-BFC450BD6C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5E79F702-0C7E-48F3-A8EB-BFC450BD6C45}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5E79F702-0C7E-48F3-A8EB-BFC450BD6C45}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5E79F702-0C7E-48F3-A8EB-BFC450BD6C45}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{F3CF4BFC-F128-4D95-8C29-037A76A728F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F3CF4BFC-F128-4D95-8C29-037A76A728F5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F3CF4BFC-F128-4D95-8C29-037A76A728F5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F3CF4BFC-F128-4D95-8C29-037A76A728F5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Application x:Class="X_Mouse_Controls.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Windows; | ||
|
||
namespace X_Mouse_Controls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Window x:Class="X_Mouse_Controls.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
Title="X-Mouse Controls" ResizeMode="NoResize" SizeToContent="WidthAndHeight" Loaded="Window_Loaded" Topmost="True" Margin="3" WindowStartupLocation="CenterScreen"> | ||
<StackPanel Name="stackPanel1" VerticalAlignment="Center" Margin="25" Width="200"> | ||
|
||
<CheckBox Height="16" Name="activeWindowTrackingCheckbox" Margin="3">Activate window tracking</CheckBox> | ||
<CheckBox Height="16" Name="activeWindowRaisingCheckbox" Margin="3">Activate window raising</CheckBox> | ||
<Slider Height="21" Name="activeWindowTrkTimeoutSlider" Margin="3" AutoToolTipPlacement="BottomRight" Maximum="5000" SmallChange="500" LargeChange="1000" TickPlacement="BottomRight" Padding="10" TickFrequency="500"/> | ||
<Button Height="23" Name="button1" Width="75" Click="button1_Click" Margin="3">Save</Button> | ||
|
||
<Expander Header="Information" Name="expander1" Margin="3"> | ||
<StackPanel Name="stackPanel2" VerticalAlignment="Center"> | ||
<TextBlock TextWrapping="WrapWithOverflow" Margin="3" Padding="3">A tool to enable or disable active window tracking, raising and also the delay in milliseconds. This is known as x-mouse behavior.</TextBlock> | ||
<TextBlock TextWrapping="WrapWithOverflow" Margin="3" Padding="3">Changes may not come in effect until logging off or rebooting.</TextBlock> | ||
<TextBlock TextWrapping="WrapWithOverflow" Margin="3" Padding="3">Coded a late night in December of 2007 by Joel Purra<LineBreak/><Hyperlink NavigateUri="http://deathrow1.se/" TargetName="_blank" RequestNavigate="Hyperlink_RequestNavigate">http://deathrow1.se/</Hyperlink></TextBlock> | ||
</StackPanel> | ||
</Expander> | ||
</StackPanel> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Navigation; | ||
using System.Windows.Documents; | ||
|
||
using System.Diagnostics; | ||
using SystemParametersInfo; | ||
|
||
namespace X_Mouse_Controls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void Window_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
// Defaults to be overwritten when reading system settings | ||
bool activateWindowTracking = false; | ||
bool activeWindowRaising = false; | ||
uint activeWindowTrkTimeout = 500; | ||
|
||
// Values are read by passing a constant value and a reference to a corresponding datatype | ||
try | ||
{ | ||
Helper.SystemParametersInfoGet((uint)SPI.SPI_GETACTIVEWINDOWTRACKING, 0, ref activateWindowTracking, 0); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Failed to read active window tracking value.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); | ||
} | ||
try | ||
{ | ||
Helper.SystemParametersInfoGet((uint)SPI.SPI_GETACTIVEWNDTRKZORDER, 0, ref activeWindowRaising, 0); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Failed to read active window raising value.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); | ||
} | ||
try | ||
{ | ||
Helper.SystemParametersInfoGet((uint)SPI.SPI_GETACTIVEWNDTRKTIMEOUT, 0, ref activeWindowTrkTimeout, 0); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Failed to read active window tracking timeout value.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); | ||
} | ||
|
||
// Updating the interface controls | ||
activeWindowTrackingCheckbox.IsChecked = activateWindowTracking; | ||
activeWindowRaisingCheckbox.IsChecked = activeWindowRaising; | ||
activeWindowTrkTimeoutSlider.Value = (double)activeWindowTrkTimeout; | ||
} | ||
|
||
private void button1_Click(object sender, RoutedEventArgs e) | ||
{ | ||
// Parsing the interface controls | ||
bool activateWindowTracking = (activeWindowTrackingCheckbox.IsChecked == true); | ||
bool activeWindowRaising = (activeWindowRaisingCheckbox.IsChecked == true); | ||
uint activeWindowTrkTimeout = (uint)activeWindowTrkTimeoutSlider.Value; | ||
|
||
// Saving values | ||
try | ||
{ | ||
Helper.SystemParametersInfoSet((uint)SPI.SPI_SETACTIVEWINDOWTRACKING, 0, activateWindowTracking, 1); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Failed to set active window tracking value.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); | ||
} | ||
try | ||
{ | ||
Helper.SystemParametersInfoSet((uint)SPI.SPI_SETACTIVEWNDTRKZORDER, 0, activeWindowRaising, 1); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Failed to set active window raising value.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); | ||
} | ||
try | ||
{ | ||
Helper.SystemParametersInfoSet((uint)SPI.SPI_SETACTIVEWNDTRKTIMEOUT, 0, activeWindowTrkTimeout, 1); | ||
} | ||
catch | ||
{ | ||
MessageBox.Show("Failed to set active window tracking timeout value.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); | ||
} | ||
} | ||
|
||
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) | ||
{ | ||
// Not looking very nice, but it's a workaround for standalone applications | ||
// http://laurenlavoie.com/avalon/159 | ||
Uri uri = ((Hyperlink)sender).NavigateUri; | ||
Process.Start(new ProcessStartInfo(uri.ToString())); | ||
e.Handled = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using System.Windows; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("X-Mouse Controls")] | ||
[assembly: AssemblyDescription("Controls for active window tracking and raising.")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Joel Purra")] | ||
[assembly: AssemblyProduct("X-Mouse Controls")] | ||
[assembly: AssemblyCopyright("Copyright © Joel Purra 2007")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
//In order to begin building localizable applications, set | ||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file | ||
//inside a <PropertyGroup>. For example, if you are using US english | ||
//in your source files, set the <UICulture> to en-US. Then uncomment | ||
//the NeutralResourceLanguage attribute below. Update the "en-US" in | ||
//the line below to match the UICulture setting in the project file. | ||
|
||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] | ||
|
||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] | ||
|
||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Oops, something went wrong.