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

Method _validate_ws

plugins/window-rules/view-action-interface.cpp:456–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456std::tuple<bool, wf::point_t> view_action_interface_t::_validate_ws(
457 const std::vector<variant_t>& args)
458{
459 if (!this->_view->get_output())
460 {
461 return {false, {}};
462 }
463
464 if (args.size() != 2)
465 {
466 LOGE("Invalid workspace identifier, expected <x> <y>");
467 }
468
469 auto [ok1, x] = _expect_int(args, 0);
470 auto [ok2, y] = _expect_int(args, 1);
471 if (!ok1 || !ok2)
472 {
473 LOGE("Workspace coordinates should be integers!");
474 return {false, {}};
475 }
476
477 auto wsize = _view->get_output()->wset()->get_workspace_grid_size();
478 if (((0 <= x) && (x < wsize.width)) && ((0 <= y) && (y < wsize.height)))
479 {
480 return {true, {x, y}};
481 }
482
483 LOGE("Workspace coordinates out of bounds!");
484 return {false, {}};
485}
486
487wf::geometry_t view_action_interface_t::_get_workspace_grid_geometry(
488 wf::output_t *output) const

Callers

nothing calls this directly

Calls 4

wsetMethod · 0.80
get_outputMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected