Convert loc() to function and add arguments checks
Summary:
For debug builds, the function will fail when called with out of display
coordinates, allowing to spot addressing errors. For regular builds,
it will limit coordinates to valid area without triggering errors.
Depends on D12551
Test Plan: * Compiles, does not fail with use cases from previous commit
Reviewers: Konsole, hindenburg
Reviewed By: Konsole, hindenburg
Subscribers: konsole-devel, hindenburg, Konsole
Tags: Konsole
Differential Revision: https://phabricator.kde.org/D12553