add new option to allow Eject key emulation of the Fn key
This allows Wired Keyboard users to press Eject + [function key] and have the same thing happen that what would happen when Fn + [function key] was pressed on a Wireless keyboard. Essentially making Eject the Fn key. However, when this option is enabled, you can no longer toggle FMode on/off using the Eject key (obviously).
This commit is contained in:
parent
9bf6a135ee
commit
bd64c54940
|
@ -93,13 +93,29 @@ private static void SpecialKeyStateChanged(IAsyncResult ar)
|
||||||
Debug.WriteLine(String.Format("{0}, {1}", asyncState[0], asyncState[1]));
|
Debug.WriteLine(String.Format("{0}, {1}", asyncState[0], asyncState[1]));
|
||||||
if (asyncState[0] == 0x0 && asyncState[1] == 0x8)
|
if (asyncState[0] == 0x0 && asyncState[1] == 0x8)
|
||||||
{
|
{
|
||||||
EjectDown = true;
|
if (AppleWirelessKeyboard.Properties.Settings.Default.WiredHoldEjectForFn)
|
||||||
KeyDown(AppleKeyboardSpecialKeys.Eject);
|
{
|
||||||
|
FnDown = true;
|
||||||
|
KeyDown(AppleKeyboardSpecialKeys.Fn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EjectDown = true;
|
||||||
|
KeyDown(AppleKeyboardSpecialKeys.Eject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (asyncState[0] == 0x0 && asyncState[1] == 0x0)
|
else if (asyncState[0] == 0x0 && asyncState[1] == 0x0)
|
||||||
{
|
{
|
||||||
EjectDown = false;
|
if (AppleWirelessKeyboard.Properties.Settings.Default.WiredHoldEjectForFn)
|
||||||
KeyUp(AppleKeyboardSpecialKeys.Eject);
|
{
|
||||||
|
FnDown = false;
|
||||||
|
KeyUp(AppleKeyboardSpecialKeys.Fn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EjectDown = false;
|
||||||
|
KeyUp(AppleKeyboardSpecialKeys.Eject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -19,7 +19,7 @@ public static bool FMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return AppleWirelessKeyboard.Properties.Settings.Default.FMode;
|
return AppleWirelessKeyboard.Properties.Settings.Default.FMode;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,12 @@ public static void HandleEject()
|
||||||
|
|
||||||
public static bool HandleKeyDown(KeyboardListener.KeyHookEventArgs e)
|
public static bool HandleKeyDown(KeyboardListener.KeyHookEventArgs e)
|
||||||
{
|
{
|
||||||
bool F = (FMode || e.ModifierFn) && !e.ModifierAnyNative;
|
bool F;
|
||||||
|
if (AppleWirelessKeyboard.Properties.Settings.Default.WiredKeyboard &&
|
||||||
|
AppleWirelessKeyboard.Properties.Settings.Default.WiredHoldEjectForFn)
|
||||||
|
F = e.ModifierFn && !e.ModifierAnyNative;
|
||||||
|
else
|
||||||
|
F = (FMode || e.ModifierFn) && !e.ModifierAnyNative;
|
||||||
|
|
||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.269
|
// Runtime Version:4.0.30319.296
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -94,5 +94,17 @@ internal sealed partial class Settings : global::System.Configuration.Applicatio
|
||||||
this["WiredKeyboard"] = value;
|
this["WiredKeyboard"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||||
|
public bool WiredHoldEjectForFn {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["WiredHoldEjectForFn"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["WiredHoldEjectForFn"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,5 +20,8 @@
|
||||||
<Setting Name="WiredKeyboard" Type="System.Boolean" Scope="User">
|
<Setting Name="WiredKeyboard" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">False</Value>
|
<Value Profile="(Default)">False</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="WiredHoldEjectForFn" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">False</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
|
@ -25,6 +25,9 @@
|
||||||
<setting name="WiredKeyboard" serializeAs="String">
|
<setting name="WiredKeyboard" serializeAs="String">
|
||||||
<value>False</value>
|
<value>False</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="WiredHoldEjectForFn" serializeAs="String">
|
||||||
|
<value>False</value>
|
||||||
|
</setting>
|
||||||
</AppleWirelessKeyboard.Properties.Settings>
|
</AppleWirelessKeyboard.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
|
||||||
|
|
Reference in a new issue