summaryrefslogtreecommitdiff
path: root/plugins/KeyboardNotify
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/KeyboardNotify')
-rw-r--r--plugins/KeyboardNotify/src/flash.cpp11
-rw-r--r--plugins/KeyboardNotify/src/main.cpp11
2 files changed, 9 insertions, 13 deletions
diff --git a/plugins/KeyboardNotify/src/flash.cpp b/plugins/KeyboardNotify/src/flash.cpp
index bac58a276a..22a86b2d63 100644
--- a/plugins/KeyboardNotify/src/flash.cpp
+++ b/plugins/KeyboardNotify/src/flash.cpp
@@ -31,7 +31,7 @@ FLASHING_SEQUENCE *getCustomSeq(void);
FLASHING_SEQUENCE *getPredefinedSeq(void);
FLASHING_SEQUENCE *getTrillianSeq(void);
void updateTrillianSeq(void);
-static void TestThread(FLASHING_SEQUENCE *);
+static void __cdecl TestThread(void *param);
static void PreviewThread(void *);
FLASHING_SEQUENCE str2FS(TCHAR *);
BYTE KbdChar2Byte(char);
@@ -310,13 +310,13 @@ void testSequence(TCHAR *testStr)
static FLASHING_SEQUENCE Test = {0};
Test = str2FS(testStr);
- DWORD threadID = 0;
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TestThread, &Test, 0, &threadID);
+ mir_forkthread(TestThread, (void*)&Test);
}
-static void TestThread(FLASHING_SEQUENCE *pTest)
+static void __cdecl TestThread(void *param)
{
+ FLASHING_SEQUENCE *pTest = (FLASHING_SEQUENCE *)param;
unsigned int testNum = (unsigned int)db_get_b(NULL, KEYBDMODULE, "testnum", DEF_SETTING_TESTNUM);
unsigned int testSecs = (unsigned int)db_get_b(NULL, KEYBDMODULE, "testsecs", DEF_SETTING_TESTSECS);
@@ -339,8 +339,7 @@ void previewFlashing(BOOL buttonState)
return;
bPreviewSemaphore = TRUE;
- DWORD threadID = 0;
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)PreviewThread, NULL, 0, &threadID);
+ mir_forkthread(PreviewThread, 0);
}
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index ae7e48fd98..1db3b1f8e8 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -264,7 +264,7 @@ BOOL checkUnopenEvents()
return FALSE;
}
-static void FlashThreadFunction()
+static void __cdecl FlashThreadFunction(void *)
{
BOOL bEvent = FALSE;
DWORD dwEventStarted, dwFlashStarted;
@@ -503,20 +503,17 @@ INT_PTR NormalizeSequenceService(WPARAM wParam, LPARAM lParam)
// Support for Trigger plugin
-static DWORD WINAPI ForceEventsWereOpenedThread(void *eventMaxSeconds)
+static void __cdecl ForceEventsWereOpenedThread(void *eventMaxSeconds)
{
Sleep(((WORD)eventMaxSeconds) * 1000);
CallService(MS_KBDNOTIFY_EVENTSOPENED, 1, 0);
- return 0;
}
void StartBlinkAction(char *flashSequence, WORD eventMaxSeconds)
{
- DWORD threadID = 0;
-
if (eventMaxSeconds)
- CreateThread(NULL, 0, ForceEventsWereOpenedThread, (void *)eventMaxSeconds, 0, &threadID);
+ mir_forkthread(ForceEventsWereOpenedThread, (void *)eventMaxSeconds);
CallService(MS_KBDNOTIFY_STARTBLINK, 1, (LPARAM)flashSequence);
}
@@ -729,7 +726,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
mir_sntprintf(eventName, SIZEOF(eventName), _T("%s/ExitEvent"), eventPrefix);
hExitEvent = CreateEvent(NULL, FALSE, FALSE, eventName);
- hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)FlashThreadFunction, NULL, 0, &IDThread);
+ hThread = mir_forkthread(FlashThreadFunction, 0);
HookEvent(ME_MC_ENABLED, OnMetaChanged);
HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);