mirror of
https://github.com/hyprwm/aquamarine.git
synced 2026-05-05 00:07:58 +02:00
core: Compiler fixes and options (#141)
* reorder ctors * sign-compare * Add some compile options from Hyprland
This commit is contained in:
parent
257b205079
commit
343178ba45
7 changed files with 16 additions and 10 deletions
|
|
@ -40,6 +40,12 @@ pkg_check_modules(
|
||||||
configure_file(aquamarine.pc.in aquamarine.pc @ONLY)
|
configure_file(aquamarine.pc.in aquamarine.pc @ONLY)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
add_compile_options(
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wno-unused-parameter
|
||||||
|
-Wno-unused-value
|
||||||
|
-Wno-missing-field-initializers)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,6 @@ eAllocatorType Aquamarine::CDRMDumbAllocator::type() {
|
||||||
return eAllocatorType::AQ_ALLOCATOR_TYPE_DRM_DUMB;
|
return eAllocatorType::AQ_ALLOCATOR_TYPE_DRM_DUMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
Aquamarine::CDRMDumbAllocator::CDRMDumbAllocator(int fd_, Hyprutils::Memory::CWeakPointer<CBackend> backend_) : drmfd(fd_), backend(backend_) {
|
Aquamarine::CDRMDumbAllocator::CDRMDumbAllocator(int fd_, Hyprutils::Memory::CWeakPointer<CBackend> backend_) : backend(backend_), drmfd(fd_) {
|
||||||
; // nothing to do
|
; // nothing to do
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ static const libinput_interface libinputListener = {
|
||||||
|
|
||||||
// ------------
|
// ------------
|
||||||
|
|
||||||
Aquamarine::CSessionDevice::CSessionDevice(Hyprutils::Memory::CSharedPointer<CSession> session_, const std::string& path_) : session(session_), path(path_) {
|
Aquamarine::CSessionDevice::CSessionDevice(Hyprutils::Memory::CSharedPointer<CSession> session_, const std::string& path_) : path(path_), session(session_) {
|
||||||
deviceID = libseat_open_device(session->libseatHandle, path.c_str(), &fd);
|
deviceID = libseat_open_device(session->libseatHandle, path.c_str(), &fd);
|
||||||
if (deviceID < 0) {
|
if (deviceID < 0) {
|
||||||
session->backend->log(AQ_LOG_ERROR, std::format("libseat: Couldn't open device at {}", path_));
|
session->backend->log(AQ_LOG_ERROR, std::format("libseat: Couldn't open device at {}", path_));
|
||||||
|
|
@ -1025,7 +1025,7 @@ Aquamarine::CLibinputTabletPad::CLibinputTabletPad(Hyprutils::Memory::CSharedPoi
|
||||||
paths.emplace_back(udev_device_get_syspath(udevice));
|
paths.emplace_back(udev_device_get_syspath(udevice));
|
||||||
|
|
||||||
int groupsno = libinput_device_tablet_pad_get_num_mode_groups(device->device);
|
int groupsno = libinput_device_tablet_pad_get_num_mode_groups(device->device);
|
||||||
for (size_t i = 0; i < groupsno; ++i) {
|
for (int i = 0; i < groupsno; ++i) {
|
||||||
auto g = createGroupFromID(i);
|
auto g = createGroupFromID(i);
|
||||||
if (g)
|
if (g)
|
||||||
groups.emplace_back(g);
|
groups.emplace_back(g);
|
||||||
|
|
|
||||||
|
|
@ -783,7 +783,7 @@ Aquamarine::CWaylandBuffer::CWaylandBuffer(SP<IBuffer> buffer_, Hyprutils::Memor
|
||||||
|
|
||||||
auto attrs = buffer->dmabuf();
|
auto attrs = buffer->dmabuf();
|
||||||
|
|
||||||
for (size_t i = 0; i < attrs.planes; ++i) {
|
for (int i = 0; i < attrs.planes; ++i) {
|
||||||
params->sendAdd(attrs.fds.at(i), i, attrs.offsets.at(i), attrs.strides.at(i), attrs.modifier >> 32, attrs.modifier & 0xFFFFFFFF);
|
params->sendAdd(attrs.fds.at(i), i, attrs.offsets.at(i), attrs.strides.at(i), attrs.modifier >> 32, attrs.modifier & 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -470,7 +470,7 @@ bool Aquamarine::CDRMBackend::initResources() {
|
||||||
|
|
||||||
backend->log(AQ_LOG_DEBUG, std::format("drm: found {} CRTCs", resources->count_crtcs));
|
backend->log(AQ_LOG_DEBUG, std::format("drm: found {} CRTCs", resources->count_crtcs));
|
||||||
|
|
||||||
for (size_t i = 0; i < resources->count_crtcs; ++i) {
|
for (int i = 0; i < resources->count_crtcs; ++i) {
|
||||||
auto CRTC = makeShared<SDRMCRTC>();
|
auto CRTC = makeShared<SDRMCRTC>();
|
||||||
CRTC->id = resources->crtcs[i];
|
CRTC->id = resources->crtcs[i];
|
||||||
CRTC->backend = self;
|
CRTC->backend = self;
|
||||||
|
|
@ -762,7 +762,7 @@ void Aquamarine::CDRMBackend::scanConnectors() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < resources->count_connectors; ++i) {
|
for (int i = 0; i < resources->count_connectors; ++i) {
|
||||||
uint32_t connectorID = resources->connectors[i];
|
uint32_t connectorID = resources->connectors[i];
|
||||||
|
|
||||||
SP<SDRMConnector> conn;
|
SP<SDRMConnector> conn;
|
||||||
|
|
@ -804,7 +804,7 @@ void Aquamarine::CDRMBackend::scanConnectors() {
|
||||||
|
|
||||||
// cleanup hot unplugged connectors
|
// cleanup hot unplugged connectors
|
||||||
std::erase_if(connectors, [resources](const auto& conn) {
|
std::erase_if(connectors, [resources](const auto& conn) {
|
||||||
for (size_t i = 0; i < resources->count_connectors; ++i) {
|
for (int i = 0; i < resources->count_connectors; ++i) {
|
||||||
if (resources->connectors[i] == conn->id)
|
if (resources->connectors[i] == conn->id)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2103,7 +2103,7 @@ uint32_t Aquamarine::CDRMFB::submitBuffer() {
|
||||||
|
|
||||||
auto attrs = buffer->dmabuf();
|
auto attrs = buffer->dmabuf();
|
||||||
std::array<uint64_t, 4> mods = {0, 0, 0, 0};
|
std::array<uint64_t, 4> mods = {0, 0, 0, 0};
|
||||||
for (size_t i = 0; i < attrs.planes; ++i) {
|
for (int i = 0; i < attrs.planes; ++i) {
|
||||||
mods[i] = attrs.modifier;
|
mods[i] = attrs.modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ namespace Aquamarine {
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < prop->count_enums; ++i) {
|
for (int i = 0; i < prop->count_enums; ++i) {
|
||||||
const prop_info* p = (prop_info*)bsearch(prop->enums[i].name, info, info_len, sizeof(info[0]), comparePropInfo);
|
const prop_info* p = (prop_info*)bsearch(prop->enums[i].name, info, info_len, sizeof(info[0]), comparePropInfo);
|
||||||
if (p)
|
if (p)
|
||||||
result[p->index] = prop->enums[i].value;
|
result[p->index] = prop->enums[i].value;
|
||||||
|
|
|
||||||
|
|
@ -1039,6 +1039,6 @@ bool CDRMRenderer::verifyDestinationDMABUF(const SDMABUFAttrs& attrs) {
|
||||||
|
|
||||||
CDRMRendererBufferAttachment::CDRMRendererBufferAttachment(Hyprutils::Memory::CWeakPointer<CDRMRenderer> renderer_, Hyprutils::Memory::CSharedPointer<IBuffer> buffer,
|
CDRMRendererBufferAttachment::CDRMRendererBufferAttachment(Hyprutils::Memory::CWeakPointer<CDRMRenderer> renderer_, Hyprutils::Memory::CSharedPointer<IBuffer> buffer,
|
||||||
EGLImageKHR image, GLuint fbo_, GLuint rbo_, SGLTex tex_) :
|
EGLImageKHR image, GLuint fbo_, GLuint rbo_, SGLTex tex_) :
|
||||||
eglImage(image), fbo(fbo_), rbo(rbo_), renderer(renderer_), tex(tex_) {
|
eglImage(image), fbo(fbo_), rbo(rbo_), tex(tex_), renderer(renderer_) {
|
||||||
bufferDestroy = buffer->events.destroy.registerListener([this](std::any d) { renderer->onBufferAttachmentDrop(this); });
|
bufferDestroy = buffer->events.destroy.registerListener([this](std::any d) { renderer->onBufferAttachmentDrop(this); });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue