Skip to content

Commit 6add553

Browse files
wayland: fix wrong scale factor logic in xdg_toplevel_listener (sony#390)
This change fixes a wrong scale factor logic in configure callback of xdg_toplevel_listener when the scale value is not 1.0. Signed-off-by: Hidenori Matsubayashi <[email protected]>
1 parent 32d8a7a commit 6add553

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/flutter/shell/platform/linux_embedded/window/elinux_window_wayland.cc

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,24 @@ const xdg_toplevel_listener ELinuxWindowWayland::kXdgToplevelListener = {
123123
std::swap(width, height);
124124
}
125125

126-
int32_t next_width = width;
127-
int32_t next_height = height;
126+
int32_t next_width_dip = width / self->current_scale_;
127+
int32_t next_height_dip = height / self->current_scale_;
128128
if (self->restore_window_required_) {
129129
self->restore_window_required_ = false;
130-
next_width = self->restore_window_width_;
131-
next_height = self->restore_window_height_;
130+
next_width_dip = self->restore_window_width_;
131+
next_height_dip = self->restore_window_height_;
132132
}
133133

134-
if (!next_width || !next_height ||
135-
(self->view_properties_.width == next_width &&
136-
self->view_properties_.height == next_height)) {
134+
if (!next_width_dip || !next_height_dip ||
135+
(self->view_properties_.width == next_width_dip &&
136+
self->view_properties_.height == next_height_dip)) {
137137
return;
138138
}
139139

140-
ELINUX_LOG(TRACE)
141-
<< "request redraw: " << next_width << ", " << next_height;
142-
self->view_properties_.width = next_width;
143-
self->view_properties_.height = next_height;
140+
ELINUX_LOG(TRACE) << "request redraw: " << next_width_dip << ", "
141+
<< next_height_dip;
142+
self->view_properties_.width = next_width_dip;
143+
self->view_properties_.height = next_height_dip;
144144
self->request_redraw_ = true;
145145
},
146146
.close =
@@ -1274,6 +1274,11 @@ bool ELinuxWindowWayland::DispatchEvent() {
12741274
window_decorations_->Resize(view_properties_.width,
12751275
view_properties_.height, current_scale_);
12761276
}
1277+
1278+
ELINUX_LOG(ERROR) << "width: " << view_properties_.width;
1279+
ELINUX_LOG(ERROR) << "height: " << view_properties_.height;
1280+
ELINUX_LOG(ERROR) << "current_scale: " << current_scale_;
1281+
12771282
if (binding_handler_delegate_) {
12781283
binding_handler_delegate_->OnWindowSizeChanged(
12791284
view_properties_.width * current_scale_,
@@ -1820,8 +1825,9 @@ void ELinuxWindowWayland::DismissVirtualKeybaord() {
18201825
}
18211826

18221827
void ELinuxWindowWayland::UpdateWindowScale() {
1823-
if (view_properties_.force_scale_factor)
1828+
if (view_properties_.force_scale_factor) {
18241829
return;
1830+
}
18251831

18261832
double scale_factor = 1.0;
18271833
for (auto output_id : entered_outputs_) {

0 commit comments

Comments
 (0)