[client,sdl] fix clang-tidy warnings

This commit is contained in:
akallabeth
2025-06-02 18:03:51 +02:00
parent 63f4c63200
commit f74a7247cd
12 changed files with 54 additions and 80 deletions

View File

@@ -42,5 +42,5 @@ class SdlBlendModeGuard
private:
SDL_BlendMode _restore_mode = SDL_BLENDMODE_INVALID;
SDL_BlendMode _current_mode = SDL_BLENDMODE_INVALID;
std::shared_ptr<SDL_Renderer> _renderer{};
std::shared_ptr<SDL_Renderer> _renderer;
};

View File

@@ -26,10 +26,10 @@
#include <SDL3/SDL.h>
#include "sdl_widget_list.hpp"
#include "sdl_widget.hpp"
#include "sdl_buttons.hpp"
#include "sdl_connection_dialog_wrapper.hpp"
#include "sdl_widget.hpp"
#include "sdl_widget_list.hpp"
class SDLConnectionDialog : public SdlWidgetList
{
@@ -37,7 +37,7 @@ class SDLConnectionDialog : public SdlWidgetList
explicit SDLConnectionDialog(rdpContext* context);
SDLConnectionDialog(const SDLConnectionDialog& other) = delete;
SDLConnectionDialog(const SDLConnectionDialog&& other) = delete;
virtual ~SDLConnectionDialog() override;
~SDLConnectionDialog() override;
SDLConnectionDialog& operator=(const SDLConnectionDialog& other) = delete;
SDLConnectionDialog& operator=(SDLConnectionDialog&& other) = delete;
@@ -91,5 +91,5 @@ class SDLConnectionDialog : public SdlWidgetList
SdlConnectionDialogWrapper::MsgType _type_active = SdlConnectionDialogWrapper::MSG_NONE;
SDL_TimerID _timer = 0;
bool _running = false;
std::vector<widget_cfg_t> _list{};
std::vector<widget_cfg_t> _list;
};

View File

@@ -20,9 +20,9 @@
#include <sstream>
#include "sdl_connection_dialog_wrapper.hpp"
#include "sdl_connection_dialog.hpp"
#include "../sdl_utils.hpp"
#include "sdl_connection_dialog.hpp"
#include "sdl_connection_dialog_wrapper.hpp"
SdlConnectionDialogWrapper::SdlConnectionDialogWrapper() = default;
@@ -93,7 +93,7 @@ void SdlConnectionDialogWrapper::setTitle(const char* fmt, ...)
void SdlConnectionDialogWrapper::setTitle(const std::string& title)
{
push({ title });
push(EventArg{ title });
}
void SdlConnectionDialogWrapper::showInfo(const char* fmt, ...)
@@ -143,7 +143,7 @@ void SdlConnectionDialogWrapper::show(SdlConnectionDialogWrapper::MsgType type,
void SdlConnectionDialogWrapper::show(bool visible)
{
push({ visible });
push(EventArg{ visible });
}
void SdlConnectionDialogWrapper::handleShow()

View File

@@ -87,27 +87,27 @@ class SdlConnectionDialogWrapper
class EventArg
{
public:
EventArg(bool visible);
EventArg(const std::string& title);
explicit EventArg(bool visible);
explicit EventArg(const std::string& title);
EventArg(SdlConnectionDialogWrapper::MsgType type, const std::string& msg, bool visible);
bool hasTitle() const;
const std::string& title() const;
[[nodiscard]] bool hasTitle() const;
[[nodiscard]] const std::string& title() const;
bool hasMessage() const;
const std::string& message() const;
[[nodiscard]] bool hasMessage() const;
[[nodiscard]] const std::string& message() const;
bool hasType() const;
SdlConnectionDialogWrapper::MsgType type() const;
[[nodiscard]] bool hasType() const;
[[nodiscard]] SdlConnectionDialogWrapper::MsgType type() const;
bool hasVisibility() const;
bool visible() const;
[[nodiscard]] bool hasVisibility() const;
[[nodiscard]] bool visible() const;
std::string str() const;
[[nodiscard]] std::string str() const;
private:
std::string _title{};
std::string _message{};
std::string _title;
std::string _message;
SdlConnectionDialogWrapper::MsgType _type = MSG_NONE;
bool _visible = false;
uint32_t _mask = 0;

View File

@@ -36,7 +36,7 @@ class SdlInputWidgetPairList : public SdlWidgetList
SdlInputWidgetPairList(const SdlInputWidgetPairList& other) = delete;
SdlInputWidgetPairList(SdlInputWidgetPairList&& other) = delete;
virtual ~SdlInputWidgetPairList() override;
~SdlInputWidgetPairList() override;
SdlInputWidgetPairList& operator=(const SdlInputWidgetPairList& other) = delete;
SdlInputWidgetPairList& operator=(SdlInputWidgetPairList&& other) = delete;

View File

@@ -16,7 +16,7 @@ class SdlSelectList : public SdlWidgetList
SdlSelectList(const std::string& title, const std::vector<std::string>& labels);
SdlSelectList(const SdlSelectList& other) = delete;
SdlSelectList(SdlSelectList&& other) = delete;
virtual ~SdlSelectList() override;
~SdlSelectList() override;
SdlSelectList& operator=(const SdlSelectList& other) = delete;
SdlSelectList& operator=(SdlSelectList&& other) = delete;

View File

@@ -31,7 +31,7 @@ class SdlSelectableWidget : public SdlWidget
#endif
SdlSelectableWidget(SdlSelectableWidget&& other) noexcept;
SdlSelectableWidget(const SdlSelectableWidget& other) = delete;
virtual ~SdlSelectableWidget() override;
~SdlSelectableWidget() override;
SdlSelectableWidget& operator=(const SdlSelectableWidget& other) = delete;
SdlSelectableWidget& operator=(SdlSelectableWidget&& other) = delete;

View File

@@ -74,7 +74,7 @@ class SdlWidget
const char* fkt);
protected:
std::shared_ptr<SDL_Renderer> _renderer{};
std::shared_ptr<SDL_Renderer> _renderer;
SDL_Color _backgroundcolor = { 0x56, 0x56, 0x56, 0xff };
SDL_Color _fontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
mutable std::string _text;

View File

@@ -20,16 +20,15 @@ class SdlWidgetList
virtual bool reset(const std::string& title, size_t width, size_t height);
virtual bool visible() const;
[[nodiscard]] virtual bool visible() const;
protected:
bool update();
virtual bool clearWindow();
virtual bool updateInternal() = 0;
protected:
std::shared_ptr<SDL_Window> _window{};
std::shared_ptr<SDL_Renderer> _renderer{};
std::shared_ptr<SDL_Window> _window;
std::shared_ptr<SDL_Renderer> _renderer;
SdlButtonList _buttons;
SDL_Color _backgroundcolor{ 0x38, 0x36, 0x35, 0xff };
};

View File

@@ -17,9 +17,9 @@
* limitations under the License.
*/
#include <iostream>
#include <memory>
#include <mutex>
#include <iostream>
#include <freerdp/config.h>
@@ -27,44 +27,44 @@
#include <cstdio>
#include <cstring>
#include <freerdp/freerdp.h>
#include <freerdp/constants.h>
#include <freerdp/freerdp.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/streamdump.h>
#include <freerdp/utils/signal.h>
#include <freerdp/client/file.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/channels.h>
#include <freerdp/channels/channels.h>
#include <freerdp/client/channels.h>
#include <freerdp/client/cliprdr.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/client/file.h>
#include <winpr/crt.h>
#include <winpr/config.h>
#include <winpr/assert.h>
#include <winpr/synch.h>
#include <freerdp/log.h>
#include <winpr/assert.h>
#include <winpr/config.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <SDL3/SDL.h>
#if !defined(__MINGW32__)
#include <SDL3/SDL_main.h>
#endif
#include <SDL3/SDL_hints.h>
#include <SDL3/SDL_video.h>
#include <SDL3/SDL_oldnames.h>
#include <SDL3/SDL_video.h>
#include "dialogs/sdl_connection_dialog_hider.hpp"
#include "dialogs/sdl_dialogs.hpp"
#include "scoped_guard.hpp"
#include "sdl_channels.hpp"
#include "sdl_freerdp.hpp"
#include "sdl_utils.hpp"
#include "sdl_disp.hpp"
#include "sdl_monitor.hpp"
#include "sdl_freerdp.hpp"
#include "sdl_kbd.hpp"
#include "sdl_touch.hpp"
#include "sdl_monitor.hpp"
#include "sdl_pointer.hpp"
#include "sdl_prefs.hpp"
#include "dialogs/sdl_dialogs.hpp"
#include "dialogs/sdl_connection_dialog_hider.hpp"
#include "scoped_guard.hpp"
#include "sdl_touch.hpp"
#include "sdl_utils.hpp"
#include <aad/sdl_webview.hpp>
@@ -314,31 +314,6 @@ static bool sdl_draw_to_window_rect(SdlContext* sdl, SdlWindow& window, SDL_Surf
return true;
}
static bool sdl_draw_to_window_scaled_rect(SdlContext* sdl, SdlWindow& window, SDL_Surface* surface,
const SDL_Rect& srcRect)
{
SDL_Rect dstRect = srcRect;
sdl_scale_coordinates(sdl, window.id(), &dstRect.x, &dstRect.y, FALSE, TRUE);
sdl_scale_coordinates(sdl, window.id(), &dstRect.w, &dstRect.h, FALSE, TRUE);
return window.blit(surface, srcRect, dstRect);
}
static BOOL sdl_draw_to_window_scaled_rect(SdlContext* sdl, SdlWindow& window, SDL_Surface* surface,
const std::vector<SDL_Rect>& rects = {})
{
if (rects.empty())
{
return sdl_draw_to_window_scaled_rect(sdl, window, surface,
{ 0, 0, surface->w, surface->h });
}
for (const auto& srcRect : rects)
{
if (!sdl_draw_to_window_scaled_rect(sdl, window, surface, srcRect))
return FALSE;
}
return TRUE;
}
static BOOL sdl_draw_to_window(SdlContext* sdl, SdlWindow& window,
const std::vector<SDL_Rect>& rects = {})
{
@@ -636,7 +611,8 @@ static BOOL sdl_create_windows(SdlContext* sdl)
UINT32 windowCount = freerdp_settings_get_uint32(settings, FreeRDP_MonitorCount);
Sint32 originX = 0, originY = 0;
Sint32 originX = 0;
Sint32 originY = 0;
for (UINT32 x = 0; x < windowCount; x++)
{
auto id = sdl->monitorId(x);
@@ -781,8 +757,8 @@ static int sdl_run(SdlContext* sdl)
SDL_Event windowEvent = {};
while (!shall_abort(sdl) && SDL_WaitEventTimeout(nullptr, 1000))
{
/* Only poll standard SDL events and SDL_EVENT_USERS meant to create dialogs.
* do not process the dialog return value events here.
/* Only poll standard SDL events and SDL_EVENT_USERS meant to create
* dialogs. do not process the dialog return value events here.
*/
const int prc = SDL_PeepEvents(&windowEvent, 1, SDL_GETEVENT, SDL_EVENT_FIRST,
SDL_EVENT_USER_RETRY_DIALOG);
@@ -798,8 +774,8 @@ static int sdl_run(SdlContext* sdl)
#endif
{
std::lock_guard<CriticalSection> lock(sdl->critical);
/* The session might have been disconnected while we were waiting for a new SDL
* event. In that case ignore the SDL event and terminate. */
/* The session might have been disconnected while we were waiting for a
* new SDL event. In that case ignore the SDL event and terminate. */
if (freerdp_shall_disconnect_context(sdl->context()))
continue;
}

View File

@@ -86,4 +86,4 @@ namespace sdl::utils
UINT32 orientaion_to_rdp(SDL_DisplayOrientation orientation);
std::string generate_uuid_v4();
}
} // namespace sdl::utils

View File

@@ -64,7 +64,6 @@ class SdlWindow
private:
static UINT32 orientaion_to_rdp(SDL_DisplayOrientation orientation);
private:
SDL_Window* _window = nullptr;
Sint32 _offset_x = 0;
Sint32 _offset_y = 0;