Changeset View
Changeset View
Standalone View
Standalone View
events.cpp
Show First 20 Lines • Show All 768 Lines • ▼ Show 20 Line(s) | |||||
769 | void X11Client::enterNotifyEvent(xcb_enter_notify_event_t *e) | 769 | void X11Client::enterNotifyEvent(xcb_enter_notify_event_t *e) | ||
770 | { | 770 | { | ||
771 | if (e->event != frameId()) | 771 | if (e->event != frameId()) | ||
772 | return; // care only about entering the whole frame | 772 | return; // care only about entering the whole frame | ||
773 | 773 | | |||
774 | #define MOUSE_DRIVEN_FOCUS (!options->focusPolicyIsReasonable() || \ | 774 | #define MOUSE_DRIVEN_FOCUS (!options->focusPolicyIsReasonable() || \ | ||
775 | (options->focusPolicy() == Options::FocusFollowsMouse && options->isNextFocusPrefersMouse())) | 775 | (options->focusPolicy() == Options::FocusFollowsMouse && options->isNextFocusPrefersMouse())) | ||
776 | if (e->mode == XCB_NOTIFY_MODE_NORMAL || (e->mode == XCB_NOTIFY_MODE_UNGRAB && MOUSE_DRIVEN_FOCUS)) { | 776 | if (e->mode == XCB_NOTIFY_MODE_NORMAL || (e->mode == XCB_NOTIFY_MODE_UNGRAB && MOUSE_DRIVEN_FOCUS)) { | ||
777 | | ||||
778 | if (options->isShadeHover()) { | | |||
779 | cancelShadeHoverTimer(); | | |||
780 | if (isShade()) { | | |||
781 | shadeHoverTimer = new QTimer(this); | | |||
782 | connect(shadeHoverTimer, SIGNAL(timeout()), this, SLOT(shadeHover())); | | |||
783 | shadeHoverTimer->setSingleShot(true); | | |||
784 | shadeHoverTimer->start(options->shadeHoverInterval()); | | |||
785 | } | | |||
786 | } | | |||
787 | #undef MOUSE_DRIVEN_FOCUS | 777 | #undef MOUSE_DRIVEN_FOCUS | ||
788 | 778 | | |||
789 | enterEvent(QPoint(e->root_x, e->root_y)); | 779 | enterEvent(QPoint(e->root_x, e->root_y)); | ||
790 | return; | 780 | return; | ||
791 | } | 781 | } | ||
792 | } | 782 | } | ||
793 | 783 | | |||
794 | void X11Client::leaveNotifyEvent(xcb_leave_notify_event_t *e) | 784 | void X11Client::leaveNotifyEvent(xcb_leave_notify_event_t *e) | ||
Show All 17 Lines | 801 | if (!lostMouse && e->detail != XCB_NOTIFY_DETAIL_INFERIOR) { | |||
812 | Xcb::Pointer pointer(frameId()); | 802 | Xcb::Pointer pointer(frameId()); | ||
813 | if (!pointer || !pointer->same_screen || pointer->child == XCB_WINDOW_NONE) { | 803 | if (!pointer || !pointer->same_screen || pointer->child == XCB_WINDOW_NONE) { | ||
814 | // really lost the mouse | 804 | // really lost the mouse | ||
815 | lostMouse = true; | 805 | lostMouse = true; | ||
816 | } | 806 | } | ||
817 | } | 807 | } | ||
818 | if (lostMouse) { | 808 | if (lostMouse) { | ||
819 | leaveEvent(); | 809 | leaveEvent(); | ||
820 | cancelShadeHoverTimer(); | | |||
821 | if (shade_mode == ShadeHover && !isMoveResize() && !isMoveResizePointerButtonDown()) { | | |||
822 | shadeHoverTimer = new QTimer(this); | | |||
823 | connect(shadeHoverTimer, SIGNAL(timeout()), this, SLOT(shadeUnhover())); | | |||
824 | shadeHoverTimer->setSingleShot(true); | | |||
825 | shadeHoverTimer->start(options->shadeHoverInterval()); | | |||
826 | } | | |||
827 | if (isDecorated()) { | 810 | if (isDecorated()) { | ||
828 | // sending a move instead of a leave. With leave we need to send proper coords, with move it's handled internally | 811 | // sending a move instead of a leave. With leave we need to send proper coords, with move it's handled internally | ||
829 | QHoverEvent leaveEvent(QEvent::HoverMove, QPointF(-1, -1), QPointF(-1, -1), Qt::NoModifier); | 812 | QHoverEvent leaveEvent(QEvent::HoverMove, QPointF(-1, -1), QPointF(-1, -1), Qt::NoModifier); | ||
830 | QCoreApplication::sendEvent(decoration(), &leaveEvent); | 813 | QCoreApplication::sendEvent(decoration(), &leaveEvent); | ||
831 | } | 814 | } | ||
832 | } | 815 | } | ||
833 | if (options->focusPolicy() == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) { | 816 | if (options->focusPolicy() == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) { | ||
834 | workspace()->requestDelayFocus(nullptr); | 817 | workspace()->requestDelayFocus(nullptr); | ||
▲ Show 20 Lines • Show All 522 Lines • Show Last 20 Lines |