aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/layout/MasterLayout.hpp
diff options
context:
space:
mode:
authorTom Englund <[email protected]>2024-08-08 21:01:50 +0200
committerGitHub <[email protected]>2024-08-08 21:01:50 +0200
commit4b4971c06fb02df00a2bd20b6b47b5d0e7d799a7 (patch)
treeadd5929723a1dd48f7cffa37ef26f31cb433297f /src/layout/MasterLayout.hpp
parent83a334f97df4389ca30cb63e50317a66a82562b9 (diff)
downloadHyprland-4b4971c06fb02df00a2bd20b6b47b5d0e7d799a7.tar.gz
Hyprland-4b4971c06fb02df00a2bd20b6b47b5d0e7d799a7.zip
internal: introduce new types to avoid unsigned int rollover and signed int overflow (#7216)
* framebuffer: avoid gluint overflow GLuint was being initialized to -1 and rolling over to unsigned int max, its defined behaviour but very unnecessery. add a bool and use it for checking if allocated or not. * opengl: avoid gluint rollover -1 rolls over to unsigned int max, use 0xFF instead. * core: big uint64_t to int type conversion there were a few uint64_t to int implicit conversions overflowing int and causing UB, make all monitor/workspaces/windows use the new typedefs. also fix the various related 64 to 32 implicit conversions going around found with -Wshorten-64-to-32
Diffstat (limited to 'src/layout/MasterLayout.hpp')
-rw-r--r--src/layout/MasterLayout.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/layout/MasterLayout.hpp b/src/layout/MasterLayout.hpp
index fdb916e5..b72be74f 100644
--- a/src/layout/MasterLayout.hpp
+++ b/src/layout/MasterLayout.hpp
@@ -30,7 +30,7 @@ struct SMasterNodeData {
float percSize = 1.f; // size multiplier for resizing children
- int workspaceID = -1;
+ WORKSPACEID workspaceID = WORKSPACE_INVALID;
bool ignoreFullscreenChecks = false;
@@ -41,7 +41,7 @@ struct SMasterNodeData {
};
struct SMasterWorkspaceData {
- int workspaceID = -1;
+ WORKSPACEID workspaceID = WORKSPACE_INVALID;
eOrientation orientation = ORIENTATION_LEFT;
//
@@ -55,7 +55,7 @@ class CHyprMasterLayout : public IHyprLayout {
virtual void onWindowCreatedTiling(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT);
virtual void onWindowRemovedTiling(PHLWINDOW);
virtual bool isWindowTiled(PHLWINDOW);
- virtual void recalculateMonitor(const int&);
+ virtual void recalculateMonitor(const MONITORID&);
virtual void recalculateWindow(PHLWINDOW);
virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, PHLWINDOW pWindow = nullptr);
virtual void fullscreenRequestForWindow(PHLWINDOW pWindow, const eFullscreenMode CURRENT_EFFECTIVE_MODE, const eFullscreenMode EFFECTIVE_MODE);
@@ -81,14 +81,14 @@ class CHyprMasterLayout : public IHyprLayout {
void buildOrientationCycleVectorFromEOperation(std::vector<eOrientation>& cycle);
void runOrientationCycle(SLayoutMessageHeader& header, CVarList* vars, int next);
eOrientation getDynamicOrientation(PHLWORKSPACE);
- int getNodesOnWorkspace(const int&);
+ int getNodesOnWorkspace(const WORKSPACEID&);
void applyNodeDataToWindow(SMasterNodeData*);
SMasterNodeData* getNodeFromWindow(PHLWINDOW);
- SMasterNodeData* getMasterNodeOnWorkspace(const int&);
- SMasterWorkspaceData* getMasterWorkspaceData(const int&);
+ SMasterNodeData* getMasterNodeOnWorkspace(const WORKSPACEID&);
+ SMasterWorkspaceData* getMasterWorkspaceData(const WORKSPACEID&);
void calculateWorkspace(PHLWORKSPACE);
PHLWINDOW getNextWindow(PHLWINDOW, bool);
- int getMastersOnWorkspace(const int&);
+ int getMastersOnWorkspace(const WORKSPACEID&);
friend struct SMasterNodeData;
friend struct SMasterWorkspaceData;