mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-05 06:31:57 -07:00
refactor: replace all typedef
with using
(#10594)
This commit is contained in:
@@ -58,8 +58,8 @@ struct SDispatchResult {
|
|||||||
std::string error;
|
std::string error;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int64_t WINDOWID;
|
using WINDOWID = int64_t;
|
||||||
typedef int64_t MONITORID;
|
using MONITORID = int64_t;
|
||||||
typedef int64_t WORKSPACEID;
|
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)>;
|
||||||
|
@@ -6,21 +6,21 @@ class CLayerSurface;
|
|||||||
class CMonitor;
|
class CMonitor;
|
||||||
|
|
||||||
/* Shared pointer to a workspace */
|
/* Shared pointer to a workspace */
|
||||||
typedef SP<CWorkspace> PHLWORKSPACE;
|
using PHLWORKSPACE = SP<CWorkspace>;
|
||||||
/* Weak pointer to a workspace */
|
/* Weak pointer to a workspace */
|
||||||
typedef WP<CWorkspace> PHLWORKSPACEREF;
|
using PHLWORKSPACEREF = WP<CWorkspace>;
|
||||||
|
|
||||||
/* Shared pointer to a window */
|
/* Shared pointer to a window */
|
||||||
typedef SP<CWindow> PHLWINDOW;
|
using PHLWINDOW = SP<CWindow>;
|
||||||
/* Weak pointer to a window */
|
/* Weak pointer to a window */
|
||||||
typedef WP<CWindow> PHLWINDOWREF;
|
using PHLWINDOWREF = WP<CWindow>;
|
||||||
|
|
||||||
/* Shared pointer to a layer surface */
|
/* Shared pointer to a layer surface */
|
||||||
typedef SP<CLayerSurface> PHLLS;
|
using PHLLS = SP<CLayerSurface>;
|
||||||
/* Weak pointer to a layer surface */
|
/* Weak pointer to a layer surface */
|
||||||
typedef WP<CLayerSurface> PHLLSREF;
|
using PHLLSREF = WP<CLayerSurface>;
|
||||||
|
|
||||||
/* Shared pointer to a monitor */
|
/* Shared pointer to a monitor */
|
||||||
typedef SP<CMonitor> PHLMONITOR;
|
using PHLMONITOR = SP<CMonitor>;
|
||||||
/* Weak pointer to a monitor */
|
/* Weak pointer to a monitor */
|
||||||
typedef WP<CMonitor> PHLMONITORREF;
|
using PHLMONITORREF = WP<CMonitor>;
|
||||||
|
@@ -5,8 +5,8 @@
|
|||||||
#include "math/Math.hpp"
|
#include "math/Math.hpp"
|
||||||
#include <aquamarine/backend/Misc.hpp>
|
#include <aquamarine/backend/Misc.hpp>
|
||||||
|
|
||||||
typedef uint32_t DRMFormat;
|
using DRMFormat = uint32_t;
|
||||||
typedef uint32_t SHMFormat;
|
using SHMFormat = uint32_t;
|
||||||
|
|
||||||
struct SPixelFormat {
|
struct SPixelFormat {
|
||||||
DRMFormat drmFormat = 0; /* DRM_FORMAT_INVALID */
|
DRMFormat drmFormat = 0; /* DRM_FORMAT_INVALID */
|
||||||
@@ -20,7 +20,7 @@ struct SPixelFormat {
|
|||||||
Vector2D blockSize;
|
Vector2D blockSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Aquamarine::SDRMFormat SDRMFormat;
|
using SDRMFormat = Aquamarine::SDRMFormat;
|
||||||
|
|
||||||
namespace NFormatUtils {
|
namespace NFormatUtils {
|
||||||
SHMFormat drmToShm(DRMFormat drm);
|
SHMFormat drmToShm(DRMFormat drm);
|
||||||
|
@@ -411,7 +411,7 @@ static void snapResize(double& start, double& end, const double P) {
|
|||||||
start = 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 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");
|
static auto SNAPWINDOWGAP = CConfigValue<Hyprlang::INT>("general:snap:window_gap");
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
#define HANDLE void*
|
#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 {
|
struct SCallbackFNPtr {
|
||||||
WP<HOOK_CALLBACK_FN> fn;
|
WP<HOOK_CALLBACK_FN> fn;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
class CWindow; // because clangd
|
class CWindow; // because clangd
|
||||||
typedef SP<CWindow> PHLWINDOW;
|
using PHLWINDOW = SP<CWindow>;
|
||||||
class CWLSurfaceResource;
|
class CWLSurfaceResource;
|
||||||
|
|
||||||
class CHyprXWaylandManager {
|
class CHyprXWaylandManager {
|
||||||
|
@@ -31,12 +31,12 @@ Feel like the API is missing something you'd like to use in your plugin? Open an
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <hyprlang.hpp>
|
#include <hyprlang.hpp>
|
||||||
|
|
||||||
typedef struct {
|
using PLUGIN_DESCRIPTION_INFO = struct {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description;
|
||||||
std::string author;
|
std::string author;
|
||||||
std::string version;
|
std::string version;
|
||||||
} PLUGIN_DESCRIPTION_INFO;
|
};
|
||||||
|
|
||||||
struct SFunctionMatch {
|
struct SFunctionMatch {
|
||||||
void* address = nullptr;
|
void* address = nullptr;
|
||||||
@@ -83,7 +83,7 @@ class CWindow;
|
|||||||
|
|
||||||
This function should not be modified, see the example plugin.
|
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 pluginAPIVersion
|
||||||
#define PLUGIN_API_VERSION_FUNC_STR "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 ..."))
|
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 pluginInit
|
||||||
#define PLUGIN_INIT_FUNC_STR "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.
|
Hooks are unloaded after exit.
|
||||||
*/
|
*/
|
||||||
typedef OPTIONAL void (*PPLUGIN_EXIT_FUNC)();
|
using PPLUGIN_EXIT_FUNC = OPTIONAL void (*)();
|
||||||
#define PLUGIN_EXIT pluginExit
|
#define PLUGIN_EXIT pluginExit
|
||||||
#define PLUGIN_EXIT_FUNC_STR "pluginExit"
|
#define PLUGIN_EXIT_FUNC_STR "pluginExit"
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ namespace NColorManagement {
|
|||||||
return (eTransferFunction)tf;
|
return (eTransferFunction)tf;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef Hyprgraphics::SPCPRimaries SPCPRimaries;
|
using SPCPRimaries = Hyprgraphics::SPCPRimaries;
|
||||||
|
|
||||||
namespace NColorPrimaries {
|
namespace NColorPrimaries {
|
||||||
static const auto DEFAULT_PRIMARIES = SPCPRimaries{};
|
static const auto DEFAULT_PRIMARIES = SPCPRimaries{};
|
||||||
|
@@ -9,9 +9,9 @@ class CWLSurfaceResource;
|
|||||||
class CXWaylandSurfaceResource;
|
class CXWaylandSurfaceResource;
|
||||||
|
|
||||||
#ifdef NO_XWAYLAND
|
#ifdef NO_XWAYLAND
|
||||||
typedef uint32_t xcb_pixmap_t;
|
using xcb_pixmap_t = uint32_t;
|
||||||
typedef uint32_t xcb_window_t;
|
using xcb_window_t = uint32_t;
|
||||||
typedef struct {
|
using xcb_icccm_wm_hints_t = struct {
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
uint32_t input;
|
uint32_t input;
|
||||||
int32_t initial_state;
|
int32_t initial_state;
|
||||||
@@ -20,8 +20,8 @@ typedef struct {
|
|||||||
int32_t icon_x, icon_y;
|
int32_t icon_x, icon_y;
|
||||||
xcb_pixmap_t icon_mask;
|
xcb_pixmap_t icon_mask;
|
||||||
xcb_window_t window_group;
|
xcb_window_t window_group;
|
||||||
} xcb_icccm_wm_hints_t;
|
};
|
||||||
typedef struct {
|
using xcb_size_hints_t = struct {
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
@@ -32,7 +32,7 @@ typedef struct {
|
|||||||
int32_t max_aspect_num, max_aspect_den;
|
int32_t max_aspect_num, max_aspect_den;
|
||||||
int32_t base_width, base_height;
|
int32_t base_width, base_height;
|
||||||
uint32_t win_gravity;
|
uint32_t win_gravity;
|
||||||
} xcb_size_hints_t;
|
};
|
||||||
#else
|
#else
|
||||||
#include <xcb/xcb_icccm.h>
|
#include <xcb/xcb_icccm.h>
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user