touch up the clang format and format all files

This commit is contained in:
vaxerski 2022-12-20 02:18:47 +00:00
parent 3e2785b970
commit 4fd90144d1
15 changed files with 337 additions and 328 deletions

View file

@ -60,6 +60,6 @@ AllowShortEnumsOnASingleLine: false
BraceWrapping: BraceWrapping:
AfterEnum: false AfterEnum: false
AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments AlignConsecutiveDeclarations: AcrossEmptyLines
NamespaceIndentation: All NamespaceIndentation: All

View file

@ -59,7 +59,6 @@ void request(std::string arg, int minArgs = 0) {
return; return;
} }
// get the instance signature // get the instance signature
auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE"); auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE");
@ -176,7 +175,7 @@ int dispatchRequest(int argc, char** argv) {
std::string rq = "/dispatch"; std::string rq = "/dispatch";
for(int i = 2; i < argc; i++) { for (int i = 2; i < argc; i++) {
if (!strcmp(argv[i], "--")) if (!strcmp(argv[i], "--"))
continue; continue;
rq += " " + std::string(argv[i]); rq += " " + std::string(argv[i]);
@ -195,7 +194,7 @@ int keywordRequest(int argc, char** argv) {
std::string rq = "/keyword"; std::string rq = "/keyword";
for(int i = 2; i < argc; i++) for (int i = 2; i < argc; i++)
rq += " " + std::string(argv[i]); rq += " " + std::string(argv[i]);
request(rq); request(rq);
@ -311,26 +310,46 @@ int main(int argc, char** argv) {
int exitStatus = 0; int exitStatus = 0;
if (fullRequest.contains("/--batch")) batchRequest(fullRequest); if (fullRequest.contains("/--batch"))
else if (fullRequest.contains("/monitors")) request(fullRequest); batchRequest(fullRequest);
else if (fullRequest.contains("/clients")) request(fullRequest); else if (fullRequest.contains("/monitors"))
else if (fullRequest.contains("/workspaces")) request(fullRequest); request(fullRequest);
else if (fullRequest.contains("/activewindow")) request(fullRequest); else if (fullRequest.contains("/clients"))
else if (fullRequest.contains("/layers")) request(fullRequest); request(fullRequest);
else if (fullRequest.contains("/version")) request(fullRequest); else if (fullRequest.contains("/workspaces"))
else if (fullRequest.contains("/kill")) request(fullRequest); request(fullRequest);
else if (fullRequest.contains("/splash")) request(fullRequest); else if (fullRequest.contains("/activewindow"))
else if (fullRequest.contains("/devices")) request(fullRequest); request(fullRequest);
else if (fullRequest.contains("/reload")) request(fullRequest); else if (fullRequest.contains("/layers"))
else if (fullRequest.contains("/getoption")) request(fullRequest); request(fullRequest);
else if (fullRequest.contains("/cursorpos")) request(fullRequest); else if (fullRequest.contains("/version"))
else if (fullRequest.contains("/switchxkblayout")) request(fullRequest, 2); request(fullRequest);
else if (fullRequest.contains("/output")) exitStatus = outputRequest(argc, argv); else if (fullRequest.contains("/kill"))
else if (fullRequest.contains("/setcursor")) exitStatus = setcursorRequest(argc, argv); request(fullRequest);
else if (fullRequest.contains("/dispatch")) exitStatus = dispatchRequest(argc, argv); else if (fullRequest.contains("/splash"))
else if (fullRequest.contains("/keyword")) exitStatus = keywordRequest(argc, argv); request(fullRequest);
else if (fullRequest.contains("/hyprpaper")) exitStatus = hyprpaperRequest(argc, argv); else if (fullRequest.contains("/devices"))
else if (fullRequest.contains("/--help")) printf("%s", USAGE.c_str()); request(fullRequest);
else if (fullRequest.contains("/reload"))
request(fullRequest);
else if (fullRequest.contains("/getoption"))
request(fullRequest);
else if (fullRequest.contains("/cursorpos"))
request(fullRequest);
else if (fullRequest.contains("/switchxkblayout"))
request(fullRequest, 2);
else if (fullRequest.contains("/output"))
exitStatus = outputRequest(argc, argv);
else if (fullRequest.contains("/setcursor"))
exitStatus = setcursorRequest(argc, argv);
else if (fullRequest.contains("/dispatch"))
exitStatus = dispatchRequest(argc, argv);
else if (fullRequest.contains("/keyword"))
exitStatus = keywordRequest(argc, argv);
else if (fullRequest.contains("/hyprpaper"))
exitStatus = hyprpaperRequest(argc, argv);
else if (fullRequest.contains("/--help"))
printf("%s", USAGE.c_str());
else { else {
printf("%s\n", USAGE.c_str()); printf("%s\n", USAGE.c_str());
return 1; return 1;

View file

@ -134,11 +134,7 @@ void CWindow::createToplevelHandle() {
// handle events // handle events
hyprListener_toplevelActivate.initCallback( hyprListener_toplevelActivate.initCallback(
&m_phForeignToplevel->events.request_activate, &m_phForeignToplevel->events.request_activate, [&](void* owner, void* data) { g_pCompositor->focusWindow(this); }, this, "Toplevel");
[&](void* owner, void* data) {
g_pCompositor->focusWindow(this);
},
this, "Toplevel");
hyprListener_toplevelFullscreen.initCallback( hyprListener_toplevelFullscreen.initCallback(
&m_phForeignToplevel->events.request_fullscreen, &m_phForeignToplevel->events.request_fullscreen,
@ -150,11 +146,7 @@ void CWindow::createToplevelHandle() {
this, "Toplevel"); this, "Toplevel");
hyprListener_toplevelClose.initCallback( hyprListener_toplevelClose.initCallback(
&m_phForeignToplevel->events.request_close, &m_phForeignToplevel->events.request_close, [&](void* owner, void* data) { g_pCompositor->closeWindow(this); }, this, "Toplevel");
[&](void* owner, void* data) {
g_pCompositor->closeWindow(this);
},
this, "Toplevel");
m_iLastToplevelMonitorID = m_iMonitorID; m_iLastToplevelMonitorID = m_iMonitorID;
} }

View file

@ -156,8 +156,7 @@ static const struct wlr_pixel_format_info pixel_format_info[] = {
}, },
}; };
static const size_t pixel_format_info_size = static const size_t pixel_format_info_size = sizeof(pixel_format_info) / sizeof(pixel_format_info[0]);
sizeof(pixel_format_info) / sizeof(pixel_format_info[0]);
const struct wlr_pixel_format_info* drm_get_pixel_format_info(uint32_t fmt) { const struct wlr_pixel_format_info* drm_get_pixel_format_info(uint32_t fmt) {
for (size_t i = 0; i < pixel_format_info_size; ++i) { for (size_t i = 0; i < pixel_format_info_size; ++i) {
@ -171,23 +170,17 @@ const struct wlr_pixel_format_info* drm_get_pixel_format_info(uint32_t fmt) {
uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt) { uint32_t convert_wl_shm_format_to_drm(enum wl_shm_format fmt) {
switch (fmt) { switch (fmt) {
case WL_SHM_FORMAT_XRGB8888: case WL_SHM_FORMAT_XRGB8888: return DRM_FORMAT_XRGB8888;
return DRM_FORMAT_XRGB8888; case WL_SHM_FORMAT_ARGB8888: return DRM_FORMAT_ARGB8888;
case WL_SHM_FORMAT_ARGB8888: default: return (uint32_t)fmt;
return DRM_FORMAT_ARGB8888;
default:
return (uint32_t)fmt;
} }
} }
enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt) { enum wl_shm_format convert_drm_format_to_wl_shm(uint32_t fmt) {
switch (fmt) { switch (fmt) {
case DRM_FORMAT_XRGB8888: case DRM_FORMAT_XRGB8888: return WL_SHM_FORMAT_XRGB8888;
return WL_SHM_FORMAT_XRGB8888; case DRM_FORMAT_ARGB8888: return WL_SHM_FORMAT_ARGB8888;
case DRM_FORMAT_ARGB8888: default: return (enum wl_shm_format)fmt;
return WL_SHM_FORMAT_ARGB8888;
default:
return (enum wl_shm_format)fmt;
} }
} }

View file

@ -30,7 +30,8 @@ inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVar
distances /= 4.0; distances /= 4.0;
)#" + colorVarName + R"#( = )#" + colorVarName + R"#( * distances; )#" +
colorVarName + R"#( = )#" + colorVarName + R"#( * distances;
} }
} }
@ -66,7 +67,8 @@ void main() {
vec4 pixColor = v_color; vec4 pixColor = v_color;
if (radius > 0.0) { if (radius > 0.0) {
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#( )#" +
ROUNDED_SHADER_FUNC("pixColor") + R"#(
} }
gl_FragColor = pixColor; gl_FragColor = pixColor;
@ -114,7 +116,8 @@ void main() {
pixColor[2] = pixColor[2] * tint[2]; pixColor[2] = pixColor[2] * tint[2];
} }
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#( )#" +
ROUNDED_SHADER_FUNC("pixColor") + R"#(
gl_FragColor = pixColor * alpha; gl_FragColor = pixColor * alpha;
})#"; })#";
@ -149,7 +152,8 @@ void main() {
pixColor[2] = pixColor[2] * tint[2]; pixColor[2] = pixColor[2] * tint[2];
} }
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#( )#" +
ROUNDED_SHADER_FUNC("pixColor") + R"#(
gl_FragColor = pixColor * alpha; gl_FragColor = pixColor * alpha;
})#"; })#";
@ -234,7 +238,8 @@ void main() {
pixColor[2] = pixColor[2] * tint[2]; pixColor[2] = pixColor[2] * tint[2];
} }
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#( )#" +
ROUNDED_SHADER_FUNC("pixColor") + R"#(
gl_FragColor = pixColor * alpha; gl_FragColor = pixColor * alpha;
} }