Skip to content

Commit ff8cfb8

Browse files
committed
fix lint
1 parent dd7f6fc commit ff8cfb8

1 file changed

Lines changed: 23 additions & 24 deletions

File tree

src/ruis/widget/container.cpp

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ void container::render(const ruis::mat4& matrix) const
8080

8181
event_status container::on_mouse_button(const mouse_button_event& e)
8282
{
83-
// TRACE(<< "container::OnMouseButton(): isDown = " << isDown << ", button = " << button << ", pos = " << pos <<
84-
// std::endl)
85-
8683
blocked_flag_guard blocked_guard(this->is_blocked);
8784

8885
// check if mouse captured
@@ -92,10 +89,10 @@ event_status container::on_mouse_button(const mouse_button_event& e)
9289
if (auto w = i->second.capturing_widget.lock()) {
9390
if (w->is_interactive()) {
9491
w->on_mouse_button(mouse_button_event{
95-
e.action, //
96-
e.pos - w->rect().p,
97-
e.button,
98-
e.pointer_id
92+
.action = e.action, //
93+
.pos = e.pos - w->rect().p,
94+
.button = e.button,
95+
.pointer_id = e.pointer_id
9996
});
10097
w->set_hovered(
10198
w->rect().overlaps(e.pos), //
@@ -108,8 +105,8 @@ event_status container::on_mouse_button(const mouse_button_event& e)
108105
// which are already down, so we increase the button counter.
109106
++num_buttons_captured;
110107
} else {
111-
// If we get button up event,
112-
// then it is for one of the buttons which was down before, so we decrease the button counter.
108+
// If we get button up event, then it is for one of the buttons which was down before,
109+
// so we decrease the button counter.
113110
--num_buttons_captured;
114111
}
115112
if (num_buttons_captured == 0) {
@@ -143,10 +140,10 @@ event_status container::on_mouse_button(const mouse_button_event& e)
143140
c.set_hovered(true, e.pointer_id);
144141

145142
if (c.on_mouse_button(mouse_button_event{
146-
e.action, //
147-
e.pos - c.rect().p,
148-
e.button,
149-
e.pointer_id
143+
.action = e.action, //
144+
.pos = e.pos - c.rect().p,
145+
.button = e.button,
146+
.pointer_id = e.pointer_id
150147
}) == event_status::consumed)
151148
{
152149
utki::assert(
@@ -156,7 +153,7 @@ event_status container::on_mouse_button(const mouse_button_event& e)
156153
SL
157154
);
158155

159-
// normally, we get here only when the mouse was not captured by widget, because
156+
// Normally, we get here only when the mouse was not captured by widget, because
160157
// as soon as mouse button down event comes to some widget, it captures the mouse.
161158
// So, the event should be button down.
162159
// But, in theory, it can be button up event here, if some widget which captured
@@ -165,15 +162,15 @@ event_status container::on_mouse_button(const mouse_button_event& e)
165162
this->mouse_capture_map.insert(std::make_pair(
166163
e.pointer_id, //
167164
mouse_capture_info{
168-
utki::make_weak(i->to_shared_ptr()), //
169-
1 // one button captured
165+
.capturing_widget = utki::make_weak(i->to_shared_ptr()), //
166+
.num_buttons_captured = 1 // one button captured
170167
}
171168
));
172169
}
173170

174-
// widget has consumed the mouse button event,
171+
// Widget has consumed the mouse button event,
175172
// that means the rest of the underlying widgets are not hovered,
176-
// update the hovered state of those
173+
// update the hovered state of those.
177174
for (++i; i != this->children().rend(); ++i) {
178175
i->get().set_hovered(
179176
false, //
@@ -198,9 +195,9 @@ event_status container::on_mouse_move(const mouse_move_event& e)
198195
if (auto w = i->second.capturing_widget.lock()) {
199196
if (w->is_interactive()) { // TODO: why check interactive here?
200197
auto status = w->on_mouse_move(mouse_move_event{
201-
e.pos - w->rect().p, //
202-
e.pointer_id,
203-
e.ignore_mouse_capture
198+
.pos = e.pos - w->rect().p, //
199+
.pointer_id = e.pointer_id,
200+
.ignore_mouse_capture = e.ignore_mouse_capture
204201
});
205202
w->set_hovered(
206203
w->rect().overlaps(e.pos), //
@@ -238,9 +235,11 @@ event_status container::on_mouse_move(const mouse_move_event& e)
238235

239236
c.set_hovered(true, e.pointer_id);
240237

241-
// LOG("e.pos = " << e.pos << ", rect() = " << c->rect() << std::endl)
242-
if (c.on_mouse_move(mouse_move_event{e.pos - c.rect().p, e.pointer_id, e.ignore_mouse_capture}) ==
243-
event_status::consumed)
238+
if (c.on_mouse_move(mouse_move_event{
239+
.pos = e.pos - c.rect().p, //
240+
.pointer_id = e.pointer_id,
241+
.ignore_mouse_capture = e.ignore_mouse_capture
242+
}) == event_status::consumed)
244243
{
245244
// widget has consumed the mouse move event,
246245
// that means the rest of the underlying widgets are not hovered,

0 commit comments

Comments
 (0)