MCPcopy Create free account
hub / github.com/KDE/kwin / CursorImage

Method CursorImage

src/pointer_input.cpp:1056–1117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1054}
1055
1056CursorImage::CursorImage(PointerInputRedirection *parent)
1057 : QObject(parent)
1058 , m_pointer(parent)
1059{
1060 m_effectsCursor = std::make_unique<ShapeCursorSource>();
1061 m_fallbackCursor = std::make_unique<ShapeCursorSource>();
1062 m_moveResizeCursor = std::make_unique<ShapeCursorSource>();
1063 m_windowSelectionCursor = std::make_unique<ShapeCursorSource>();
1064 m_decoration.cursor = std::make_unique<ShapeCursorSource>();
1065 m_serverCursor.surface = std::make_unique<SurfaceCursorSource>();
1066 m_serverCursor.shape = std::make_unique<ShapeCursorSource>();
1067 m_dragCursor = std::make_unique<ShapeCursorSource>();
1068
1069#if KWIN_BUILD_SCREENLOCKER
1070 if (kwinApp()->supportsLockScreen()) {
1071 connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, &CursorImage::reevaluteSource);
1072 }
1073#endif
1074 connect(m_pointer, &PointerInputRedirection::decorationChanged, this, &CursorImage::updateDecoration);
1075 // connect the move resize of all window
1076 auto setupMoveResizeConnection = [this](Window *window) {
1077 connect(window, &Window::moveResizedChanged, this, &CursorImage::updateMoveResize);
1078 connect(window, &Window::moveResizeCursorChanged, this, &CursorImage::updateMoveResize);
1079 };
1080 const auto clients = workspace()->windows();
1081 std::for_each(clients.begin(), clients.end(), setupMoveResizeConnection);
1082 connect(workspace(), &Workspace::windowAdded, this, setupMoveResizeConnection);
1083
1084 m_fallbackCursor->setShape(Qt::ArrowCursor);
1085
1086 m_effectsCursor->setTheme(m_waylandImage.theme());
1087 m_fallbackCursor->setTheme(m_waylandImage.theme());
1088 m_moveResizeCursor->setTheme(m_waylandImage.theme());
1089 m_windowSelectionCursor->setTheme(m_waylandImage.theme());
1090 m_decoration.cursor->setTheme(m_waylandImage.theme());
1091 m_serverCursor.shape->setTheme(m_waylandImage.theme());
1092 m_dragCursor->setTheme(m_waylandImage.theme());
1093
1094 connect(&m_waylandImage, &WaylandCursorImage::themeChanged, this, [this] {
1095 m_effectsCursor->setTheme(m_waylandImage.theme());
1096 m_fallbackCursor->setTheme(m_waylandImage.theme());
1097 m_moveResizeCursor->setTheme(m_waylandImage.theme());
1098 m_windowSelectionCursor->setTheme(m_waylandImage.theme());
1099 m_decoration.cursor->setTheme(m_waylandImage.theme());
1100 m_serverCursor.shape->setTheme(m_waylandImage.theme());
1101 m_dragCursor->setTheme(m_waylandImage.theme());
1102 });
1103
1104 connect(waylandServer()->seat(), &SeatInterface::dragStarted, this, [this]() {
1105 m_dragCursor->setShape(Qt::ForbiddenCursor);
1106 connect(waylandServer()->seat()->dragSource(), &AbstractDataSource::dndActionChanged, this, &CursorImage::updateDragCursor);
1107 connect(waylandServer()->seat()->dragSource(), &AbstractDataSource::acceptedChanged, this, &CursorImage::updateDragCursor);
1108 reevaluteSource();
1109 });
1110
1111 PointerInterface *pointer = waylandServer()->seat()->pointer();
1112
1113 connect(pointer, &PointerInterface::focusedSurfaceChanged,

Callers

nothing calls this directly

Calls 14

kwinAppFunction · 0.85
selfFunction · 0.85
workspaceFunction · 0.85
waylandServerFunction · 0.85
supportsLockScreenMethod · 0.80
setShapeMethod · 0.80
dragSourceMethod · 0.80
windowsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
setThemeMethod · 0.45
themeMethod · 0.45

Tested by

no test coverage detected