Skip to content

Commit 672d65b

Browse files
committed
HotKeys continuation.
1 parent cd0f9d9 commit 672d65b

File tree

7 files changed

+36
-27
lines changed

7 files changed

+36
-27
lines changed

SmartSystemMenu/HotKeys/HotKeyHook.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private int HookProc(int code, IntPtr wParam, ref KBDLLHOOKSTRUCT lParam)
5959
{
6060
if (code == NativeConstants.HC_ACTION)
6161
{
62-
if (wParam.ToInt32() == NativeConstants.WM_KEYDOWN)
62+
if (wParam.ToInt32() == NativeConstants.WM_KEYDOWN || wParam.ToInt32() == NativeConstants.WM_SYSKEYDOWN)
6363
{
6464
foreach (var item in _menuItems.Where(x => x.HotKeyEnabled))
6565
{
@@ -89,7 +89,6 @@ private int HookProc(int code, IntPtr wParam, ref KBDLLHOOKSTRUCT lParam)
8989
break;
9090
}
9191
}
92-
9392
}
9493
}
9594
}

SmartSystemMenu/HotKeys/VirtualKey.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ namespace SmartSystemMenu.HotKeys
44
{
55
public enum VirtualKey : int
66
{
7+
[Description("None")]
8+
None = 0x00,
9+
710
VK_LBUTTON = 0x01,
811
VK_RBUTTON = 0x02,
912
VK_CANCEL = 0x03,
@@ -183,34 +186,34 @@ public enum VirtualKey : int
183186
VK_RWIN = 0x5C,
184187
VK_APPS = 0x5D,
185188

186-
[Description("Numpad 0")]
189+
[Description("Num 0")]
187190
VK_NUMPAD0 = 0x60,
188191

189-
[Description("Numpad 1")]
192+
[Description("Num 1")]
190193
VK_NUMPAD1 = 0x61,
191194

192-
[Description("Numpad 2")]
195+
[Description("Num 2")]
193196
VK_NUMPAD2 = 0x62,
194197

195-
[Description("Numpad 3")]
198+
[Description("Num 3")]
196199
VK_NUMPAD3 = 0x63,
197200

198-
[Description("Numpad 4")]
201+
[Description("Num 4")]
199202
VK_NUMPAD4 = 0x64,
200203

201-
[Description("Numpad 5")]
204+
[Description("Num 5")]
202205
VK_NUMPAD5 = 0x65,
203206

204-
[Description("Numpad 6")]
207+
[Description("Num 6")]
205208
VK_NUMPAD6 = 0x66,
206209

207-
[Description("Numpad 7")]
210+
[Description("Num 7")]
208211
VK_NUMPAD7 = 0x67,
209212

210-
[Description("Numpad 8")]
213+
[Description("Num 8")]
211214
VK_NUMPAD8 = 0x68,
212215

213-
[Description("Numpad 9")]
216+
[Description("Num 9")]
214217
VK_NUMPAD9 = 0x69,
215218

216219
[Description("Multiply")]

SmartSystemMenu/HotKeys/VirtualKeyModifier.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace SmartSystemMenu.HotKeys
44
{
55
public enum VirtualKeyModifier : int
66
{
7-
[Description("")]
7+
[Description("None")]
88
None = 0x00,
99

1010
[Description("Shift")]
@@ -14,6 +14,12 @@ public enum VirtualKeyModifier : int
1414
Ctrl = 0x11,
1515

1616
[Description("Alt")]
17-
Alt = 0x12
17+
Alt = 0x12,
18+
19+
[Description("WinL")]
20+
WinL = 0x5B,
21+
22+
[Description("WinR")]
23+
WinR = 0x5C
1824
}
1925
}

SmartSystemMenu/Native/NativeConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static class NativeConstants
4949
public const int WM_CLOSE = 0x0010;
5050
public const int WM_NULL = 0x0000;
5151
public const int WM_KEYDOWN = 0x0100;
52+
public const int WM_SYSKEYDOWN = 0x0104;
5253

5354
// SetWindowPos
5455
public const uint SWP_NOSIZE = 0x0001;

SmartSystemMenu/Settings/SmartSystemMenuSettings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static SmartSystemMenuSettings Read(string fileName, string languageFileN
160160
HotKeyEnabled = x.Attribute("hotKeyEnabled") != null && !string.IsNullOrEmpty(x.Attribute("hotKeyEnabled").Value) ? x.Attribute("hotKeyEnabled").Value.ToLower() == "true" : false,
161161
Key1 = x.Attribute("key1") != null && !string.IsNullOrEmpty(x.Attribute("key1").Value) ? (VirtualKeyModifier)int.Parse(x.Attribute("key1").Value) : VirtualKeyModifier.None,
162162
Key2 = x.Attribute("key2") != null && !string.IsNullOrEmpty(x.Attribute("key2").Value) ? (VirtualKeyModifier)int.Parse(x.Attribute("key2").Value) : VirtualKeyModifier.None,
163-
Key3 = x.Attribute("key3") != null && !string.IsNullOrEmpty(x.Attribute("key3").Value) ? (VirtualKey)int.Parse(x.Attribute("key3").Value) : 0
163+
Key3 = x.Attribute("key3") != null && !string.IsNullOrEmpty(x.Attribute("key3").Value) ? (VirtualKey)int.Parse(x.Attribute("key3").Value) : VirtualKey.None
164164
})
165165
.ToList();
166166

@@ -225,9 +225,9 @@ public static void Save(string fileName, SmartSystemMenuSettings settings)
225225
new XElement("item", settings.MenuItems.Items.Select(x => new XElement("item",
226226
new XAttribute("name", x.Name),
227227
new XAttribute("hotKeyEnabled", x.HotKeyEnabled.ToString().ToLower()),
228-
new XAttribute("key1", ((int)x.Key1).ToString()),
229-
new XAttribute("key2", ((int)x.Key2).ToString()),
230-
new XAttribute("key3", ((int)x.Key3).ToString())))),
228+
new XAttribute("key1", x.Key1 == VirtualKeyModifier.None ? "" : ((int)x.Key1).ToString()),
229+
new XAttribute("key2", x.Key2 == VirtualKeyModifier.None ? "" : ((int)x.Key2).ToString()),
230+
new XAttribute("key3", x.Key3 == VirtualKey.None ? "" : ((int)x.Key3).ToString())))),
231231
new XElement("startProgramItem", settings.MenuItems.StartProgramItems.Select(x => new XElement("item",
232232
new XAttribute("title", x.Title),
233233
new XAttribute("fileName", x.FileName),

SmartSystemMenu/SmartSystemMenu.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
<item name="1680_1050" hotKeyEnabled="false" key1="" key2="" key3="" />
3434
<item name="size_default" hotKeyEnabled="false" key1="" key2="" key3="" />
3535
<item name="size_custom" hotKeyEnabled="false" key1="" key2="" key3="" />
36-
<item name="align_top_left" hotKeyEnabled="false" key1="" key2="" key3="" />
37-
<item name="align_top_center" hotKeyEnabled="false" key1="" key2="" key3="" />
38-
<item name="align_top_right" hotKeyEnabled="false" key1="" key2="" key3="" />
39-
<item name="align_middle_left" hotKeyEnabled="false" key1="" key2="" key3="" />
40-
<item name="align_middle_center" hotKeyEnabled="false" key1="" key2="" key3="" />
41-
<item name="align_middle_right" hotKeyEnabled="false" key1="" key2="" key3="" />
42-
<item name="align_bottom_left" hotKeyEnabled="false" key1="" key2="" key3="" />
43-
<item name="align_bottom_center" hotKeyEnabled="false" key1="" key2="" key3="" />
44-
<item name="align_bottom_right" hotKeyEnabled="false" key1="" key2="" key3="" />
36+
<item name="align_top_left" hotKeyEnabled="true" key1="18" key2="" key3="103" />
37+
<item name="align_top_center" hotKeyEnabled="true" key1="18" key2="" key3="104" />
38+
<item name="align_top_right" hotKeyEnabled="true" key1="18" key2="" key3="105" />
39+
<item name="align_middle_left" hotKeyEnabled="true" key1="18" key2="" key3="100" />
40+
<item name="align_middle_center" hotKeyEnabled="true" key1="18" key2="" key3="101" />
41+
<item name="align_middle_right" hotKeyEnabled="true" key1="18" key2="" key3="102" />
42+
<item name="align_bottom_left" hotKeyEnabled="true" key1="18" key2="" key3="97" />
43+
<item name="align_bottom_center" hotKeyEnabled="true" key1="18" key2="" key3="98" />
44+
<item name="align_bottom_right" hotKeyEnabled="true" key1="18" key2="" key3="99" />
4545
<item name="align_default" hotKeyEnabled="false" key1="" key2="" key3="" />
4646
<item name="align_custom" hotKeyEnabled="false" key1="" key2="" key3="" />
4747
<item name="trans_opaque" hotKeyEnabled="false" key1="" key2="" key3="" />
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)