OSDN Git Service

Modify or remove some declarations of constants in xkeymacsdll.h.
[xkeymacs/xkeymacs.git] / xkeymacsdll / xkeymacsdll.cpp
index 2a4c67d..1b74239 100644 (file)
@@ -612,8 +612,8 @@ int CXkeymacsDll::GetAppID(const LPCSTR szName, const int fallback)
 LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)\r
 {\r
        const BYTE nOrigKey = static_cast<BYTE>(wParam);\r
-       const bool bRelease = (lParam & BEING_RELEASED) != 0;\r
-       const bool bExtended = (lParam & EXTENDED_KEY) != 0;\r
+       const bool bRelease = (HIWORD(lParam) & KF_UP) != 0;\r
+       const bool bExtended = (HIWORD(lParam) & KF_EXTENDED) != 0;\r
 \r
        static BOOL bLocked = FALSE;\r
        static const BYTE RECURSIVE_KEY = 0x07;\r
@@ -628,7 +628,7 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                return CallNextHookEx(NULL, nCode, wParam, lParam);\r
 \r
 //     CUtils::Log(_T("nKey = %#x, ext = %d, rel = %d, pre = %d, %#hx, %#hx"), nOrigKey,\r
-//             (lParam & EXTENDED_KEY) ? 1 : 0, (lParam & BEING_RELEASED) ? 1 : 0, (lParam & REPEATED_KEY) ? 1 : 0,\r
+//             (HIWORD(lParam) & KF_EXTENDED) ? 1 : 0, (HIWORD(lParam) & KF_UP) ? 1 : 0, (HIWORD(lParam) & KF_REPEAT) ? 1 : 0,\r
 //             GetKeyState(nOrigKey), GetAsyncKeyState(nOrigKey));\r
 \r
        if (nOrigKey == RECURSIVE_KEY) {\r
@@ -926,14 +926,13 @@ HOOK_RECURSIVE_KEY:
 \r
 void CXkeymacsDll::SetModifierIcons()\r
 {\r
-#define IconState(x) ((x) ? ON_ICON : OFF_ICON)\r
        ICONMSG msg[6] = {\r
-               {MX_ICON, IconState(CCommands::bM_x()), ""},\r
-               {CX_ICON, IconState(CCommands::bC_x()), ""},\r
-               {META_ICON, IconState(CCommands::bM_()), ""},\r
-               {SHIFT_ICON, IconState(IsDown(VK_SHIFT, FALSE)), ""},\r
-               {CTRL_ICON, IconState(IsControl()), ""},\r
-               {ALT_ICON, IconState(IsDown(VK_MENU, FALSE)), ""}\r
+               {MX_ICON, CCommands::bM_x(), ""},\r
+               {CX_ICON, CCommands::bC_x(), ""},\r
+               {META_ICON, CCommands::bM_(), ""},\r
+               {SHIFT_ICON, IsDown(VK_SHIFT, FALSE), ""},\r
+               {CTRL_ICON, IsControl(), ""},\r
+               {ALT_ICON, IsDown(VK_MENU, FALSE), ""}\r
        };\r
        _tcscpy_s(msg[0].szTip, m_M_xTip);\r
        SendIconMessage(msg, 6);\r
@@ -1131,7 +1130,7 @@ void CXkeymacsDll::EndRecordMacro()
        m_bRecordingMacro = FALSE;\r
        while (!m_Macro.empty()) { // remove not released push\r
                const KbdMacro& m = m_Macro.back();\r
-               if (m.lParam & BEING_RELEASED)\r
+               if (HIWORD(m.lParam) & KF_UP)\r
                        break;\r
                m_Macro.pop_back();\r
        }\r
@@ -1144,7 +1143,7 @@ void CXkeymacsDll::CallMacro()
        UINT before = GetModifierState(FALSE);\r
        SetModifierState(0, before);\r
        for (std::list<KbdMacro>::const_iterator m = m_Macro.begin(); m != m_Macro.end(); ++m)\r
-               if (m->lParam & BEING_RELEASED)\r
+               if (HIWORD(m->lParam) & KF_UP)\r
                        ReleaseKey(static_cast<BYTE>(m->wParam));\r
                else\r
                        DepressKey(static_cast<BYTE>(m->wParam), m->bOriginal);\r