| 1161 | } |
| 1162 | |
| 1163 | void MSWindowsKeyState::fakeKey(const Keystroke &keystroke) |
| 1164 | { |
| 1165 | switch (keystroke.m_type) { |
| 1166 | case Keystroke::KeyType::Button: { |
| 1167 | LOG( |
| 1168 | (CLOG_DEBUG1 " %03x (%08x) %s", keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_client, |
| 1169 | keystroke.m_data.m_button.m_press ? "down" : "up") |
| 1170 | ); |
| 1171 | KeyButton scanCode = keystroke.m_data.m_button.m_button; |
| 1172 | |
| 1173 | // windows doesn't send key ups for key repeats |
| 1174 | if (keystroke.m_data.m_button.m_repeat && !keystroke.m_data.m_button.m_press) { |
| 1175 | LOG_DEBUG1(" discard key repeat release"); |
| 1176 | break; |
| 1177 | } |
| 1178 | |
| 1179 | // get the virtual key for the button |
| 1180 | WORD vk = (WORD)keystroke.m_data.m_button.m_client; |
| 1181 | DWORD flags = 0; |
| 1182 | |
| 1183 | if (keystroke.m_data.m_button.m_press == false) |
| 1184 | flags |= KEYEVENTF_KEYUP; |
| 1185 | |
| 1186 | // special handling of VK_SNAPSHOT |
| 1187 | if (vk == VK_SNAPSHOT) |
| 1188 | scanCode = (getActiveModifiers() & KeyModifierAlt) ? 0x54 : 0x137; |
| 1189 | |
| 1190 | if (scanCode & 0x100) |
| 1191 | flags |= KEYEVENTF_EXTENDEDKEY; |
| 1192 | |
| 1193 | // vk,sc,flags,keystroke.m_data.m_button.m_repeat |
| 1194 | |
| 1195 | m_desks->fakeKeyEvent(vk, scanCode, flags, keystroke.m_data.m_button.m_repeat); |
| 1196 | |
| 1197 | // synthesize event |
| 1198 | // m_desks->fakeKeyEvent(button, vk, |
| 1199 | // keystroke.m_data.m_button.m_press, |
| 1200 | // keystroke.m_data.m_button.m_repeat); |
| 1201 | break; |
| 1202 | } |
| 1203 | |
| 1204 | case Keystroke::KeyType::Group: |
| 1205 | // we don't restore the group. we'd like to but we can't be |
| 1206 | // sure the restoring group change will be processed after the |
| 1207 | // key events. |
| 1208 | if (!keystroke.m_data.m_group.m_restore) { |
| 1209 | if (keystroke.m_data.m_group.m_absolute) { |
| 1210 | LOG_DEBUG1(" group %d", keystroke.m_data.m_group.m_group); |
| 1211 | setWindowGroup(keystroke.m_data.m_group.m_group); |
| 1212 | } else { |
| 1213 | LOG_DEBUG1(" group %+d", keystroke.m_data.m_group.m_group); |
| 1214 | setWindowGroup(getEffectiveGroup(pollActiveGroup(), keystroke.m_data.m_group.m_group)); |
| 1215 | } |
| 1216 | } |
| 1217 | break; |
| 1218 | } |
| 1219 | } |
| 1220 |
nothing calls this directly
no test coverage detected