void update_in_win_pos() { check_CS(); // dbg("update_in_win_pos %x %d\n", current_CS, current_CS->input_style); if (current_CS->input_style == InputStyleRoot) { Window r_root, r_child; int winx, winy, rootx, rooty; u_int mask; XQueryPointer(dpy, root, &r_root, &r_child, &rootx, &rooty, &winx, &winy, &mask); winx++; winy++; Window inpwin = current_CS->client_win; #if 0 dbg("update_in_win_pos\n"); #endif if (inpwin) { int tx, ty; Window ow; XTranslateCoordinates(dpy, root, inpwin, winx, winy, &tx, &ty, &ow); current_CS->spot_location.x = tx; current_CS->spot_location.y = ty; } move_in_win(current_CS, winx, winy); } else { move_IC_in_win(current_CS); } }
void move_IC_in_win(ClientState *cs) { #if 0 dbg("move_IC_in_win %d,%d\n", cs->spot_location.x, cs->spot_location.y); #endif Window inpwin = cs->client_win; #if UNIX if (!inpwin) { dbg("no inpwin\n"); return; } #endif // non focus win filtering is done in the client lib if (inpwin != focus_win && focus_win && !cs->b_hime_protocol) { return; } int inpx = cs->spot_location.x; int inpy = cs->spot_location.y; #if UNIX XWindowAttributes att; XGetWindowAttributes(dpy, inpwin, &att); // chrome window is override_redirect // if (att.override_redirect) // return; if (inpx >= att.width) inpx = att.width - 1; if (inpy >= att.height) inpy = att.height - 1; #else if (inpwin) { RECT rect; GetClientRect((HWND)inpwin, &rect); if (inpx >= rect.right) inpx = rect.right - 1; if (inpy >= rect.bottom) inpy = rect.bottom - 1; } // dbg("GetClientRect %x %d,%d\n", inpwin, inpx, inpy); #endif int tx,ty; getRootXY(inpwin, inpx, inpy, &tx, &ty); #if 0 dbg("move_IC_in_win inpxy:%d,%d txy:%d,%d\n", inpx, inpy, tx, ty); #endif move_in_win(cs, tx, ty+1); }