mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[client,sdl] adjust nodiscard use for dialogs
This commit is contained in:
@@ -31,8 +31,8 @@ SdlButton::SdlButton(std::shared_ptr<SDL_Renderer>& renderer, const std::string&
|
||||
_highlightcolor = { 0xcd, 0xca, 0x35, 0x60 };
|
||||
_mouseovercolor = { 0x66, 0xff, 0x66, 0x60 };
|
||||
_fontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
(void)update_text(label);
|
||||
(void)update();
|
||||
std::ignore = update_text(label);
|
||||
std::ignore = update();
|
||||
}
|
||||
|
||||
SdlButton::SdlButton(SdlButton&& other) noexcept = default;
|
||||
|
||||
@@ -25,9 +25,9 @@ class SdlButtonList
|
||||
[[nodiscard]] std::shared_ptr<SdlButton> get_selected(const SDL_MouseButtonEvent& button);
|
||||
[[nodiscard]] std::shared_ptr<SdlButton> get_selected(float x, float y);
|
||||
|
||||
[[nodiscard]] bool set_highlight_next(bool reset = false);
|
||||
[[nodiscard]] bool set_highlight(size_t index);
|
||||
[[nodiscard]] bool set_mouseover(float x, float y);
|
||||
bool set_highlight_next(bool reset = false);
|
||||
bool set_highlight(size_t index);
|
||||
bool set_mouseover(float x, float y);
|
||||
|
||||
void clear();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ static const Uint32 hpadding = 5;
|
||||
|
||||
SDLConnectionDialog::SDLConnectionDialog(rdpContext* context) : _context(context)
|
||||
{
|
||||
(void)hide();
|
||||
std::ignore = hide();
|
||||
}
|
||||
|
||||
SDLConnectionDialog::~SDLConnectionDialog()
|
||||
@@ -207,7 +207,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
if (event.type == SDL_EVENT_KEY_UP)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
(void)sdl_push_quit();
|
||||
std::ignore = sdl_push_quit();
|
||||
}
|
||||
break;
|
||||
case SDLK_TAB:
|
||||
@@ -246,7 +246,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
if (event.type == SDL_EVENT_MOUSE_BUTTON_UP)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
(void)sdl_push_quit();
|
||||
std::ignore = sdl_push_quit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
if (windowID == ev.windowID)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
(void)sdl_push_quit();
|
||||
std::ignore = sdl_push_quit();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -473,7 +473,7 @@ Uint32 SDLConnectionDialog::timeout(void* pvthis, [[maybe_unused]] SDL_TimerID t
|
||||
[[maybe_unused]] Uint32 intervalMS)
|
||||
{
|
||||
auto self = static_cast<SDLConnectionDialog*>(pvthis);
|
||||
(void)self->hide();
|
||||
std::ignore = self->hide();
|
||||
self->_running = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ static std::string format(WINPR_FORMAT_ARG const char* fmt, va_list ap)
|
||||
|
||||
va_list ap2;
|
||||
va_copy(ap2, ap);
|
||||
(void)vsnprintf(msg.data(), msg.size(), fmt, ap2);
|
||||
std::ignore = vsnprintf(msg.data(), msg.size(), fmt, ap2);
|
||||
va_end(ap2);
|
||||
return msg;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void SdlConnectionDialogWrapper::handleShow()
|
||||
|
||||
if (arg.hasTitle() && _connection_dialog)
|
||||
{
|
||||
(void)_connection_dialog->setTitle(arg.title().c_str());
|
||||
std::ignore = _connection_dialog->setTitle(arg.title().c_str());
|
||||
}
|
||||
|
||||
if (arg.hasType() && arg.hasMessage())
|
||||
@@ -175,19 +175,19 @@ void SdlConnectionDialogWrapper::handleShow()
|
||||
{
|
||||
case SdlConnectionDialogWrapper::MSG_INFO:
|
||||
if (_connection_dialog)
|
||||
(void)_connection_dialog->showInfo(arg.message().c_str());
|
||||
std::ignore = _connection_dialog->showInfo(arg.message().c_str());
|
||||
else
|
||||
WLog_Print(_log, WLOG_INFO, "%s", arg.message().c_str());
|
||||
break;
|
||||
case SdlConnectionDialogWrapper::MSG_WARN:
|
||||
if (_connection_dialog)
|
||||
(void)_connection_dialog->showWarn(arg.message().c_str());
|
||||
std::ignore = _connection_dialog->showWarn(arg.message().c_str());
|
||||
else
|
||||
WLog_Print(_log, WLOG_WARN, "%s", arg.message().c_str());
|
||||
break;
|
||||
case SdlConnectionDialogWrapper::MSG_ERROR:
|
||||
if (_connection_dialog)
|
||||
(void)_connection_dialog->showError(arg.message().c_str());
|
||||
std::ignore = _connection_dialog->showError(arg.message().c_str());
|
||||
else
|
||||
WLog_Print(_log, WLOG_ERROR, "%s", arg.message().c_str());
|
||||
break;
|
||||
@@ -199,9 +199,9 @@ void SdlConnectionDialogWrapper::handleShow()
|
||||
if (arg.hasVisibility() && _connection_dialog)
|
||||
{
|
||||
if (arg.visible())
|
||||
(void)_connection_dialog->show();
|
||||
std::ignore = _connection_dialog->show();
|
||||
else
|
||||
(void)_connection_dialog->hide();
|
||||
std::ignore = _connection_dialog->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ SdlInputWidgetPair::SdlInputWidgetPair(std::shared_ptr<SDL_Renderer>& renderer,
|
||||
static_cast<float>(offset * (height + _vpadding)),
|
||||
static_cast<float>(width), static_cast<float>(height) })
|
||||
{
|
||||
(void)_label.update_text(label);
|
||||
(void)update_input_text(initial);
|
||||
std::ignore = _label.update_text(label);
|
||||
std::ignore = update_input_text(initial);
|
||||
}
|
||||
|
||||
SdlInputWidgetPair::SdlInputWidgetPair(SdlInputWidgetPair&& other) noexcept = default;
|
||||
|
||||
@@ -45,8 +45,8 @@ class SdlInputWidgetPair
|
||||
SdlInputWidgetPair& operator=(const SdlInputWidgetPair& other) = delete;
|
||||
SdlInputWidgetPair& operator=(SdlInputWidgetPair&& other) = delete;
|
||||
|
||||
[[nodiscard]] bool set_mouseover(bool mouseOver);
|
||||
[[nodiscard]] bool set_highlight(bool highlight);
|
||||
bool set_mouseover(bool mouseOver);
|
||||
bool set_highlight(bool highlight);
|
||||
|
||||
[[nodiscard]] bool set_str(const std::string& text);
|
||||
[[nodiscard]] bool remove_str(size_t count);
|
||||
|
||||
@@ -55,10 +55,10 @@ SdlInputWidgetPairList::SdlInputWidgetPairList(const std::string& title,
|
||||
m_list.emplace_back(widget);
|
||||
}
|
||||
|
||||
(void)_buttons.populate(
|
||||
std::ignore = _buttons.populate(
|
||||
_renderer, buttonlabels, buttonids, total_width, static_cast<Sint32>(input_height),
|
||||
static_cast<Sint32>(widget_width), static_cast<Sint32>(widget_heigth));
|
||||
(void)_buttons.set_highlight(0);
|
||||
_buttons.set_highlight(0);
|
||||
m_currentActiveTextInput = selected;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ SdlSelectWidget::SdlSelectWidget(std::shared_ptr<SDL_Renderer>& renderer, const
|
||||
{
|
||||
_backgroundcolor = { 0x69, 0x66, 0x63, 0xff };
|
||||
_fontcolor = { 0xd1, 0xcf, 0xcd, 0xff };
|
||||
(void)update_text(label);
|
||||
std::ignore = update_text(label);
|
||||
}
|
||||
|
||||
SdlSelectWidget::~SdlSelectWidget() = default;
|
||||
|
||||
@@ -23,10 +23,10 @@ SdlSelectList::SdlSelectList(const std::string& title, const std::vector<std::st
|
||||
|
||||
const std::vector<int> buttonids = { INPUT_BUTTON_ACCEPT, INPUT_BUTTON_CANCEL };
|
||||
const std::vector<std::string> buttonlabels = { "accept", "cancel" };
|
||||
(void)_buttons.populate(
|
||||
std::ignore = _buttons.populate(
|
||||
_renderer, buttonlabels, buttonids, widget_width, static_cast<Sint32>(total_height),
|
||||
static_cast<Sint32>(widget_width / 2), static_cast<Sint32>(widget_height));
|
||||
(void)_buttons.set_highlight(0);
|
||||
_buttons.set_highlight(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ void SdlSelectList::reset_mouseover()
|
||||
{
|
||||
for (auto& cur : _list)
|
||||
{
|
||||
(void)cur.mouseover(false);
|
||||
cur.mouseover(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,6 @@ void SdlSelectList::reset_highlight()
|
||||
{
|
||||
for (auto& cur : _list)
|
||||
{
|
||||
(void)cur.highlight(false);
|
||||
cur.highlight(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ class SdlSelectableWidget : public SdlWidget
|
||||
SdlSelectableWidget& operator=(const SdlSelectableWidget& other) = delete;
|
||||
SdlSelectableWidget& operator=(SdlSelectableWidget&& other) = delete;
|
||||
|
||||
[[nodiscard]] bool highlight(bool enable);
|
||||
[[nodiscard]] bool mouseover(bool enable);
|
||||
bool highlight(bool enable);
|
||||
bool mouseover(bool enable);
|
||||
|
||||
protected:
|
||||
[[nodiscard]] bool updateInternal() override;
|
||||
|
||||
@@ -51,12 +51,12 @@ SdlWidget::SdlWidget(std::shared_ptr<SDL_Renderer>& renderer, const SDL_FRect& r
|
||||
auto ops = SDL3ResourceManager::get(SDLResourceManager::typeFonts(),
|
||||
"OpenSans-VariableFont_wdth,wght.ttf");
|
||||
if (!ops)
|
||||
(void)widget_log_error(false, "SDLResourceManager::get");
|
||||
widget_log_error(false, "SDLResourceManager::get");
|
||||
else
|
||||
{
|
||||
_font = std::shared_ptr<TTF_Font>(TTF_OpenFontIO(ops, true, 64), TTF_CloseFont);
|
||||
if (!_font)
|
||||
(void)widget_log_error(false, "TTF_OpenFontRW");
|
||||
widget_log_error(false, "TTF_OpenFontRW");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ SdlWidget::SdlWidget(std::shared_ptr<SDL_Renderer>& renderer, const SDL_FRect& r
|
||||
_image = std::shared_ptr<SDL_Texture>(IMG_LoadTexture_IO(renderer.get(), ops, true),
|
||||
SDL_DestroyTexture);
|
||||
if (!_image)
|
||||
(void)widget_log_error(false, "IMG_LoadTexture_IO");
|
||||
widget_log_error(false, "IMG_LoadTexture_IO");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -95,7 +95,7 @@ std::shared_ptr<SDL_Texture> SdlWidget::render_text(const std::string& text, SDL
|
||||
TTF_RenderText_Blended(_font.get(), text.c_str(), 0, fgcolor), SDL_DestroySurface);
|
||||
if (!surface)
|
||||
{
|
||||
(void)widget_log_error(false, "TTF_RenderText_Blended");
|
||||
widget_log_error(false, "TTF_RenderText_Blended");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -103,13 +103,13 @@ std::shared_ptr<SDL_Texture> SdlWidget::render_text(const std::string& text, SDL
|
||||
SDL_CreateTextureFromSurface(_renderer.get(), surface.get()), SDL_DestroyTexture);
|
||||
if (!texture)
|
||||
{
|
||||
(void)widget_log_error(false, "SDL_CreateTextureFromSurface");
|
||||
widget_log_error(false, "SDL_CreateTextureFromSurface");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!_engine)
|
||||
{
|
||||
(void)widget_log_error(false, "TTF_CreateRendererTextEngine");
|
||||
widget_log_error(false, "TTF_CreateRendererTextEngine");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -118,14 +118,14 @@ std::shared_ptr<SDL_Texture> SdlWidget::render_text(const std::string& text, SDL
|
||||
|
||||
if (!txt)
|
||||
{
|
||||
(void)widget_log_error(false, "TTF_CreateText");
|
||||
widget_log_error(false, "TTF_CreateText");
|
||||
return nullptr;
|
||||
}
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
if (!TTF_GetTextSize(txt.get(), &w, &h))
|
||||
{
|
||||
(void)widget_log_error(false, "TTF_GetTextSize");
|
||||
widget_log_error(false, "TTF_GetTextSize");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ std::shared_ptr<SDL_Texture> SdlWidget::render_text_wrapped(const std::string& t
|
||||
SDL_DestroySurface);
|
||||
if (!surface)
|
||||
{
|
||||
(void)widget_log_error(false, "TTF_RenderText_Blended");
|
||||
widget_log_error(false, "TTF_RenderText_Blended");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ std::shared_ptr<SDL_Texture> SdlWidget::render_text_wrapped(const std::string& t
|
||||
SDL_CreateTextureFromSurface(_renderer.get(), surface.get()), SDL_DestroyTexture);
|
||||
if (!texture)
|
||||
{
|
||||
(void)widget_log_error(false, "SDL_CreateTextureFromSurface");
|
||||
widget_log_error(false, "SDL_CreateTextureFromSurface");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ class SdlWidget
|
||||
[[nodiscard]] bool update();
|
||||
|
||||
#define widget_log_error(res, what) SdlWidget::error_ex(res, what, __FILE__, __LINE__, __func__)
|
||||
[[nodiscard]] static bool error_ex(bool success, const char* what, const char* file,
|
||||
size_t line, const char* fkt);
|
||||
static bool error_ex(bool success, const char* what, const char* file, size_t line,
|
||||
const char* fkt);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<SDL_Renderer> _renderer;
|
||||
|
||||
@@ -14,7 +14,7 @@ bool SdlWidgetList::reset(const std::string& title, size_t width, size_t height)
|
||||
_renderer = std::shared_ptr<SDL_Renderer>(renderer, SDL_DestroyRenderer);
|
||||
_window = std::shared_ptr<SDL_Window>(window, SDL_DestroyWindow);
|
||||
if (!rc)
|
||||
(void)widget_log_error(rc, "SDL_CreateWindowAndRenderer");
|
||||
widget_log_error(rc, "SDL_CreateWindowAndRenderer");
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,14 +53,7 @@ static int runTest(fkt_t fkt)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
rc = runTest(auth_dialogs);
|
||||
|
||||
return rc;
|
||||
return runTest(auth_dialogs);
|
||||
}
|
||||
|
||||
@@ -41,14 +41,7 @@ static int runTest(fkt_t fkt)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
rc = runTest(select_dialogs);
|
||||
|
||||
return rc;
|
||||
return runTest(select_dialogs);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
static bool send_mouse_wheel(SdlContext* sdl, UINT16 flags, INT32 avalue)
|
||||
[[nodiscard]] static bool send_mouse_wheel(SdlContext* sdl, UINT16 flags, INT32 avalue)
|
||||
{
|
||||
WINPR_ASSERT(sdl);
|
||||
if (avalue < 0)
|
||||
@@ -54,7 +54,7 @@ static bool send_mouse_wheel(SdlContext* sdl, UINT16 flags, INT32 avalue)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static UINT32 sdl_scale_pressure(const float pressure)
|
||||
[[nodiscard]] static UINT32 sdl_scale_pressure(const float pressure)
|
||||
{
|
||||
const float val = pressure * 0x400; /* [MS-RDPEI] 2.2.3.3.1.1 RDPINPUT_TOUCH_CONTACT */
|
||||
if (val < 0.0f)
|
||||
@@ -130,13 +130,15 @@ bool SdlTouch::handleEvent(SdlContext* sdl, const SDL_MouseWheelEvent& ev)
|
||||
if (y != 0)
|
||||
{
|
||||
flags |= PTR_FLAGS_WHEEL;
|
||||
send_mouse_wheel(sdl, flags, y);
|
||||
if (!send_mouse_wheel(sdl, flags, y))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (x != 0)
|
||||
{
|
||||
flags |= PTR_FLAGS_HWHEEL;
|
||||
send_mouse_wheel(sdl, flags, x);
|
||||
if (!send_mouse_wheel(sdl, flags, x))
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user