#include "ui/ozone/platform/wayland/host/wayland_window_drag_controller.h"
#include <extended-drag-unstable-v1-client-protocol.h>
#include <wayland-client-protocol.h>
#include <cstdint>
#include <memory>
#include <ostream>
#include <utility>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/memory/raw_ref.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/task/current_thread.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h"
#include "ui/base/ui_base_features.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/scoped_event_dispatcher.h"
#include "ui/events/platform_event.h"
#include "ui/events/types/event_type.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/ozone/platform/wayland/host/dump_util.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor_position.h"
#include "ui/ozone/platform/wayland/host/wayland_data_device_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_data_offer.h"
#include "ui/ozone/platform/wayland/host/wayland_data_source.h"
#include "ui/ozone/platform/wayland/host/wayland_event_source.h"
#include "ui/ozone/platform/wayland/host/wayland_keyboard.h"
#include "ui/ozone/platform/wayland/host/wayland_output_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_screen.h"
#include "ui/ozone/platform/wayland/host/wayland_serial_tracker.h"
#include "ui/ozone/platform/wayland/host/wayland_surface.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window_manager.h"
#include "ui/platform_window/platform_window_init_properties.h"
namespace ui {
namespace {
DragEventSource;
constexpr char kMimeTypeChromiumWindow[] = …;
constexpr uint32_t kDndActionWindowDrag = …;
constexpr int kHorizontalRailExitThreshold = …;
}
class WaylandWindowDragController::ExtendedDragSource { … };
WaylandWindowDragController::WaylandWindowDragController(
WaylandConnection* connection,
WaylandDataDeviceManager* device_manager,
WaylandPointer::Delegate* pointer_delegate,
WaylandTouch::Delegate* touch_delegate,
WaylandKeyboard::Delegate* keyboard_delegate)
: … { … }
WaylandWindowDragController::~WaylandWindowDragController() = default;
bool WaylandWindowDragController::StartDragSession(
WaylandToplevelWindow* origin,
DragEventSource drag_source) { … }
bool WaylandWindowDragController::Drag(WaylandToplevelWindow* window,
const gfx::Vector2d& offset) { … }
void WaylandWindowDragController::StopDragging() { … }
bool WaylandWindowDragController::IsDragInProgress() const { … }
bool WaylandWindowDragController::IsDragSource() const { … }
void WaylandWindowDragController::DrawIcon() { … }
void WaylandWindowDragController::OnDragOffer(
std::unique_ptr<WaylandDataOffer> offer) { … }
void WaylandWindowDragController::OnDragEnter(WaylandWindow* window,
const gfx::PointF& location,
base::TimeTicks timestamp,
uint32_t serial) { … }
void WaylandWindowDragController::OnDragMotion(const gfx::PointF& location,
base::TimeTicks timestamp) { … }
void WaylandWindowDragController::OnDragLeave(base::TimeTicks timestamp) { … }
void WaylandWindowDragController::OnDragDrop(base::TimeTicks timestamp) { … }
const WaylandWindow* WaylandWindowDragController::GetDragTarget() const { … }
void WaylandWindowDragController::OnDataSourceFinish(WaylandDataSource* source,
base::TimeTicks timestamp,
bool completed) { … }
void WaylandWindowDragController::OnDataSourceSend(WaylandDataSource* source,
const std::string& mime_type,
std::string* contents) { … }
bool WaylandWindowDragController::CanDispatchEvent(const PlatformEvent& event) { … }
uint32_t WaylandWindowDragController::DispatchEvent(
const PlatformEvent& event) { … }
void WaylandWindowDragController::OnWindowRemoved(WaylandWindow* window) { … }
void WaylandWindowDragController::HandleMotionEvent(LocatedEvent* event) { … }
void WaylandWindowDragController::HandleDropAndResetState(
base::TimeTicks timestamp) { … }
void WaylandWindowDragController::RunLoop() { … }
void WaylandWindowDragController::QuitLoop() { … }
void WaylandWindowDragController::SetDraggedWindow(
WaylandToplevelWindow* window,
const gfx::Vector2d& offset) { … }
bool WaylandWindowDragController::IsExtendedDragAvailable() const { … }
bool WaylandWindowDragController::IsActiveDragAndDropSession() const { … }
void WaylandWindowDragController::DumpState(std::ostream& out) const { … }
bool WaylandWindowDragController::IsExtendedDragAvailableInternal() const { … }
std::ostream& operator<<(std::ostream& out,
WaylandWindowDragController::State state) { … }
std::optional<wl::Serial> WaylandWindowDragController::GetSerial(
DragEventSource drag_source,
WaylandToplevelWindow* origin) { … }
}