[client,sdl] make logging less verbose

This commit is contained in:
Armin Novak
2026-02-20 09:23:48 +01:00
parent 98f37bdf8c
commit 0caa0fb4f6
3 changed files with 32 additions and 25 deletions

View File

@@ -325,28 +325,29 @@ bool sdlDispContext::updateMonitors(SDL_EventType type, SDL_DisplayID displayID)
bool sdlDispContext::handleEvent(const SDL_DisplayEvent& ev)
{
const auto cat = SDL_LOG_CATEGORY_APPLICATION;
switch (ev.type)
{
case SDL_EVENT_DISPLAY_ADDED:
SDL_Log("A new display with id %u was connected", ev.displayID);
SDL_LogDebug(cat, "A new display with id %u was connected", ev.displayID);
return updateMonitors(ev.type, ev.displayID);
case SDL_EVENT_DISPLAY_REMOVED:
SDL_Log("The display with id %u was disconnected", ev.displayID);
SDL_LogDebug(cat, "The display with id %u was disconnected", ev.displayID);
return updateMonitors(ev.type, ev.displayID);
case SDL_EVENT_DISPLAY_ORIENTATION:
SDL_Log("The orientation of display with id %u was changed", ev.displayID);
SDL_LogDebug(cat, "The orientation of display with id %u was changed", ev.displayID);
return updateMonitors(ev.type, ev.displayID);
case SDL_EVENT_DISPLAY_MOVED:
SDL_Log("The display with id %u was moved", ev.displayID);
SDL_LogDebug(cat, "The display with id %u was moved", ev.displayID);
return updateMonitors(ev.type, ev.displayID);
case SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED:
SDL_Log("The display with id %u changed scale", ev.displayID);
SDL_LogDebug(cat, "The display with id %u changed scale", ev.displayID);
return updateMonitors(ev.type, ev.displayID);
case SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED:
SDL_Log("The display with id %u changed mode", ev.displayID);
SDL_LogDebug(cat, "The display with id %u changed mode", ev.displayID);
return updateMonitors(ev.type, ev.displayID);
case SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED:
SDL_Log("The display with id %u changed desktop mode", ev.displayID);
SDL_LogDebug(cat, "The display with id %u changed desktop mode", ev.displayID);
return updateMonitors(ev.type, ev.displayID);
default:
return true;

View File

@@ -466,11 +466,12 @@ static void SDLCALL winpr_LogOutputFunction(void* userdata, int category, SDL_Lo
static void sdl_quit()
{
const auto cat = SDL_LOG_CATEGORY_APPLICATION;
SDL_Event ev = {};
ev.type = SDL_EVENT_QUIT;
if (!SDL_PushEvent(&ev))
{
SDL_Log("An error occurred: %s", SDL_GetError());
SDL_LogError(cat, "An error occurred: %s", SDL_GetError());
}
}
@@ -479,23 +480,24 @@ static void SDLCALL rdp_file_cb(void* userdata, const char* const* filelist,
{
auto rdp = static_cast<std::string*>(userdata);
const auto cat = SDL_LOG_CATEGORY_APPLICATION;
if (!filelist)
{
SDL_Log("An error occurred: %s", SDL_GetError());
SDL_LogError(cat, "An error occurred: %s", SDL_GetError());
sdl_quit();
return;
}
else if (!*filelist)
{
SDL_Log("The user did not select any file.");
SDL_Log("Most likely, the dialog was canceled.");
SDL_LogError(cat, "The user did not select any file.");
SDL_LogError(cat, "Most likely, the dialog was canceled.");
sdl_quit();
return;
}
while (*filelist)
{
SDL_Log("Full path to selected file: '%s'", *filelist);
SDL_LogError(cat, "Full path to selected file: '%s'", *filelist);
*rdp = *filelist;
filelist++;
}

View File

@@ -311,19 +311,23 @@ rdpMonitor SdlWindow::query(SDL_Window* window, SDL_DisplayID id, bool forceAsPr
monitor.attributes.physicalWidth = WINPR_ASSERTING_INT_CAST(uint32_t, r.w);
monitor.attributes.physicalHeight = WINPR_ASSERTING_INT_CAST(uint32_t, r.h);
SDL_Log("monitor.orig_screen %" PRIu32, monitor.orig_screen);
SDL_Log("monitor.x %" PRId32, monitor.x);
SDL_Log("monitor.y %" PRId32, monitor.y);
SDL_Log("monitor.width %" PRId32, monitor.width);
SDL_Log("monitor.height %" PRId32, monitor.height);
SDL_Log("monitor.is_primary %" PRIu32, monitor.is_primary);
SDL_Log("monitor.attributes.desktopScaleFactor %" PRIu32,
monitor.attributes.desktopScaleFactor);
SDL_Log("monitor.attributes.deviceScaleFactor %" PRIu32, monitor.attributes.deviceScaleFactor);
SDL_Log("monitor.attributes.orientation %s",
freerdp_desktop_rotation_flags_to_string(monitor.attributes.orientation));
SDL_Log("monitor.attributes.physicalWidth %" PRIu32, monitor.attributes.physicalWidth);
SDL_Log("monitor.attributes.physicalHeight %" PRIu32, monitor.attributes.physicalHeight);
const auto cat = SDL_LOG_CATEGORY_APPLICATION;
SDL_LogDebug(cat, "monitor.orig_screen %" PRIu32, monitor.orig_screen);
SDL_LogDebug(cat, "monitor.x %" PRId32, monitor.x);
SDL_LogDebug(cat, "monitor.y %" PRId32, monitor.y);
SDL_LogDebug(cat, "monitor.width %" PRId32, monitor.width);
SDL_LogDebug(cat, "monitor.height %" PRId32, monitor.height);
SDL_LogDebug(cat, "monitor.is_primary %" PRIu32, monitor.is_primary);
SDL_LogDebug(cat, "monitor.attributes.desktopScaleFactor %" PRIu32,
monitor.attributes.desktopScaleFactor);
SDL_LogDebug(cat, "monitor.attributes.deviceScaleFactor %" PRIu32,
monitor.attributes.deviceScaleFactor);
SDL_LogDebug(cat, "monitor.attributes.orientation %s",
freerdp_desktop_rotation_flags_to_string(monitor.attributes.orientation));
SDL_LogDebug(cat, "monitor.attributes.physicalWidth %" PRIu32,
monitor.attributes.physicalWidth);
SDL_LogDebug(cat, "monitor.attributes.physicalHeight %" PRIu32,
monitor.attributes.physicalHeight);
return monitor;
}