chromium/ui/ozone/platform/wayland/host/wayland_connection.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_connection.h"

#include <content-type-v1-client-protocol.h>
#include <extended-drag-unstable-v1-client-protocol.h>
#include <presentation-time-client-protocol.h>
#include <xdg-shell-client-protocol.h>

#include <algorithm>
#include <cstdint>
#include <memory>
#include <vector>

#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_util.h"
#include "base/task/current_thread.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/input_device.h"
#include "ui/events/devices/keyboard_device.h"
#include "ui/events/devices/touchscreen_device.h"
#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
#include "ui/gfx/geometry/point.h"
#include "ui/ozone/common/features.h"
#include "ui/ozone/platform/wayland/common/wayland_object.h"
#include "ui/ozone/platform/wayland/host/fractional_scale_manager.h"
#include "ui/ozone/platform/wayland/host/gtk_primary_selection_device_manager.h"
#include "ui/ozone/platform/wayland/host/gtk_shell1.h"
#include "ui/ozone/platform/wayland/host/org_kde_kwin_idle.h"
#include "ui/ozone/platform/wayland/host/overlay_prioritizer.h"
#include "ui/ozone/platform/wayland/host/proxy/wayland_proxy_impl.h"
#include "ui/ozone/platform/wayland/host/single_pixel_buffer.h"
#include "ui/ozone/platform/wayland/host/surface_augmenter.h"
#include "ui/ozone/platform/wayland/host/toplevel_icon_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_factory.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor_position.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor_shape.h"
#include "ui/ozone/platform/wayland/host/wayland_data_device_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_drm.h"
#include "ui/ozone/platform/wayland/host/wayland_event_source.h"
#include "ui/ozone/platform/wayland/host/wayland_input_method_context.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_pointer.h"
#include "ui/ozone/platform/wayland/host/wayland_seat.h"
#include "ui/ozone/platform/wayland/host/wayland_shm.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_output_manager_v2.h"
#include "ui/ozone/platform/wayland/host/wayland_zaura_shell.h"
#include "ui/ozone/platform/wayland/host/wayland_zcr_color_management_output.h"
#include "ui/ozone/platform/wayland/host/wayland_zcr_color_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_zcr_cursor_shapes.h"
#include "ui/ozone/platform/wayland/host/wayland_zcr_touchpad_haptics.h"
#include "ui/ozone/platform/wayland/host/wayland_zwp_linux_dmabuf.h"
#include "ui/ozone/platform/wayland/host/wayland_zwp_pointer_constraints.h"
#include "ui/ozone/platform/wayland/host/wayland_zwp_pointer_gestures.h"
#include "ui/ozone/platform/wayland/host/wayland_zwp_relative_pointer_manager.h"
#include "ui/ozone/platform/wayland/host/xdg_activation.h"
#include "ui/ozone/platform/wayland/host/xdg_foreign_wrapper.h"
#include "ui/ozone/platform/wayland/host/zwp_idle_inhibit_manager.h"
#include "ui/ozone/platform/wayland/host/zwp_primary_selection_device_manager.h"
#include "ui/ozone/public/ozone_switches.h"
#include "ui/platform_window/common/platform_window_defaults.h"

namespace ui {

namespace {

// The maximum supported versions for a given interface.
// The version bound will be the minimum of the value and the version
// advertised by the server.
constexpr uint32_t kMaxCompositorVersion =;
constexpr uint32_t kMaxKeyboardExtensionVersion =;
constexpr uint32_t kMaxXdgShellVersion =;
constexpr uint32_t kMaxWpPresentationVersion =;
constexpr uint32_t kMaxWpViewporterVersion =;
constexpr uint32_t kMaxTextInputManagerV1Version =;
constexpr uint32_t kMaxTextInputManagerV3Version =;
constexpr uint32_t kMaxTextInputExtensionVersion =;
constexpr uint32_t kMaxExplicitSyncVersion =;
constexpr uint32_t kMaxAlphaCompositingVersion =;
constexpr uint32_t kMaxXdgDecorationVersion =;
constexpr uint32_t kMaxExtendedDragVersion =;
constexpr uint32_t kMaxXdgOutputManagerVersion =;
constexpr uint32_t kMaxKeyboardShortcutsInhibitManagerVersion =;
constexpr uint32_t kMaxStylusVersion =;
constexpr uint32_t kMaxWpContentTypeVersion =;

int64_t ConvertTimespecToMicros(const struct timespec& ts) {}

int64_t ConvertTimespecResultToMicros(uint32_t tv_sec_hi,
                                      uint32_t tv_sec_lo,
                                      uint32_t tv_nsec) {}

}  // namespace

void ReportShellUMA(UMALinuxWaylandShell shell) {}

WaylandConnection::WaylandConnection() = default;

WaylandConnection::~WaylandConnection() = default;

bool WaylandConnection::Initialize(bool use_threaded_polling) {}

void WaylandConnection::RoundTripQueue() {}

void WaylandConnection::SetShutdownCb(base::OnceCallback<void()> shutdown_cb) {}

base::Version WaylandConnection::GetServerVersion() const {}

void WaylandConnection::SetPlatformCursor(wl_cursor* cursor_data,
                                          int buffer_scale) {}

void WaylandConnection::SetCursorBufferListener(
    WaylandCursorBufferListener* listener) {}

void WaylandConnection::SetCursorBitmap(const std::vector<SkBitmap>& bitmaps,
                                        const gfx::Point& hotspot_in_dips,
                                        int buffer_scale) {}

bool WaylandConnection::IsDragInProgress() const {}

bool WaylandConnection::SupportsSetWindowGeometry() const {}

wl::Object<wl_surface> WaylandConnection::CreateSurface() {}

void WaylandConnection::RegisterGlobalObjectFactory(
    const char* interface_name,
    wl::GlobalObjectFactory factory) {}

bool WaylandConnection::WlGlobalsReady() const {}

bool WaylandConnection::WlObjectsReady() const {}

void WaylandConnection::Flush() {}

void WaylandConnection::UpdateInputDevices() {}

std::vector<InputDevice> WaylandConnection::CreateMouseDevices() const {}

std::vector<KeyboardDevice> WaylandConnection::CreateKeyboardDevices() const {}

std::vector<TouchscreenDevice> WaylandConnection::CreateTouchscreenDevices()
    const {}

void WaylandConnection::UpdateCursor() {}

void WaylandConnection::CreateDataObjectsIfReady() {}

base::TimeTicks WaylandConnection::ConvertPresentationTime(uint32_t tv_sec_hi,
                                                           uint32_t tv_sec_lo,
                                                           uint32_t tv_nsec) {}

const gfx::PointF WaylandConnection::MaybeConvertLocation(
    const gfx::PointF& location,
    const WaylandWindow* window) const {}

void WaylandConnection::DumpState(std::ostream& out) const {}

bool WaylandConnection::ShouldUseOverlayDelegation() const {}

bool WaylandConnection::IsUsingZAuraOutputManager() const {}

// static
void WaylandConnection::OnGlobal(void* data,
                                 wl_registry* registry,
                                 uint32_t name,
                                 const char* interface,
                                 uint32_t version) {}

// static
void WaylandConnection::OnGlobalRemove(void* data,
                                       wl_registry* registry,
                                       uint32_t name) {}

// static
void WaylandConnection::OnPing(void* data,
                               xdg_wm_base* shell,
                               uint32_t serial) {}

// static
void WaylandConnection::OnClockId(void* data,
                                  wp_presentation* presentation,
                                  uint32_t clk_id) {}

void WaylandConnection::HandleGlobal(wl_registry* registry,
                                     uint32_t name,
                                     const char* interface,
                                     uint32_t version) {}

struct wl_callback* WaylandConnection::GetSyncCallback() {}

gl::EGLDisplayPlatform WaylandConnection::GetNativeDisplay() {}

struct wl_registry* WaylandConnection::GetRegistry() {}

}  // namespace ui