MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / backgroundKeyUp

Function backgroundKeyUp

cpp/webdriver-interactions/interactions.cpp:219–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void backgroundKeyUp(HWND hwnd, HKL layout, BYTE keyboardState[256],
220 WORD keyCode, UINT scanCode, bool extended, int pause)
221{
222 WORD origKeyCode = keyCode;
223 keyCode = LOBYTE(keyCode);
224 keyboardState[keyCode] &= ~0x80;
225
226 LPARAM lparam = generateKeyMessageParam(scanCode, extended);
227 lparam |= 0x3 << 30;
228 if (!PostMessage(hwnd, WM_KEYUP, keyCode, lparam)) {
229 LOG(WARN) << "Key up failed: " << GetLastError();
230 }
231
232 wait(pause);
233
234 sendModifierKeyUpIfNeeded(isShiftPressNeeded(origKeyCode) && (!shiftPressed), hwnd, layout,
235 VK_SHIFT, keyboardState, pause);
236 sendModifierKeyUpIfNeeded(isControlPressNeeded(origKeyCode) && (!controlPressed), hwnd, layout,
237 VK_CONTROL, keyboardState, pause);
238 sendModifierKeyUpIfNeeded(isAltPressNeeded(origKeyCode) && (!altPressed), hwnd, layout,
239 VK_MENU, keyboardState, pause);
240
241 // If Shift was held down, we should reset the keyboard state for it
242 // as well. See the comment in backgroundKeyDown on why it is set
243 // in the first place.
244 if ((shiftPressed) || (isShiftPressNeeded(origKeyCode))) {
245 keyboardState[VK_SHIFT] &= ~0x80;
246 }
247
248 SetKeyboardState(keyboardState);
249}
250
251
252void backgroundKeyPress(HWND hwnd, HKL layout, BYTE keyboardState[256],

Callers 1

backgroundKeyPressFunction · 0.85

Calls 7

generateKeyMessageParamFunction · 0.85
waitFunction · 0.85
isShiftPressNeededFunction · 0.85
isControlPressNeededFunction · 0.85
isAltPressNeededFunction · 0.85
LOGClass · 0.70

Tested by

no test coverage detected