diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-28 11:21:32 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-28 11:21:32 +0000 |
commit | 30bd869d78ea7d67904e6fa46c205e3a8697c6fc (patch) | |
tree | 361f46f51f495f4b27a1122f1018bb0ff2e8f2f5 | |
parent | d4c7112ac94d71397957c2bab796167cc91532fd (diff) |
fix for keyboard idle state interruption
git-svn-id: http://svn.miranda-ng.org/main/trunk@6256 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/BossKeyPlus/src/BossKeyIdle.cpp | 6 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/main.cpp | 8 | ||||
-rw-r--r-- | plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp | 7 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 4 | ||||
-rw-r--r-- | src/core/stdidle/idle.cpp | 22 | ||||
-rw-r--r-- | src/modules/skin/hotkeys.cpp | 9 |
6 files changed, 18 insertions, 38 deletions
diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index 806f3820e1..65e090de21 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -37,10 +37,8 @@ static bool IsUserIdle() return GetTickCount() - dwTick > (minutes * 60 * 1000);
}
- LASTINPUTINFO ii;
- ZeroMemory(&ii,sizeof(ii));
- ii.cbSize=sizeof(ii);
- if (GetLastInputInfo(&ii))
+ LASTINPUTINFO ii = { sizeof(ii) };
+ if ( GetLastInputInfo(&ii))
return GetTickCount() - ii.dwTime > (minutes * 60 * 1000);
return FALSE;
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index bf5a170972..f6c4385ede 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -320,11 +320,9 @@ static void FlashThreadFunction() break;
if (bFlashUntil & UNTIL_REATTENDED) {
if (bMirandaOrWindows == ACTIVE_WINDOWS && !bEmulateKeypresses) {
- LASTINPUTINFO lii;
- ZeroMemory(&lii, sizeof(lii));
- lii.cbSize = sizeof(lii);
- GetLastInputInfo(&lii);
- dwLastInput = lii.dwTime;
+ LASTINPUTINFO ii = { sizeof(ii) };
+ GetLastInputInfo(&ii);
+ dwLastInput = ii.dwTime;
}
if (dwLastInput > dwEventStarted)
break;
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index 5a3a801732..a28c94f75f 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -269,10 +269,9 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD if ( aas.optionFlags & FLAG_MONITORMIRANDA )
mouseStationaryTimer = (GetTickCount() - lastMirandaInput)/1000;
else {
- LASTINPUTINFO lii = { 0 };
- lii.cbSize = sizeof(lii);
- GetLastInputInfo(&lii);
- mouseStationaryTimer = (GetTickCount()-lii.dwTime)/1000;
+ LASTINPUTINFO ii = { sizeof(ii) };
+ GetLastInputInfo(&ii);
+ mouseStationaryTimer = (GetTickCount() - ii.dwTime)/1000;
}
int sts1Time = aas.awayTime * SECS_PER_MINUTE;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 8def3fb880..0ff7df9324 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -73,8 +73,8 @@ void CGlobals::reloadSystemStartup() m_WinVerMajor = WinVerMajor();
m_WinVerMinor = WinVerMinor();
- m_bIsVista = IsWinVerVistaPlus();
- m_bIsWin7 = IsWinVer7Plus();
+ m_bIsVista = IsWinVerVistaPlus() != 0;
+ m_bIsWin7 = IsWinVer7Plus() != 0;
::RegisterTabCtrlClass();
CTip::registerClass();
diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp index 15981a872d..3991217fd8 100644 --- a/src/core/stdidle/idle.cpp +++ b/src/core/stdidle/idle.cpp @@ -140,7 +140,6 @@ static const WORD aa_Status[] = {ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIE static IdleObject gIdleObject;
static HANDLE hIdleEvent;
-static BOOL (WINAPI * MyGetLastInputInfo)(PLASTINPUTINFO);
void CALLBACK IdleTimer(HWND hwnd, UINT umsg, UINT_PTR idEvent, DWORD dwTime);
@@ -186,25 +185,10 @@ static int IdleObject_IsUserIdle(IdleObject * obj) return GetTickCount() - dwTick > (obj->minutes * 60 * 1000);
}
- if (MyGetLastInputInfo != NULL) {
- LASTINPUTINFO ii;
- ZeroMemory(&ii, sizeof(ii));
- ii.cbSize = sizeof(ii);
- if (MyGetLastInputInfo(&ii))
- return GetTickCount() - ii.dwTime > (obj->minutes * 60 * 1000);
- }
- else {
- POINT pt;
- GetCursorPos(&pt);
- if (pt.x != obj->mousepos.x || pt.y != obj->mousepos.y) {
- obj->mousepos = pt;
- obj->mouseidle = 0;
- }
- else obj->mouseidle += 2;
+ LASTINPUTINFO ii = { sizeof(ii) };
+ if ( GetLastInputInfo(&ii))
+ return GetTickCount() - ii.dwTime > (obj->minutes * 60 * 1000);
- if (obj->mouseidle)
- return obj->mouseidle * 1000 >= (obj->minutes * 60 * 1000);
- }
return FALSE;
}
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp index fec07d812a..fc8ca86828 100644 --- a/src/modules/skin/hotkeys.cpp +++ b/src/modules/skin/hotkeys.cpp @@ -99,12 +99,13 @@ static LRESULT CALLBACK sttKeyboardProc(int code, WPARAM wParam, LPARAM lParam) for (int i=0; i < hotkeys.getCount(); i++) {
THotkeyItem *item = hotkeys[i];
+ if (item->type != HKT_LOCAL || !item->Enabled)
+ continue;
+
BYTE hkMod, hkVk;
- if (item->type != HKT_LOCAL) continue;
sttWordToModAndVk(item->Hotkey, &hkMod, &hkVk);
- if ( !hkVk) continue;
- if ( !item->Enabled) continue;
- if (item->pszService && (vk == hkVk) && (mod == hkMod)) {
+ if (!hkVk) continue;
+ if (item->pszService && vk == hkVk && mod == hkMod) {
CallService(item->pszService, 0, item->lParam);
return TRUE;
} } } }
|