blob: 07d53a9794b053c9afbd3363fb8229698c08509d [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/exo/pointer_delegate.h"
#include "components/exo/wayland/wayland_input_delegate.h"
struct wl_client;
struct wl_resource;
namespace exo {
namespace wayland {
// Pointer delegate class that accepts events for surfaces owned by the same
// client as a pointer resource.
class WaylandPointerDelegate : public WaylandInputDelegate,
public PointerDelegate {
explicit WaylandPointerDelegate(wl_resource* pointer_resource);
// Overridden from PointerDelegate:
void OnPointerDestroying(Pointer* pointer) override;
bool CanAcceptPointerEventsForSurface(Surface* surface) const override;
void OnPointerEnter(Surface* surface,
const gfx::PointF& location,
int button_flags) override;
void OnPointerLeave(Surface* surface) override;
void OnPointerMotion(base::TimeTicks time_stamp,
const gfx::PointF& location) override;
void OnPointerButton(base::TimeTicks time_stamp,
int button_flags,
bool pressed) override;
void OnPointerScroll(base::TimeTicks time_stamp,
const gfx::Vector2dF& offset,
bool discrete) override;
void OnPointerScrollStop(base::TimeTicks time_stamp) override;
void OnPointerFrame() override;
// The client who own this pointer instance.
wl_client* client() const;
// Returns the next serial to use for pointer events.
uint32_t next_serial() const;
// The pointer resource associated with the pointer.
wl_resource* const pointer_resource_;
} // namespace wayland
} // namespace exo