/* * Return the ewin to focus after entering area or losing focused window. */ static EWin * FocusEwinSelect(void) { EWin *const *lst, *ewin; int num, i; switch (Conf.focus.mode) { default: case MODE_FOCUS_POINTER: ewin = GetEwinPointerInClient(); if (ewin && !FocusEwinValid(ewin, 1, 0, 0)) ewin = NULL; break; case MODE_FOCUS_SLOPPY: ewin = GetEwinPointerInClient(); if (ewin && FocusEwinValid(ewin, 1, 0, 0)) break; goto do_select; case MODE_FOCUS_CLICK: goto do_select; do_select: ewin = NULL; lst = EwinListFocusGet(&num); for (i = 0; i < num; i++) { if (!FocusEwinValid(lst[i], 1, 0, 0) || lst[i]->props.skip_focuslist) continue; ewin = lst[i]; break; } break; } return ewin; }
static int EdgeTimeout(void *data) { int val; int ax, ay, aw, ah, dx, dy, dax, day; EWin *ewin; if (MenusActive()) goto done; if (Conf.desks.edge_flip_mode == EDGE_FLIP_OFF) goto done; /* Quit if pointer has left screen */ if (!EQueryPointer(NULL, NULL, NULL, NULL, NULL)) goto done; /* Quit if in fullscreen window */ ewin = GetEwinPointerInClient(); if (ewin && ewin->state.fullscreen) goto done; DeskCurrentGetArea(&ax, &ay); DesksGetAreaSize(&aw, &ah); val = PTR2INT(data); dx = 0; dy = 0; dax = 0; day = 0; switch (val) { case 0: if (ax == 0 && !Conf.desks.areas_wraparound) goto done; dx = WinGetW(VROOT) - 2; dax = -1; break; case 1: if (ax == (aw - 1) && !Conf.desks.areas_wraparound) goto done; dx = -(WinGetW(VROOT) - 2); dax = 1; break; case 2: if (ay == 0 && !Conf.desks.areas_wraparound) goto done; dy = WinGetH(VROOT) - 2; day = -1; break; case 3: if (ay == (ah - 1) && !Conf.desks.areas_wraparound) goto done; dy = -(WinGetH(VROOT) - 2); day = 1; break; default: break; } if (aw == 1) dx = 0; if (ah == 1) dy = 0; Mode.events.px = Mode.events.mx; Mode.events.py = Mode.events.my; Mode.events.mx = Mode.events.cx += dx; Mode.events.my = Mode.events.cy += dy; EWarpPointer(VROOT, Mode.events.mx, Mode.events.my); DeskCurrentMoveAreaBy(dax, day); Mode.events.px = Mode.events.mx; Mode.events.py = Mode.events.my; done: edge_timer = NULL; return 0; }