Remove trailing whitespace.

This commit is contained in:
Felix Dick 2022-09-25 20:07:48 +02:00
parent 190229942f
commit bf3f519eb7
44 changed files with 183 additions and 183 deletions

View file

@ -19,7 +19,7 @@
#include <deque> #include <deque>
const std::string USAGE = R"#(usage: hyprctl [(opt)flags] [command] [(opt)args] const std::string USAGE = R"#(usage: hyprctl [(opt)flags] [command] [(opt)args]
commands: commands:
monitors monitors
workspaces workspaces
@ -36,7 +36,7 @@ commands:
reload reload
setcursor setcursor
getoption getoption
flags: flags:
-j -> output in JSON -j -> output in JSON
--batch -> execute a batch of commands, separated by ';' --batch -> execute a batch of commands, separated by ';'
@ -198,7 +198,7 @@ void setcursorRequest(int argc, char** argv) {
void batchRequest(std::string arg) { void batchRequest(std::string arg) {
std::string rq = "[[BATCH]]" + arg.substr(arg.find_first_of(" ") + 1); std::string rq = "[[BATCH]]" + arg.substr(arg.find_first_of(" ") + 1);
request(rq); request(rq);
} }

View file

@ -278,7 +278,7 @@ void CCompositor::startCompositor() {
// //
Debug::log(LOG, "Creating the CHyprError!"); Debug::log(LOG, "Creating the CHyprError!");
g_pHyprError = std::make_unique<CHyprError>(); g_pHyprError = std::make_unique<CHyprError>();
Debug::log(LOG, "Creating the KeybindManager!"); Debug::log(LOG, "Creating the KeybindManager!");
g_pKeybindManager = std::make_unique<CKeybindManager>(); g_pKeybindManager = std::make_unique<CKeybindManager>();
@ -542,7 +542,7 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
if (resultSurf) if (resultSurf)
return w->get(); return w->get();
} }
} }
} }
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter. // first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
@ -561,7 +561,7 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
if (resultSurf) if (resultSurf)
return w->get(); return w->get();
} }
} }
} }
// for windows, we need to check their extensions too, first. // for windows, we need to check their extensions too, first.
@ -649,7 +649,7 @@ wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pW
RASSERT(!pWindow->m_bIsX11, "Cannot call vectorWindowToSurface on an X11 window!"); RASSERT(!pWindow->m_bIsX11, "Cannot call vectorWindowToSurface on an X11 window!");
const auto PSURFACE = pWindow->m_uSurface.xdg; const auto PSURFACE = pWindow->m_uSurface.xdg;
double subx, suby; double subx, suby;
// calc for oversized windows... fucking bullshit, again. // calc for oversized windows... fucking bullshit, again.
@ -747,7 +747,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
g_pXWaylandManager->activateWindow(pWindow, true); // sets the m_pLastWindow g_pXWaylandManager->activateWindow(pWindow, true); // sets the m_pLastWindow
// do pointer focus too // do pointer focus too
const auto POINTERLOCAL = g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.goalv(); const auto POINTERLOCAL = g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.goalv();
wlr_seat_pointer_notify_enter(m_sSeat.seat, PWINDOWSURFACE, POINTERLOCAL.x, POINTERLOCAL.y); wlr_seat_pointer_notify_enter(m_sSeat.seat, PWINDOWSURFACE, POINTERLOCAL.x, POINTERLOCAL.y);
@ -775,7 +775,7 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
g_pInputManager->m_sIMERelay.onKeyboardFocus(nullptr); g_pInputManager->m_sIMERelay.onKeyboardFocus(nullptr);
return; return;
} }
const auto KEYBOARD = wlr_seat_get_keyboard(m_sSeat.seat); const auto KEYBOARD = wlr_seat_get_keyboard(m_sSeat.seat);
@ -865,7 +865,7 @@ bool CCompositor::isWorkspaceVisible(const int& w) {
for (auto& m : m_vMonitors) { for (auto& m : m_vMonitors) {
if (m->activeWorkspace == w) if (m->activeWorkspace == w)
return true; return true;
if (m->specialWorkspaceOpen && w == SPECIAL_WORKSPACE_ID) if (m->specialWorkspaceOpen && w == SPECIAL_WORKSPACE_ID)
return true; return true;
} }
@ -1599,7 +1599,7 @@ bool CCompositor::workspaceIDOutOfBounds(const int& id) {
if (w->m_iID < lowestID) if (w->m_iID < lowestID)
lowestID = w->m_iID; lowestID = w->m_iID;
if (w->m_iID > highestID) if (w->m_iID > highestID)
highestID = w->m_iID; highestID = w->m_iID;
} }
@ -1619,7 +1619,7 @@ void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(pWindow, mode, on); g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(pWindow, mode, on);
g_pXWaylandManager->setWindowFullscreen(pWindow, pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL); g_pXWaylandManager->setWindowFullscreen(pWindow, pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL);
// make all windows on the same workspace under the fullscreen window // make all windows on the same workspace under the fullscreen window
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID) { if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID) {
@ -1635,7 +1635,7 @@ void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode
if (!ls->fadingOut) if (!ls->fadingOut)
ls->alpha = pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL ? 0.f : 255.f; ls->alpha = pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL ? 0.f : 255.f;
} }
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv(), true); g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv(), true);
forceReportSizesToWindowsOnWorkspace(pWindow->m_iWorkspaceID); forceReportSizesToWindowsOnWorkspace(pWindow->m_iWorkspaceID);
@ -1662,7 +1662,7 @@ CWindow* CCompositor::getX11Parent(CWindow* pWindow) {
if (w->m_uSurface.xwayland == pWindow->m_uSurface.xwayland->parent) if (w->m_uSurface.xwayland == pWindow->m_uSurface.xwayland->parent)
return w.get(); return w.get();
} }
return nullptr; return nullptr;
} }

View file

@ -86,13 +86,13 @@ public:
std::vector<CWindow*> m_vWindowsFadingOut; std::vector<CWindow*> m_vWindowsFadingOut;
std::vector<SLayerSurface*> m_vSurfacesFadingOut; std::vector<SLayerSurface*> m_vSurfacesFadingOut;
void startCompositor(); void startCompositor();
void cleanup(); void cleanup();
wlr_surface* m_pLastFocus = nullptr; wlr_surface* m_pLastFocus = nullptr;
CWindow* m_pLastWindow = nullptr; CWindow* m_pLastWindow = nullptr;
CMonitor* m_pLastMonitor = nullptr; CMonitor* m_pLastMonitor = nullptr;
SSeat m_sSeat; SSeat m_sSeat;
bool m_bReadyToProcess = false; bool m_bReadyToProcess = false;
@ -165,14 +165,14 @@ public:
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&); Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
void forceReportSizesToWindowsOnWorkspace(const int&); void forceReportSizesToWindowsOnWorkspace(const int&);
bool cursorOnReservedArea(); bool cursorOnReservedArea();
std::string explicitConfigPath; std::string explicitConfigPath;
private: private:
void initAllSignals(); void initAllSignals();
void setRandomSplash(); void setRandomSplash();
uint64_t m_iHyprlandPID = 0; uint64_t m_iHyprlandPID = 0;
}; };
@ -191,4 +191,4 @@ inline std::map<std::string, xcb_atom_t> HYPRATOMS = {
HYPRATOM("_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"), HYPRATOM("_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_POPUP_MENU"), HYPRATOM("_NET_WM_WINDOW_TYPE_POPUP_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLTIP"), HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLTIP"),
HYPRATOM("_NET_WM_WINDOW_TYPE_NOTIFICATION")}; HYPRATOM("_NET_WM_WINDOW_TYPE_NOTIFICATION")};

View file

@ -48,7 +48,7 @@ wlr_box CWindow::getFullWindowBoundingBox() {
m_vRealPosition.vec().y - maxExtents.topLeft.y, m_vRealPosition.vec().y - maxExtents.topLeft.y,
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x, m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x,
m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y}; m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
return finalBox; return finalBox;
} }
@ -119,7 +119,7 @@ void CWindow::createToplevelHandle() {
return; // don't create a toplevel return; // don't create a toplevel
m_phForeignToplevel = wlr_foreign_toplevel_handle_v1_create(g_pCompositor->m_sWLRToplevelMgr); m_phForeignToplevel = wlr_foreign_toplevel_handle_v1_create(g_pCompositor->m_sWLRToplevelMgr);
wlr_foreign_toplevel_handle_v1_set_app_id(m_phForeignToplevel, g_pXWaylandManager->getAppIDClass(this).c_str()); wlr_foreign_toplevel_handle_v1_set_app_id(m_phForeignToplevel, g_pXWaylandManager->getAppIDClass(this).c_str());
wlr_foreign_toplevel_handle_v1_output_enter(m_phForeignToplevel, g_pCompositor->getMonitorFromID(m_iMonitorID)->output); wlr_foreign_toplevel_handle_v1_output_enter(m_phForeignToplevel, g_pCompositor->getMonitorFromID(m_iMonitorID)->output);
wlr_foreign_toplevel_handle_v1_set_title(m_phForeignToplevel, m_szTitle.c_str()); wlr_foreign_toplevel_handle_v1_set_title(m_phForeignToplevel, m_szTitle.c_str());

View file

@ -15,7 +15,7 @@ struct SWindowSpecialRenderData {
bool rounding = true; bool rounding = true;
bool border = true; bool border = true;
bool decorate = true; bool decorate = true;
}; };
struct SWindowAdditionalConfigData { struct SWindowAdditionalConfigData {
std::string animationStyle = ""; std::string animationStyle = "";

View file

@ -48,7 +48,7 @@ void CConfigManager::setDefaultVars() {
configValues["general:no_cursor_warps"].intValue = 0; configValues["general:no_cursor_warps"].intValue = 0;
configValues["general:layout"].strValue = "dwindle"; configValues["general:layout"].strValue = "dwindle";
configValues["misc:disable_hyprland_logo"].intValue = 0; configValues["misc:disable_hyprland_logo"].intValue = 0;
configValues["misc:disable_splash_rendering"].intValue = 0; configValues["misc:disable_splash_rendering"].intValue = 0;
configValues["misc:no_vfr"].intValue = 1; configValues["misc:no_vfr"].intValue = 1;
@ -205,7 +205,7 @@ void CConfigManager::setDefaultAnimationVars() {
// workspaces // workspaces
INITANIMCFG("specialWorkspace"); INITANIMCFG("specialWorkspace");
} }
// init the values // init the values
animationConfig["global"] = { animationConfig["global"] = {
false, false,
@ -236,7 +236,7 @@ void CConfigManager::setDefaultAnimationVars() {
} }
void CConfigManager::init() { void CConfigManager::init() {
loadConfigLoadVars(); loadConfigLoadVars();
const char* const ENVHOME = getenv("HOME"); const char* const ENVHOME = getenv("HOME");
@ -450,7 +450,7 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
return; return;
} }
if (std::find_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }) != m_dMonitorRules.end()) if (std::find_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }) != m_dMonitorRules.end())
m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; })); m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }));
m_dMonitorRules.push_back(newrule); m_dMonitorRules.push_back(newrule);
@ -593,7 +593,7 @@ void CConfigManager::handleAnimation(const std::string& command, const std::stri
// anim name // anim name
const auto ANIMNAME = curitem; const auto ANIMNAME = curitem;
const auto PANIM = animationConfig.find(ANIMNAME); const auto PANIM = animationConfig.find(ANIMNAME);
if (PANIM == animationConfig.end()) { if (PANIM == animationConfig.end()) {
@ -749,7 +749,7 @@ void CConfigManager::handleUnbind(const std::string& command, const std::string&
} }
bool windowRuleValid(const std::string& RULE) { bool windowRuleValid(const std::string& RULE) {
return !(RULE != "float" return !(RULE != "float"
&& RULE != "tile" && RULE != "tile"
&& RULE.find("opacity") != 0 && RULE.find("opacity") != 0
&& RULE.find("move") != 0 && RULE.find("move") != 0
@ -875,7 +875,7 @@ void CConfigManager::handleDefaultWorkspace(const std::string& command, const st
} }
void CConfigManager::handleSubmap(const std::string& command, const std::string& submap) { void CConfigManager::handleSubmap(const std::string& command, const std::string& submap) {
if (submap == "reset") if (submap == "reset")
m_szCurrentSubmap = ""; m_szCurrentSubmap = "";
else else
m_szCurrentSubmap = submap; m_szCurrentSubmap = submap;
@ -1051,9 +1051,9 @@ void CConfigManager::parseLine(std::string& line) {
if (LASTSEP == std::string::npos || currentCategory.contains("device")) if (LASTSEP == std::string::npos || currentCategory.contains("device"))
currentCategory = ""; currentCategory = "";
else else
currentCategory = currentCategory.substr(0, LASTSEP); currentCategory = currentCategory.substr(0, LASTSEP);
return; return;
} }
@ -1078,7 +1078,7 @@ void CConfigManager::loadConfigLoadVars() {
Debug::log(LOG, "Reloading the config!"); Debug::log(LOG, "Reloading the config!");
parseError = ""; // reset the error parseError = ""; // reset the error
currentCategory = ""; // reset the category currentCategory = ""; // reset the category
// reset all vars before loading // reset all vars before loading
setDefaultVars(); setDefaultVars();
m_dMonitorRules.clear(); m_dMonitorRules.clear();
@ -1107,7 +1107,7 @@ void CConfigManager::loadConfigLoadVars() {
} }
configPaths.push_back(CONFIGPATH); configPaths.push_back(CONFIGPATH);
std::ifstream ifs; std::ifstream ifs;
ifs.open(CONFIGPATH); ifs.open(CONFIGPATH);
@ -1219,7 +1219,7 @@ void CConfigManager::loadConfigLoadVars() {
// Force the compositor to fully re-render all monitors // Force the compositor to fully re-render all monitors
m->forceFullFrames = 2; m->forceFullFrames = 2;
} }
// Reset no monitor reload // Reset no monitor reload
m_bNoMonitorReload = false; m_bNoMonitorReload = false;
} }

View file

@ -17,7 +17,7 @@ std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string result = ""; std::string result = "";
if (format == HyprCtl::FORMAT_JSON) { if (format == HyprCtl::FORMAT_JSON) {
result += "["; result += "[";
for (auto& m : g_pCompositor->m_vMonitors) { for (auto& m : g_pCompositor->m_vMonitors) {
result += getFormat( result += getFormat(
R"#({ R"#({
@ -113,7 +113,7 @@ R"#({
if (w->m_bIsMapped) { if (w->m_bIsMapped) {
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\tpinned: %i\n\n", result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\tpinned: %i\n\n",
w.get(), w->m_szTitle.c_str(), (int)w->m_vRealPosition.vec().x, (int)w->m_vRealPosition.vec().y, (int)w->m_vRealSize.vec().x, (int)w->m_vRealSize.vec().y, w->m_iWorkspaceID, (w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()), (int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w.get()).c_str(), g_pXWaylandManager->getTitle(w.get()).c_str(), w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned); w.get(), w->m_szTitle.c_str(), (int)w->m_vRealPosition.vec().x, (int)w->m_vRealPosition.vec().y, (int)w->m_vRealSize.vec().x, (int)w->m_vRealSize.vec().y, w->m_iWorkspaceID, (w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()), (int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w.get()).c_str(), g_pXWaylandManager->getTitle(w.get()).c_str(), w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned);
} }
} }
} }
@ -214,12 +214,12 @@ R"#("%s": {
"levels": { "levels": {
)#", )#",
escapeJSONStrings(mon->szName).c_str() escapeJSONStrings(mon->szName).c_str()
); );
int layerLevel = 0; int layerLevel = 0;
for (auto& level : mon->m_aLayerSurfaceLists) { for (auto& level : mon->m_aLayerSurfaceLists) {
result += getFormat( result += getFormat(
R"#( R"#(
"%i": [ "%i": [
)#", )#",
layerLevel layerLevel
@ -264,7 +264,7 @@ R"#( {
result.pop_back(); result.pop_back();
result += "\n}\n"; result += "\n}\n";
} else { } else {
for (auto& mon : g_pCompositor->m_vMonitors) { for (auto& mon : g_pCompositor->m_vMonitors) {
result += getFormat("Monitor %s:\n", mon->szName.c_str()); result += getFormat("Monitor %s:\n", mon->szName.c_str());
@ -537,14 +537,14 @@ std::string dispatchKeyword(std::string in) {
Debug::log(LOG, "Hyprctl: keyword %s : %s", COMMAND.c_str(), VALUE.c_str()); Debug::log(LOG, "Hyprctl: keyword %s : %s", COMMAND.c_str(), VALUE.c_str());
if (retval == "") if (retval == "")
return "ok"; return "ok";
return retval; return retval;
} }
std::string reloadRequest(std::string request) { std::string reloadRequest(std::string request) {
const auto REQMODE = request.substr(request.find_last_of(' ') + 1); const auto REQMODE = request.substr(request.find_last_of(' ') + 1);
g_pConfigManager->m_bForceReload = true; g_pConfigManager->m_bForceReload = true;
@ -705,7 +705,7 @@ std::string getReply(std::string request) {
} }
sepIndex++; sepIndex++;
if (c == 'j') if (c == 'j')
format = HyprCtl::FORMAT_JSON; format = HyprCtl::FORMAT_JSON;
} }

View file

@ -58,7 +58,7 @@ void Debug::log(LogLevel level, const char* fmt, ...) {
if (disableTime && !*disableTime) { if (disableTime && !*disableTime) {
auto timet = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); auto timet = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
const auto MILLIS = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() % 1000; const auto MILLIS = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() % 1000;
ofs << std::put_time(std::localtime(&timet), "[%H:%M:%S:"); ofs << std::put_time(std::localtime(&timet), "[%H:%M:%S:");
if (MILLIS > 99) if (MILLIS > 99)

View file

@ -28,7 +28,7 @@
#define PIXMAN_DAMAGE_FOREACH(region) int rectsNum = 0; \ #define PIXMAN_DAMAGE_FOREACH(region) int rectsNum = 0; \
const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \ const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \
for (int i = 0; i < rectsNum; ++i) for (int i = 0; i < rectsNum; ++i)
#define interface class #define interface class
@ -74,4 +74,4 @@
#define GIT_DIRTY "?" #define GIT_DIRTY "?"
#endif #endif
#define SPECIAL_WORKSPACE_ID -99 #define SPECIAL_WORKSPACE_ID -99

View file

@ -67,7 +67,7 @@ namespace Events {
LISTENER(mouseButton); LISTENER(mouseButton);
LISTENER(mouseAxis); LISTENER(mouseAxis);
LISTENER(mouseFrame); LISTENER(mouseFrame);
LISTENER(newInput); LISTENER(newInput);
// Virt Ptr // Virt Ptr
@ -77,7 +77,7 @@ namespace Events {
DYNLISTENFUNC(keyboardKey); DYNLISTENFUNC(keyboardKey);
DYNLISTENFUNC(keyboardMod); DYNLISTENFUNC(keyboardMod);
DYNLISTENFUNC(keyboardDestroy); DYNLISTENFUNC(keyboardDestroy);
DYNLISTENFUNC(commitConstraint); DYNLISTENFUNC(commitConstraint);
LISTENER(newConstraint); LISTENER(newConstraint);
DYNLISTENFUNC(setConstraintRegion); DYNLISTENFUNC(setConstraintRegion);
@ -156,4 +156,4 @@ namespace Events {
LISTENER(holdBegin); LISTENER(holdBegin);
LISTENER(holdEnd); LISTENER(holdEnd);
}; };

View file

@ -244,7 +244,7 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
if (layersurface->layerSurface->current.committed != 0) { if (layersurface->layerSurface->current.committed != 0) {
if (layersurface->layer != layersurface->layerSurface->current.layer) { if (layersurface->layer != layersurface->layerSurface->current.layer) {
for (auto it = PMONITOR->m_aLayerSurfaceLists[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLists[layersurface->layer].end(); it++) { for (auto it = PMONITOR->m_aLayerSurfaceLists[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLists[layersurface->layer].end(); it++) {
if (it->get() == layersurface) { if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].emplace_back(std::move(*it)); PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].emplace_back(std::move(*it));
@ -270,4 +270,4 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, layersurface->layerSurface->surface->current.width, layersurface->layerSurface->surface->current.height}; layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, layersurface->layerSurface->surface->current.width, layersurface->layerSurface->surface->current.height};
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y); g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
} }

View file

@ -87,7 +87,7 @@ void Events::listener_requestDrag(wl_listener* listener, void* data) {
} }
void Events::listener_startDrag(wl_listener* listener, void* data) { void Events::listener_startDrag(wl_listener* listener, void* data) {
if (g_pInputManager->m_sDrag.drag) if (g_pInputManager->m_sDrag.drag)
return; // don't handle multiple drags return; // don't handle multiple drags
@ -167,7 +167,7 @@ void Events::listener_commitDragIcon(void* owner, void* data) {
void Events::listener_InhibitActivate(wl_listener* listener, void* data) { void Events::listener_InhibitActivate(wl_listener* listener, void* data) {
Debug::log(LOG, "Activated exclusive for %x.", g_pCompositor->m_sSeat.exclusiveClient); Debug::log(LOG, "Activated exclusive for %x.", g_pCompositor->m_sSeat.exclusiveClient);
g_pInputManager->refocus(); g_pInputManager->refocus();
g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client; g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client;
} }
@ -195,7 +195,7 @@ void Events::listener_powerMgrSetMode(wl_listener* listener, void* data) {
const auto EVENT = (wlr_output_power_v1_set_mode_event*)data; const auto EVENT = (wlr_output_power_v1_set_mode_event*)data;
wlr_output_enable(EVENT->output, EVENT->mode == 1); wlr_output_enable(EVENT->output, EVENT->mode == 1);
if (!wlr_output_commit(EVENT->output)) if (!wlr_output_commit(EVENT->output))
Debug::log(ERR, "Couldn't set power mode"); Debug::log(ERR, "Couldn't set power mode");
} }
@ -210,4 +210,4 @@ void Events::listener_newTextInput(wl_listener* listener, void* data) {
Debug::log(LOG, "New TextInput added!"); Debug::log(LOG, "New TextInput added!");
g_pInputManager->m_sIMERelay.onNewTextInput((wlr_text_input_v3*)data); g_pInputManager->m_sIMERelay.onNewTextInput((wlr_text_input_v3*)data);
} }

View file

@ -99,7 +99,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
Debug::log(WARN, "Attempted to render frame on inactive session!"); Debug::log(WARN, "Attempted to render frame on inactive session!");
return; // cannot draw on session inactive (different tty) return; // cannot draw on session inactive (different tty)
} }
if (!PMONITOR->m_bEnabled) if (!PMONITOR->m_bEnabled)
return; return;
@ -218,7 +218,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
if (PMONITOR->forceFullFrames > 10) if (PMONITOR->forceFullFrames > 10)
PMONITOR->forceFullFrames = 0; PMONITOR->forceFullFrames = 0;
} }
// TODO: this is getting called with extents being 0,0,0,0 should it be? // TODO: this is getting called with extents being 0,0,0,0 should it be?
// potentially can save on resources. // potentially can save on resources.

View file

@ -120,7 +120,7 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner; SXDGPopup* PPOPUP = (SXDGPopup*)owner;
ASSERT(PPOPUP); ASSERT(PPOPUP);
if (PPOPUP->parentWindow) if (PPOPUP->parentWindow)
Debug::log(LOG, "New popup created from XDG Window popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str()); Debug::log(LOG, "New popup created from XDG Window popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str());
else else
@ -201,4 +201,4 @@ void Events::listener_destroyPopupXDG(void* owner, void* data) {
} }
g_pCompositor->m_vXDGPopups.erase(std::remove_if(g_pCompositor->m_vXDGPopups.begin(), g_pCompositor->m_vXDGPopups.end(), [&](std::unique_ptr<SXDGPopup>& el) { return el.get() == PPOPUP; })); g_pCompositor->m_vXDGPopups.erase(std::remove_if(g_pCompositor->m_vXDGPopups.begin(), g_pCompositor->m_vXDGPopups.end(), [&](std::unique_ptr<SXDGPopup>& el) { return el.get() == PPOPUP; }));
} }

View file

@ -301,7 +301,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (!PWINDOW->m_bIsX11) { if (!PWINDOW->m_bIsX11) {
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_newPopupXDG.initCallback(&PWINDOW->m_uSurface.xdg->events.new_popup, &Events::listener_newPopupXDG, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_newPopupXDG.initCallback(&PWINDOW->m_uSurface.xdg->events.new_popup, &Events::listener_newPopupXDG, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW, "XDG Window Late"); PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW, "XDG Window Late");
@ -313,7 +313,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late"); PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late"); PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late"); PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
if (PWINDOW->m_iX11Type == 2) if (PWINDOW->m_iX11Type == 2)
PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW, "XWayland Window Late"); PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW, "XWayland Window Late");
} }
@ -375,8 +375,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
} }
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y); Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName; auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", getFormat("%x,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())}); g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", getFormat("%x,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
} }
@ -384,7 +384,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner; CWindow* PWINDOW = (CWindow*)owner;
Debug::log(LOG, "Window %x unmapped (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str()); Debug::log(LOG, "Window %x unmapped (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("%x", PWINDOW)}); g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("%x", PWINDOW)});
if (!PWINDOW->m_bIsX11) { if (!PWINDOW->m_bIsX11) {
@ -458,7 +458,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW); Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW);
SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree); SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
PWINDOW->m_pSurfaceTree = nullptr; PWINDOW->m_pSurfaceTree = nullptr;
PWINDOW->m_bFadingOut = true; PWINDOW->m_bFadingOut = true;
@ -475,7 +475,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in. if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in.
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.vec() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.vec() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it
// anims // anims
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, true); g_pAnimationManager->onWindowPostCreateClose(PWINDOW, true);
PWINDOW->m_fAlpha = 0.f; PWINDOW->m_fAlpha = 0.f;
@ -493,7 +493,7 @@ void Events::listener_commitWindow(void* owner, void* data) {
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11)) if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
return; return;
g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y); g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
// Debug::log(LOG, "Window %x committed", PWINDOW); // SPAM! // Debug::log(LOG, "Window %x committed", PWINDOW); // SPAM!
} }
@ -567,7 +567,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
PWINDOW->updateToplevel(); PWINDOW->updateToplevel();
Debug::log(LOG, "Window %x fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen); Debug::log(LOG, "Window %x fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen);
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen); g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen);
} }
@ -645,7 +645,7 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
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) { 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); 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); g_pHyprRenderer->damageWindow(PWINDOW);
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y)); PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y));
@ -725,4 +725,4 @@ void Events::listener_requestResize(void* owner, void* data) {
// ignore // ignore
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg); wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
} }

View file

@ -125,7 +125,7 @@ public:
switch (m_eVarType) { switch (m_eVarType) {
case AVARTYPE_FLOAT: case AVARTYPE_FLOAT:
return m_fValue != m_fGoal; return m_fValue != m_fGoal;
case AVARTYPE_VECTOR: case AVARTYPE_VECTOR:
return m_vValue != m_vGoal; return m_vValue != m_vGoal;
case AVARTYPE_COLOR: case AVARTYPE_COLOR:
return m_cValue != m_cGoal; return m_cValue != m_cGoal;
@ -198,4 +198,4 @@ private:
friend class CAnimationManager; friend class CAnimationManager;
friend class CWorkspace; friend class CWorkspace;
friend struct SLayerSurface; friend struct SLayerSurface;
}; };

View file

@ -23,8 +23,8 @@ public:
CColor operator* (const float& v) const { CColor operator* (const float& v) const {
return CColor(r * v, g * v, b * v, a * v); return CColor(r * v, g * v, b * v, a * v);
} }
bool operator==(const CColor& c2) const { bool operator==(const CColor& c2) const {
return r == c2.r && g == c2.g && b == c2.b && a == c2.a; return r == c2.r && g == c2.g && b == c2.b && a == c2.a;
} }
}; };

View file

@ -65,7 +65,7 @@ std::string absolutePath(const std::string& rawpath, const std::string& currentP
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) { void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
ASSERT(pSignal); ASSERT(pSignal);
ASSERT(pListener); ASSERT(pListener);
wl_signal_add(pSignal, pListener); wl_signal_add(pSignal, pListener);
Debug::log(LOG, "Registered signal for owner %x: %x -> %x (owner: %s)", pOwner, pSignal, pListener, ownerString.c_str()); Debug::log(LOG, "Registered signal for owner %x: %x -> %x (owner: %s)", pOwner, pSignal, pListener, ownerString.c_str());
@ -212,9 +212,9 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
while (remains != 0) { while (remains != 0) {
if (remains < 0) if (remains < 0)
searchID--; searchID--;
else else
searchID++; searchID++;
if (g_pCompositor->workspaceIDOutOfBounds(searchID)){ if (g_pCompositor->workspaceIDOutOfBounds(searchID)){
// means we need to wrap around // means we need to wrap around
int lowestID = 99999; int lowestID = 99999;
@ -233,7 +233,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
if (remains < 0) if (remains < 0)
searchID = highestID; searchID = highestID;
else else
searchID = lowestID; searchID = lowestID;
} }
@ -262,7 +262,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
result = INT_MAX; result = INT_MAX;
} }
outName = std::to_string(result); outName = std::to_string(result);
} }
} }
return result; return result;

View file

@ -31,7 +31,7 @@ void CMonitor::onConnect(bool noRule) {
if (!wlr_output_test(output)) if (!wlr_output_test(output))
continue; continue;
PREFSTATE = mode; PREFSTATE = mode;
break; break;
} }
@ -43,7 +43,7 @@ void CMonitor::onConnect(bool noRule) {
Debug::log(WARN, "No mode found for disabled output %s", output->name); Debug::log(WARN, "No mode found for disabled output %s", output->name);
wlr_output_enable(output, 0); wlr_output_enable(output, 0);
if (!wlr_output_commit(output)) { if (!wlr_output_commit(output)) {
Debug::log(ERR, "Couldn't commit disabled state on output %s", output->name); Debug::log(ERR, "Couldn't commit disabled state on output %s", output->name);
} }
@ -85,7 +85,7 @@ void CMonitor::onConnect(bool noRule) {
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()){ if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()){
g_pCompositor->m_vMonitors.push_back(*m_pThisWrap); g_pCompositor->m_vMonitors.push_back(*m_pThisWrap);
} }
m_bEnabled = true; m_bEnabled = true;
wlr_output_set_scale(output, monitorRule.scale); wlr_output_set_scale(output, monitorRule.scale);
@ -115,9 +115,9 @@ void CMonitor::onConnect(bool noRule) {
if (!pWLRWorkspaceGroupHandle) { if (!pWLRWorkspaceGroupHandle) {
pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr); pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr);
} }
wlr_ext_workspace_group_handle_v1_output_enter(pWLRWorkspaceGroupHandle, output); wlr_ext_workspace_group_handle_v1_output_enter(pWLRWorkspaceGroupHandle, output);
setupDefaultWS(monitorRule); setupDefaultWS(monitorRule);
scale = monitorRule.scale; scale = monitorRule.scale;

View file

@ -43,7 +43,7 @@ public:
// for the special workspace // for the special workspace
bool specialWorkspaceOpen = false; bool specialWorkspaceOpen = false;
// Double-linked list because we need to have constant mem addresses for signals // Double-linked list because we need to have constant mem addresses for signals
// We have to store pointers and use raw new/delete because they might be moved between them // We have to store pointers and use raw new/delete because they might be moved between them
// and I am lazy // and I am lazy
@ -78,4 +78,4 @@ public:
private: private:
void setupDefaultWS(const SMonitorRule&); void setupDefaultWS(const SMonitorRule&);
}; };

View file

@ -193,7 +193,7 @@ struct SDrag {
bool iconMapped = false; bool iconMapped = false;
wlr_drag_icon* dragIcon = nullptr; wlr_drag_icon* dragIcon = nullptr;
Vector2D pos; Vector2D pos;
DYNLISTENER(destroyIcon); DYNLISTENER(destroyIcon);

View file

@ -12,7 +12,7 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
m_iMonitorID = monitorID; m_iMonitorID = monitorID;
m_szName = name; m_szName = name;
m_bIsSpecialWorkspace = special; m_bIsSpecialWorkspace = special;
if (!special) { if (!special) {
m_pWlrHandle = wlr_ext_workspace_handle_v1_create(PMONITOR->pWLRWorkspaceGroupHandle); m_pWlrHandle = wlr_ext_workspace_handle_v1_create(PMONITOR->pWLRWorkspaceGroupHandle);

View file

@ -56,7 +56,7 @@ void CHyprError::createQueued() {
cairo_show_text(CAIRO, current.c_str()); cairo_show_text(CAIRO, current.c_str());
yoffset += FONTSIZE + (FONTSIZE / 10.f); yoffset += FONTSIZE + (FONTSIZE / 10.f);
} }
cairo_surface_flush(CAIROSURFACE); cairo_surface_flush(CAIROSURFACE);
@ -66,12 +66,12 @@ void CHyprError::createQueued() {
glBindTexture(GL_TEXTURE_2D, m_tTexture.m_iTexID); glBindTexture(GL_TEXTURE_2D, m_tTexture.m_iTexID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
#ifndef GLES2 #ifndef GLES2
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
#endif #endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
// delete cairo // delete cairo
@ -114,4 +114,4 @@ void CHyprError::draw() {
void CHyprError::destroy() { void CHyprError::destroy() {
if (m_bIsCreated) if (m_bIsCreated)
m_bQueuedDestroy = true; m_bQueuedDestroy = true;
} }

View file

@ -139,7 +139,7 @@ SDwindleNodeData* CHyprDwindleLayout::getMasterNodeOnWorkspace(const int& id) {
void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool force) { void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool force) {
// Don't set nodes, only windows. // Don't set nodes, only windows.
if (pNode->isNode) if (pNode->isNode)
return; return;
CMonitor* PMONITOR = nullptr; CMonitor* PMONITOR = nullptr;
@ -300,7 +300,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
// happens on reserved area // happens on reserved area
if (!OPENINGON && g_pCompositor->getWindowsOnWorkspace(PNODE->workspaceID) > 0) if (!OPENINGON && g_pCompositor->getWindowsOnWorkspace(PNODE->workspaceID) > 0)
OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace); OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
} else if (*PUSEACTIVE) { } else if (*PUSEACTIVE) {
if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow && g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) { if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow && g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) {
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow); OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow);
@ -370,7 +370,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
return; return;
} }
// If it's not, get the node under our cursor // If it's not, get the node under our cursor
m_lDwindleNodesData.push_back(SDwindleNodeData()); m_lDwindleNodesData.push_back(SDwindleNodeData());
@ -413,7 +413,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
NEWPARENT->children[1] = PNODE; NEWPARENT->children[1] = PNODE;
} }
} }
// and update the previous parent if it exists // and update the previous parent if it exists
if (OPENINGON->pParent) { if (OPENINGON->pParent) {
if (OPENINGON->pParent->children[0] == OPENINGON) { if (OPENINGON->pParent->children[0] == OPENINGON) {
@ -424,7 +424,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
} }
// Update the children // Update the children
if (NEWPARENT->size.x * *PWIDTHMULTIPLIER > NEWPARENT->size.y) { if (NEWPARENT->size.x * *PWIDTHMULTIPLIER > NEWPARENT->size.y) {
// split left/right // split left/right
@ -473,7 +473,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(CWindow* pWindow) {
if (PNODE->groupHead) { if (PNODE->groupHead) {
PNEXT->groupHead = true; PNEXT->groupHead = true;
PNEXT->pParent = PNODE->pParent; PNEXT->pParent = PNODE->pParent;
if (PNODE->pParent) { if (PNODE->pParent) {
if (PNODE->pParent->children[0] == PNODE) { if (PNODE->pParent->children[0] == PNODE) {
PNODE->pParent->children[0] = PNEXT; PNODE->pParent->children[0] = PNEXT;
@ -502,7 +502,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(CWindow* pWindow) {
// means we dissolved the group // means we dissolved the group
recalculateMonitor(PNEXT->pWindow->m_iMonitorID); recalculateMonitor(PNEXT->pWindow->m_iMonitorID);
} }
return; return;
} }
@ -533,7 +533,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(CWindow* pWindow) {
if (PSIBLING->pParent) if (PSIBLING->pParent)
PSIBLING->pParent->recalcSizePosRecursive(); PSIBLING->pParent->recalcSizePosRecursive();
else else
PSIBLING->recalcSizePosRecursive(); PSIBLING->recalcSizePosRecursive();
m_lDwindleNodesData.remove(*PPARENT); m_lDwindleNodesData.remove(*PPARENT);
@ -809,7 +809,7 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
PNODE->pWindow->m_bIsFloating = PHEAD->pWindow->m_bIsFloating; PNODE->pWindow->m_bIsFloating = PHEAD->pWindow->m_bIsFloating;
std::deque<CWindow*> toAddWindows; std::deque<CWindow*> toAddWindows;
const auto PWINDOWNODE = PNODE->pWindow; const auto PWINDOWNODE = PNODE->pWindow;
toAddWindows.push_back(PWINDOWNODE); toAddWindows.push_back(PWINDOWNODE);
@ -821,13 +821,13 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
PWINDOW->m_bHidden = false; PWINDOW->m_bHidden = false;
} }
if (PHEAD->pPreviousGroupMember) if (PHEAD->pPreviousGroupMember)
PHEAD->pPreviousGroupMember->pNextGroupMember = PHEAD->pNextGroupMember; PHEAD->pPreviousGroupMember->pNextGroupMember = PHEAD->pNextGroupMember;
if (PHEAD->pNextGroupMember) if (PHEAD->pNextGroupMember)
PHEAD->pNextGroupMember->pPreviousGroupMember = PHEAD->pPreviousGroupMember; PHEAD->pNextGroupMember->pPreviousGroupMember = PHEAD->pPreviousGroupMember;
PHEAD->pPreviousGroupMember = nullptr; PHEAD->pPreviousGroupMember = nullptr;
PHEAD->pNextGroupMember = nullptr; PHEAD->pNextGroupMember = nullptr;
@ -921,7 +921,7 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
} }
std::deque<CWindow*> CHyprDwindleLayout::getGroupMembers(CWindow* pWindow) { std::deque<CWindow*> CHyprDwindleLayout::getGroupMembers(CWindow* pWindow) {
std::deque<CWindow*> result; std::deque<CWindow*> result;
if (!g_pCompositor->windowExists(pWindow)) if (!g_pCompositor->windowExists(pWindow))
@ -985,7 +985,7 @@ void CHyprDwindleLayout::switchGroupWindow(CWindow* pWindow, bool forward, CWind
g_pCompositor->focusWindow(pNewNode->pWindow); g_pCompositor->focusWindow(pNewNode->pWindow);
pNewNode->pWindow->m_bIsFloating = PNODE->pWindow->m_bIsFloating; pNewNode->pWindow->m_bIsFloating = PNODE->pWindow->m_bIsFloating;
if (PNODE->pWindow->m_bIsFullscreen) { if (PNODE->pWindow->m_bIsFullscreen) {
PNODE->pWindow->m_bHidden = false; PNODE->pWindow->m_bHidden = false;
g_pCompositor->setWindowFullscreen(PNODE->pWindow, false, PWORKSPACE->m_efFullscreenMode); g_pCompositor->setWindowFullscreen(PNODE->pWindow, false, PWORKSPACE->m_efFullscreenMode);
@ -1104,7 +1104,7 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
// recalc the workspace // recalc the workspace
getMasterNodeOnWorkspace(PNODE->workspaceID)->recalcSizePosRecursive(); getMasterNodeOnWorkspace(PNODE->workspaceID)->recalcSizePosRecursive();
if (PNODE2->workspaceID != PNODE->workspaceID) { if (PNODE2->workspaceID != PNODE->workspaceID) {
getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive(); getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive();
} }
@ -1150,7 +1150,7 @@ std::any CHyprDwindleLayout::layoutMessage(SLayoutMessageHeader header, std::str
auto res = getGroupMembers(header.pWindow ? header.pWindow : g_pCompositor->m_pLastWindow); auto res = getGroupMembers(header.pWindow ? header.pWindow : g_pCompositor->m_pLastWindow);
return res; return res;
} }
return ""; return "";
} }

View file

@ -50,7 +50,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
pWindow->m_bHidden = true; pWindow->m_bHidden = true;
return; return;
} }
// reject any windows with size <= 5x5 // reject any windows with size <= 5x5
if (pWindow->m_vRealSize.goalv().x <= 5 || pWindow->m_vRealSize.goalv().y <= 5) { if (pWindow->m_vRealSize.goalv().x <= 5 || pWindow->m_vRealSize.goalv().y <= 5) {
pWindow->m_vRealSize = PMONITOR->vecSize / 2.f; pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
@ -207,7 +207,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(m_vBeginDragSizeXY + DELTA); DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(m_vBeginDragSizeXY + DELTA);
DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(Vector2D(std::clamp(DRAGGINGWINDOW->m_vRealSize.vec().x, (double)20, (double)MAXSIZE.x), std::clamp(DRAGGINGWINDOW->m_vRealSize.vec().y, (double)20, (double)MAXSIZE.y))); DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(Vector2D(std::clamp(DRAGGINGWINDOW->m_vRealSize.vec().x, (double)20, (double)MAXSIZE.x), std::clamp(DRAGGINGWINDOW->m_vRealSize.vec().y, (double)20, (double)MAXSIZE.y)));
} }
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv()); g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv());
} else { } else {
resizeActiveWindow(TICKDELTA, DRAGGINGWINDOW); resizeActiveWindow(TICKDELTA, DRAGGINGWINDOW);
@ -223,7 +223,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
if (PMONITOR) { if (PMONITOR) {
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID; DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace); DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace);
DRAGGINGWINDOW->updateToplevel(); DRAGGINGWINDOW->updateToplevel();
} }
@ -302,4 +302,4 @@ void IHyprLayout::moveActiveWindow(const Vector2D& delta, CWindow* pWindow) {
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.goalv() + delta; PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.goalv() + delta;
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);
} }

View file

@ -79,7 +79,7 @@ public:
*/ */
virtual void onEndDragWindow(); virtual void onEndDragWindow();
/* /*
Called whenever the mouse moves, should the layout want to Called whenever the mouse moves, should the layout want to
do anything with it. do anything with it.
Useful for dragging. Useful for dragging.
*/ */
@ -94,19 +94,19 @@ public:
/* /*
Called when a dispatcher requests a custom message Called when a dispatcher requests a custom message
The layout is free to ignore. The layout is free to ignore.
std::any is the reply. Can be empty. std::any is the reply. Can be empty.
*/ */
virtual std::any layoutMessage(SLayoutMessageHeader, std::string) = 0; virtual std::any layoutMessage(SLayoutMessageHeader, std::string) = 0;
/* /*
Required to be handled, but may return just SWindowRenderLayoutHints() Required to be handled, but may return just SWindowRenderLayoutHints()
Called when the renderer requests any special draw flags for Called when the renderer requests any special draw flags for
a specific window, e.g. border color for groups. a specific window, e.g. border color for groups.
*/ */
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*) = 0; virtual SWindowRenderLayoutHints requestRenderHints(CWindow*) = 0;
/* /*
Called when the user requests two windows to be swapped places. Called when the user requests two windows to be swapped places.
The layout is free to ignore. The layout is free to ignore.
*/ */
@ -128,4 +128,4 @@ private:
Vector2D m_vLastDragXY; Vector2D m_vLastDragXY;
Vector2D m_vBeginDragPositionXY; Vector2D m_vBeginDragPositionXY;
Vector2D m_vBeginDragSizeXY; Vector2D m_vBeginDragSizeXY;
}; };

View file

@ -56,7 +56,7 @@ int main(int argc, char** argv) {
// let's init the compositor. // let's init the compositor.
// it initializes basic Wayland stuff in the constructor. // it initializes basic Wayland stuff in the constructor.
g_pCompositor = std::make_unique<CCompositor>(); g_pCompositor = std::make_unique<CCompositor>();
g_pCompositor->explicitConfigPath = configPath; g_pCompositor->explicitConfigPath = configPath;
Debug::log(LOG, "Hyprland init finished."); Debug::log(LOG, "Hyprland init finished.");

View file

@ -167,7 +167,7 @@ void CAnimationManager::tick() {
} }
case AVARDAMAGE_BORDER: { case AVARDAMAGE_BORDER: {
RASSERT(PWINDOW, "Tried to AVARDAMAGE_BORDER a non-window AVAR!"); RASSERT(PWINDOW, "Tried to AVARDAMAGE_BORDER a non-window AVAR!");
// damage only the border. // damage only the border.
static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue;
const auto ROUNDINGSIZE = *PROUNDING + 1; const auto ROUNDINGSIZE = *PROUNDING + 1;
@ -222,7 +222,7 @@ void CAnimationManager::tick() {
break; break;
} }
} }
// set size and pos if valid, but only if damage policy entire (dont if border for example) // set size and pos if valid, but only if damage policy entire (dont if border for example)
if (g_pCompositor->windowValidMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && PWINDOW->m_iX11Type != 2) if (g_pCompositor->windowValidMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && PWINDOW->m_iX11Type != 2)
@ -438,4 +438,4 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
} }
return ""; return "";
} }

View file

@ -243,7 +243,7 @@ bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) {
bool found = false; bool found = false;
if (e->source == WLR_AXIS_SOURCE_WHEEL && e->orientation == WLR_AXIS_ORIENTATION_VERTICAL) { if (e->source == WLR_AXIS_SOURCE_WHEEL && e->orientation == WLR_AXIS_ORIENTATION_VERTICAL) {
if (e->delta < 0) { if (e->delta < 0) {
found = g_pKeybindManager->handleKeybinds(MODS, "mouse_down", 0, 0, true, 0); found = g_pKeybindManager->handleKeybinds(MODS, "mouse_down", 0, 0, true, 0);
} else { } else {
found = g_pKeybindManager->handleKeybinds(MODS, "mouse_up", 0, 0, true, 0); found = g_pKeybindManager->handleKeybinds(MODS, "mouse_up", 0, 0, true, 0);
@ -391,7 +391,7 @@ void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const int&
for (auto& pk : m_dPressedKeysyms) { for (auto& pk : m_dPressedKeysyms) {
if ((pk == KBKEY || pk == KBKEYUPPER)) { if ((pk == KBKEY || pk == KBKEYUPPER)) {
shadow = true; shadow = true;
if (pk == doesntHave && doesntHave != 0) { if (pk == doesntHave && doesntHave != 0) {
shadow = false; shadow = false;
break; break;
@ -609,7 +609,7 @@ void CKeybindManager::changeworkspace(std::string args) {
return; return;
} }
// Workspace_back_and_forth being enabled means that an attempt to switch to // Workspace_back_and_forth being enabled means that an attempt to switch to
// the current workspace will instead switch to the previous. // the current workspace will instead switch to the previous.
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
static auto *const PBACKANDFORTH = &g_pConfigManager->getConfigValuePtr("binds:workspace_back_and_forth")->intValue; static auto *const PBACKANDFORTH = &g_pConfigManager->getConfigValuePtr("binds:workspace_back_and_forth")->intValue;
@ -624,11 +624,11 @@ void CKeybindManager::changeworkspace(std::string args) {
static auto *const PALLOWWORKSPACECYCLES = &g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles")->intValue; static auto *const PALLOWWORKSPACECYCLES = &g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles")->intValue;
if (!*PALLOWWORKSPACECYCLES) if (!*PALLOWWORKSPACECYCLES)
PCURRENTWORKSPACE->m_iPrevWorkspaceID = -1; PCURRENTWORKSPACE->m_iPrevWorkspaceID = -1;
} else if (PCURRENTWORKSPACE->m_iID == workspaceToChangeTo && !internal) } else if (PCURRENTWORKSPACE->m_iID == workspaceToChangeTo && !internal)
return; return;
// remove constraints // remove constraints
g_pInputManager->unconstrainMouse(); g_pInputManager->unconstrainMouse();
// if it's not internal, we will unfocus to prevent stuck focus // if it's not internal, we will unfocus to prevent stuck focus
@ -699,7 +699,7 @@ void CKeybindManager::changeworkspace(std::string args) {
// warp and focus // warp and focus
if (anotherMonitor) if (anotherMonitor)
g_pCompositor->warpCursorTo(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f); g_pCompositor->warpCursorTo(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f);
g_pCompositor->focusWindow(PWINDOW, g_pXWaylandManager->getWindowSurface(PWINDOW)); g_pCompositor->focusWindow(PWINDOW, g_pXWaylandManager->getWindowSurface(PWINDOW));
if (g_pCompositor->cursorOnReservedArea()) // fix focus on bars etc if (g_pCompositor->cursorOnReservedArea()) // fix focus on bars etc
@ -853,7 +853,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
// Hack: So that the layout doesnt find our window at the cursor // Hack: So that the layout doesnt find our window at the cursor
PWINDOW->m_vPosition = Vector2D(-42069, -42069); PWINDOW->m_vPosition = Vector2D(-42069, -42069);
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW); g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
// and restore it // and restore it
@ -997,7 +997,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
return; return;
} }
const auto PWINDOWTOCHANGETO = g_pCompositor->getWindowInDirection(PLASTWINDOW, arg); const auto PWINDOWTOCHANGETO = g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
if (PWINDOWTOCHANGETO) { if (PWINDOWTOCHANGETO) {
@ -1147,7 +1147,7 @@ void CKeybindManager::moveCursorToCorner(std::string arg) {
} }
void CKeybindManager::workspaceOpt(std::string args) { void CKeybindManager::workspaceOpt(std::string args) {
// current workspace // current workspace
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
@ -1484,7 +1484,7 @@ void CKeybindManager::pass(std::string regexp) {
else else
wlr_seat_pointer_enter(g_pCompositor->m_sSeat.seat, g_pXWaylandManager->getWindowSurface(PWINDOW), 1, 1); wlr_seat_pointer_enter(g_pCompositor->m_sSeat.seat, g_pXWaylandManager->getWindowSurface(PWINDOW), 1, 1);
} }
wlr_keyboard_modifiers kbmods = {g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0}; wlr_keyboard_modifiers kbmods = {g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0};
wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &kbmods); wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &kbmods);
@ -1507,7 +1507,7 @@ void CKeybindManager::pass(std::string regexp) {
} else { } else {
wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WLR_BUTTON_PRESSED); wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WLR_BUTTON_PRESSED);
wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WLR_BUTTON_RELEASED); wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WLR_BUTTON_RELEASED);
} }
} }
if (XWTOXW) if (XWTOXW)
@ -1553,7 +1553,7 @@ void CKeybindManager::dpms(std::string arg) {
for (auto& m : g_pCompositor->m_vMonitors) { for (auto& m : g_pCompositor->m_vMonitors) {
wlr_output_enable(m->output, enable); wlr_output_enable(m->output, enable);
if (!wlr_output_commit(m->output)) { if (!wlr_output_commit(m->output)) {
Debug::log(ERR, "Couldn't commit output %s", m->szName.c_str()); Debug::log(ERR, "Couldn't commit output %s", m->szName.c_str());
} }

View file

@ -38,7 +38,7 @@ public:
bool onKeyEvent(wlr_keyboard_key_event*, SKeyboard*); bool onKeyEvent(wlr_keyboard_key_event*, SKeyboard*);
bool onAxisEvent(wlr_pointer_axis_event*); bool onAxisEvent(wlr_pointer_axis_event*);
bool onMouseEvent(wlr_pointer_button_event*); bool onMouseEvent(wlr_pointer_button_event*);
void addKeybind(SKeybind); void addKeybind(SKeybind);
void removeKeybind(uint32_t, const std::string&); void removeKeybind(uint32_t, const std::string&);
uint32_t stringToModMask(std::string); uint32_t stringToModMask(std::string);

View file

@ -2,7 +2,7 @@
IHyprLayout* CLayoutManager::getCurrentLayout() { IHyprLayout* CLayoutManager::getCurrentLayout() {
switch (m_iCurrentLayoutID) { switch (m_iCurrentLayoutID) {
case DWINDLE: case DWINDLE:
return &m_cDwindleLayout; return &m_cDwindleLayout;
case MASTER: case MASTER:
return &m_cMasterLayout; return &m_cMasterLayout;
@ -28,4 +28,4 @@ void CLayoutManager::switchToLayout(std::string layout) {
} else { } else {
Debug::log(ERR, "Unknown layout %s!", layout.c_str()); Debug::log(ERR, "Unknown layout %s!", layout.c_str());
} }
} }

View file

@ -46,7 +46,7 @@ void CHyprXWaylandManager::activateSurface(wlr_surface* pSurface, bool activate)
if (activate) if (activate)
wlr_xwayland_surface_restack(wlr_xwayland_surface_from_wlr_surface(pSurface), NULL, XCB_STACK_MODE_ABOVE); wlr_xwayland_surface_restack(wlr_xwayland_surface_from_wlr_surface(pSurface), NULL, XCB_STACK_MODE_ABOVE);
} }
} }
void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) { void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
@ -166,7 +166,7 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
{ {
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"]) if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"])
pWindow->m_bX11ShouldntFocus = true; pWindow->m_bX11ShouldntFocus = true;
pWindow->m_bNoInitialFocus = true; pWindow->m_bNoInitialFocus = true;
return true; return true;
} }
@ -196,7 +196,7 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
return true; return true;
} else { } else {
const auto PSTATE = &pWindow->m_uSurface.xdg->toplevel->current; const auto PSTATE = &pWindow->m_uSurface.xdg->toplevel->current;
if ((PSTATE->min_width != 0 && PSTATE->min_height != 0 && (PSTATE->min_width == PSTATE->max_width || PSTATE->min_height == PSTATE->max_height)) || pWindow->m_uSurface.xdg->toplevel->parent) if ((PSTATE->min_width != 0 && PSTATE->min_height != 0 && (PSTATE->min_width == PSTATE->max_width || PSTATE->min_height == PSTATE->max_height)) || pWindow->m_uSurface.xdg->toplevel->parent)
return true; return true;
} }
@ -207,7 +207,7 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow) {
void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D& pos) { void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D& pos) {
if (!g_pCompositor->windowValidMapped(pWindow)) if (!g_pCompositor->windowValidMapped(pWindow))
return; return;
if (pWindow->m_bIsX11) { if (pWindow->m_bIsX11) {
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.vec().x, pWindow->m_vRealSize.vec().y); wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.vec().x, pWindow->m_vRealSize.vec().y);
} }
@ -222,7 +222,7 @@ void CHyprXWaylandManager::checkBorders(CWindow* pWindow) {
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] ||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) { pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) {
pWindow->m_bX11DoesntWantBorders = true; pWindow->m_bX11DoesntWantBorders = true;
return; return;
} }

View file

@ -288,7 +288,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (*PFOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_pLastWindow) if (*PFOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_pLastWindow)
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y); wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
m_bLastFocusOnLS = false; m_bLastFocusOnLS = false;
return; // don't enter any new surfaces return; // don't enter any new surfaces
} else { } else {
@ -372,7 +372,7 @@ void CInputManager::setClickMode(eClickBehaviorMode mode) {
break; break;
default: default:
break; break;
} }
} }
void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) { void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
@ -467,11 +467,11 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
const auto PKEYBOARD = (SKeyboard*)owner; const auto PKEYBOARD = (SKeyboard*)owner;
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," +getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," +getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent
}, PNEWKEYBOARD, "Keyboard"); }, PNEWKEYBOARD, "Keyboard");
disableAllKeyboards(false); disableAllKeyboards(false);
m_pActiveKeyboard = PNEWKEYBOARD; m_pActiveKeyboard = PNEWKEYBOARD;
PNEWKEYBOARD->active = true; PNEWKEYBOARD->active = true;
@ -502,7 +502,7 @@ void CInputManager::newVirtualKeyboard(wlr_input_device* keyboard) {
const auto PKEYBOARD = (SKeyboard*)owner; const auto PKEYBOARD = (SKeyboard*)owner;
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," +getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEYBOARD->name + "," +getActiveLayoutForKeyboard(PKEYBOARD)}, true); // force as this should ALWAYS be sent
}, PNEWKEYBOARD, "Keyboard"); }, PNEWKEYBOARD, "Keyboard");
disableAllKeyboards(true); disableAllKeyboards(true);
@ -599,7 +599,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
} else { } else {
KEYMAP = xkb_keymap_new_from_file(CONTEXT, fopen(path.c_str(), "r"), XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); KEYMAP = xkb_keymap_new_from_file(CONTEXT, fopen(path.c_str(), "r"), XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS);
} }
} }
if (!KEYMAP) { if (!KEYMAP) {
KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
@ -642,7 +642,7 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->name + "," +getActiveLayoutForKeyboard(pKeyboard)}, true); // force as this should ALWAYS be sent g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->name + "," +getActiveLayoutForKeyboard(pKeyboard)}, true); // force as this should ALWAYS be sent
Debug::log(LOG, "Set the keyboard layout to %s and variant to %s for keyboard \"%s\"", rules.layout, rules.variant, pKeyboard->keyboard->name); Debug::log(LOG, "Set the keyboard layout to %s and variant to %s for keyboard \"%s\"", rules.layout, rules.variant, pKeyboard->keyboard->name);
} }
void CInputManager::newMouse(wlr_input_device* mouse, bool virt) { void CInputManager::newMouse(wlr_input_device* mouse, bool virt) {
m_lMice.emplace_back(); m_lMice.emplace_back();
@ -879,7 +879,7 @@ void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* co
} }
} }
} }
wlr_pointer_constraint_v1_send_deactivated(pMouse->currentConstraint); wlr_pointer_constraint_v1_send_deactivated(pMouse->currentConstraint);
} }
@ -969,7 +969,7 @@ std::string CInputManager::getActiveLayoutForKeyboard(SKeyboard* pKeyboard) {
if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE)) { if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE)) {
const auto LAYOUTNAME = xkb_keymap_layout_get_name(KEYMAP, i); const auto LAYOUTNAME = xkb_keymap_layout_get_name(KEYMAP, i);
if (LAYOUTNAME) if (LAYOUTNAME)
return std::string(LAYOUTNAME); return std::string(LAYOUTNAME);
return "error"; return "error";
} }

View file

@ -29,7 +29,7 @@ public:
void onMouseMoved(wlr_pointer_motion_event*); void onMouseMoved(wlr_pointer_motion_event*);
void onMouseWarp(wlr_pointer_motion_absolute_event*); void onMouseWarp(wlr_pointer_motion_absolute_event*);
void onMouseButton(wlr_pointer_button_event*); void onMouseButton(wlr_pointer_button_event*);
void onMouseWheel(wlr_pointer_axis_event*); void onMouseWheel(wlr_pointer_axis_event*);
void onKeyboardKey(wlr_keyboard_key_event*, SKeyboard*); void onKeyboardKey(wlr_keyboard_key_event*, SKeyboard*);
void onKeyboardMod(void*, SKeyboard*); void onKeyboardMod(void*, SKeyboard*);
@ -136,4 +136,4 @@ private:
void applyConfigToKeyboard(SKeyboard*); void applyConfigToKeyboard(SKeyboard*);
}; };
inline std::unique_ptr<CInputManager> g_pInputManager; inline std::unique_ptr<CInputManager> g_pInputManager;

View file

@ -97,7 +97,7 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
}, this, "IMERelay"); }, this, "IMERelay");
hyprListener_IMENewPopup.initCallback(&m_pWLRIME->events.new_popup_surface, [&](void* owner, void* data) { hyprListener_IMENewPopup.initCallback(&m_pWLRIME->events.new_popup_surface, [&](void* owner, void* data) {
const auto PNEWPOPUP = &m_lIMEPopups.emplace_back(); const auto PNEWPOPUP = &m_lIMEPopups.emplace_back();
PNEWPOPUP->pSurface = (wlr_input_popup_surface_v2*)data; PNEWPOPUP->pSurface = (wlr_input_popup_surface_v2*)data;
@ -120,7 +120,7 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
} }
void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) { void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
if (!pPopup->pSurface->mapped) if (!pPopup->pSurface->mapped)
return; return;
// damage last known pos & size // damage last known pos & size
@ -404,7 +404,7 @@ void CInputMethodRelay::onKeyboardFocus(wlr_surface* pSurface) {
for (auto& ti : m_lTextInputs) { for (auto& ti : m_lTextInputs) {
if (ti.pPendingSurface) { if (ti.pPendingSurface) {
if (pSurface != ti.pPendingSurface) if (pSurface != ti.pPendingSurface)
setPendingSurface(&ti, nullptr); setPendingSurface(&ti, nullptr);
} else if (ti.pWlrInput->focused_surface) { } else if (ti.pWlrInput->focused_surface) {
@ -446,4 +446,4 @@ void CInputMethodRelay::setPendingSurface(STextInput* pInput, wlr_surface* pSurf
} else { } else {
pInput->hyprListener_pendingSurfaceDestroy.removeCallback(); pInput->hyprListener_pendingSurfaceDestroy.removeCallback();
} }
} }

View file

@ -66,7 +66,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
if (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_SLIDER) if (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_SLIDER)
wlr_tablet_v2_tablet_tool_notify_slider(PTOOL->wlrTabletToolV2, EVENT->slider); wlr_tablet_v2_tablet_tool_notify_slider(PTOOL->wlrTabletToolV2, EVENT->slider);
if (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_WHEEL) if (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_WHEEL)
wlr_tablet_v2_tablet_tool_notify_wheel(PTOOL->wlrTabletToolV2, EVENT->wheel_delta, 0); wlr_tablet_v2_tablet_tool_notify_wheel(PTOOL->wlrTabletToolV2, EVENT->wheel_delta, 0);
if (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_TILT_X) if (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_TILT_X)
@ -95,7 +95,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
else { else {
wlr_send_tablet_v2_tablet_tool_up(PTOOL->wlrTabletToolV2); wlr_send_tablet_v2_tablet_tool_up(PTOOL->wlrTabletToolV2);
} }
}, PNEWTABLET, "Tablet"); }, PNEWTABLET, "Tablet");
PNEWTABLET->hyprListener_Button.initCallback(&wlr_tablet_from_input_device(pDevice)->events.button, [](void* owner, void* data) { PNEWTABLET->hyprListener_Button.initCallback(&wlr_tablet_from_input_device(pDevice)->events.button, [](void* owner, void* data) {
@ -104,7 +104,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
const auto PTOOL = g_pInputManager->ensureTabletToolPresent(EVENT->tool); const auto PTOOL = g_pInputManager->ensureTabletToolPresent(EVENT->tool);
wlr_tablet_v2_tablet_tool_notify_button(PTOOL->wlrTabletToolV2, (zwp_tablet_pad_v2_button_state)EVENT->button, (zwp_tablet_pad_v2_button_state)EVENT->state); wlr_tablet_v2_tablet_tool_notify_button(PTOOL->wlrTabletToolV2, (zwp_tablet_pad_v2_button_state)EVENT->button, (zwp_tablet_pad_v2_button_state)EVENT->state);
}, PNEWTABLET, "Tablet"); }, PNEWTABLET, "Tablet");
PNEWTABLET->hyprListener_Proximity.initCallback(&wlr_tablet_from_input_device(pDevice)->events.proximity, [](void* owner, void* data) { PNEWTABLET->hyprListener_Proximity.initCallback(&wlr_tablet_from_input_device(pDevice)->events.proximity, [](void* owner, void* data) {
@ -120,13 +120,13 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
wlr_tablet_v2_tablet_tool_notify_proximity_out(PTOOL->wlrTabletToolV2); wlr_tablet_v2_tablet_tool_notify_proximity_out(PTOOL->wlrTabletToolV2);
PTOOL->pSurface = nullptr; PTOOL->pSurface = nullptr;
} }
} else { } else {
PTOOL->active = true; PTOOL->active = true;
g_pInputManager->refocus(); g_pInputManager->refocus();
g_pInputManager->focusTablet(PTAB, EVENT->tool); g_pInputManager->focusTablet(PTAB, EVENT->tool);
} }
}, PNEWTABLET, "Tablet"); }, PNEWTABLET, "Tablet");
} }

View file

@ -4,7 +4,7 @@
bool CFramebuffer::alloc(int w, int h) { bool CFramebuffer::alloc(int w, int h) {
bool firstAlloc = false; bool firstAlloc = false;
RASSERT((w > 1 && h > 1), "cannot alloc a FB with negative / zero size! (attempted %ix%i)", w, h); RASSERT((w > 1 && h > 1), "cannot alloc a FB with negative / zero size! (attempted %ix%i)", w, h);
if (m_iFb == (uint32_t)-1) { if (m_iFb == (uint32_t)-1) {
firstAlloc = true; firstAlloc = true;
glGenFramebuffers(1, &m_iFb); glGenFramebuffers(1, &m_iFb);
@ -78,4 +78,4 @@ void CFramebuffer::release() {
CFramebuffer::~CFramebuffer() { CFramebuffer::~CFramebuffer() {
release(); release();
} }

View file

@ -517,7 +517,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
pixman_region32_copy(&damage, originalDamage); pixman_region32_copy(&damage, originalDamage);
wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y); wlr_region_transform(&damage, &damage, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
wlr_region_expand(&damage, &damage, pow(2, *PBLURPASSES) * *PBLURSIZE); wlr_region_expand(&damage, &damage, pow(2, *PBLURPASSES) * *PBLURSIZE);
// helper // helper
const auto PMIRRORFB = &m_RenderData.pCurrentMonData->mirrorFB; const auto PMIRRORFB = &m_RenderData.pCurrentMonData->mirrorFB;
const auto PMIRRORSWAPFB = &m_RenderData.pCurrentMonData->mirrorSwapFB; const auto PMIRRORSWAPFB = &m_RenderData.pCurrentMonData->mirrorSwapFB;
@ -581,7 +581,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
pixman_region32_t tempDamage; pixman_region32_t tempDamage;
pixman_region32_init(&tempDamage); pixman_region32_init(&tempDamage);
wlr_region_scale(&tempDamage, &damage, 1.f / 2.f); // when DOWNscaling, we make the region twice as small because it's the TARGET wlr_region_scale(&tempDamage, &damage, 1.f / 2.f); // when DOWNscaling, we make the region twice as small because it's the TARGET
drawPass(&m_RenderData.pCurrentMonData->m_shBLUR1, &tempDamage); drawPass(&m_RenderData.pCurrentMonData->m_shBLUR1, &tempDamage);
// and draw // and draw
@ -663,7 +663,7 @@ void CHyprOpenGLImpl::preWindowPass() {
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_iWorkspaceID == m_RenderData.pMonitor->activeWorkspace && !w->m_bHidden && w->m_bIsMapped && !w->m_bIsFloating) { if (w->m_iWorkspaceID == m_RenderData.pMonitor->activeWorkspace && !w->m_bHidden && w->m_bIsMapped && !w->m_bIsFloating) {
hasWindows = true; hasWindows = true;
break; break;
} }
} }
@ -1116,7 +1116,7 @@ void CHyprOpenGLImpl::renderMirrored() {
void CHyprOpenGLImpl::renderSplash(cairo_t *const CAIRO, cairo_surface_t *const CAIROSURFACE) { void CHyprOpenGLImpl::renderSplash(cairo_t *const CAIRO, cairo_surface_t *const CAIROSURFACE) {
cairo_select_font_face(CAIRO, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_select_font_face(CAIRO, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
const auto FONTSIZE = (int)(m_RenderData.pMonitor->vecPixelSize.y / 76); const auto FONTSIZE = (int)(m_RenderData.pMonitor->vecPixelSize.y / 76);
cairo_set_font_size(CAIRO, FONTSIZE); cairo_set_font_size(CAIRO, FONTSIZE);
cairo_set_source_rgba(CAIRO, 1.f, 1.f, 1.f, 0.32f); cairo_set_source_rgba(CAIRO, 1.f, 1.f, 1.f, 0.32f);

View file

@ -16,7 +16,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, RDATA->w, RDATA->h}; windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, RDATA->w, RDATA->h};
else // here we clamp to 2, these might be some tiny specks else // here we clamp to 2, these might be some tiny specks
windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, std::clamp(surface->current.width, 2, 1337420), std::clamp(surface->current.height, 2, 1337420)}; windowBox = {(int)outputX + RDATA->x + x, (int)outputY + RDATA->y + y, std::clamp(surface->current.width, 2, 1337420), std::clamp(surface->current.height, 2, 1337420)};
if (RDATA->squishOversized) { if (RDATA->squishOversized) {
if (x + windowBox.width > RDATA->w) if (x + windowBox.width > RDATA->w)
windowBox.width = RDATA->w - x; windowBox.width = RDATA->w - x;
@ -26,7 +26,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
if (RDATA->pWindow) if (RDATA->pWindow)
g_pHyprRenderer->calculateUVForWindowSurface(RDATA->pWindow, surface, RDATA->squishOversized); g_pHyprRenderer->calculateUVForWindowSurface(RDATA->pWindow, surface, RDATA->squishOversized);
scaleBox(&windowBox, RDATA->output->scale); scaleBox(&windowBox, RDATA->output->scale);
static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; static auto *const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue;
@ -219,7 +219,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
g_pHyprOpenGL->renderSnapshot(&pWindow); g_pHyprOpenGL->renderSnapshot(&pWindow);
return; return;
} }
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec()); const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec());
static const auto PNOFLOATINGBORDERS = &g_pConfigManager->getConfigValuePtr("general:no_border_on_floating")->intValue; static const auto PNOFLOATINGBORDERS = &g_pConfigManager->getConfigValuePtr("general:no_border_on_floating")->intValue;
@ -407,7 +407,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_bHidden && !w->m_bIsMapped && !w->m_bFadingOut) if (w->m_bHidden && !w->m_bIsMapped && !w->m_bFadingOut)
continue; continue;
if (w->m_iWorkspaceID != SPECIAL_WORKSPACE_ID) if (w->m_iWorkspaceID != SPECIAL_WORKSPACE_ID)
continue; continue;
@ -1017,7 +1017,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
float currentRefresh = 0; float currentRefresh = 0;
bool success = false; bool success = false;
//(-1,-1) indicates a preference to refreshrate over resolution, (-1,-2) preference to resolution //(-1,-1) indicates a preference to refreshrate over resolution, (-1,-2) preference to resolution
if(pMonitorRule->resolution == Vector2D(-1,-1)) { if(pMonitorRule->resolution == Vector2D(-1,-1)) {
wl_list_for_each(mode, &pMonitor->output->modes, link) { wl_list_for_each(mode, &pMonitor->output->modes, link) {
if( ( mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= ( currentRefresh - 1000.f ) ) || mode->refresh > ( currentRefresh + 3000.f ) ) { if( ( mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= ( currentRefresh - 1000.f ) ) || mode->refresh > ( currentRefresh + 3000.f ) ) {
@ -1048,7 +1048,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
Debug::log(LOG, "Monitor %s: REJECTED mode: %ix%i@%2f! Falling back to preferred.", Debug::log(LOG, "Monitor %s: REJECTED mode: %ix%i@%2f! Falling back to preferred.",
pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate,
mode->width, mode->height, mode->refresh / 1000.f); mode->width, mode->height, mode->refresh / 1000.f);
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output); const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
if (!PREFERREDMODE) { if (!PREFERREDMODE) {
@ -1116,7 +1116,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
Debug::log(LOG, "Setting preferred mode for %s", pMonitor->output->name); Debug::log(LOG, "Setting preferred mode for %s", pMonitor->output->name);
} }
} }
wlr_output_set_transform(pMonitor->output, pMonitorRule->transform); wlr_output_set_transform(pMonitor->output, pMonitorRule->transform);
pMonitor->transform = pMonitorRule->transform; pMonitor->transform = pMonitorRule->transform;

View file

@ -90,7 +90,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
// draw the shadow // draw the shadow
wlr_box fullBox = {m_vLastWindowPos.x - m_seExtents.topLeft.x + 2, m_vLastWindowPos.y - m_seExtents.topLeft.y + 2, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x - 4, m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y - 4}; wlr_box fullBox = {m_vLastWindowPos.x - m_seExtents.topLeft.x + 2, m_vLastWindowPos.y - m_seExtents.topLeft.y + 2, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x - 4, m_vLastWindowSize.y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y - 4};
fullBox.x -= pMonitor->vecPosition.x; fullBox.x -= pMonitor->vecPosition.x;
fullBox.y -= pMonitor->vecPosition.y; fullBox.y -= pMonitor->vecPosition.y;
@ -111,7 +111,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
wlr_box windowBox = {m_vLastWindowPos.x - pMonitor->vecPosition.x, m_vLastWindowPos.y - pMonitor->vecPosition.y, m_vLastWindowSize.x, m_vLastWindowSize.y}; wlr_box windowBox = {m_vLastWindowPos.x - pMonitor->vecPosition.x, m_vLastWindowPos.y - pMonitor->vecPosition.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
scaleBox(&windowBox, pMonitor->scale); scaleBox(&windowBox, pMonitor->scale);
if (windowBox.width < 1 || windowBox.height < 1) { if (windowBox.width < 1 || windowBox.height < 1) {
glClearStencil(0); glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT);

View file

@ -3,5 +3,5 @@
#include "../../Window.hpp" #include "../../Window.hpp"
IHyprWindowDecoration::~IHyprWindowDecoration() { IHyprWindowDecoration::~IHyprWindowDecoration() {
} }

View file

@ -42,7 +42,7 @@ void main() {
vec4 pixColor = v_color; vec4 pixColor = v_color;
bool done = false; bool done = false;
// check for edges // check for edges
if (pixCoord[0] < topLeft[0]) { if (pixCoord[0] < topLeft[0]) {
if (pixCoord[1] < topLeft[1]) { if (pixCoord[1] < topLeft[1]) {
@ -88,4 +88,4 @@ void main() {
gl_FragColor = pixColor; gl_FragColor = pixColor;
} }
)#"; )#";

View file

@ -59,7 +59,7 @@ void main() {
} }
} }
if (!done) { if (!done) {
// distance to all straight bb borders // distance to all straight bb borders
float distanceT = pixCoord[1]; float distanceT = pixCoord[1];
float distanceB = fullSize[1] - pixCoord[1]; float distanceB = fullSize[1] - pixCoord[1];
@ -79,4 +79,4 @@ void main() {
} }
gl_FragColor = pixColor; gl_FragColor = pixColor;
})#"; })#";

View file

@ -267,7 +267,7 @@ void main() {
pixColor[1] = pixColor[1] * tint[1]; pixColor[1] = pixColor[1] * tint[1];
pixColor[2] = pixColor[2] * tint[2]; pixColor[2] = pixColor[2] * tint[2];
} }
vec2 pixCoord = fullSize * v_texcoord; vec2 pixCoord = fullSize * v_texcoord;
)#" + ROUNDED_SHADER_FUNC("pixColor") + )#" + ROUNDED_SHADER_FUNC("pixColor") +
@ -310,7 +310,7 @@ void main() {
vec2 uv = v_texcoord / 2.0; vec2 uv = v_texcoord / 2.0;
vec4 sum = texture2D(tex, uv + vec2(-halfpixel.x * 2.0, 0.0) * radius); vec4 sum = texture2D(tex, uv + vec2(-halfpixel.x * 2.0, 0.0) * radius);
sum += texture2D(tex, uv + vec2(-halfpixel.x, halfpixel.y) * radius) * 2.0; sum += texture2D(tex, uv + vec2(-halfpixel.x, halfpixel.y) * radius) * 2.0;
sum += texture2D(tex, uv + vec2(0.0, halfpixel.y * 2.0) * radius); sum += texture2D(tex, uv + vec2(0.0, halfpixel.y * 2.0) * radius);
sum += texture2D(tex, uv + vec2(halfpixel.x, halfpixel.y) * radius) * 2.0; sum += texture2D(tex, uv + vec2(halfpixel.x, halfpixel.y) * radius) * 2.0;