core: fix Wextra Wall warnings

add missing field initializers, add a missing destructor for a base
class that is being inherited later on.
This commit is contained in:
Tom Englund 2024-08-21 21:04:14 +02:00
parent 696a5ad4ec
commit f7471daba9
7 changed files with 13 additions and 11 deletions

View File

@ -7,8 +7,8 @@ namespace Aquamarine {
class IBackendImplementation; class IBackendImplementation;
struct SSwapchainOptions { struct SSwapchainOptions {
size_t length = 0; size_t length = 0;
Hyprutils::Math::Vector2D size; 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. 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 */; bool scanout = false, cursor = false /* requires scanout = true */, multigpu = false /* if true, will force linear */;
}; };

View File

@ -236,12 +236,12 @@ namespace Aquamarine {
}; };
struct SDRMConnectorCommitData { struct SDRMConnectorCommitData {
Hyprutils::Memory::CSharedPointer<CDRMFB> mainFB, cursorFB; Hyprutils::Memory::CSharedPointer<CDRMFB> mainFB = nullptr, cursorFB = nullptr;
bool modeset = false; bool modeset = false;
bool blocking = false; bool blocking = false;
uint32_t flags = 0; uint32_t flags = 0;
bool test = false; bool test = false;
drmModeModeInfo modeInfo; drmModeModeInfo modeInfo{0};
struct { struct {
uint32_t gammaLut = 0; uint32_t gammaLut = 0;
@ -323,6 +323,7 @@ namespace Aquamarine {
class IDRMImplementation { class IDRMImplementation {
public: public:
virtual ~IDRMImplementation() = default;
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data) = 0; virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data) = 0;
virtual bool reset() = 0; virtual bool reset() = 0;

View File

@ -21,8 +21,8 @@ namespace Aquamarine {
class CWLBufferResource; class CWLBufferResource;
struct SDMABUFAttrs { struct SDMABUFAttrs {
bool success = false; bool success = false;
Hyprutils::Math::Vector2D size; Hyprutils::Math::Vector2D size = Hyprutils::Math::Vector2D(0, 0);
uint32_t format = 0; // fourcc uint32_t format = 0; // fourcc
uint64_t modifier = 0; uint64_t modifier = 0;

View File

@ -19,7 +19,7 @@ namespace Aquamarine {
Hyprutils::Math::Vector2D pixelSize; Hyprutils::Math::Vector2D pixelSize;
unsigned int refreshRate = 0 /* in mHz */; unsigned int refreshRate = 0 /* in mHz */;
bool preferred = false; 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 { enum eOutputPresentationMode : uint32_t {

View File

@ -246,7 +246,7 @@ void Aquamarine::CBackend::updateIdleTimer() {
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
timespecAddNs(&now, ADD_NS); 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)) if (timerfd_settime(idle.fd, TFD_TIMER_ABSTIME, &ts, nullptr))
log(AQ_LOG_ERROR, std::format("backend: failed to arm timerfd: {}", strerror(errno))); log(AQ_LOG_ERROR, std::format("backend: failed to arm timerfd: {}", strerror(errno)));

View File

@ -176,7 +176,7 @@ void Aquamarine::CHeadlessBackend::updateTimerFD() {
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
timespecAddNs(&now, lowestNs); 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)) if (timerfd_settime(timers.timerfd, TFD_TIMER_ABSTIME, &ts, nullptr))
backend->log(AQ_LOG_ERROR, std::format("headless: failed to arm timerfd: {}", strerror(errno))); backend->log(AQ_LOG_ERROR, std::format("headless: failed to arm timerfd: {}", strerror(errno)));

View File

@ -722,8 +722,9 @@ void Aquamarine::CSession::handleLibinputEvent(libinput_event* e) {
auto tool = hlDevice->toolFrom(libinput_event_tablet_tool_get_tool(tte)); auto tool = hlDevice->toolFrom(libinput_event_tablet_tool_get_tool(tte));
ITablet::SAxisEvent event = { ITablet::SAxisEvent event = {
.tool = tool, .tool = tool,
.timeMs = (uint32_t)(libinput_event_tablet_tool_get_time_usec(tte) / 1000), .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)) { if (libinput_event_tablet_tool_x_has_changed(tte)) {