MCPcopy Create free account
hub / github.com/Sonic-DE/sonic-win / init

Method init

src/pointer_input.cpp:79–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void PointerInputRedirection::init()
80{
81 Q_ASSERT(!inited());
82
83 m_cursor = new CursorImage(this);
84 setInited(true);
85 InputDeviceHandler::init();
86
87 if (!input()->hasPointer()) {
88 Cursors::self()->hideCursor();
89 }
90 connect(input(), &InputRedirection::hasPointerChanged, this, []() {
91 if (input()->hasPointer()) {
92 Cursors::self()->showCursor();
93 } else {
94 Cursors::self()->hideCursor();
95 }
96 });
97
98 connect(m_cursor, &CursorImage::changed, Cursors::self()->mouse(), [this] {
99 Cursors::self()->mouse()->setSource(m_cursor->source());
100 m_cursor->updateCursorOutputs(m_pos);
101 });
102 Q_EMIT m_cursor->changed();
103
104 connect(workspace(), &Workspace::outputsChanged, this, &PointerInputRedirection::updateAfterScreenChange);
105#if KWIN_BUILD_SCREENLOCKER
106 if (kwinApp()->supportsLockScreen()) {
107 connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::lockStateChanged, this, [this]() {
108 update();
109 });
110 }
111#endif
112 connect(workspace(), &QObject::destroyed, this, [this] {
113 setInited(false);
114 });
115 // connect the move resize of all window
116 auto setupMoveResizeConnection = [this](Window *window) {
117 connect(window, &Window::interactiveMoveResizeStarted, this, &PointerInputRedirection::updateOnStartMoveResize);
118 connect(window, &Window::interactiveMoveResizeFinished, this, &PointerInputRedirection::update);
119 };
120 const auto clients = workspace()->windows();
121 std::for_each(clients.begin(), clients.end(), setupMoveResizeConnection);
122 connect(workspace(), &Workspace::windowAdded, this, setupMoveResizeConnection);
123
124 // warp the cursor to center of screen containing the workspace center
125 if (const Output *output = workspace()->outputAt(workspace()->geometry().center())) {
126 warp(output->geometry().center());
127 }
128 updateAfterScreenChange();
129}
130
131void PointerInputRedirection::updateOnStartMoveResize()
132{

Callers

nothing calls this directly

Calls 15

initedFunction · 0.85
setInitedFunction · 0.85
inputFunction · 0.85
selfFunction · 0.85
workspaceFunction · 0.85
kwinAppFunction · 0.85
hasPointerMethod · 0.80
updateCursorOutputsMethod · 0.80
supportsLockScreenMethod · 0.80
beginMethod · 0.80
outputAtMethod · 0.80
initFunction · 0.50

Tested by

no test coverage detected