MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / update_cursor_focus

Method update_cursor_focus

src/core/seat/pointer.cpp:155–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155void wf::pointer_t::update_cursor_focus(wf::scene::node_ptr new_focus)
156{
157 if (cursor_focus == new_focus)
158 {
159 return;
160 }
161
162 LOGC(POINTER, "Change cursor focus ", cursor_focus.get(), " -> ", new_focus.get());
163 auto old_focus = std::move(cursor_focus);
164 cursor_focus = new_focus;
165
166 send_leave_to_focus(old_focus);
167 currently_sent_buttons.clear();
168
169 if (cursor_focus)
170 {
171 send_enter_to_focus();
172 } else
173 {
174 // If there is focused surface, we should reset the cursor image to
175 // avoid the last cursor image getting stuck outside of its surface.
176 wf::get_core().set_cursor("default");
177 }
178
179 wf::pointer_focus_changed_signal ev;
180 ev.new_focus = cursor_focus;
181 wf::get_core().emit(&ev);
182}
183
184wf::scene::node_ptr wf::pointer_t::get_focus() const
185{

Callers 1

set_enable_focusMethod · 0.95

Calls 4

getMethod · 0.45
clearMethod · 0.45
set_cursorMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected