Cleanup whitespace and suppress unused variable warnings

This commit is contained in:
Oskari Alaranta 2026-02-22 17:58:09 +02:00
parent 85bb292a31
commit 8c2fea9edf
6 changed files with 27 additions and 21 deletions

View File

@ -646,7 +646,7 @@ static BAN::Vector<WINDOW> get_path_to_child(WINDOW wid, int32_t x, int32_t y)
const auto& window = object.object.get<Object::Window>();
if (!window_contains(window, x, y))
break;
MUST(result.push_back(wid));
const WINDOW old_wid = wid;
@ -849,11 +849,11 @@ static void on_window_close_event(Client& client_info, WINDOW wid)
{
if (WM_PROTOCOLS == None || WM_DELETE_WINDOW == None)
return false;
auto wm_protocols_it = window.properties.find(WM_PROTOCOLS);
if (wm_protocols_it == window.properties.end())
return false;
const auto& wm_protocols = wm_protocols_it->value;
if (wm_protocols.type != XA_ATOM || wm_protocols.format != 32)
return false;
@ -1101,7 +1101,7 @@ static void on_mouse_button_event(Client& client_info, WINDOW wid, uint8_t xbutt
case Button5: mask = Button5Mask; break;
}
if (pressed)
if (pressed)
s_butmask |= mask;
else
s_butmask &= ~mask;
@ -1672,7 +1672,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
if (!window_changed)
break;
invalidate_window(request.window, min_x, min_y, max_x - min_x, max_y + min_y);
if (window.event_mask & StructureNotifyMask)
@ -1904,7 +1904,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
.data = {},
}));
}
auto& property = it->value;
ASSERT(property.format == request.format);
@ -2028,7 +2028,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
else
{
const auto& property = it->value;
const size_t offset = request.longOffset * 4;
const size_t bytes = BAN::Math::min<size_t>(request.longLength * 4, property.data.size() - offset);
ASSERT(bytes % (property.format / 8) == 0);
@ -2538,7 +2538,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
TRY(client_info.objects.insert(request.gc));
TRY(g_objects.insert(request.gc, TRY(BAN::UniqPtr<Object>::create(Object {
.type = Object::Type::GraphicsContext,
.object = Object::GraphicsContext {
.object = Object::GraphicsContext {
.foreground = foreground,
.background = background,
.line_width = line_width,
@ -2956,7 +2956,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
.nColors = static_cast<CARD16>(count),
};
TRY(encode(client_info.output_buffer, reply));
dprintln(" colors:");
for (size_t i = 0; i < count; i++)
{
@ -3003,7 +3003,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
case X_CreateCursor:
{
auto request = decode<xCreateCursorReq>(packet).value();
dprintln("CreateCursor");
dprintln(" cid: {}", request.cid);
dprintln(" source: {}", request.source);
@ -3071,7 +3071,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
case X_FreeCursor:
{
const auto cid = packet.as_span<const uint32_t>()[1];
dprintln("FreeCursor");
dprintln(" cid: {}", cid);

View File

@ -33,6 +33,12 @@ banan_link_library(xbanan libdeflate)
banan_link_library(xbanan libgui)
banan_link_library(xbanan libinput)
target_compile_options(xbanan PRIVATE -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers)
target_compile_options(xbanan PRIVATE -Wall -Wextra)
target_compile_options(xbanan PRIVATE
-Wno-sign-compare
-Wno-missing-field-initializers
-Wno-unused-variable
-Wno-unused-but-set-variable
)
install(TARGETS xbanan OPTIONAL)

View File

@ -207,7 +207,7 @@ BAN::ErrorOr<void> fill_poly(Client& client_info, BAN::ConstByteSpan packet)
dprintln(" gc: {}", request.gc);
dprintln(" shape: {}", request.shape);
dprintln(" coordMode: {}", request.coordMode);
auto [out_data_u32, out_w, out_h, _] = TRY(get_drawable_info(client_info, request.drawable, X_FillPoly));
const auto& gc = TRY_REF(get_gc(client_info, request.gc, X_FillPoly));
@ -268,7 +268,7 @@ BAN::ErrorOr<void> fill_poly(Client& client_info, BAN::ConstByteSpan packet)
}
if (g_objects[request.drawable]->type == Object::Type::Window)
invalidate_window(request.drawable, min_x, min_y, max_x - min_x + 1, max_y - min_y + 1);
invalidate_window(request.drawable, min_x, min_y, max_x - min_x + 1, max_y - min_y + 1);
return {};
}
@ -347,7 +347,7 @@ BAN::ErrorOr<void> poly_fill_arc(Client& client_info, BAN::ConstByteSpan packet)
const int32_t min_x = BAN::Math::max<int32_t>(0, arc.x);
const int32_t min_y = BAN::Math::max<int32_t>(0, arc.y);
const int32_t max_x = BAN::Math::min<int32_t>(out_w, arc.x + arc.width);
const int32_t max_y = BAN::Math::min<int32_t>(out_h, arc.y + arc.height);

View File

@ -144,7 +144,7 @@ BAN::ErrorOr<void> extension_glx(Client& client_info, BAN::ConstByteSpan packet)
delete &TRY_REF(get_glx_context(request.context));
client_info.objects.remove(request.context);
g_objects.remove(request.context);
break;
}
case X_GLXIsDirect:
@ -253,7 +253,7 @@ BAN::ErrorOr<void> extension_glx(Client& client_info, BAN::ConstByteSpan packet)
.n = static_cast<CARD16>(string.size()),
};
TRY(encode(client_info.output_buffer, reply));
TRY(encode(client_info.output_buffer, string));
for (size_t i = 0; (string.size() + i) % 4; i++)
TRY(encode(client_info.output_buffer, '\0'));
@ -289,7 +289,7 @@ BAN::ErrorOr<void> extension_glx(Client& client_info, BAN::ConstByteSpan packet)
.numAttribs = attribs,
};
TRY(encode(client_info.output_buffer, reply));
TRY(encode(client_info.output_buffer, g_fb_configs));
break;

View File

@ -10,7 +10,7 @@ static BAN::ErrorOr<void> extension_randr(Client& client_info, BAN::ConstByteSpa
{
static CARD32 crtc_id = 5;
static CARD32 output_id = 6;
static CARD32 mode_id = 7;
static CARD32 mode_id = 7;
static CARD32 timestamp = time(nullptr);
static xRenderTransform transform {

View File

@ -455,7 +455,7 @@ static void initialize_fonts()
auto it = s_available_fonts.find(BAN::String(name));
if (it == s_available_fonts.end())
continue;
continue;
MUST(s_available_fonts.insert(BAN::String(alias), it->value));
}
@ -756,7 +756,7 @@ static void write_text(WriteTextInfo& info)
for (size_t i = 0; i < info.string_len; i++)
{
const uint16_t codepoint = info.wide ? (info.string[i * 2] << 8) | info.string[i * 2 + 1] : info.string[i];
auto glyph_index = info.font->find_glyph(codepoint);
if (!glyph_index.has_value())
continue;