Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.cpp
Show First 20 Lines • Show All 597 Lines • ▼ Show 20 Line(s) | 538 | { | |||
---|---|---|---|---|---|
598 | m_constraintsConnection = connect(focusNow->surface(), &KWayland::Server::SurfaceInterface::pointerConstraintsChanged, | 598 | m_constraintsConnection = connect(focusNow->surface(), &KWayland::Server::SurfaceInterface::pointerConstraintsChanged, | ||
599 | this, &PointerInputRedirection::updatePointerConstraints); | 599 | this, &PointerInputRedirection::updatePointerConstraints); | ||
600 | m_constraintsActivatedConnection = connect(workspace(), &Workspace::clientActivated, | 600 | m_constraintsActivatedConnection = connect(workspace(), &Workspace::clientActivated, | ||
601 | this, &PointerInputRedirection::updatePointerConstraints); | 601 | this, &PointerInputRedirection::updatePointerConstraints); | ||
602 | updatePointerConstraints(); | 602 | updatePointerConstraints(); | ||
603 | } | 603 | } | ||
604 | 604 | | |||
605 | void PointerInputRedirection::breakPointerConstraints(KWayland::Server::SurfaceInterface *surface) | 605 | void PointerInputRedirection::breakPointerConstraints(KWayland::Server::SurfaceInterface *surface) | ||
606 | { | 606 | { | ||
graesslin: I think it's dangerous to remove the moveResizedChanged connection. It's possible that we lose… | |||||
607 | // cancel pointer constraints | 607 | // cancel pointer constraints | ||
608 | if (surface) { | 608 | if (surface) { | ||
609 | auto c = surface->confinedPointer(); | 609 | auto c = surface->confinedPointer(); | ||
610 | if (c && c->isConfined()) { | 610 | if (c && c->isConfined()) { | ||
611 | c->setConfined(false); | 611 | c->setConfined(false); | ||
612 | } | 612 | } | ||
613 | auto l = surface->lockedPointer(); | 613 | auto l = surface->lockedPointer(); | ||
614 | if (l && l->isLocked()) { | 614 | if (l && l->isLocked()) { | ||
▲ Show 20 Lines • Show All 373 Lines • ▼ Show 20 Line(s) | 984 | connect(waylandServer()->seat(), &KWayland::Server::SeatInterface::dragEnded, this, | |||
988 | } | 988 | } | ||
989 | ); | 989 | ); | ||
990 | if (waylandServer()->hasScreenLockerIntegration()) { | 990 | if (waylandServer()->hasScreenLockerIntegration()) { | ||
991 | connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &CursorImage::reevaluteSource); | 991 | connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &CursorImage::reevaluteSource); | ||
992 | } | 992 | } | ||
993 | connect(m_pointer, &PointerInputRedirection::decorationChanged, this, &CursorImage::updateDecoration); | 993 | connect(m_pointer, &PointerInputRedirection::decorationChanged, this, &CursorImage::updateDecoration); | ||
994 | // connect the move resize of all window | 994 | // connect the move resize of all window | ||
995 | auto setupMoveResizeConnection = [this] (AbstractClient *c) { | 995 | auto setupMoveResizeConnection = [this] (AbstractClient *c) { | ||
996 | connect(c, &AbstractClient::moveResizedChanged, this, &CursorImage::updateMoveResize); | 996 | connect(c, &AbstractClient::moveResizeCursorChanged, this, &CursorImage::updateMoveResize); | ||
997 | }; | 997 | }; | ||
998 | const auto clients = workspace()->allClientList(); | 998 | const auto clients = workspace()->allClientList(); | ||
999 | std::for_each(clients.begin(), clients.end(), setupMoveResizeConnection); | 999 | std::for_each(clients.begin(), clients.end(), setupMoveResizeConnection); | ||
1000 | connect(workspace(), &Workspace::clientAdded, this, setupMoveResizeConnection); | 1000 | connect(workspace(), &Workspace::clientAdded, this, setupMoveResizeConnection); | ||
1001 | connect(waylandServer(), &WaylandServer::shellClientAdded, this, setupMoveResizeConnection); | 1001 | connect(waylandServer(), &WaylandServer::shellClientAdded, this, setupMoveResizeConnection); | ||
1002 | loadThemeCursor(Qt::ArrowCursor, &m_fallbackCursor); | 1002 | loadThemeCursor(Qt::ArrowCursor, &m_fallbackCursor); | ||
1003 | if (m_cursorTheme) { | 1003 | if (m_cursorTheme) { | ||
1004 | connect(m_cursorTheme, &WaylandCursorTheme::themeChanged, this, | 1004 | connect(m_cursorTheme, &WaylandCursorTheme::themeChanged, this, | ||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 1092 | { | |||
1103 | reevaluteSource(); | 1103 | reevaluteSource(); | ||
1104 | } | 1104 | } | ||
1105 | 1105 | | |||
1106 | void CursorImage::updateMoveResize() | 1106 | void CursorImage::updateMoveResize() | ||
1107 | { | 1107 | { | ||
1108 | m_moveResizeCursor.image = QImage(); | 1108 | m_moveResizeCursor.image = QImage(); | ||
1109 | m_moveResizeCursor.hotSpot = QPoint(); | 1109 | m_moveResizeCursor.hotSpot = QPoint(); | ||
1110 | if (AbstractClient *c = workspace()->getMovingClient()) { | 1110 | if (AbstractClient *c = workspace()->getMovingClient()) { | ||
1111 | loadThemeCursor(c->isMove() ? Qt::SizeAllCursor : Qt::SizeBDiagCursor, &m_moveResizeCursor); | 1111 | loadThemeCursor(c->cursor(), &m_moveResizeCursor); | ||
1112 | if (m_currentSource == CursorSource::MoveResize) { | 1112 | if (m_currentSource == CursorSource::MoveResize) { | ||
1113 | emit changed(); | 1113 | emit changed(); | ||
1114 | } | 1114 | } | ||
1115 | } | 1115 | } | ||
1116 | reevaluteSource(); | 1116 | reevaluteSource(); | ||
1117 | } | 1117 | } | ||
1118 | 1118 | | |||
1119 | void CursorImage::updateServerCursor() | 1119 | void CursorImage::updateServerCursor() | ||
▲ Show 20 Lines • Show All 292 Lines • Show Last 20 Lines |
I think it's dangerous to remove the moveResizedChanged connection. It's possible that we lose a change there
Also it looks dangerous to me that we don't have any evaluation about workspace()->getMovingClient(). The moveResizeCursorChanged might be emitted in situations where no window is being move/resized