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

// Copyright 2016 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_pointer.h"

#include <linux/input.h>
#include <stylus-unstable-v2-client-protocol.h>

#include "base/logging.h"
#include "base/version.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/types/event_type.h"
#include "ui/ozone/platform/wayland/common/wayland_util.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_serial_tracker.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window_drag_controller.h"
#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h"

namespace ui {

namespace {

// TODO(crbug.com/40235357): Remove this method when Compositors other
// than Exo comply with `wl_pointer.frame`.
wl::EventDispatchPolicy EventDispatchPolicyForPlatform() {}

}  // namespace

WaylandPointer::WaylandPointer(wl_pointer* pointer,
                               WaylandConnection* connection,
                               Delegate* delegate)
    :{}

WaylandPointer::~WaylandPointer() {}

// static
void WaylandPointer::OnEnter(void* data,
                             wl_pointer* pointer,
                             uint32_t serial,
                             wl_surface* surface,
                             wl_fixed_t surface_x,
                             wl_fixed_t surface_y) {}

// static
void WaylandPointer::OnLeave(void* data,
                             wl_pointer* pointer,
                             uint32_t serial,
                             wl_surface* surface) {}

// static
void WaylandPointer::OnMotion(void* data,
                              wl_pointer* pointer,
                              uint32_t time,
                              wl_fixed_t surface_x,
                              wl_fixed_t surface_y) {}

// static
void WaylandPointer::OnButton(void* data,
                              wl_pointer* pointer,
                              uint32_t serial,
                              uint32_t time,
                              uint32_t button,
                              uint32_t state) {}

// static
void WaylandPointer::OnAxis(void* data,
                            wl_pointer* pointer,
                            uint32_t time,
                            uint32_t axis,
                            wl_fixed_t value) {}

// ---- Version 5 ----

// static
void WaylandPointer::OnFrame(void* data, wl_pointer* pointer) {}

// static
void WaylandPointer::OnAxisSource(void* data,
                                  wl_pointer* pointer,
                                  uint32_t axis_source) {}

// static
void WaylandPointer::OnAxisStop(void* data,
                                wl_pointer* pointer,
                                uint32_t time,
                                uint32_t axis) {}

// static
void WaylandPointer::OnAxisDiscrete(void* data,
                                    wl_pointer* pointer,
                                    uint32_t axis,
                                    int32_t discrete) {}

// --- Version 8 ---

// static
void WaylandPointer::OnAxisValue120(void* data,
                                    wl_pointer* pointer,
                                    uint32_t axis,
                                    int32_t value120) {}

void WaylandPointer::SetupStylus() {}

// static
void WaylandPointer::OnTool(void* data,
                            struct zcr_pointer_stylus_v2* stylus,
                            uint32_t wl_pointer_type) {}

// static
void WaylandPointer::OnForce(void* data,
                             struct zcr_pointer_stylus_v2* stylus,
                             uint32_t time,
                             wl_fixed_t force) {}

// static
void WaylandPointer::OnTilt(void* data,
                            struct zcr_pointer_stylus_v2* stylus,
                            uint32_t time,
                            wl_fixed_t tilt_x,
                            wl_fixed_t tilt_y) {}

// Enter/Leave events cause undesirable tab detaches in window dragging
// sessions. At least KWin and Mutter are known to send leave/enter events
// before the events currently used by the window drag controller to detect
// drop, see the crbug linked below for more details.
//
// TODO(crbug.com/329479345): Move this suppression logic to drag controller
// code once they're refactored to intercept events for the whole session. Also,
// limit it to apply only in between the first data_device.enter and
// dnd_drop_performed.
bool WaylandPointer::SuppressFocusChangeEvents() const {}

}  // namespace ui