-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from idietmoran/iss42
Iss42
- Loading branch information
Showing
16 changed files
with
128 additions
and
24 deletions.
There are no files selected for viewing
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
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
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
Binary file not shown.
Binary file not shown.
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,7 @@ | ||
#pragma once | ||
#include "common.h" | ||
|
||
void initHotkey(HWND hWnd, SETTINGS *settings); | ||
BOOL addHotkey(HWND hWnd, SETTINGS *settings, int msgID, int modifier, unsigned int key); | ||
BOOL removeHotkey(HWND hWnd, SETTINGS *settings, int index); | ||
void cleanupHotkeys(HWND hWnd, SETTINGS *settings); |
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,56 @@ | ||
#include "hotkey.h" | ||
|
||
void initHotkey(HWND hWnd, SETTINGS *settings) | ||
{ | ||
for (int i = 0; i < settings->numOfHotkeys; i++) | ||
{ | ||
RegisterHotKey(hWnd, settings->hotkeys[i].id, settings->hotkeys[i].modifiers, settings->hotkeys[i].key); | ||
} | ||
} | ||
|
||
|
||
BOOL addHotkey(HWND hWnd, SETTINGS *settings, int msgID, int modifier, unsigned int key) | ||
{ | ||
/* | ||
if (settings->numOfHotkeys > 1) | ||
return FALSE; | ||
*/ | ||
UnregisterHotKey(hWnd, msgID); | ||
BOOL result = RegisterHotKey(hWnd, msgID, modifier, key); | ||
|
||
// store in setting | ||
if (result) | ||
{ | ||
settings->hotkeys[0] = (HOTKEY) { msgID, modifier, key }; | ||
//settings->numOfHotkeys++; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
||
BOOL removeHotkey(HWND hWnd, SETTINGS *settings, int index) | ||
{ | ||
if (index > settings->numOfHotkeys) | ||
return FALSE; | ||
|
||
// unregister the hotkey | ||
BOOL result = UnregisterHotKey(hWnd, settings->hotkeys[index].id); | ||
|
||
// remove hotkeys from settings | ||
if (result) | ||
{ | ||
settings->hotkeys[index] = (HOTKEY) { 0 }; | ||
//settings->numOfHotkeys--; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
void cleanupHotkeys(HWND hWnd, SETTINGS *settings) | ||
{ | ||
for (int i = 0; i < settings->numOfHotkeys; i++) | ||
{ | ||
UnregisterHotKey(hWnd, settings->hotkeys[i].id); | ||
} | ||
} |
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
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
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
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