| 392 | |
| 393 | public: |
| 394 | void init() |
| 395 | { |
| 396 | output->connect(&on_set_workspace_request); |
| 397 | output->connect(&on_grabbed_view_disappear); |
| 398 | |
| 399 | algorithm = std::make_unique<vswitch_basic_plugin>(output, |
| 400 | [=] () { output->deactivate_plugin(&grab_interface); }); |
| 401 | |
| 402 | bindings = std::make_unique<wf::vswitch::control_bindings_t>(output); |
| 403 | bindings->setup([this] (wf::point_t delta, wayfire_toplevel_view view, bool only_view) |
| 404 | { |
| 405 | // Do not switch workspace with sticky view, they are on all |
| 406 | // workspaces anyway |
| 407 | if (view && view->sticky) |
| 408 | { |
| 409 | view = nullptr; |
| 410 | } |
| 411 | |
| 412 | if (this->set_capabilities(wf::CAPABILITY_MANAGE_DESKTOP)) |
| 413 | { |
| 414 | if (delta == wf::point_t{0, 0}) |
| 415 | { |
| 416 | // Consume input event |
| 417 | return true; |
| 418 | } |
| 419 | |
| 420 | if (only_view && view) |
| 421 | { |
| 422 | if (!view->get_wset()) |
| 423 | { |
| 424 | return false; |
| 425 | } |
| 426 | |
| 427 | wf::vswitch::move_view(view, delta, true); |
| 428 | return true; |
| 429 | } |
| 430 | |
| 431 | return add_direction(delta, view); |
| 432 | } else |
| 433 | { |
| 434 | return false; |
| 435 | } |
| 436 | }); |
| 437 | } |
| 438 | |
| 439 | inline bool is_active() |
| 440 | { |
nothing calls this directly
no test coverage detected