Skip to content

Commit

Permalink
core: fix Wextra Wall warnings
Browse files Browse the repository at this point in the history
add missing field initializers, add a missing destructor for a base
class that is being inherited later on.
  • Loading branch information
gulafaran committed Aug 21, 2024
1 parent 696a5ad commit f7471da
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/aquamarine/allocator/Swapchain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Aquamarine {
class IBackendImplementation;

struct SSwapchainOptions {
size_t length = 0;
Hyprutils::Math::Vector2D size;
size_t length = 0;
Hyprutils::Math::Vector2D size = Hyprutils::Math::Vector2D(0, 0);
uint32_t format = DRM_FORMAT_INVALID; // if you leave this on invalid, the swapchain will choose an appropriate format (and modifier) for you.
bool scanout = false, cursor = false /* requires scanout = true */, multigpu = false /* if true, will force linear */;
};
Expand Down
5 changes: 3 additions & 2 deletions include/aquamarine/backend/DRM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ namespace Aquamarine {
};

struct SDRMConnectorCommitData {
Hyprutils::Memory::CSharedPointer<CDRMFB> mainFB, cursorFB;
Hyprutils::Memory::CSharedPointer<CDRMFB> mainFB = nullptr, cursorFB = nullptr;
bool modeset = false;
bool blocking = false;
uint32_t flags = 0;
bool test = false;
drmModeModeInfo modeInfo;
drmModeModeInfo modeInfo{0};

struct {
uint32_t gammaLut = 0;
Expand Down Expand Up @@ -323,6 +323,7 @@ namespace Aquamarine {

class IDRMImplementation {
public:
virtual ~IDRMImplementation() = default;
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data) = 0;
virtual bool reset() = 0;

Expand Down
4 changes: 2 additions & 2 deletions include/aquamarine/buffer/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace Aquamarine {
class CWLBufferResource;

struct SDMABUFAttrs {
bool success = false;
Hyprutils::Math::Vector2D size;
bool success = false;
Hyprutils::Math::Vector2D size = Hyprutils::Math::Vector2D(0, 0);
uint32_t format = 0; // fourcc
uint64_t modifier = 0;

Expand Down
2 changes: 1 addition & 1 deletion include/aquamarine/output/Output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Aquamarine {
Hyprutils::Math::Vector2D pixelSize;
unsigned int refreshRate = 0 /* in mHz */;
bool preferred = false;
std::optional<drmModeModeInfo> modeInfo; // if this is a drm mode, this will be populated.
std::optional<drmModeModeInfo> modeInfo = std::nullopt; // if this is a drm mode, this will be populated.
};

enum eOutputPresentationMode : uint32_t {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void Aquamarine::CBackend::updateIdleTimer() {
clock_gettime(CLOCK_MONOTONIC, &now);
timespecAddNs(&now, ADD_NS);

itimerspec ts = {.it_value = now};
itimerspec ts = {.it_interval{0, 0}, .it_value = now};

if (timerfd_settime(idle.fd, TFD_TIMER_ABSTIME, &ts, nullptr))
log(AQ_LOG_ERROR, std::format("backend: failed to arm timerfd: {}", strerror(errno)));
Expand Down
2 changes: 1 addition & 1 deletion src/backend/Headless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void Aquamarine::CHeadlessBackend::updateTimerFD() {
clock_gettime(CLOCK_MONOTONIC, &now);
timespecAddNs(&now, lowestNs);

itimerspec ts = {.it_value = now};
itimerspec ts = {.it_interval{0, 0}, .it_value = now};

if (timerfd_settime(timers.timerfd, TFD_TIMER_ABSTIME, &ts, nullptr))
backend->log(AQ_LOG_ERROR, std::format("headless: failed to arm timerfd: {}", strerror(errno)));
Expand Down
5 changes: 3 additions & 2 deletions src/backend/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,9 @@ void Aquamarine::CSession::handleLibinputEvent(libinput_event* e) {
auto tool = hlDevice->toolFrom(libinput_event_tablet_tool_get_tool(tte));

ITablet::SAxisEvent event = {
.tool = tool,
.timeMs = (uint32_t)(libinput_event_tablet_tool_get_time_usec(tte) / 1000),
.tool = tool,
.timeMs = (uint32_t)(libinput_event_tablet_tool_get_time_usec(tte) / 1000),
.absolute = Hyprutils::Math::Vector2D(0, 0),
};

if (libinput_event_tablet_tool_x_has_changed(tte)) {
Expand Down

0 comments on commit f7471da

Please sign in to comment.