refactor: replace all typedef with using (#10594)

This commit is contained in:
Kamikadze
2025-05-31 18:02:02 +05:00
committed by GitHub
parent af2fdb5d58
commit 4078e1d17c
9 changed files with 31 additions and 31 deletions

View File

@@ -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)>;

View File

@@ -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>;

View File

@@ -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);

View File

@@ -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");

View File

@@ -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;

View File

@@ -4,7 +4,7 @@
#include <optional>
class CWindow; // because clangd
typedef SP<CWindow> PHLWINDOW;
using PHLWINDOW = SP<CWindow>;
class CWLSurfaceResource;
class CHyprXWaylandManager {

View File

@@ -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"

View File

@@ -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{};

View File

@@ -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