Commit f7553872 authored by Alexander Dunaev's avatar Alexander Dunaev Committed by Chromium LUCI CQ

[ozone/wayland] Fixed proper scaling of the drag image.

The surface created for the drag image did not have set the proper
buffer scale, which resulted in rendering it wrong way on a HiDPI
output.

This CL fixes that by setting the proper buffer scale to the surface at
the moment when it is created.

There are other issues with the drag image that will be fixed in
subsequent patches.

Bug: 1085418
Change-Id: Ib4cd95584cff9be5cb049c9c5e3a6981ca82832a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2637474Reviewed-by: default avatarMaksim Sisov <msisov@igalia.com>
Commit-Queue: Alexander Dunaev <adunaev@igalia.com>
Cr-Commit-Position: refs/heads/master@{#845086}
parent 645abf98
......@@ -87,7 +87,12 @@ void WaylandDataDragController::StartSession(const OSExchangeData& data,
Offer(data, operation);
// Create drag icon surface (if any) and store the data to be exchanged.
CreateIconSurfaceIfNeeded(data);
icon_bitmap_ = GetDragImage(data);
if (icon_bitmap_) {
icon_surface_ = connection_->CreateSurface();
wl_surface_set_buffer_scale(icon_surface_.get(),
origin_window_->buffer_scale());
}
data_ = std::make_unique<OSExchangeData>(data.provider().Clone());
// Starts the wayland drag session setting |this| object as delegate.
......@@ -118,7 +123,6 @@ void WaylandDataDragController::DrawIcon() {
return;
}
}
// TODO(crbug.com/1085418): Fix drag icon scaling
wl::DrawBitmap(*icon_bitmap_, shm_buffer_.get());
wl_surface_attach(icon_surface_.get(), shm_buffer_->get(), 0, 0);
wl_surface_damage(icon_surface_.get(), 0, 0, size.width(), size.height());
......@@ -275,13 +279,6 @@ void WaylandDataDragController::Offer(const OSExchangeData& data,
data_source_->SetAction(operation);
}
void WaylandDataDragController::CreateIconSurfaceIfNeeded(
const OSExchangeData& data) {
icon_bitmap_ = GetDragImage(data);
if (icon_bitmap_)
icon_surface_ = connection_->CreateSurface();
}
// Asynchronously requests and reads data for every negotiated/supported mime
// type, one after another, OnMimeTypeDataTransferred calls back into this
// function once it finishes reading data for each mime type, until there is no
......
......@@ -109,7 +109,6 @@ class WaylandDataDragController : public WaylandDataDevice::DragDelegate,
void OnWindowRemoved(WaylandWindow* window) override;
void Offer(const OSExchangeData& data, int operation);
void CreateIconSurfaceIfNeeded(const OSExchangeData& data);
void HandleUnprocessedMimeTypes(base::TimeTicks start_time);
void OnMimeTypeDataTransferred(base::TimeTicks start_time,
PlatformClipboard::Data contents);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment