mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge branch 'noctalia-dev:v5' into v5
This commit is contained in:
@@ -972,6 +972,8 @@ void Application::initUi() {
|
||||
m_fileDialogPopup.requestLayout();
|
||||
});
|
||||
|
||||
m_configService.addReloadCallback([]() { malloc_trim(0); });
|
||||
|
||||
m_timeService.setTickSecondCallback([this]() {
|
||||
m_wallpaper.onSecondTick();
|
||||
if (m_lockScreen.isActive()) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <clocale>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <malloc.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
@@ -60,6 +61,7 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
mallopt(M_ARENA_MAX, 2);
|
||||
std::setlocale(LC_ALL, "");
|
||||
if (argc >= 2) {
|
||||
if (std::strcmp(argv[1], "theme") == 0)
|
||||
|
||||
@@ -716,6 +716,10 @@ void ClipboardPanel::onClose() {
|
||||
m_lastHeight = 0.0f;
|
||||
m_pendingScrollToSelected = false;
|
||||
m_thumbnailRefreshPending = false;
|
||||
|
||||
if (m_clipboard != nullptr) {
|
||||
m_clipboard->evictAllPayloads();
|
||||
}
|
||||
}
|
||||
|
||||
InputArea* ClipboardPanel::initialFocusArea() const {
|
||||
@@ -821,6 +825,9 @@ void ClipboardPanel::rebuildPreview(Renderer& renderer, float width, float heigh
|
||||
}
|
||||
|
||||
if (m_clipboard != nullptr) {
|
||||
if (m_previewPayloadIndex != static_cast<std::size_t>(-1) && m_previewPayloadIndex != historyIndex) {
|
||||
m_clipboard->evictEntryPayload(m_previewPayloadIndex);
|
||||
}
|
||||
(void)m_clipboard->ensureEntryLoaded(historyIndex);
|
||||
}
|
||||
const auto& loadedEntry = m_clipboard != nullptr ? m_clipboard->history()[historyIndex] : entry;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <malloc.h>
|
||||
#include <string>
|
||||
|
||||
PanelManager* PanelManager::s_instance = nullptr;
|
||||
@@ -684,6 +685,8 @@ void PanelManager::destroyPanel() {
|
||||
if (m_wayland != nullptr) {
|
||||
m_wayland->stopKeyRepeat();
|
||||
}
|
||||
|
||||
malloc_trim(0);
|
||||
}
|
||||
|
||||
void PanelManager::togglePanel(const std::string& panelId, PanelOpenRequest request) {
|
||||
|
||||
@@ -405,6 +405,25 @@ bool ClipboardService::ensureEntryLoaded(std::size_t index) {
|
||||
return loadEntryPayload(m_history[index]);
|
||||
}
|
||||
|
||||
void ClipboardService::evictEntryPayload(std::size_t index) {
|
||||
if (index >= m_history.size()) {
|
||||
return;
|
||||
}
|
||||
auto& entry = m_history[index];
|
||||
if (entry.data.empty() || entry.payloadPath.empty()) {
|
||||
return;
|
||||
}
|
||||
entry.data.clear();
|
||||
entry.data.shrink_to_fit();
|
||||
entry.payloadLoaded = false;
|
||||
}
|
||||
|
||||
void ClipboardService::evictAllPayloads() {
|
||||
for (std::size_t i = 0; i < m_history.size(); ++i) {
|
||||
evictEntryPayload(i);
|
||||
}
|
||||
}
|
||||
|
||||
bool ClipboardService::copyText(std::string text) {
|
||||
std::vector<std::uint8_t> data(text.begin(), text.end());
|
||||
return copyData({"text/plain;charset=utf-8", "text/plain"}, std::move(data));
|
||||
|
||||
@@ -73,6 +73,8 @@ public:
|
||||
[[nodiscard]] std::size_t addPollFds(std::vector<pollfd>& fds) const;
|
||||
|
||||
bool ensureEntryLoaded(std::size_t index);
|
||||
void evictEntryPayload(std::size_t index);
|
||||
void evictAllPayloads();
|
||||
bool copyText(std::string text);
|
||||
bool copyEntry(const ClipboardEntry& entry);
|
||||
bool promoteEntry(std::size_t index);
|
||||
|
||||
Reference in New Issue
Block a user