int GrabPointerSet(Win win, unsigned int csr, int confine __UNUSED__) { int rc; #if USE_XI2 EXIEventMask em; EXIMaskSetup(&em, DEV_PTR, ButtonPressMask | ButtonReleaseMask | PointerMotionMask); rc = XIGrabDevice(disp, DEV_PTR, WinGetXwin(win), CurrentTime, ECsrGet(csr), GrabModeAsync, GrabModeAsync, False, &em.em); #else EX_Window confine_to = (confine) ? WinGetXwin(VROOT) : NoXID; rc = XGrabPointer(disp, WinGetXwin(win), False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask, GrabModeAsync, GrabModeAsync, confine_to, ECsrGet(csr), CurrentTime); #endif Mode.grabs.pointer_grab_window = WinGetXwin(win); Mode.grabs.pointer_grab_active = 1; if (EDebug(EDBUG_TYPE_GRABS)) Eprintf("%s: %#x, rc=%d\n", __func__, Mode.grabs.pointer_grab_window, rc); return rc; }
void GrabButtonSet(unsigned int button, unsigned int modifiers, Win win, unsigned int event_mask, unsigned int csr, int confine) { Bool owner_events = False; int pointer_mode = GrabModeSync; int keyboard_mode = GrabModeAsync; Window confine_to = (confine) ? WinGetXwin(win) : None; int i; if (modifiers == AnyModifier) { XGrabButton(disp, button, modifiers, WinGetXwin(win), owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, ECsrGet(csr)); return; } for (i = 0; i < 8; i++) { if (i && !Mode.masks.mod_combos[i]) continue; XGrabButton(disp, button, modifiers | Mode.masks.mod_combos[i], WinGetXwin(win), owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, ECsrGet(csr)); } }
void GrabButtonSet(unsigned int button, unsigned int modifiers, Win win, unsigned int event_mask, unsigned int csr, int confine __UNUSED__) { Bool owner_events = False; int pointer_mode = GrabModeSync; int keyboard_mode = GrabModeAsync; int i; #if USE_XI2 EXIEventMask em; XIGrabModifiers modifiers_inouts[8]; int num_modifiers; EXIMaskSetup(&em, DEV_PTR, event_mask); if (modifiers == AnyModifier) { num_modifiers = 1; modifiers_inouts[0].modifiers = XIAnyModifier; modifiers_inouts[0].status = 0; } else { num_modifiers = 0; for (i = 0; i < 8; i++) { if (i && !Mode.masks.mod_combos[i]) continue; modifiers_inouts[num_modifiers].modifiers = modifiers | Mode.masks.mod_combos[i]; modifiers_inouts[num_modifiers].status = 0; num_modifiers++; } } XIGrabButton(disp, DEV_PTR, button, WinGetXwin(win), ECsrGet(csr), pointer_mode, keyboard_mode, owner_events, &em.em, num_modifiers, modifiers_inouts); #else EX_Window confine_to = (confine) ? WinGetXwin(win) : NoXID; if (modifiers == AnyModifier) { XGrabButton(disp, button, modifiers, WinGetXwin(win), owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, ECsrGet(csr)); return; } for (i = 0; i < 8; i++) { if (i && !Mode.masks.mod_combos[i]) continue; XGrabButton(disp, button, modifiers | Mode.masks.mod_combos[i], WinGetXwin(win), owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, ECsrGet(csr)); } #endif }
int GrabPointerSet(Win win, unsigned int csr, int confine) { int ret; Window confine_to = (confine) ? WinGetXwin(VROOT) : None; ret = XGrabPointer(disp, WinGetXwin(win), False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask, GrabModeAsync, GrabModeAsync, confine_to, ECsrGet(csr), CurrentTime); Mode.grabs.pointer_grab_window = WinGetXwin(win); Mode.grabs.pointer_grab_active = 1; if (EDebug(EDBUG_TYPE_GRABS)) Eprintf("GrabPointerSet: %#lx, ret=%d\n", Mode.grabs.pointer_grab_window, ret); return ret; }
void ECsrApply(int which, EX_Window win) { XDefineCursor(disp, win, ECsrGet(which)); }