Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.cpp
Show First 20 Lines • Show All 449 Lines • ▼ Show 20 Line(s) | 449 | { | |||
---|---|---|---|---|---|
450 | for (auto state : m_buttons) { | 450 | for (auto state : m_buttons) { | ||
451 | if (state == InputRedirection::PointerButtonPressed) { | 451 | if (state == InputRedirection::PointerButtonPressed) { | ||
452 | return true; | 452 | return true; | ||
453 | } | 453 | } | ||
454 | } | 454 | } | ||
455 | return false; | 455 | return false; | ||
456 | } | 456 | } | ||
457 | 457 | | |||
458 | static bool s_cursorUpdateBlocking = false; | ||||
459 | | ||||
458 | void PointerInputRedirection::update() | 460 | void PointerInputRedirection::update() | ||
459 | { | 461 | { | ||
460 | if (!m_inited) { | 462 | if (!m_inited) { | ||
461 | return; | 463 | return; | ||
462 | } | 464 | } | ||
463 | if (waylandServer()->seat()->isDragPointer()) { | 465 | if (waylandServer()->seat()->isDragPointer()) { | ||
464 | // ignore during drag and drop | 466 | // ignore during drag and drop | ||
465 | return; | 467 | return; | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 513 | if (m_decoration.isNull() || m_decoration->client() != c) { | |||
512 | c->enterEvent(m_pos.toPoint()); | 514 | c->enterEvent(m_pos.toPoint()); | ||
513 | workspace()->updateFocusMousePosition(m_pos.toPoint()); | 515 | workspace()->updateFocusMousePosition(m_pos.toPoint()); | ||
514 | } | 516 | } | ||
515 | } | 517 | } | ||
516 | if (t && t->surface()) { | 518 | if (t && t->surface()) { | ||
517 | m_window = QPointer<Toplevel>(t); | 519 | m_window = QPointer<Toplevel>(t); | ||
518 | // TODO: add convenient API to update global pos together with updating focused surface | 520 | // TODO: add convenient API to update global pos together with updating focused surface | ||
519 | warpXcbOnSurfaceLeft(t->surface()); | 521 | warpXcbOnSurfaceLeft(t->surface()); | ||
522 | s_cursorUpdateBlocking = true; | ||||
520 | seat->setFocusedPointerSurface(nullptr); | 523 | seat->setFocusedPointerSurface(nullptr); | ||
524 | s_cursorUpdateBlocking = false; | ||||
521 | seat->setPointerPos(m_pos.toPoint()); | 525 | seat->setPointerPos(m_pos.toPoint()); | ||
522 | seat->setFocusedPointerSurface(t->surface(), t->inputTransformation()); | 526 | seat->setFocusedPointerSurface(t->surface(), t->inputTransformation()); | ||
523 | m_windowGeometryConnection = connect(t, &Toplevel::geometryChanged, this, | 527 | m_windowGeometryConnection = connect(t, &Toplevel::geometryChanged, this, | ||
524 | [this] { | 528 | [this] { | ||
525 | if (m_window.isNull()) { | 529 | if (m_window.isNull()) { | ||
526 | return; | 530 | return; | ||
527 | } | 531 | } | ||
528 | // TODO: can we check on the client instead? | 532 | // TODO: can we check on the client instead? | ||
▲ Show 20 Lines • Show All 430 Lines • ▼ Show 20 Line(s) | 928 | { | |||
959 | if (cursorSurface.isNull()) { | 963 | if (cursorSurface.isNull()) { | ||
960 | return; | 964 | return; | ||
961 | } | 965 | } | ||
962 | cursorSurface->frameRendered(m_surfaceRenderedTimer.elapsed()); | 966 | cursorSurface->frameRendered(m_surfaceRenderedTimer.elapsed()); | ||
963 | } | 967 | } | ||
964 | 968 | | |||
965 | void CursorImage::update() | 969 | void CursorImage::update() | ||
966 | { | 970 | { | ||
971 | if (s_cursorUpdateBlocking) { | ||||
972 | return; | ||||
973 | } | ||||
967 | using namespace KWayland::Server; | 974 | using namespace KWayland::Server; | ||
968 | disconnect(m_serverCursor.connection); | 975 | disconnect(m_serverCursor.connection); | ||
969 | auto p = waylandServer()->seat()->focusedPointer(); | 976 | auto p = waylandServer()->seat()->focusedPointer(); | ||
970 | if (p) { | 977 | if (p) { | ||
971 | m_serverCursor.connection = connect(p, &PointerInterface::cursorChanged, this, &CursorImage::updateServerCursor); | 978 | m_serverCursor.connection = connect(p, &PointerInterface::cursorChanged, this, &CursorImage::updateServerCursor); | ||
972 | } else { | 979 | } else { | ||
973 | m_serverCursor.connection = QMetaObject::Connection(); | 980 | m_serverCursor.connection = QMetaObject::Connection(); | ||
981 | reevaluteSource(); | ||||
974 | } | 982 | } | ||
975 | updateServerCursor(); | | |||
976 | } | 983 | } | ||
977 | 984 | | |||
978 | void CursorImage::updateDecoration() | 985 | void CursorImage::updateDecoration() | ||
979 | { | 986 | { | ||
980 | disconnect(m_decorationConnection); | 987 | disconnect(m_decorationConnection); | ||
981 | auto deco = m_pointer->decoration(); | 988 | auto deco = m_pointer->decoration(); | ||
982 | AbstractClient *c = deco.isNull() ? nullptr : deco->client(); | 989 | AbstractClient *c = deco.isNull() ? nullptr : deco->client(); | ||
983 | if (c) { | 990 | if (c) { | ||
▲ Show 20 Lines • Show All 249 Lines • ▼ Show 20 Line(s) | 1222 | { | |||
1233 | if (workspace() && workspace()->getMovingClient()) { | 1240 | if (workspace() && workspace()->getMovingClient()) { | ||
1234 | setSource(CursorSource::MoveResize); | 1241 | setSource(CursorSource::MoveResize); | ||
1235 | return; | 1242 | return; | ||
1236 | } | 1243 | } | ||
1237 | if (!m_pointer->decoration().isNull()) { | 1244 | if (!m_pointer->decoration().isNull()) { | ||
1238 | setSource(CursorSource::Decoration); | 1245 | setSource(CursorSource::Decoration); | ||
1239 | return; | 1246 | return; | ||
1240 | } | 1247 | } | ||
1241 | if (!m_pointer->window().isNull()) { | 1248 | if (!m_pointer->window().isNull() && waylandServer()->seat()->focusedPointer()) { | ||
1242 | setSource(CursorSource::PointerSurface); | 1249 | setSource(CursorSource::PointerSurface); | ||
1243 | return; | 1250 | return; | ||
1244 | } | 1251 | } | ||
1245 | setSource(CursorSource::Fallback); | 1252 | setSource(CursorSource::Fallback); | ||
1246 | } | 1253 | } | ||
1247 | 1254 | | |||
1248 | void CursorImage::setSource(CursorSource source) | 1255 | void CursorImage::setSource(CursorSource source) | ||
1249 | { | 1256 | { | ||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |