| 1643 | } |
| 1644 | |
| 1645 | void XWindowsScreen::doSelectEvents(Window w) const |
| 1646 | { |
| 1647 | // we want to track the mouse everywhere on the display. to achieve |
| 1648 | // that we select PointerMotionMask on every window. we also select |
| 1649 | // SubstructureNotifyMask in order to get CreateNotify events so we |
| 1650 | // select events on new windows too. |
| 1651 | |
| 1652 | // we don't want to adjust our grab window |
| 1653 | if (w == m_window) { |
| 1654 | return; |
| 1655 | } |
| 1656 | |
| 1657 | // X11 has a design flaw. If *no* client selected PointerMotionMask for |
| 1658 | // a window, motion events will be delivered to that window's parent. |
| 1659 | // If *any* client, not necessarily the owner, selects PointerMotionMask |
| 1660 | // on such a window, X will stop propagating motion events to its |
| 1661 | // parent. This breaks applications that rely on event propagation |
| 1662 | // behavior. |
| 1663 | // |
| 1664 | // Avoid selecting PointerMotionMask unless some other client selected |
| 1665 | // it already. |
| 1666 | long mask = SubstructureNotifyMask; |
| 1667 | XWindowAttributes attr; |
| 1668 | XGetWindowAttributes(m_display, w, &attr); |
| 1669 | if ((attr.all_event_masks & PointerMotionMask) == PointerMotionMask) { |
| 1670 | mask |= PointerMotionMask; |
| 1671 | } |
| 1672 | |
| 1673 | // select events of interest. do this before querying the tree so |
| 1674 | // we'll get notifications of children created after the XQueryTree() |
| 1675 | // so we won't miss them. |
| 1676 | XSelectInput(m_display, w, mask); |
| 1677 | |
| 1678 | // recurse on child windows |
| 1679 | Window rw; |
| 1680 | Window pw; |
| 1681 | Window *cw; |
| 1682 | unsigned int nc; |
| 1683 | if (XQueryTree(m_display, w, &rw, &pw, &cw, &nc)) { |
| 1684 | for (unsigned int i = 0; i < nc; ++i) { |
| 1685 | doSelectEvents(cw[i]); |
| 1686 | } |
| 1687 | XFree(cw); |
| 1688 | } |
| 1689 | } |
| 1690 | |
| 1691 | KeyID XWindowsScreen::mapKeyFromX(XKeyEvent *event) const |
| 1692 | { |
nothing calls this directly
no outgoing calls
no test coverage detected