| 168 | |
| 169 | public: |
| 170 | void init() override |
| 171 | { |
| 172 | input_grab = std::make_unique<wf::input_grab_t>("wrot", output, nullptr, this, nullptr); |
| 173 | call = [=] (auto) |
| 174 | { |
| 175 | if (current_mode != mode::NONE) |
| 176 | { |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | if (!output->activate_plugin(&grab_interface)) |
| 181 | { |
| 182 | return false; |
| 183 | } |
| 184 | |
| 185 | current_view = toplevel_cast(wf::get_core().get_cursor_focus_view()); |
| 186 | if (!current_view || (current_view->role != wf::VIEW_ROLE_TOPLEVEL)) |
| 187 | { |
| 188 | output->deactivate_plugin(&grab_interface); |
| 189 | return false; |
| 190 | } |
| 191 | |
| 192 | wf::get_core().default_wm->focus_raise_view(current_view); |
| 193 | current_view->connect(¤t_view_unmapped); |
| 194 | input_grab->grab_input(wf::scene::layer::OVERLAY); |
| 195 | |
| 196 | last_position = output->get_cursor_position(); |
| 197 | current_mode = mode::ROT_2D; |
| 198 | return false; // pass btn press to the grab node |
| 199 | }; |
| 200 | |
| 201 | output->add_button(wf::option_wrapper_t<wf::buttonbinding_t>("wrot/activate"), &call); |
| 202 | output->add_button(wf::option_wrapper_t<wf::buttonbinding_t>("wrot/activate-3d"), &call_3d); |
| 203 | output->add_key(wf::option_wrapper_t<wf::keybinding_t>{"wrot/reset"}, &reset); |
| 204 | output->add_key(wf::option_wrapper_t<wf::keybinding_t>{"wrot/reset-one"}, &reset_one); |
| 205 | |
| 206 | grab_interface.cancel = [=] () |
| 207 | { |
| 208 | if (input_grab->is_grabbed()) |
| 209 | { |
| 210 | input_released(); |
| 211 | } |
| 212 | }; |
| 213 | } |
| 214 | |
| 215 | void handle_pointer_button(const wlr_pointer_button_event& event) override |
| 216 | { |
nothing calls this directly
no test coverage detected