Skip to content

armgit / WacOS

Public Imported from GitHub
0

A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.

Rust

Merge PRs #120 #121 #122 #110 #107 #106 (404-Page-Found); Dock folder drops also skip protected folders (#100)

Eternity070628f0e28d6c21c9
diff --cc src/shell/dock.cpp
index 0614d6a,3a1d918..d21a177
--- a/src/shell/dock.cpp
+++ b/src/shell/dock.cpp
@@@ -1731,18 -1806,22 +1806,32 @@@ struct DockDrop : IDropTarget
GlobalUnlock(sm.hGlobal);
ReleaseStgMedium(&sm);
}
- if (!files.empty() && g_items[i].kind == I_TRASH) {
- if (!files.empty() && g_items[i].kind == I_FOLDER) {
++ if (!files.empty() && g_items[i].kind == I_FOLDER) { // pasta do usuário no Dock (issue #108, PR #110): move para ela
+ int fi = g_items[i].folder;
+ if (fi >= 0 && fi < (int)g_folders.size()) {
+ std::wstring from;
- for (auto& f : files) { from += f; from += L'\0'; }
++ int n = 0;
++ for (auto& f : files) {
++ // issue #100: pasta especial ou raiz de disco não é movida (nem por engano)
++ if (shell::PastaProtegida(f)) { Log(L"dock: '%ls' é uma pasta do sistema: não é movida", f.c_str()); continue; }
++ from += f; from += L'\0'; n++;
++ }
+ from += L'\0';
+ std::wstring to = g_folders[fi] + L'\0' + L'\0';
- SHFILEOPSTRUCTW op{ g_icons, FO_MOVE, from.c_str(), to.c_str(), FOF_ALLOWUNDO }; // com desfazer, como na Lixeira
- SHFileOperationW(&op);
++ if (n) { SHFILEOPSTRUCTW op{ g_icons, FO_MOVE, from.c_str(), to.c_str(), FOF_ALLOWUNDO }; SHFileOperationW(&op); } // com desfazer, como na Lixeira
+ }
+ } else if (!files.empty() && g_items[i].kind == I_TRASH) {
+ // issue #100: pastas especiais (Downloads, Documentos, Mesa...) e raízes de disco nunca vão para a Lixeira por
+ // aqui; o resto vai e fica no shell.log
std::wstring from;
- for (auto& f : files) { from += f; from += L'\0'; }
+ int n = 0;
+ for (auto& f : files) {
+ if (shell::PastaProtegida(f)) { Log(L"dock: '%ls' é uma pasta do sistema: não vai para a Lixeira", f.c_str()); continue; }
+ Log(L"dock: para a Lixeira (soltado na Lixeira do Dock): %ls", f.c_str());
+ from += f; from += L'\0'; n++;
+ }
from += L'\0';
- SHFILEOPSTRUCTW op{ g_icons, FO_DELETE, from.c_str(), nullptr, FOF_ALLOWUNDO };
- SHFileOperationW(&op);
+ if (n) { SHFILEOPSTRUCTW op{ g_icons, FO_DELETE, from.c_str(), nullptr, FOF_ALLOWUNDO }; SHFileOperationW(&op); }
BuildItems();
} else if (!files.empty() && g_items[i].kind == I_APP) {
std::wstring args;