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

Method CreateEmptyKeyEvent

cpp/webdriver-interactions/interactions_linux.cpp:316–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314
315
316GdkEvent* KeypressEventsHandler::CreateEmptyKeyEvent(KeyEventType ev_type)
317{
318 GdkEventType gdk_ev = GDK_KEY_PRESS;
319 if (ev_type == kKeyRelease) {
320 gdk_ev = GDK_KEY_RELEASE;
321 }
322 GdkEvent* p_ev = gdk_event_new(gdk_ev);
323 p_ev->key.window = GDK_WINDOW(g_object_ref(win_handle_));
324 p_ev->key.send_event = 0; // NOT a synthesized event.
325 p_ev->key.time = TimeSinceBootMsec();
326 // Also update the latest event time
327 last_event_time_ = p_ev->key.time;
328 // Deprecated.
329 p_ev->key.length = 0;
330 p_ev->key.string = NULL;
331 // Put a default key code for space. This will be fixed later
332 // by callers, that will translate the given character to
333 // its appropriate keycode.
334 const guint16 kSpaceKeycode = 65;
335 p_ev->key.hardware_keycode = kSpaceKeycode;
336 // This flag will be set to true later, if we indeed create
337 // a modifier key event.
338 SetIsModifierEvent(p_ev, false);
339
340 // This applies to regular characters, keys and modifiers.
341 // This must be done before the special handling for modifier
342 // keys, as it will change the internal state of the modifiers.
343 AddModifiersToMask(p_ev->key.state);
344
345 return p_ev;
346}
347
348static guint16 get_keycode_for_key(guint for_key)
349{

Callers

nothing calls this directly

Calls 2

TimeSinceBootMsecFunction · 0.85
SetIsModifierEventFunction · 0.85

Tested by

no test coverage detected