summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKamikadze <40305144+Kam1k4dze@users.noreply.github.com>2025-05-31 18:02:02 +0500
committerGitHub <noreply@github.com>2025-05-31 14:02:02 +0100
commit4078e1d17c0fb1439ee5a0ba1e539f06a8f47aab (patch)
tree33a5bed332c5ce217b9e885f56e07c9e732b35fa /src
parentaf2fdb5d58f5d3017aafd78a8ddafb40f710e34b (diff)
refactor: replace all `typedef` with `using` (#10594)
Diffstat (limited to 'src')
-rw-r--r--src/SharedDefs.hpp8
-rw-r--r--src/desktop/DesktopTypes.hpp16
-rw-r--r--src/helpers/Format.hpp6
-rw-r--r--src/layout/IHyprLayout.cpp2
-rw-r--r--src/managers/HookSystemManager.hpp4
-rw-r--r--src/managers/XWaylandManager.hpp2
-rw-r--r--src/plugins/PluginAPI.hpp10
-rw-r--r--src/protocols/types/ColorManagement.hpp2
-rw-r--r--src/xwayland/XSurface.hpp12
9 files changed, 31 insertions, 31 deletions
diff --git a/src/SharedDefs.hpp b/src/SharedDefs.hpp
index a46a2429..b8094997 100644
--- a/src/SharedDefs.hpp
+++ b/src/SharedDefs.hpp
@@ -58,8 +58,8 @@ struct SDispatchResult {
std::string error;
};
-typedef int64_t WINDOWID;
-typedef int64_t MONITORID;
-typedef int64_t WORKSPACEID;
+using WINDOWID = int64_t;
+using MONITORID = int64_t;
+using WORKSPACEID = int64_t;
-typedef std::function<void(void*, SCallbackInfo&, std::any)> HOOK_CALLBACK_FN;
+using HOOK_CALLBACK_FN = std::function<void(void*, SCallbackInfo&, std::any)>;
diff --git a/src/desktop/DesktopTypes.hpp b/src/desktop/DesktopTypes.hpp
index 080f13d3..f724c7b9 100644
--- a/src/desktop/DesktopTypes.hpp
+++ b/src/desktop/DesktopTypes.hpp
@@ -6,21 +6,21 @@ class CLayerSurface;
class CMonitor;
/* Shared pointer to a workspace */
-typedef SP<CWorkspace> PHLWORKSPACE;
+using PHLWORKSPACE = SP<CWorkspace>;
/* Weak pointer to a workspace */
-typedef WP<CWorkspace> PHLWORKSPACEREF;
+using PHLWORKSPACEREF = WP<CWorkspace>;
/* Shared pointer to a window */
-typedef SP<CWindow> PHLWINDOW;
+using PHLWINDOW = SP<CWindow>;
/* Weak pointer to a window */
-typedef WP<CWindow> PHLWINDOWREF;
+using PHLWINDOWREF = WP<CWindow>;
/* Shared pointer to a layer surface */
-typedef SP<CLayerSurface> PHLLS;
+using PHLLS = SP<CLayerSurface>;
/* Weak pointer to a layer surface */
-typedef WP<CLayerSurface> PHLLSREF;
+using PHLLSREF = WP<CLayerSurface>;
/* Shared pointer to a monitor */
-typedef SP<CMonitor> PHLMONITOR;
+using PHLMONITOR = SP<CMonitor>;
/* Weak pointer to a monitor */
-typedef WP<CMonitor> PHLMONITORREF;
+using PHLMONITORREF = WP<CMonitor>;
diff --git a/src/helpers/Format.hpp b/src/helpers/Format.hpp
index b1353dc7..fe68f763 100644
--- a/src/helpers/Format.hpp
+++ b/src/helpers/Format.hpp
@@ -5,8 +5,8 @@
#include "math/Math.hpp"
#include <aquamarine/backend/Misc.hpp>
-typedef uint32_t DRMFormat;
-typedef uint32_t SHMFormat;
+using DRMFormat = uint32_t;
+using SHMFormat = uint32_t;
struct SPixelFormat {
DRMFormat drmFormat = 0; /* DRM_FORMAT_INVALID */
@@ -20,7 +20,7 @@ struct SPixelFormat {
Vector2D blockSize;
};
-typedef Aquamarine::SDRMFormat SDRMFormat;
+using SDRMFormat = Aquamarine::SDRMFormat;
namespace NFormatUtils {
SHMFormat drmToShm(DRMFormat drm);
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 1fe3a936..fbde7344 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -411,7 +411,7 @@ static void snapResize(double& start, double& end, const double P) {
start = P;
}
-typedef std::function<void(double&, double&, const double)> SnapFn;
+using SnapFn = std::function<void(double&, double&, const double)>;
static void performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWINDOW DRAGGINGWINDOW, const eMouseBindMode MODE, const int CORNER, const Vector2D& BEGINSIZE) {
static auto SNAPWINDOWGAP = CConfigValue<Hyprlang::INT>("general:snap:window_gap");
diff --git a/src/managers/HookSystemManager.hpp b/src/managers/HookSystemManager.hpp
index 69d54a60..647e9670 100644
--- a/src/managers/HookSystemManager.hpp
+++ b/src/managers/HookSystemManager.hpp
@@ -11,9 +11,9 @@
#define HANDLE void*
-// global typedef for hooked functions. Passes itself as a ptr when called, and `data` additionally.
+// global type alias for hooked functions. Passes itself as a ptr when called, and `data` additionally.
-typedef std::function<void(void*, SCallbackInfo& info, std::any data)> HOOK_CALLBACK_FN;
+using HOOK_CALLBACK_FN = std::function<void(void*, SCallbackInfo& info, std::any data)>;
struct SCallbackFNPtr {
WP<HOOK_CALLBACK_FN> fn;
diff --git a/src/managers/XWaylandManager.hpp b/src/managers/XWaylandManager.hpp
index e4f1e17a..59eee4c5 100644
--- a/src/managers/XWaylandManager.hpp
+++ b/src/managers/XWaylandManager.hpp
@@ -4,7 +4,7 @@
#include <optional>
class CWindow; // because clangd
-typedef SP<CWindow> PHLWINDOW;
+using PHLWINDOW = SP<CWindow>;
class CWLSurfaceResource;
class CHyprXWaylandManager {
diff --git a/src/plugins/PluginAPI.hpp b/src/plugins/PluginAPI.hpp
index 0f333294..00a1e8b2 100644
--- a/src/plugins/PluginAPI.hpp
+++ b/src/plugins/PluginAPI.hpp
@@ -31,12 +31,12 @@ Feel like the API is missing something you'd like to use in your plugin? Open an
#include <string>
#include <hyprlang.hpp>
-typedef struct {
+using PLUGIN_DESCRIPTION_INFO = struct {
std::string name;
std::string description;
std::string author;
std::string version;
-} PLUGIN_DESCRIPTION_INFO;
+};
struct SFunctionMatch {
void* address = nullptr;
@@ -83,7 +83,7 @@ class CWindow;
This function should not be modified, see the example plugin.
*/
-typedef REQUIRED std::string (*PPLUGIN_API_VERSION_FUNC)();
+using PPLUGIN_API_VERSION_FUNC = REQUIRED std::string (*)();
#define PLUGIN_API_VERSION pluginAPIVersion
#define PLUGIN_API_VERSION_FUNC_STR "pluginAPIVersion"
@@ -93,7 +93,7 @@ typedef REQUIRED std::string (*PPLUGIN_API_VERSION_FUNC)();
Keep in mind this is executed synchronously, and as such any blocking calls to hyprland might hang. (e.g. system("hyprctl ..."))
*/
-typedef REQUIRED PLUGIN_DESCRIPTION_INFO (*PPLUGIN_INIT_FUNC)(HANDLE);
+using PPLUGIN_INIT_FUNC = REQUIRED PLUGIN_DESCRIPTION_INFO (*)(HANDLE);
#define PLUGIN_INIT pluginInit
#define PLUGIN_INIT_FUNC_STR "pluginInit"
@@ -103,7 +103,7 @@ typedef REQUIRED PLUGIN_DESCRIPTION_INFO (*PPLUGIN_INIT_FUNC)(HANDLE);
Hooks are unloaded after exit.
*/
-typedef OPTIONAL void (*PPLUGIN_EXIT_FUNC)();
+using PPLUGIN_EXIT_FUNC = OPTIONAL void (*)();
#define PLUGIN_EXIT pluginExit
#define PLUGIN_EXIT_FUNC_STR "pluginExit"
diff --git a/src/protocols/types/ColorManagement.hpp b/src/protocols/types/ColorManagement.hpp
index 48d8dd31..2dd1c075 100644
--- a/src/protocols/types/ColorManagement.hpp
+++ b/src/protocols/types/ColorManagement.hpp
@@ -54,7 +54,7 @@ namespace NColorManagement {
return (eTransferFunction)tf;
}
- typedef Hyprgraphics::SPCPRimaries SPCPRimaries;
+ using SPCPRimaries = Hyprgraphics::SPCPRimaries;
namespace NColorPrimaries {
static const auto DEFAULT_PRIMARIES = SPCPRimaries{};
diff --git a/src/xwayland/XSurface.hpp b/src/xwayland/XSurface.hpp
index dc43acbb..ec71aad3 100644
--- a/src/xwayland/XSurface.hpp
+++ b/src/xwayland/XSurface.hpp
@@ -9,9 +9,9 @@ class CWLSurfaceResource;
class CXWaylandSurfaceResource;
#ifdef NO_XWAYLAND
-typedef uint32_t xcb_pixmap_t;
-typedef uint32_t xcb_window_t;
-typedef struct {
+using xcb_pixmap_t = uint32_t;
+using xcb_window_t = uint32_t;
+using xcb_icccm_wm_hints_t = struct {
int32_t flags;
uint32_t input;
int32_t initial_state;
@@ -20,8 +20,8 @@ typedef struct {
int32_t icon_x, icon_y;
xcb_pixmap_t icon_mask;
xcb_window_t window_group;
-} xcb_icccm_wm_hints_t;
-typedef struct {
+};
+using xcb_size_hints_t = struct {
uint32_t flags;
int32_t x, y;
int32_t width, height;
@@ -32,7 +32,7 @@ typedef struct {
int32_t max_aspect_num, max_aspect_den;
int32_t base_width, base_height;
uint32_t win_gravity;
-} xcb_size_hints_t;
+};
#else
#include <xcb/xcb_icccm.h>
#endif