From 0c2386861afbb10c8c5eb6de868fa2a519df2907 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 29 Jan 2023 16:38:48 +0000 Subject: [PATCH] add --no-fractional arg --- src/Hyprpaper.hpp | 1 + src/events/Events.cpp | 2 +- src/main.cpp | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Hyprpaper.hpp b/src/Hyprpaper.hpp index d942676..764be6e 100644 --- a/src/Hyprpaper.hpp +++ b/src/Hyprpaper.hpp @@ -37,6 +37,7 @@ public: bool m_bIPCEnabled = true; std::string m_szExplicitConfigPath; + bool m_bNoFractionalScale = false; void removeOldHyprpaperImages(); void preloadAllWallpapersFromConfig(); diff --git a/src/events/Events.cpp b/src/events/Events.cpp index 6740828..0fb2a31 100644 --- a/src/events/Events.cpp +++ b/src/events/Events.cpp @@ -121,7 +121,7 @@ void Events::handleGlobal(void *data, struct wl_registry *registry, uint32_t nam g_pHyprpaper->createSeat((wl_seat*)wl_registry_bind(registry, name, &wl_seat_interface, 1)); } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) { g_pHyprpaper->m_sLayerShell = (zwlr_layer_shell_v1*)wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 1); - } else if (strcmp(interface, wp_fractional_scale_manager_v1_interface.name) == 0) { + } else if (strcmp(interface, wp_fractional_scale_manager_v1_interface.name) == 0 && !g_pHyprpaper->m_bNoFractionalScale) { g_pHyprpaper->m_sFractionalScale = (wp_fractional_scale_manager_v1*)wl_registry_bind(registry, name, &wp_fractional_scale_manager_v1_interface, 1); } else if (strcmp(interface, wp_viewporter_interface.name) == 0) { g_pHyprpaper->m_sViewporter = (wp_viewporter*)wl_registry_bind(registry, name, &wp_viewporter_interface, 1); diff --git a/src/main.cpp b/src/main.cpp index a360c4b..67e38b2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,14 +7,19 @@ int main(int argc, char** argv, char** envp) { // parse some args std::string configPath; + bool noFractional = false; for (int i = 1; i < argc; ++i) { if ((!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config")) && argc >= i + 2) { configPath = std::string(argv[++i]); Debug::log(LOG, "Using config location %s.", configPath.c_str()); + } else if (!strcmp(argv[i], "--no-fractional") || !strcmp(argv[i], "-n")) { + noFractional = true; + Debug::log(LOG, "Disabling fractional scaling support!"); } else { std::cout << "Hyprpaper usage: hyprpaper [arg [...]].\n\nArguments:\n" << - "--help -h | Show this help message\n" << - "--config -c | Specify config file to use\n"; + "--help -h | Show this help message\n" << + "--config -c | Specify config file to use\n" << + "--no-fractional -n | Disable fractional scaling support\n"; return 1; } } @@ -22,6 +27,7 @@ int main(int argc, char** argv, char** envp) { // starts g_pHyprpaper = std::make_unique(); g_pHyprpaper->m_szExplicitConfigPath = configPath; + g_pHyprpaper->m_bNoFractionalScale = noFractional; g_pHyprpaper->init(); return 0;