chromium/ui/ozone/platform/wayland/host/wayland_window_drag_controller.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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;

// Custom mime type used for window dragging DND sessions.
constexpr char kMimeTypeChromiumWindow[] =;

// DND action used in window dragging DND sessions.
constexpr uint32_t kDndActionWindowDrag =;

// Value minimally higher than `GestureDetector::Config::touch_slop` (see [1])
// to exit the horizontal rail threshold in SnapScrollController, in case of
// an upwards tab dragging detach with touch.
//
// [1] //ui/events/gesture_detection/gesture_detector.h
constexpr int kHorizontalRailExitThreshold =;

}  // namespace

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 {}

// Icon drawing and update for window/tab dragging is handled by buffer manager.
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 {}

// This function is called when either 'cancelled' or 'finished' data source
// events is received during a window dragging session. It is used to detect
// when drop happens, since it is the only event sent by the server regardless
// where it happens, inside or outside toplevel surfaces.
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) {}

// Dispatch mouse release events (to tell clients that the drop just happened)
// clear focus and reset internal state. Must be called when the session is
// about to finish.
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) {}

}  // namespace ui