From b0f5e4ab5656fb3b72efa7ce646d4b47ae82b814 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 17 Apr 2022 18:47:10 +0200 Subject: store scale and scale windows with monitor --- src/helpers/MiscFunctions.cpp | 7 +++++++ src/helpers/MiscFunctions.hpp | 3 ++- src/helpers/Monitor.hpp | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/helpers') diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index ceb457c4..a3aa7871 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -54,4 +54,11 @@ std::string getFormat(const char *fmt, ...) { va_end(args); return std::string(buf); +} + +void scaleBox(wlr_box* box, float scale) { + box->width = std::round((box->x + box->width) * scale) - std::round(box->x * scale); + box->height = std::round((box->y + box->height) * scale) - std::round(box->y * scale); + box->x = std::round(box->x * scale); + box->y = std::round(box->y * scale); } \ No newline at end of file diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp index c71df0b1..c4192ff1 100644 --- a/src/helpers/MiscFunctions.hpp +++ b/src/helpers/MiscFunctions.hpp @@ -4,4 +4,5 @@ void addWLSignal(wl_signal*, wl_listener*, void* pOwner, std::string ownerString); void wlr_signal_emit_safe(struct wl_signal *signal, void *data); -std::string getFormat(const char *fmt, ...); // Basically Debug::log to a string \ No newline at end of file +std::string getFormat(const char *fmt, ...); // Basically Debug::log to a string +void scaleBox(wlr_box*, float); \ No newline at end of file diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 3f88bed1..fb318c17 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -14,6 +14,7 @@ struct SMonitor { uint64_t ID = -1; int activeWorkspace = -1; + float scale = 1; std::string szName = ""; -- cgit v1.2.3