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

Function XNextEvent

cpp/linux-specific/x_ignore_nofocus.c:669–743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

667}
668
669int XNextEvent(Display *display, XEvent *outEvent) {
670 // Code to pull the real function handle from X11 library.
671 void *handle = NULL;
672
673 //This will turn the function proto into a function pointer declaration
674 int (*real_func)(Display *display, XEvent *outEvent) = NULL;
675 handle = get_xlib_handle();
676
677 if (handle == NULL) {
678 return -1;
679 }
680
681 // The real event from XNextEvent
682 XEvent realEvent;
683
684 // Find the real function.
685 real_func = dlsym(handle, "XNextEvent");
686 // Invoke the real function.
687 int rf_ret = real_func(display, &realEvent);
688
689 OPEN_LOGGING_FILE;
690
691 initFocusStatusAndXQueryTree();
692
693 // This display object will be used to inquire X server
694 // about inferior and parent windows.
695 Display* dpy = display;
696 //assert(dpy != NULL);
697
698 print_event_to_log(dpy, &realEvent);
699
700 // Is the event on a window other than the active one?
701 // If so, update gActiveWindow on two cases:
702 // 1. It's the first window known to the module.
703 // 2. It's the second window known to the module. The second
704 // window is the actual browser window (the first one is just a
705 // set-up one).
706 //
707 if ((get_active_window(&g_focus_status) == 0) && (is_focus_in(&realEvent))) {
708 set_active_window(&g_focus_status, &realEvent);
709 } else {
710 identify_switch_situation(&g_focus_status);
711 }
712
713 if (is_reparent_notify(&realEvent)) {
714 identify_new_window_situation(&g_focus_status, &realEvent);
715 }
716
717 if (is_destroy_notify(&realEvent)) {
718 identify_active_destroyed(&g_focus_status, &realEvent);
719 }
720
721 if ((g_focus_status.during_switch == TRUE) ||
722 (get_active_window(&g_focus_status) == 0)) {
723 LOG("During switch: %d Active win: %#lx during close: %d\n",
724 g_focus_status.during_switch, get_active_window(&g_focus_status),
725 g_focus_status.during_close);
726 *outEvent = realEvent;

Callers

nothing calls this directly

Calls 15

get_xlib_handleFunction · 0.85
print_event_to_logFunction · 0.85
get_active_windowFunction · 0.85
is_focus_inFunction · 0.85
set_active_windowFunction · 0.85
is_reparent_notifyFunction · 0.85
is_destroy_notifyFunction · 0.85

Tested by

no test coverage detected