Skip to content

Commit 245d969

Browse files
committed
fix lint
1 parent 209ee0d commit 245d969

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/ruisapp/glue/sdl/glue.cxx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ ruis::key sdl_scan_code_to_ruis_key(SDL_Scancode sc)
323323
namespace {
324324
ruis::real get_dpi(int display_index = 0)
325325
{
326-
float dpi;
326+
float dpi = ruis::context::default_dots_per_inch;
327327
if (SDL_GetDisplayDPI(display_index, &dpi, nullptr, nullptr) != 0) {
328328
throw std::runtime_error(utki::cat("Could not get SDL display DPI, SDL Error: ", SDL_GetError()));
329329
}
@@ -387,7 +387,7 @@ class window_wrapper : public utki::destructable
387387
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, ver.minor);
388388
}
389389

390-
auto dims = wp.dims * get_display_scaling_factor();
390+
auto dims = wp.dims.to<ruis::real>() * get_display_scaling_factor();
391391

392392
SDL_Window* window = SDL_CreateWindow(
393393
"TODO: window title",
@@ -617,10 +617,12 @@ int main(int argc, const char** argv)
617617
// - wait for events and handle them/next cycle
618618

619619
auto to_wait_ms = app->gui.update();
620+
// clamp to_wait_ms to max of int as SDL_WaitEventTimeout() accepts int type
621+
to_wait_ms = std::min(to_wait_ms, uint32_t(std::numeric_limits<int32_t>::max()));
620622

621623
render(*app);
622624

623-
if (SDL_WaitEventTimeout(nullptr, to_wait_ms) == 0) {
625+
if (SDL_WaitEventTimeout(nullptr, int(to_wait_ms)) == 0) {
624626
// No events or error. In case of error not much we can do, just ignore it.
625627
continue;
626628
}
@@ -694,7 +696,7 @@ int main(int argc, const char** argv)
694696
struct sdl_dummy_input_string_provider : public ruis::gui::input_string_provider {
695697
std::u32string get() const override
696698
{
697-
return std::u32string();
699+
return {};
698700
}
699701
};
700702

@@ -717,7 +719,7 @@ int main(int argc, const char** argv)
717719
}
718720
} sdl_input_string_provider(
719721
// save pointer to text, the ownership of text buffer is not taken!
720-
e.text.text
722+
&(e.text.text[0])
721723
);
722724

723725
handle_character_input(*app, sdl_input_string_provider, ruis::key::unknown);
@@ -726,6 +728,7 @@ int main(int argc, const char** argv)
726728
default:
727729
if (e.type == ww.user_event_type) {
728730
std::unique_ptr<std::function<void()>> f(
731+
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
729732
reinterpret_cast<std::function<void()>*>(e.user.data1)
730733
);
731734
f->operator()();

0 commit comments

Comments
 (0)