| 153 | } |
| 154 | |
| 155 | void 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 | |
| 184 | wf::scene::node_ptr wf::pointer_t::get_focus() const |
| 185 | { |
no test coverage detected