diff --git a/AppleWirelessKeyboard/AppleKeyboardHID2.cs b/AppleWirelessKeyboard/AppleKeyboardHID2.cs index 691f6dc..a6f4cb9 100644 --- a/AppleWirelessKeyboard/AppleKeyboardHID2.cs +++ b/AppleWirelessKeyboard/AppleKeyboardHID2.cs @@ -93,13 +93,29 @@ private static void SpecialKeyStateChanged(IAsyncResult ar) Debug.WriteLine(String.Format("{0}, {1}", asyncState[0], asyncState[1])); if (asyncState[0] == 0x0 && asyncState[1] == 0x8) { - EjectDown = true; - KeyDown(AppleKeyboardSpecialKeys.Eject); + if (AppleWirelessKeyboard.Properties.Settings.Default.WiredHoldEjectForFn) + { + FnDown = true; + KeyDown(AppleKeyboardSpecialKeys.Fn); + } + else + { + EjectDown = true; + KeyDown(AppleKeyboardSpecialKeys.Eject); + } } else if (asyncState[0] == 0x0 && asyncState[1] == 0x0) { - EjectDown = false; - KeyUp(AppleKeyboardSpecialKeys.Eject); + if (AppleWirelessKeyboard.Properties.Settings.Default.WiredHoldEjectForFn) + { + FnDown = false; + KeyUp(AppleKeyboardSpecialKeys.Fn); + } + else + { + EjectDown = false; + KeyUp(AppleKeyboardSpecialKeys.Eject); + } } } else diff --git a/AppleWirelessKeyboard/KeyboardHandler.cs b/AppleWirelessKeyboard/KeyboardHandler.cs index 23525b3..2f520ee 100644 --- a/AppleWirelessKeyboard/KeyboardHandler.cs +++ b/AppleWirelessKeyboard/KeyboardHandler.cs @@ -19,7 +19,7 @@ public static bool FMode { get { - return AppleWirelessKeyboard.Properties.Settings.Default.FMode; + return AppleWirelessKeyboard.Properties.Settings.Default.FMode; } set { @@ -44,7 +44,12 @@ public static void HandleEject() 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) { diff --git a/AppleWirelessKeyboard/Properties/Settings.Designer.cs b/AppleWirelessKeyboard/Properties/Settings.Designer.cs index ad6c8f9..be769a6 100644 --- a/AppleWirelessKeyboard/Properties/Settings.Designer.cs +++ b/AppleWirelessKeyboard/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // 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 // the code is regenerated. @@ -94,5 +94,17 @@ internal sealed partial class Settings : global::System.Configuration.Applicatio 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; + } + } } } diff --git a/AppleWirelessKeyboard/Properties/Settings.settings b/AppleWirelessKeyboard/Properties/Settings.settings index 947d87e..bfb1bd5 100644 --- a/AppleWirelessKeyboard/Properties/Settings.settings +++ b/AppleWirelessKeyboard/Properties/Settings.settings @@ -20,5 +20,8 @@ False + + False + \ No newline at end of file diff --git a/AppleWirelessKeyboard/app.config b/AppleWirelessKeyboard/app.config index edb9b1e..b3e5dd1 100644 --- a/AppleWirelessKeyboard/app.config +++ b/AppleWirelessKeyboard/app.config @@ -25,6 +25,9 @@ False + + False +