Advance Wayland and KDE package bring-up

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-14 10:51:06 +01:00
parent 51f3c21121
commit cf12defd28
15214 changed files with 20594243 additions and 269 deletions
@@ -0,0 +1,73 @@
/*
SPDX-FileCopyrightText: 2023 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <sys/mman.h>
#include <utility>
namespace KWin
{
class MemoryMap
{
public:
MemoryMap()
: m_data(MAP_FAILED)
, m_size(0)
{
}
MemoryMap(int size, int prot, int flags, int fd, off_t offset)
: m_data(mmap(nullptr, size, prot, flags, fd, offset))
, m_size(size)
{
}
MemoryMap(MemoryMap &&other)
: m_data(std::exchange(other.m_data, MAP_FAILED))
, m_size(std::exchange(other.m_size, 0))
{
}
~MemoryMap()
{
if (m_data != MAP_FAILED) {
munmap(m_data, m_size);
}
}
MemoryMap &operator=(MemoryMap &&other)
{
if (m_data != MAP_FAILED) {
munmap(m_data, m_size);
}
m_data = std::exchange(other.m_data, MAP_FAILED);
m_size = std::exchange(other.m_size, 0);
return *this;
}
inline bool isValid() const
{
return m_data != MAP_FAILED;
}
inline void *data() const
{
return m_data;
}
inline int size() const
{
return m_size;
}
private:
void *m_data;
int m_size;
};
} // namespace KWin