Update upstream source from tag 'upstream/0.6.0'
Update to upstream version '0.6.0'
with Debian dir 55c65774a6
This commit is contained in:
commit
8c40de8ef6
|
|
@ -50,7 +50,7 @@ target_include_directories(
|
||||||
PUBLIC "./include"
|
PUBLIC "./include"
|
||||||
PRIVATE "./src")
|
PRIVATE "./src")
|
||||||
set_target_properties(hyprutils PROPERTIES VERSION ${hyprutils_VERSION}
|
set_target_properties(hyprutils PROPERTIES VERSION ${hyprutils_VERSION}
|
||||||
SOVERSION 4)
|
SOVERSION 5)
|
||||||
target_link_libraries(hyprutils PkgConfig::deps)
|
target_link_libraries(hyprutils PkgConfig::deps)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,11 @@ namespace Hyprutils {
|
||||||
static CSharedPointer<U> makeShared(Args&&... args) {
|
static CSharedPointer<U> makeShared(Args&&... args) {
|
||||||
return CSharedPointer<U>(new U(std::forward<Args>(args)...));
|
return CSharedPointer<U>(new U(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
CSharedPointer<T> reinterpretPointerCast(const CSharedPointer<U>& ref) {
|
||||||
|
return CSharedPointer<T>(ref.impl_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ namespace Hyprutils {
|
||||||
|
|
||||||
void addEnv(const std::string& name, const std::string& value);
|
void addEnv(const std::string& name, const std::string& value);
|
||||||
|
|
||||||
|
// only for async, sync doesn't make sense
|
||||||
|
void setStdoutFD(int fd);
|
||||||
|
// only for async, sync doesn't make sense
|
||||||
|
void setStderrFD(int fd);
|
||||||
|
|
||||||
/* Run the process, synchronously, get the stdout and stderr. False on fail */
|
/* Run the process, synchronously, get the stdout and stderr. False on fail */
|
||||||
bool runSync();
|
bool runSync();
|
||||||
|
|
||||||
|
|
@ -31,6 +36,7 @@ namespace Hyprutils {
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
std::vector<std::pair<std::string, std::string>> env;
|
std::vector<std::pair<std::string, std::string>> env;
|
||||||
pid_t grandchildPid = 0;
|
pid_t grandchildPid = 0;
|
||||||
|
int stdoutFD = -1, stderrFD = -1;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
using namespace Hyprutils::Animation;
|
using namespace Hyprutils::Animation;
|
||||||
using namespace Hyprutils::Memory;
|
using namespace Hyprutils::Memory;
|
||||||
|
|
||||||
|
static const std::string DEFAULTBEZIERNAME = "default";
|
||||||
|
static const std::string DEFAULTSTYLE = "";
|
||||||
|
|
||||||
#define SP CSharedPointer
|
#define SP CSharedPointer
|
||||||
#define WP CWeakPointer
|
#define WP CWeakPointer
|
||||||
|
|
||||||
|
|
@ -43,8 +46,6 @@ bool Hyprutils::Animation::CBaseAnimatedVariable::enabled() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CBaseAnimatedVariable::getBezierName() const {
|
const std::string& CBaseAnimatedVariable::getBezierName() const {
|
||||||
static constexpr const std::string DEFAULTBEZIERNAME = "default";
|
|
||||||
|
|
||||||
if (const auto PCONFIG = m_pConfig.lock()) {
|
if (const auto PCONFIG = m_pConfig.lock()) {
|
||||||
const auto PVALUES = PCONFIG->pValues.lock();
|
const auto PVALUES = PCONFIG->pValues.lock();
|
||||||
return PVALUES ? PVALUES->internalBezier : DEFAULTBEZIERNAME;
|
return PVALUES ? PVALUES->internalBezier : DEFAULTBEZIERNAME;
|
||||||
|
|
@ -54,8 +55,6 @@ const std::string& CBaseAnimatedVariable::getBezierName() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CBaseAnimatedVariable::getStyle() const {
|
const std::string& CBaseAnimatedVariable::getStyle() const {
|
||||||
static constexpr const std::string DEFAULTSTYLE = "";
|
|
||||||
|
|
||||||
if (const auto PCONFIG = m_pConfig.lock()) {
|
if (const auto PCONFIG = m_pConfig.lock()) {
|
||||||
const auto PVALUES = PCONFIG->pValues.lock();
|
const auto PVALUES = PCONFIG->pValues.lock();
|
||||||
return PVALUES ? PVALUES->internalStyle : DEFAULTSTYLE;
|
return PVALUES ? PVALUES->internalStyle : DEFAULTSTYLE;
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,11 @@ bool Hyprutils::OS::CProcess::runAsync() {
|
||||||
|
|
||||||
argsC.emplace_back(nullptr);
|
argsC.emplace_back(nullptr);
|
||||||
|
|
||||||
|
if (stdoutFD != -1)
|
||||||
|
dup2(stdoutFD, 1);
|
||||||
|
if (stderrFD != -1)
|
||||||
|
dup2(stderrFD, 2);
|
||||||
|
|
||||||
execvp(binary.c_str(), (char* const*)argsC.data());
|
execvp(binary.c_str(), (char* const*)argsC.data());
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
@ -230,3 +235,11 @@ const std::string& Hyprutils::OS::CProcess::stdErr() {
|
||||||
const pid_t Hyprutils::OS::CProcess::pid() {
|
const pid_t Hyprutils::OS::CProcess::pid() {
|
||||||
return grandchildPid;
|
return grandchildPid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Hyprutils::OS::CProcess::setStdoutFD(int fd) {
|
||||||
|
stdoutFD = fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hyprutils::OS::CProcess::setStderrFD(int fd) {
|
||||||
|
stderrFD = fd;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using namespace Hyprutils::Memory;
|
||||||
|
|
||||||
int main(int argc, char** argv, char** envp) {
|
int main(int argc, char** argv, char** envp) {
|
||||||
SP<int> intPtr = makeShared<int>(10);
|
SP<int> intPtr = makeShared<int>(10);
|
||||||
SP<int> intPtr2 = makeShared<int>(1337);
|
SP<int> intPtr2 = makeShared<int>(-1337);
|
||||||
UP<int> intUnique = makeUnique<int>(420);
|
UP<int> intUnique = makeUnique<int>(420);
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
@ -52,5 +52,15 @@ int main(int argc, char** argv, char** envp) {
|
||||||
EXPECT(weak.expired(), true);
|
EXPECT(weak.expired(), true);
|
||||||
EXPECT(weakUnique.expired(), true);
|
EXPECT(weakUnique.expired(), true);
|
||||||
|
|
||||||
|
auto intPtr2AsUint = reinterpretPointerCast<unsigned int>(intPtr2);
|
||||||
|
EXPECT(intPtr2.strongRef(), 4);
|
||||||
|
EXPECT(intPtr2AsUint.strongRef(), 4);
|
||||||
|
|
||||||
|
EXPECT(*intPtr2AsUint > 0, true);
|
||||||
|
EXPECT(*intPtr2AsUint, (unsigned int)(int)-1337);
|
||||||
|
*intPtr2AsUint = 10;
|
||||||
|
EXPECT(*intPtr2AsUint, 10);
|
||||||
|
EXPECT(*intPtr2, 10);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue