* Check if we can switch the plugin capabilities. * This makes sense only if the plugin is already active, otherwise, * the operation can succeed. * * @param caps The additional capabilities required, aside from the * base caps. */
| 455 | * base caps. |
| 456 | */ |
| 457 | bool set_capabilities(uint32_t caps) |
| 458 | { |
| 459 | uint32_t total_caps = caps | base_caps; |
| 460 | if (!is_active()) |
| 461 | { |
| 462 | this->grab_interface.capabilities = total_caps; |
| 463 | |
| 464 | return true; |
| 465 | } |
| 466 | |
| 467 | // already have everything needed |
| 468 | if ((grab_interface.capabilities & total_caps) == total_caps) |
| 469 | { |
| 470 | // note: do not downgrade, in case total_caps are a subset of |
| 471 | // current_caps |
| 472 | return true; |
| 473 | } |
| 474 | |
| 475 | // check for only the additional caps |
| 476 | if (output->can_activate_plugin(caps)) |
| 477 | { |
| 478 | grab_interface.capabilities = total_caps; |
| 479 | |
| 480 | return true; |
| 481 | } else |
| 482 | { |
| 483 | return false; |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | bool add_direction(wf::point_t delta, wayfire_view view = nullptr) |
| 488 | { |
no test coverage detected