Skip to content

Commit dcacad5

Browse files
committed
format
1 parent c20b5ce commit dcacad5

3 files changed

Lines changed: 56 additions & 69 deletions

File tree

src/ruisapp/application.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ void application::update_window_rect(const ruis::rect& rect)
5454
LOG([&](auto& o) {
5555
o << "application::update_window_rect(): this->cur_window_rect = " << this->cur_window_rect << std::endl;
5656
})
57-
this->gui.context.get().renderer.get().render_context.get().set_viewport(
58-
r4::rectangle<uint32_t>(
59-
uint32_t(this->cur_window_rect.p.x()),
60-
uint32_t(this->cur_window_rect.p.y()),
61-
uint32_t(this->cur_window_rect.d.x()),
62-
uint32_t(this->cur_window_rect.d.y())
63-
)
64-
);
57+
this->gui.context.get().renderer.get().render_context.get().set_viewport(r4::rectangle<uint32_t>(
58+
uint32_t(this->cur_window_rect.p.x()),
59+
uint32_t(this->cur_window_rect.p.y()),
60+
uint32_t(this->cur_window_rect.d.x()),
61+
uint32_t(this->cur_window_rect.d.y())
62+
));
6563

6664
this->gui.set_viewport(this->cur_window_rect.d);
6765
}

src/ruisapp/glue/linux/glue_wayland.cxx

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,9 +1035,10 @@ struct wm_base_wrapper {
10351035

10361036
private:
10371037
constexpr static const xdg_wm_base_listener listener = {
1038-
.ping = [](void* data, xdg_wm_base* wm_base, uint32_t serial) {
1039-
xdg_wm_base_pong(wm_base, serial);
1040-
} //
1038+
.ping =
1039+
[](void* data, xdg_wm_base* wm_base, uint32_t serial) {
1040+
xdg_wm_base_pong(wm_base, serial);
1041+
} //
10411042
};
10421043
};
10431044
} // namespace
@@ -1784,11 +1785,12 @@ class seat_wrapper
17841785

17851786
constexpr static const wl_seat_listener listener = {
17861787
.capabilities = &wl_seat_capabilities,
1787-
.name = [](void* data, wl_seat* seat, const char* name) {
1788-
LOG([&](auto& o) {
1789-
o << "seat name: " << name << std::endl;
1790-
})
1791-
} //
1788+
.name =
1789+
[](void* data, wl_seat* seat, const char* name) {
1790+
LOG([&](auto& o) {
1791+
o << "seat name: " << name << std::endl;
1792+
})
1793+
} //
17921794
};
17931795
};
17941796
} // namespace
@@ -1826,9 +1828,10 @@ struct window_wrapper : public utki::destructable {
18261828
xdg_surface* xdg_sur;
18271829

18281830
constexpr static const xdg_surface_listener listener = {
1829-
.configure = [](void* data, xdg_surface* xdg_surface, uint32_t serial) {
1830-
xdg_surface_ack_configure(xdg_surface, serial);
1831-
}, //
1831+
.configure =
1832+
[](void* data, xdg_surface* xdg_surface, uint32_t serial) {
1833+
xdg_surface_ack_configure(xdg_surface, serial);
1834+
}, //
18321835
};
18331836

18341837
xdg_surface_wrapper(surface_wrapper& surface, wm_base_wrapper& wm_base) :
@@ -2636,11 +2639,10 @@ void pointer_wrapper::wl_pointer_motion(void* data, wl_pointer* pointer, uint32_
26362639

26372640
auto& ww = get_impl(ruisapp::application::inst());
26382641

2639-
ruis::vector2
2640-
pos( //
2641-
ruis::real(wl_fixed_to_double(x)),
2642-
ruis::real(wl_fixed_to_double(y))
2643-
);
2642+
ruis::vector2 pos( //
2643+
ruis::real(wl_fixed_to_double(x)),
2644+
ruis::real(wl_fixed_to_double(y))
2645+
);
26442646
pos *= ww.scale;
26452647
self.cur_pointer_pos = round(pos);
26462648

@@ -2682,22 +2684,19 @@ void touch_wrapper::wl_touch_down( //
26822684

26832685
ASSERT(!utki::contains(self.touch_points, id))
26842686

2685-
ruis::vector2
2686-
pos( //
2687-
ruis::real(wl_fixed_to_double(x)),
2688-
ruis::real(wl_fixed_to_double(y))
2689-
);
2687+
ruis::vector2 pos( //
2688+
ruis::real(wl_fixed_to_double(x)),
2689+
ruis::real(wl_fixed_to_double(y))
2690+
);
26902691
pos = round(pos * ww.scale);
26912692

2692-
auto insert_result = self.touch_points.insert(
2693-
std::make_pair(
2694-
id,
2695-
touch_point{
2696-
.ruis_id = unsigned(id) + 1, // id = 0 reserved for mouse
2697-
.pos = pos
2698-
}
2699-
)
2700-
);
2693+
auto insert_result = self.touch_points.insert(std::make_pair(
2694+
id,
2695+
touch_point{
2696+
.ruis_id = unsigned(id) + 1, // id = 0 reserved for mouse
2697+
.pos = pos
2698+
}
2699+
));
27012700
ASSERT(insert_result.second) // pair successfully inserted
27022701

27032702
const touch_point& tp = insert_result.first->second;
@@ -2767,11 +2766,10 @@ void touch_wrapper::wl_touch_motion( //
27672766

27682767
touch_point& tp = i->second;
27692768

2770-
ruis::vector2
2771-
pos( //
2772-
ruis::real(wl_fixed_to_double(x)),
2773-
ruis::real(wl_fixed_to_double(y))
2774-
);
2769+
ruis::vector2 pos( //
2770+
ruis::real(wl_fixed_to_double(x)),
2771+
ruis::real(wl_fixed_to_double(y))
2772+
);
27752773
pos = round(pos * ww.scale);
27762774

27772775
tp.pos = pos;

src/ruisapp/glue/sdl/glue.cxx

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,10 @@ class window_wrapper : public utki::destructable
536536
if (auto res = emscripten_get_element_css_size("#canvas", &width, &height);
537537
res != EMSCRIPTEN_RESULT_SUCCESS)
538538
{
539-
throw std::runtime_error(
540-
utki::cat(
541-
"emscripten_get_canvas_element_size(#canvas): failed, error = ", //
542-
res
543-
)
544-
);
539+
throw std::runtime_error(utki::cat(
540+
"emscripten_get_canvas_element_size(#canvas): failed, error = ", //
541+
res
542+
));
545543
}
546544
return ruis::vec2(
547545
ruis::real(width), //
@@ -618,8 +616,7 @@ class window_wrapper : public utki::destructable
618616
user_event_type([]() {
619617
Uint32 t = SDL_RegisterEvents(1);
620618
if (t == (Uint32)(-1)) {
621-
throw std::runtime_error(
622-
utki::cat("Could not create SDL user event type, SDL Error: ", SDL_GetError())
619+
throw std::runtime_error(utki::cat("Could not create SDL user event type, SDL Error: ", SDL_GetError())
623620
);
624621
}
625622
return t;
@@ -760,12 +757,10 @@ application::application(std::string name, const window_parameters& wp) :
760757
dims *= ww.window.scale_factor;
761758
#endif
762759

763-
this->update_window_rect(
764-
ruis::rect(
765-
{0, 0}, //
766-
dims
767-
)
768-
);
760+
this->update_window_rect(ruis::rect(
761+
{0, 0}, //
762+
dims
763+
));
769764
}
770765

771766
void application::quit() noexcept
@@ -800,12 +795,10 @@ void application::set_fullscreen(bool enable)
800795
);
801796

802797
if (error != 0) {
803-
throw std::runtime_error(
804-
utki::cat(
805-
"application::set_fullscreen(): could not switch fullscreen mode, error: ", //
806-
SDL_GetError()
807-
)
808-
);
798+
throw std::runtime_error(utki::cat(
799+
"application::set_fullscreen(): could not switch fullscreen mode, error: ", //
800+
SDL_GetError()
801+
));
809802
}
810803
}
811804

@@ -822,12 +815,10 @@ void application::set_mouse_cursor_visible(bool visible)
822815
int error = SDL_ShowCursor(mode);
823816

824817
if (error < 0) {
825-
throw std::runtime_error(
826-
utki::cat(
827-
"application::set_mouse_cursor_visible(): could not show/hide mouse cursor, error: ", //
828-
SDL_GetError()
829-
)
830-
);
818+
throw std::runtime_error(utki::cat(
819+
"application::set_mouse_cursor_visible(): could not show/hide mouse cursor, error: ", //
820+
SDL_GetError()
821+
));
831822
}
832823
}
833824

0 commit comments

Comments
 (0)