Merge branch 'main' into scaling
This commit is contained in:
commit
6c437763f6
22 changed files with 349 additions and 244 deletions
|
|
@ -662,8 +662,8 @@ void CCompositor::cleanupFadingOut() {
|
|||
g_pHyprOpenGL->m_mLayerFramebuffers[ls].release();
|
||||
g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls);
|
||||
|
||||
m_lSurfacesFadingOut.remove(ls);
|
||||
delete ls;
|
||||
m_lSurfacesFadingOut.remove(ls);
|
||||
|
||||
Debug::log(LOG, "Cleanup: destroyed a layersurface");
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ void CConfigManager::setDefaultVars() {
|
|||
configValues["decoration:blur_passes"].intValue = 1;
|
||||
configValues["decoration:active_opacity"].floatValue = 1;
|
||||
configValues["decoration:inactive_opacity"].floatValue = 1;
|
||||
configValues["decoration:fullscreen_opacity"].floatValue = 1;
|
||||
|
||||
configValues["dwindle:pseudotile"].intValue = 0;
|
||||
configValues["dwindle:col.group_border"].intValue = 0x66777700;
|
||||
|
|
@ -700,7 +701,7 @@ void CConfigManager::tick() {
|
|||
const std::string CONFIGPATH = ENVHOME + (ISDEBUG ? (std::string) "/.config/hypr/hyprlandd.conf" : (std::string) "/.config/hypr/hyprland.conf");
|
||||
|
||||
if (!std::filesystem::exists(CONFIGPATH)) {
|
||||
loadConfigLoadVars();
|
||||
Debug::log(ERR, "Config doesn't exist??");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -849,4 +850,4 @@ void CConfigManager::performMonitorReload() {
|
|||
|
||||
SConfigValue* CConfigManager::getConfigValuePtr(std::string val) {
|
||||
return &configValues[val];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,28 +59,11 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
|
|||
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
|
||||
|
||||
if (!layersurface->fadingOut) {
|
||||
if (layersurface->layerSurface->mapped) {
|
||||
Debug::log(LOG, "LayerSurface wasn't unmapped, making a snapshot now!");
|
||||
|
||||
// make a snapshot and start fade
|
||||
// layersurfaces aren't required to unmap before destroy
|
||||
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
|
||||
layersurface->alpha = 0.f;
|
||||
|
||||
layersurface->fadingOut = true;
|
||||
} else {
|
||||
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
|
||||
layersurface->alpha.setValueAndWarp(0.f);
|
||||
layersurface->fadingOut = true;
|
||||
}
|
||||
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
|
||||
layersurface->alpha.setValueAndWarp(0.f);
|
||||
layersurface->fadingOut = true;
|
||||
}
|
||||
|
||||
if (layersurface->layerSurface->mapped)
|
||||
layersurface->layerSurface->mapped = false;
|
||||
|
||||
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
|
||||
g_pCompositor->m_pLastFocus = nullptr;
|
||||
|
||||
layersurface->hyprListener_commitLayerSurface.removeCallback();
|
||||
layersurface->hyprListener_destroyLayerSurface.removeCallback();
|
||||
layersurface->hyprListener_mapLayerSurface.removeCallback();
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ float CBezierCurve::getYForPoint(float x) {
|
|||
}
|
||||
|
||||
// in the name of performance i shall make a hack
|
||||
const auto LOWERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * lowerT)];
|
||||
const auto UPPERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * upperT)];
|
||||
const auto LOWERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * lowerT), 0, 199)];
|
||||
const auto UPPERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * upperT), 0, 199)];
|
||||
|
||||
const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "MiscFunctions.hpp"
|
||||
#include "../defines.hpp"
|
||||
#include <algorithm>
|
||||
#include "../Compositor.hpp"
|
||||
|
||||
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
|
||||
ASSERT(pSignal);
|
||||
|
|
@ -120,4 +121,23 @@ bool isNumber(const std::string& str) {
|
|||
|
||||
bool isDirection(const std::string& arg) {
|
||||
return arg == "l" || arg == "r" || arg == "u" || arg == "d" || arg == "t" || arg == "b";
|
||||
}
|
||||
|
||||
int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||
int result = INT_MAX;
|
||||
if (in.find("name:") == 0) {
|
||||
const auto WORKSPACENAME = in.substr(in.find_first_of(':') + 1);
|
||||
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
|
||||
if (!WORKSPACE) {
|
||||
result = g_pCompositor->getNextAvailableNamedWorkspace();
|
||||
} else {
|
||||
result = WORKSPACE->m_iID;
|
||||
}
|
||||
outName = WORKSPACENAME;
|
||||
} else {
|
||||
result = std::clamp((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1, INT_MAX);
|
||||
outName = std::to_string(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -9,5 +9,6 @@ void scaleBox(wlr_box*, float);
|
|||
std::string removeBeginEndSpacesTabs(std::string);
|
||||
bool isNumber(const std::string&);
|
||||
bool isDirection(const std::string&);
|
||||
int getWorkspaceIDFromString(const std::string&, std::string&);
|
||||
|
||||
float getPlusMinusKeywordResult(std::string in, float relative);
|
||||
|
|
@ -54,6 +54,9 @@ struct SRenderData {
|
|||
|
||||
// for alpha settings
|
||||
float alpha = 1.f;
|
||||
|
||||
// for decorations (border)
|
||||
bool decorate = false;
|
||||
};
|
||||
|
||||
struct SKeyboard {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ CWorkspace::CWorkspace(int monitorID) {
|
|||
|
||||
m_vRenderOffset.m_pWorkspace = this;
|
||||
m_vRenderOffset.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.m_pWorkspace = this;
|
||||
m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.setValueAndWarp(255.f);
|
||||
}
|
||||
|
||||
CWorkspace::~CWorkspace() {
|
||||
|
|
@ -33,4 +36,32 @@ CWorkspace::~CWorkspace() {
|
|||
wlr_ext_workspace_handle_v1_destroy(m_pWlrHandle);
|
||||
m_pWlrHandle = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CWorkspace::startAnim(bool in, bool left) {
|
||||
const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style");
|
||||
|
||||
if (ANIMSTYLE == "fade") {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade.
|
||||
|
||||
if (in) {
|
||||
m_fAlpha.setValueAndWarp(0.f);
|
||||
m_fAlpha = 255.f;
|
||||
} else {
|
||||
m_fAlpha.setValueAndWarp(255.f);
|
||||
m_fAlpha = 0.f;
|
||||
}
|
||||
} else {
|
||||
// fallback is slide
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||
|
||||
m_fAlpha.setValueAndWarp(255.f); // fix a bug, if switching from fade -> slide.
|
||||
|
||||
if (in) {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
|
||||
m_vRenderOffset = Vector2D(0, 0);
|
||||
} else {
|
||||
m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -21,4 +21,7 @@ public:
|
|||
|
||||
// for animations
|
||||
CAnimatedVariable m_vRenderOffset;
|
||||
CAnimatedVariable m_fAlpha;
|
||||
|
||||
void startAnim(bool in, bool left);
|
||||
};
|
||||
|
|
@ -176,7 +176,7 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
|||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||
|
||||
// Populate the node with our window's data
|
||||
PNODE->workspaceID = PMONITOR->activeWorkspace;
|
||||
PNODE->workspaceID = pWindow->m_iWorkspaceID;
|
||||
PNODE->pWindow = pWindow;
|
||||
PNODE->isNode = false;
|
||||
PNODE->layout = this;
|
||||
|
|
@ -184,7 +184,7 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
|||
SDwindleNodeData* OPENINGON;
|
||||
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor();
|
||||
|
||||
if (PMONITOR->ID == MONFROMCURSOR->ID)
|
||||
if (PMONITOR->ID == MONFROMCURSOR->ID && PNODE->workspaceID == PMONITOR->activeWorkspace)
|
||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
||||
else
|
||||
OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
|
||||
|
|
|
|||
|
|
@ -152,17 +152,17 @@ void CAnimationManager::tick() {
|
|||
const auto ROUNDINGSIZE = g_pConfigManager->getInt("decoration:rounding") + 1;
|
||||
|
||||
// damage for old box
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width, BORDERSIZE + ROUNDINGSIZE); // top
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height); // left
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x + WLRBOXPREV.width - ROUNDINGSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height); // right
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x, WLRBOXPREV.y + WLRBOXPREV.height - ROUNDINGSIZE, WLRBOXPREV.width, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height + 2 * BORDERSIZE); // left
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x + WLRBOXPREV.width - ROUNDINGSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height + 2 * BORDERSIZE); // right
|
||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x, WLRBOXPREV.y + WLRBOXPREV.height - ROUNDINGSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||
|
||||
// damage for new box
|
||||
const wlr_box WLRBOXNEW = {PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y};
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width, BORDERSIZE + ROUNDINGSIZE); // top
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height); // left
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height); // right
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x, WLRBOXNEW.y + WLRBOXNEW.height - ROUNDINGSIZE, WLRBOXNEW.width, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // left
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // right
|
||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x, WLRBOXNEW.y + WLRBOXNEW.height - ROUNDINGSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,20 +3,21 @@
|
|||
CKeybindManager::CKeybindManager() {
|
||||
// initialize all dispatchers
|
||||
|
||||
m_mDispatchers["exec"] = spawn;
|
||||
m_mDispatchers["killactive"] = killActive;
|
||||
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
||||
m_mDispatchers["workspace"] = changeworkspace;
|
||||
m_mDispatchers["fullscreen"] = fullscreenActive;
|
||||
m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
|
||||
m_mDispatchers["pseudo"] = toggleActivePseudo;
|
||||
m_mDispatchers["movefocus"] = moveFocusTo;
|
||||
m_mDispatchers["movewindow"] = moveActiveTo;
|
||||
m_mDispatchers["togglegroup"] = toggleGroup;
|
||||
m_mDispatchers["changegroupactive"] = changeGroupActive;
|
||||
m_mDispatchers["togglesplit"] = toggleSplit;
|
||||
m_mDispatchers["splitratio"] = alterSplitRatio;
|
||||
m_mDispatchers["focusmonitor"] = focusMonitor;
|
||||
m_mDispatchers["exec"] = spawn;
|
||||
m_mDispatchers["killactive"] = killActive;
|
||||
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
||||
m_mDispatchers["workspace"] = changeworkspace;
|
||||
m_mDispatchers["fullscreen"] = fullscreenActive;
|
||||
m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
|
||||
m_mDispatchers["movetoworkspacesilent"] = moveActiveToWorkspaceSilent;
|
||||
m_mDispatchers["pseudo"] = toggleActivePseudo;
|
||||
m_mDispatchers["movefocus"] = moveFocusTo;
|
||||
m_mDispatchers["movewindow"] = moveActiveTo;
|
||||
m_mDispatchers["togglegroup"] = toggleGroup;
|
||||
m_mDispatchers["changegroupactive"] = changeGroupActive;
|
||||
m_mDispatchers["togglesplit"] = toggleSplit;
|
||||
m_mDispatchers["splitratio"] = alterSplitRatio;
|
||||
m_mDispatchers["focusmonitor"] = focusMonitor;
|
||||
}
|
||||
|
||||
void CKeybindManager::addKeybind(SKeybind kb) {
|
||||
|
|
@ -167,19 +168,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
int workspaceToChangeTo = 0;
|
||||
std::string workspaceName = "";
|
||||
|
||||
if (args.find("name:") == 0) {
|
||||
const auto WORKSPACENAME = args.substr(args.find_first_of(':') + 1);
|
||||
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
|
||||
if (!WORKSPACE) {
|
||||
workspaceToChangeTo = g_pCompositor->getNextAvailableNamedWorkspace();
|
||||
} else {
|
||||
workspaceToChangeTo = WORKSPACE->m_iID;
|
||||
}
|
||||
workspaceName = WORKSPACENAME;
|
||||
} else {
|
||||
workspaceToChangeTo = std::clamp((int)getPlusMinusKeywordResult(args, g_pCompositor->m_pLastMonitor->activeWorkspace), 1, INT_MAX);
|
||||
workspaceName = std::to_string(workspaceToChangeTo);
|
||||
}
|
||||
workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
|
||||
|
||||
if (workspaceToChangeTo == INT_MAX) {
|
||||
Debug::log(ERR, "Error in changeworkspace, invalid value");
|
||||
|
|
@ -209,11 +198,10 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACEID;
|
||||
|
||||
// start anim on old workspace
|
||||
g_pCompositor->getWorkspaceByID(OLDWORKSPACEID)->m_vRenderOffset = Vector2D(ANIMTOLEFT ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
||||
g_pCompositor->getWorkspaceByID(OLDWORKSPACEID)->startAnim(false, ANIMTOLEFT);
|
||||
|
||||
// start anim on new workspace
|
||||
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset.setValueAndWarp(Vector2D(ANIMTOLEFT ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
|
||||
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset = Vector2D(0, 0);
|
||||
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->startAnim(true, ANIMTOLEFT);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -250,14 +238,13 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACE;
|
||||
|
||||
// start anim on old workspace
|
||||
g_pCompositor->getWorkspaceByID(OLDWORKSPACE)->m_vRenderOffset = Vector2D(ANIMTOLEFT ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
||||
g_pCompositor->getWorkspaceByID(OLDWORKSPACE)->startAnim(false, ANIMTOLEFT);
|
||||
|
||||
g_pCompositor->m_lWorkspaces.emplace_back(PMONITOR->ID);
|
||||
const auto PWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
||||
|
||||
// start anim on new workspace
|
||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(ANIMTOLEFT ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
|
||||
PWORKSPACE->m_vRenderOffset = Vector2D(0, 0);
|
||||
PWORKSPACE->startAnim(true, ANIMTOLEFT);
|
||||
|
||||
// We are required to set the name here immediately
|
||||
wlr_ext_workspace_handle_v1_set_name(PWORKSPACE->m_pWlrHandle, workspaceName.c_str());
|
||||
|
|
@ -351,6 +338,58 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||
}
|
||||
}
|
||||
|
||||
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||
// hacky, but works lol
|
||||
|
||||
int workspaceToMoveTo = 0;
|
||||
std::string workspaceName = "";
|
||||
|
||||
workspaceToMoveTo = getWorkspaceIDFromString(args, workspaceName);
|
||||
|
||||
if (workspaceToMoveTo == INT_MAX) {
|
||||
Debug::log(ERR, "Error in moveActiveToWorkspaceSilent, invalid value");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
||||
|
||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||
return;
|
||||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||
|
||||
if (workspaceToMoveTo == PMONITOR->activeWorkspace)
|
||||
return;
|
||||
|
||||
// may be null until later!
|
||||
auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToMoveTo);
|
||||
|
||||
const auto PMONITORNEW = PWORKSPACE ? g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID) : PMONITOR;
|
||||
|
||||
const auto OLDWORKSPACEIDONMONITOR = PMONITORNEW->activeWorkspace;
|
||||
const auto OLDWORKSPACEIDRETURN = PMONITOR->activeWorkspace;
|
||||
|
||||
const auto POLDWORKSPACEONMON = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDONMONITOR);
|
||||
const auto POLDWORKSPACEIDRETURN = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDRETURN);
|
||||
|
||||
moveActiveToWorkspace(args);
|
||||
|
||||
PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToMoveTo);
|
||||
|
||||
changeworkspace(std::to_string(OLDWORKSPACEIDONMONITOR));
|
||||
changeworkspace(std::to_string(OLDWORKSPACEIDRETURN));
|
||||
|
||||
// revert animations
|
||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0,0));
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(0.f);
|
||||
|
||||
POLDWORKSPACEIDRETURN->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
POLDWORKSPACEIDRETURN->m_fAlpha.setValueAndWarp(255.f);
|
||||
|
||||
POLDWORKSPACEONMON->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
POLDWORKSPACEONMON->m_fAlpha.setValueAndWarp(255.f);
|
||||
}
|
||||
|
||||
void CKeybindManager::moveFocusTo(std::string args) {
|
||||
char arg = args[0];
|
||||
|
||||
|
|
@ -510,4 +549,4 @@ void CKeybindManager::focusMonitor(std::string arg) {
|
|||
|
||||
Debug::log(ERR, "Error in focusMonitor: no such monitor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ private:
|
|||
static void changeworkspace(std::string);
|
||||
static void fullscreenActive(std::string);
|
||||
static void moveActiveToWorkspace(std::string);
|
||||
static void moveActiveToWorkspaceSilent(std::string);
|
||||
static void moveFocusTo(std::string);
|
||||
static void moveActiveTo(std::string);
|
||||
static void toggleGroup(std::string);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() {
|
|||
m_shQUAD.proj = glGetUniformLocation(prog, "proj");
|
||||
m_shQUAD.color = glGetUniformLocation(prog, "color");
|
||||
m_shQUAD.posAttrib = glGetAttribLocation(prog, "pos");
|
||||
m_shQUAD.texAttrib = glGetAttribLocation(prog, "texcoord");
|
||||
|
||||
prog = createProgram(TEXVERTSRC, TEXFRAGSRCRGBA);
|
||||
m_shRGBA.program = prog;
|
||||
|
|
@ -225,13 +226,10 @@ void CHyprOpenGLImpl::scissor(const int x, const int y, const int w, const int h
|
|||
scissor(&box);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col) {
|
||||
void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col, int round) {
|
||||
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
||||
|
||||
// TODO: respect damage
|
||||
scissor((wlr_box*)nullptr);
|
||||
|
||||
float matrix[9];
|
||||
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
||||
|
||||
|
|
@ -241,23 +239,42 @@ void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col) {
|
|||
|
||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
||||
|
||||
if (col.a == 255.f)
|
||||
glDisable(GL_BLEND);
|
||||
else
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glUseProgram(m_shQUAD.program);
|
||||
|
||||
glUniformMatrix3fv(m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
||||
glUniform4f(m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
||||
|
||||
const auto TOPLEFT = Vector2D(round, round);
|
||||
const auto BOTTOMRIGHT = Vector2D(box->width - round, box->height - round);
|
||||
const auto FULLSIZE = Vector2D(box->width, box->height);
|
||||
|
||||
// Rounded corners
|
||||
glUniform2f(glGetUniformLocation(m_shQUAD.program, "topLeft"), (float)TOPLEFT.x, (float)TOPLEFT.y);
|
||||
glUniform2f(glGetUniformLocation(m_shQUAD.program, "bottomRight"), (float)BOTTOMRIGHT.x, (float)BOTTOMRIGHT.y);
|
||||
glUniform2f(glGetUniformLocation(m_shQUAD.program, "fullSize"), (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||
glUniform1f(glGetUniformLocation(m_shQUAD.program, "radius"), round);
|
||||
|
||||
glVertexAttribPointer(m_shQUAD.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||
glVertexAttribPointer(m_shQUAD.texAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||
|
||||
glEnableVertexAttribArray(m_shQUAD.posAttrib);
|
||||
glEnableVertexAttribArray(m_shQUAD.texAttrib);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
||||
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
||||
const auto RECT = RECTSARR[i];
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
glDisableVertexAttribArray(m_shQUAD.posAttrib);
|
||||
glDisableVertexAttribArray(m_shQUAD.texAttrib);
|
||||
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderTexture(wlr_texture* tex, wlr_box* pBox, float alpha, int round) {
|
||||
|
|
@ -266,15 +283,15 @@ void CHyprOpenGLImpl::renderTexture(wlr_texture* tex, wlr_box* pBox, float alpha
|
|||
renderTexture(CTexture(tex), pBox, alpha, round);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderTexture(const CTexture& tex, wlr_box* pBox, float alpha, int round, bool discardopaque) {
|
||||
void CHyprOpenGLImpl::renderTexture(const CTexture& tex, wlr_box* pBox, float alpha, int round, bool discardopaque, bool border) {
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
||||
|
||||
renderTextureInternalWithDamage(tex, pBox, alpha, m_RenderData.pDamage, round, discardopaque);
|
||||
renderTextureInternalWithDamage(tex, pBox, alpha, m_RenderData.pDamage, round, discardopaque, border);
|
||||
|
||||
scissor((wlr_box*)nullptr);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque) {
|
||||
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque, bool border) {
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
||||
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
|
||||
|
||||
|
|
@ -472,11 +489,11 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
|||
return currentRenderToFB;
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, float a, wlr_surface* pSurface, int round) {
|
||||
void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, float a, wlr_surface* pSurface, int round, bool border) {
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!");
|
||||
|
||||
if (g_pConfigManager->getInt("decoration:blur") == 0) {
|
||||
renderTexture(tex, pBox, a, round);
|
||||
renderTexture(tex, pBox, a, round, false, border);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -530,18 +547,33 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
|
||||
if (pixman_region32_not_empty(&damage)) {
|
||||
// render our great blurred FB
|
||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, 255.f, &damage); // 255.f because we adjusted blur strength to a
|
||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, a, &damage);
|
||||
|
||||
// render the window, but disable stencil for it
|
||||
// because stencil has ignoreopaque
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
// render the window, but clear stencil
|
||||
glClearStencil(0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
// and write to it
|
||||
glStencilFunc(GL_ALWAYS, 1, -1);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
|
||||
renderTextureInternalWithDamage(tex, pBox, a, &damage, round);
|
||||
|
||||
// then stop
|
||||
glStencilFunc(GL_EQUAL, 1, -1);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
}
|
||||
|
||||
// disable the stencil, finalize everything
|
||||
glStencilMask(-1);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
// disable the stencil (if no border), finalize everything
|
||||
if (!border) {
|
||||
glStencilMask(-1);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
} else {
|
||||
auto BORDERCOL = m_pCurrentWindow->m_cRealBorderColor.col();
|
||||
BORDERCOL.a *= a / 255.f;
|
||||
renderBorder(pBox, BORDERCOL, g_pConfigManager->getInt("general:border_size"), round);
|
||||
}
|
||||
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
pixman_region32_fini(&damage);
|
||||
scissor((wlr_box*)nullptr);
|
||||
|
|
@ -554,98 +586,23 @@ void pushVert2D(float x, float y, float* arr, int& counter, wlr_box* box) {
|
|||
counter++;
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int thick, int radius) {
|
||||
void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int thick, int round) {
|
||||
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
||||
|
||||
scaleBox(box, m_RenderData.pMonitor->scale);
|
||||
// this method assumes a set stencil and scaled box
|
||||
box->x -= thick;
|
||||
box->y -= thick;
|
||||
box->width += 2 * thick;
|
||||
box->height += 2 * thick;
|
||||
|
||||
float matrix[9];
|
||||
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
||||
round += thick; // cuz yeah
|
||||
|
||||
float glMatrix[9];
|
||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
||||
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
||||
// only draw on non-stencild.
|
||||
glStencilFunc(GL_NOTEQUAL, 1, -1);
|
||||
|
||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
||||
|
||||
if (col.a == 255.f)
|
||||
glDisable(GL_BLEND);
|
||||
else
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glUseProgram(m_shQUAD.program);
|
||||
|
||||
glUniformMatrix3fv(m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
||||
glUniform4f(m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
||||
|
||||
// Sides are ONLY for corners meaning they have to be divisible by 4.
|
||||
// 32 sides shouldn't be taxing at all on the performance.
|
||||
const int SIDES = 32; // sides
|
||||
const int SIDES34 = 24; // 3/4th of the sides
|
||||
float verts[(SIDES + 8 + 1) * 4]; // 8 for the connections and 1 because last is doubled (begin/end)
|
||||
int vertNo = 0;
|
||||
|
||||
// start from 0,0 tex coord space
|
||||
float x = 0, y = 0, w = box->width, h = box->height;
|
||||
|
||||
pushVert2D(x + radius, y + h, verts, vertNo, box);
|
||||
pushVert2D(x + w - radius, y + h, verts, vertNo, box);
|
||||
|
||||
float x1 = x + w - radius;
|
||||
float y1 = y + h - radius;
|
||||
|
||||
for (int i = 0; i <= SIDES / 4; i++) {
|
||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
||||
}
|
||||
|
||||
// Right Line
|
||||
pushVert2D(x + w, y + radius, verts, vertNo, box);
|
||||
|
||||
x1 = x + w - radius;
|
||||
y1 = y + radius;
|
||||
|
||||
for (int i = SIDES / 4; i <= SIDES / 2; i++) {
|
||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
||||
}
|
||||
|
||||
// Top Line
|
||||
pushVert2D(x + radius, y, verts, vertNo, box);
|
||||
|
||||
x1 = x + radius;
|
||||
y1 = y + radius;
|
||||
|
||||
for (int i = SIDES / 2; i <= SIDES34; i++) {
|
||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
||||
}
|
||||
|
||||
// Left Line
|
||||
pushVert2D(x, y + h - radius, verts, vertNo, box);
|
||||
|
||||
x1 = x + radius;
|
||||
y1 = y + h - radius;
|
||||
|
||||
for (int i = SIDES34; i <= SIDES; i++) {
|
||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
||||
}
|
||||
|
||||
glVertexAttribPointer(m_shQUAD.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, verts);
|
||||
|
||||
glEnableVertexAttribArray(m_shQUAD.posAttrib);
|
||||
|
||||
glLineWidth(thick);
|
||||
|
||||
// draw with damage
|
||||
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
||||
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
||||
const auto RECT = RECTSARR[i];
|
||||
scissor(&RECT);
|
||||
|
||||
glDrawArrays(GL_LINE_STRIP, 0, 41);
|
||||
}
|
||||
}
|
||||
|
||||
glDisableVertexAttribArray(m_shQUAD.posAttrib);
|
||||
// draw a rounded rect
|
||||
renderRect(box, col, round);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
|
||||
|
|
|
|||
|
|
@ -53,11 +53,10 @@ public:
|
|||
void begin(SMonitor*, pixman_region32_t*, bool fake = false);
|
||||
void end();
|
||||
|
||||
void renderRect(wlr_box*, const CColor&);
|
||||
void renderRect(wlr_box*, const CColor&, int round = 0);
|
||||
void renderTexture(wlr_texture*, wlr_box*, float a, int round = 0);
|
||||
void renderTexture(const CTexture&, wlr_box*, float a, int round = 0, bool discardOpaque = false);
|
||||
void renderTextureWithBlur(const CTexture&, wlr_box*, float a, wlr_surface* pSurface, int round = 0);
|
||||
void renderBorder(wlr_box*, const CColor&, int thick = 1, int round = 0);
|
||||
void renderTexture(const CTexture&, wlr_box*, float a, int round = 0, bool discardOpaque = false, bool border = false);
|
||||
void renderTextureWithBlur(const CTexture&, wlr_box*, float a, wlr_surface* pSurface, int round = 0, bool border = false);
|
||||
|
||||
void makeWindowSnapshot(CWindow*);
|
||||
void makeLayerSnapshot(SLayerSurface*);
|
||||
|
|
@ -77,6 +76,8 @@ public:
|
|||
GLint m_iCurrentOutputFb = 0;
|
||||
GLint m_iWLROutputFb = 0;
|
||||
|
||||
CWindow* m_pCurrentWindow = nullptr; // hack to get the current rendered window
|
||||
|
||||
pixman_region32_t m_rOriginalDamageRegion; // used for storing the pre-expanded region
|
||||
|
||||
std::unordered_map<CWindow*, CFramebuffer> m_mWindowFramebuffers;
|
||||
|
|
@ -109,9 +110,8 @@ private:
|
|||
// returns the out FB, can be either Mirror or MirrorSwap
|
||||
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
||||
|
||||
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false);
|
||||
void renderTextureWithBlurInternal(const CTexture&, wlr_box*, float a, int round = 0);
|
||||
|
||||
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false, bool border = false);
|
||||
void renderBorder(wlr_box*, const CColor&, int thick = 1, int round = 0);
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CHyprOpenGLImpl> g_pHyprOpenGL;
|
||||
|
|
@ -20,10 +20,10 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
|||
scaleBox(&windowBox, RDATA->output->scale);
|
||||
|
||||
if (RDATA->surface && surface == RDATA->surface)
|
||||
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
|
||||
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"), RDATA->decorate);
|
||||
else
|
||||
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
|
||||
|
||||
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"), false, RDATA->decorate);
|
||||
|
||||
wlr_surface_send_frame_done(surface, RDATA->when);
|
||||
|
||||
wlr_presentation_surface_sampled_on_output(g_pCompositor->m_sWLRPresentation, surface, RDATA->output);
|
||||
|
|
@ -41,7 +41,7 @@ bool shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) {
|
|||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||
// if not, check if it maybe is active on a different monitor. vvv might be animation in progress
|
||||
if (g_pCompositor->isWorkspaceVisible(pWindow->m_iWorkspaceID) || (PWORKSPACE && PWORKSPACE->m_iMonitorID == pMonitor->ID && PWORKSPACE->m_vRenderOffset.isBeingAnimated()))
|
||||
if (g_pCompositor->isWorkspaceVisible(pWindow->m_iWorkspaceID) || (PWORKSPACE && PWORKSPACE->m_iMonitorID == pMonitor->ID && (PWORKSPACE->m_vRenderOffset.isBeingAnimated() || PWORKSPACE->m_fAlpha.isBeingAnimated())))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -96,17 +96,16 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
|
|||
renderdata.w = pWindow->m_vRealSize.vec().x;
|
||||
renderdata.h = pWindow->m_vRealSize.vec().y;
|
||||
renderdata.dontRound = pWindow->m_bIsFullscreen;
|
||||
renderdata.fadeAlpha = pWindow->m_fAlpha.fl();
|
||||
renderdata.alpha = pWindow == g_pCompositor->m_pLastWindow ? g_pConfigManager->getFloat("decoration:active_opacity") : g_pConfigManager->getFloat("decoration:inactive_opacity");
|
||||
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (PWORKSPACE->m_fAlpha.fl() / 255.f);
|
||||
renderdata.alpha = pWindow->m_bIsFullscreen ? g_pConfigManager->getFloat("decoration:fullscreen_opacity") : pWindow == g_pCompositor->m_pLastWindow ? g_pConfigManager->getFloat("decoration:active_opacity") : g_pConfigManager->getFloat("decoration:inactive_opacity");
|
||||
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders;
|
||||
|
||||
// apply window special data
|
||||
renderdata.alpha *= pWindow->m_sSpecialRenderData.alpha;
|
||||
|
||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);
|
||||
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
|
||||
|
||||
// border
|
||||
if (decorate && !pWindow->m_bX11DoesntWantBorders)
|
||||
drawBorderForWindow(pWindow, pMonitor, pWindow->m_fAlpha.fl() * renderdata.alpha, PWORKSPACE->m_vRenderOffset.vec());
|
||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);
|
||||
|
||||
if (pWindow->m_bIsX11) {
|
||||
if (pWindow->m_uSurface.xwayland->surface) {
|
||||
|
|
@ -117,7 +116,9 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
|
|||
renderdata.dontRound = false; // restore dontround
|
||||
renderdata.pMonitor = pMonitor;
|
||||
wlr_xdg_surface_for_each_popup_surface(pWindow->m_uSurface.xdg, renderSurface, &renderdata);
|
||||
}
|
||||
}
|
||||
|
||||
g_pHyprOpenGL->m_pCurrentWindow = nullptr;
|
||||
}
|
||||
|
||||
void CHyprRenderer::renderLayer(SLayerSurface* pLayer, SMonitor* pMonitor, timespec* time) {
|
||||
|
|
@ -437,23 +438,6 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
|
|||
Debug::log(LOG, "Monitor %s layers arranged: reserved: %f %f %f %f", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y, PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
||||
}
|
||||
|
||||
void CHyprRenderer::drawBorderForWindow(CWindow* pWindow, SMonitor* pMonitor, float alpha, const Vector2D& offset) {
|
||||
const auto BORDERSIZE = g_pConfigManager->getInt("general:border_size");
|
||||
|
||||
if (BORDERSIZE < 1)
|
||||
return;
|
||||
|
||||
auto BORDERCOL = pWindow->m_cRealBorderColor.col();
|
||||
BORDERCOL.a *= (alpha / 255.f);
|
||||
|
||||
Vector2D correctPos = pWindow->m_vRealPosition.vec() - pMonitor->vecPosition;
|
||||
Vector2D correctSize = pWindow->m_vRealSize.vec();
|
||||
|
||||
// top
|
||||
wlr_box border = {correctPos.x - BORDERSIZE / 2.f + offset.x, correctPos.y - BORDERSIZE / 2.f + offset.y, pWindow->m_vRealSize.vec().x + BORDERSIZE, pWindow->m_vRealSize.vec().y + BORDERSIZE};
|
||||
g_pHyprOpenGL->renderBorder(&border, BORDERCOL, BORDERSIZE, g_pConfigManager->getInt("decoration:rounding"));
|
||||
}
|
||||
|
||||
void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
||||
if (!pSurface)
|
||||
return; // wut?
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ public:
|
|||
|
||||
private:
|
||||
void arrangeLayerArray(SMonitor*, const std::list<SLayerSurface*>&, bool, wlr_box*);
|
||||
void drawBorderForWindow(CWindow*, SMonitor*, float a = 255.f, const Vector2D& offset = Vector2D(0,0));
|
||||
void renderWorkspaceWithFullscreenWindow(SMonitor*, CWorkspace*, timespec*);
|
||||
void renderWindow(CWindow*, SMonitor*, timespec*, bool);
|
||||
void renderLayer(SLayerSurface*, SMonitor*, timespec*);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ struct SQuad {
|
|||
GLint proj;
|
||||
GLint color;
|
||||
GLint posAttrib;
|
||||
GLint texAttrib;
|
||||
};
|
||||
|
||||
class CShader {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,53 @@ precision mediump float;
|
|||
varying vec4 v_color;
|
||||
varying vec2 v_texcoord;
|
||||
|
||||
uniform vec2 topLeft;
|
||||
uniform vec2 bottomRight;
|
||||
uniform vec2 fullSize;
|
||||
uniform float radius;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = v_color;
|
||||
if (radius == 0.0) {
|
||||
gl_FragColor = v_color;
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 pixCoord = fullSize * v_texcoord;
|
||||
|
||||
if (pixCoord[0] < topLeft[0]) {
|
||||
// we're close left
|
||||
if (pixCoord[1] < topLeft[1]) {
|
||||
// top
|
||||
if (distance(topLeft, pixCoord) > radius) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
} else if (pixCoord[1] > bottomRight[1]) {
|
||||
// bottom
|
||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord) > radius) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pixCoord[0] > bottomRight[0]) {
|
||||
// we're close right
|
||||
if (pixCoord[1] < topLeft[1]) {
|
||||
// top
|
||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord) > radius) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
} else if (pixCoord[1] > bottomRight[1]) {
|
||||
// bottom
|
||||
if (distance(bottomRight, pixCoord) > radius) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = v_color;
|
||||
})#";
|
||||
|
||||
inline const std::string TEXVERTSRC = R"#(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue