void xf_cliprdr_handle_xevent(xfContext* xfc, XEvent* event) { xfClipboard* clipboard; if (!xfc || !event) return; clipboard = xfc->clipboard; if (!clipboard) return; #ifdef WITH_XFIXES if (clipboard->xfixes_supported && event->type == XFixesSelectionNotify + clipboard->xfixes_event_base) { XFixesSelectionNotifyEvent* se = (XFixesSelectionNotifyEvent*) event; if (se->subtype == XFixesSetSelectionOwnerNotify) { if (se->selection != clipboard->clipboard_atom) return; if (XGetSelectionOwner(xfc->display, se->selection) == xfc->drawable) return; clipboard->owner = None; xf_cliprdr_check_owner(clipboard); } return; } #endif switch (event->type) { case SelectionNotify: xf_cliprdr_process_selection_notify(clipboard, event); break; case SelectionRequest: xf_cliprdr_process_selection_request(clipboard, event); break; case SelectionClear: xf_cliprdr_process_selection_clear(clipboard, event); break; case PropertyNotify: xf_cliprdr_process_property_notify(clipboard, event); break; case FocusIn: if (!clipboard->xfixes_supported) { xf_cliprdr_check_owner(clipboard); } break; } }
static BOOL xf_event_FocusIn(xfInfo* xfi, XEvent* event, BOOL app) { if (event->xfocus.mode == NotifyGrab) return TRUE; xfi->focused = TRUE; if (xfi->mouse_active && (!app)) XGrabKeyboard(xfi->display, xfi->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime); if (app) { xf_rail_send_activate(xfi, event->xany.window, TRUE); rdpWindow* window; rdpRail* rail = ((rdpContext*) xfi->context)->rail; window = window_list_get_by_extra_id(rail->list, (void*) event->xany.window); /* Update the server with any window changes that occured while the window was not focused. */ if (window != NULL) xf_rail_adjust_position(xfi, window); } xf_kbd_focus_in(xfi); if (!app) xf_cliprdr_check_owner(xfi); return TRUE; }
boolean xf_event_FocusIn(xfInfo* xfi, XEvent* event, boolean app) { if (event->xfocus.mode == NotifyGrab) return true; xfi->focused = true; if (xfi->mouse_active && (app != true)) XGrabKeyboard(xfi->display, xfi->window->handle, true, GrabModeAsync, GrabModeAsync, CurrentTime); if (app) xf_rail_send_activate(xfi, event->xany.window, true); xf_kbd_focus_in(xfi); if (app != true) xf_cliprdr_check_owner(xfi); return true; }