[client,sdl] enable screensaver

by default sdl disables screensaver.
This commit is contained in:
akallabeth 2024-02-08 13:23:37 +01:00 committed by akallabeth
parent a7fb0d5c75
commit 78818aec34
2 changed files with 36 additions and 11 deletions

View File

@ -165,15 +165,19 @@ if (WIN32)
endif()
if (WINPR_HAVE_EXECINFO_H)
list(APPEND SRCS
execinfo/debug.c
execinfo/debug.h)
option(USE_EXECINFO "Use execinfo.h to generate backtraces" ON)
if (USE_EXECINFO)
winpr_definition_add(-DUSE_EXECINFO)
list(APPEND SRCS
execinfo/debug.c
execinfo/debug.h)
endif()
endif()
if (WINPR_HAVE_UNWIND_H)
option(USE_UNWIND "Use unwind.h to generate backtraces" ON)
if (USE_UNWIND)
add_definitions(-DUSE_UNWIND)
winpr_definition_add(-DUSE_UNWIND)
list(APPEND SRCS
unwind/debug.c
unwind/debug.h)

View File

@ -28,7 +28,7 @@
#include <winpr/crt.h>
#include <winpr/string.h>
#if defined(WINPR_HAVE_EXECINFO_H)
#if defined(USE_EXECINFO)
#include <execinfo/debug.h>
#endif
@ -94,13 +94,14 @@ void winpr_backtrace_free(void* buffer)
#if defined(USE_UNWIND)
winpr_unwind_backtrace_free(buffer);
#elif defined(WINPR_HAVE_EXECINFO_H)
#elif defined(USE_EXECINFO)
winpr_execinfo_backtrace_free(buffer);
#elif defined(WINPR_HAVE_CORKSCREW)
winpr_corkscrew_backtrace_free(buffer);
#elif defined(_WIN32) || defined(_WIN64)
winpr_win_backtrace_free(buffer);
#else
free(buffer);
LOGF(support_msg);
#endif
}
@ -109,7 +110,7 @@ void* winpr_backtrace(DWORD size)
{
#if defined(USE_UNWIND)
return winpr_unwind_backtrace(size);
#elif defined(WINPR_HAVE_EXECINFO_H)
#elif defined(USE_EXECINFO)
return winpr_execinfo_backtrace(size);
#elif defined(WINPR_HAVE_CORKSCREW)
return winpr_corkscrew_backtrace(size);
@ -117,7 +118,9 @@ void* winpr_backtrace(DWORD size)
return winpr_win_backtrace(size);
#else
LOGF(support_msg);
return NULL;
/* return a non NULL buffer to allow the backtrace function familiy to succeed without failing
*/
return _strdup(support_msg);
#endif
}
@ -134,7 +137,7 @@ char** winpr_backtrace_symbols(void* buffer, size_t* used)
#if defined(USE_UNWIND)
return winpr_unwind_backtrace_symbols(buffer, used);
#elif defined(WINPR_HAVE_EXECINFO_H)
#elif defined(USE_EXECINFO)
return winpr_execinfo_backtrace_symbols(buffer, used);
#elif defined(WINPR_HAVE_CORKSCREW)
return winpr_corkscrew_backtrace_symbols(buffer, used);
@ -142,7 +145,24 @@ char** winpr_backtrace_symbols(void* buffer, size_t* used)
return winpr_win_backtrace_symbols(buffer, used);
#else
LOGF(support_msg);
return NULL;
/* We return a char** on heap that is compatible with free:
*
* 1. We allocate sizeof(char*) + strlen + 1 bytes.
* 2. The first sizeof(char*) bytes contain the pointer to the string following the pointer.
* 3. The at data + sizeof(char*) contains the actual string
*/
size_t len = strlen(support_msg);
char* ppmsg = calloc(sizeof(char*) + len + 1, sizeof(char));
if (!ppmsg)
return NULL;
char** msgptr = (char**)ppmsg;
char* msg = &ppmsg[sizeof(char*)];
*msgptr = msg;
strncpy(msg, support_msg, len);
*used = 1;
return ppmsg;
#endif
}
@ -154,7 +174,7 @@ void winpr_backtrace_symbols_fd(void* buffer, int fd)
return;
}
#if defined(WINPR_HAVE_EXECINFO_H) && !defined(USE_UNWIND)
#if defined(USE_EXECINFO) && !defined(USE_UNWIND)
winpr_execinfo_backtrace_symbols_fd(buffer, fd);
#elif !defined(ANDROID)
{
@ -167,6 +187,7 @@ void winpr_backtrace_symbols_fd(void* buffer, int fd)
for (i = 0; i < used; i++)
_write(fd, lines[i], (unsigned)strnlen(lines[i], UINT32_MAX));
free(lines);
}
#else
LOGF(support_msg);