From 641aaff998d6297831b9b139e5ff8767ab5c0c79 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Wed, 20 Jul 2022 18:39:08 +0200 Subject: [PATCH] minor code adjustments --- src/Compositor.cpp | 4 ++-- src/events/Monitors.cpp | 6 +++--- src/events/Windows.cpp | 6 +++--- src/helpers/WLListener.cpp | 2 +- src/layout/DwindleLayout.cpp | 2 +- src/layout/MasterLayout.cpp | 2 +- src/managers/KeybindManager.cpp | 6 +++--- src/managers/input/InputManager.cpp | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index f941625d9..99a46dfa3 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -646,7 +646,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { updateWindowAnimatedDecorationValues(pWindow); // Send an event - g_pEventManager->postEvent(SHyprIPCEvent("activewindow", g_pXWaylandManager->getAppIDClass(pWindow) + "," + pWindow->m_szTitle)); + g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(pWindow) + "," + pWindow->m_szTitle}); if (pWindow->m_phForeignToplevel) wlr_foreign_toplevel_handle_v1_set_activated(pWindow->m_phForeignToplevel, true); @@ -663,7 +663,7 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) { if (!pSurface) { wlr_seat_keyboard_clear_focus(m_sSeat.seat); - g_pEventManager->postEvent(SHyprIPCEvent("activewindow", ",")); // unfocused + g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","}); // unfocused return; } diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 24a8faa71..9604dc69d 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -120,7 +120,7 @@ void Events::listener_newOutput(wl_listener* listener, void* data) { WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1; newDefaultWorkspaceName = std::to_string(WORKSPACEID); - Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace); + Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace.c_str()); } auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID); @@ -157,7 +157,7 @@ void Events::listener_newOutput(wl_listener* listener, void* data) { if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet g_pCompositor->m_pLastMonitor = PNEWMONITOR; - g_pEventManager->postEvent(SHyprIPCEvent("monitoradded", PNEWMONITOR->szName)); + g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", PNEWMONITOR->szName}); // ready to process cuz we have a monitor g_pCompositor->m_bReadyToProcess = true; @@ -393,7 +393,7 @@ void Events::listener_monitorDestroy(void* owner, void* data) { Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str()); - g_pEventManager->postEvent(SHyprIPCEvent("monitorremoved", pMonitor->szName)); + g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", pMonitor->szName}); g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::unique_ptr& el) { return el.get() == pMonitor; })); diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 327c06fa0..3cd111ba4 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -438,7 +438,7 @@ void Events::listener_setTitleWindow(void* owner, void* data) { PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW); if (PWINDOW == g_pCompositor->m_pLastWindow) // if it's the active, let's post an event to update others - g_pEventManager->postEvent(SHyprIPCEvent("activewindow", g_pXWaylandManager->getAppIDClass(PWINDOW) + "," + PWINDOW->m_szTitle)); + g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(PWINDOW) + "," + PWINDOW->m_szTitle}); if (PWINDOW->m_phForeignToplevel) wlr_foreign_toplevel_handle_v1_set_title(PWINDOW->m_phForeignToplevel, PWINDOW->m_szTitle.c_str()); @@ -525,13 +525,13 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) { const auto POS = PWINDOW->m_vRealPosition.goalv(); const auto SIZ = PWINDOW->m_vRealSize.goalv(); - if (abs(floor(POS.x) - PWINDOW->m_uSurface.xwayland->x) > 2 || abs(floor(POS.y) - PWINDOW->m_uSurface.xwayland->y) > 2 || abs(floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) { + if (abs(std::floor(POS.x) - PWINDOW->m_uSurface.xwayland->x) > 2 || abs(std::floor(POS.y) - PWINDOW->m_uSurface.xwayland->y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) { Debug::log(LOG, "Unmanaged window %x requests geometry update to %i %i %i %i", PWINDOW, (int)PWINDOW->m_uSurface.xwayland->x, (int)PWINDOW->m_uSurface.xwayland->y, (int)PWINDOW->m_uSurface.xwayland->width, (int)PWINDOW->m_uSurface.xwayland->height); g_pHyprRenderer->damageWindow(PWINDOW); PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y)); - if (abs(floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) + if (abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->width, PWINDOW->m_uSurface.xwayland->height)); PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromVector(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f)->activeWorkspace; diff --git a/src/helpers/WLListener.cpp b/src/helpers/WLListener.cpp index adaab2884..117e16eb9 100644 --- a/src/helpers/WLListener.cpp +++ b/src/helpers/WLListener.cpp @@ -23,7 +23,7 @@ CHyprWLListener::~CHyprWLListener() { void CHyprWLListener::removeCallback() { if (m_bIsConnected) { - Debug::log(LOG, "Callback %x -> %x, %s removed.", m_pCallback, m_pOwner, m_szAuthor.c_str()); + Debug::log(LOG, "Callback %x -> %x, %s removed.", &m_pCallback, &m_pOwner, m_szAuthor.c_str()); wl_list_remove(&m_sListener.link); } diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 307537d86..c1bd09964 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -548,7 +548,7 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscree pWindow->m_bIsFullscreen = on; PWORKSPACE->m_bHasFullscreenWindow = !PWORKSPACE->m_bHasFullscreenWindow; - g_pEventManager->postEvent(SHyprIPCEvent("fullscreen", std::to_string((int)on))); + g_pEventManager->postEvent(SHyprIPCEvent{"fullscreen", std::to_string((int)on)}); if (!pWindow->m_bIsFullscreen) { // if it got its fullscreen disabled, set back its node if it had one diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 02b275981..6521ae803 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -294,7 +294,7 @@ void CHyprMasterLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreen pWindow->m_bIsFullscreen = on; PWORKSPACE->m_bHasFullscreenWindow = !PWORKSPACE->m_bHasFullscreenWindow; - g_pEventManager->postEvent(SHyprIPCEvent("fullscreen", std::to_string((int)on))); + g_pEventManager->postEvent(SHyprIPCEvent{"fullscreen", std::to_string((int)on)}); if (!pWindow->m_bIsFullscreen) { // if it got its fullscreen disabled, set back its node if it had one diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 2c91f81ff..1d7a4ba4a 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -230,7 +230,7 @@ void CKeybindManager::killActive(std::string args) { g_pXWaylandManager->sendCloseWindow(g_pCompositor->m_pLastWindow); g_pCompositor->m_pLastFocus = nullptr; g_pCompositor->m_pLastWindow = nullptr; - g_pEventManager->postEvent(SHyprIPCEvent("activewindow", ",")); // post an activewindow event to empty, as we are currently unfocused + g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","}); // post an activewindow event to empty, as we are currently unfocused } g_pCompositor->focusWindow(g_pCompositor->windowFromCursor()); @@ -325,7 +325,7 @@ void CKeybindManager::changeworkspace(std::string args) { // start anim on new workspace PWORKSPACETOCHANGETO->startAnim(true, ANIMTOLEFT); - g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACETOCHANGETO->m_szName)); + g_pEventManager->postEvent(SHyprIPCEvent{"workspace", PWORKSPACETOCHANGETO->m_szName}); } // If the monitor is not the one our cursor's at, warp to it. @@ -398,7 +398,7 @@ void CKeybindManager::changeworkspace(std::string args) { g_pInputManager->refocus(); // Event - g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACE->m_szName)); + g_pEventManager->postEvent(SHyprIPCEvent{"workspace", PWORKSPACE->m_szName}); Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo); } diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 5fbdcf230..f1ef0a919 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -117,7 +117,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { ACTIVEWORKSPACE->setActive(true); // event - g_pEventManager->postEvent(SHyprIPCEvent("activemon", PMONITOR->szName + "," + ACTIVEWORKSPACE->m_szName)); + g_pEventManager->postEvent(SHyprIPCEvent{"activemon", PMONITOR->szName + "," + ACTIVEWORKSPACE->m_szName}); } Vector2D surfaceCoords;