Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: components/exo/wayland/server.cc

Issue 2352563002: third_party: Remove deprecated zwp wayland interfaces. (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/wayland-protocols/include/protocol/alpha-compositing-unstable-v1-client-protocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/wayland/server.cc
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc
index 839846527c6412f0b92f1512c7c0db5d99e4cd13..21809af9eb28ff8a17814151fc2cbf531eda6175 100644
--- a/components/exo/wayland/server.cc
+++ b/components/exo/wayland/server.cc
@@ -1554,141 +1554,6 @@ const struct zcr_remote_surface_v1_interface remote_surface_implementation = {
remote_surface_set_system_modal,
remote_surface_unset_system_modal};
-void remote_surface_destroy_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-void remote_surface_set_app_id_DEPRECATED(wl_client* client,
- wl_resource* resource,
- const char* app_id) {
- GetUserDataAs<ShellSurface>(resource)->SetApplicationId(app_id);
-}
-
-void remote_surface_set_window_geometry_DEPRECATED(wl_client* client,
- wl_resource* resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height) {
- GetUserDataAs<ShellSurface>(resource)->SetGeometry(
- gfx::Rect(x, y, width, height));
-}
-
-void remote_surface_set_scale_DEPRECATED(wl_client* client,
- wl_resource* resource,
- wl_fixed_t scale) {
- GetUserDataAs<ShellSurface>(resource)->SetScale(wl_fixed_to_double(scale));
-}
-
-void remote_surface_fullscreen_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true);
-}
-
-void remote_surface_maximize_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->Maximize();
-}
-
-void remote_surface_minimize_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->Minimize();
-}
-
-void remote_surface_restore_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->Restore();
-}
-
-void remote_surface_pin_DEPRECATED(wl_client* client, wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->SetPinned(true, /* trusted */ false);
-}
-
-void remote_surface_unpin_DEPRECATED(wl_client* client, wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->SetPinned(false, /* trusted */ false);
-}
-
-void remote_surface_unfullscreen_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false);
-}
-
-void remote_surface_set_rectangular_shadow_DEPRECATED(wl_client* client,
- wl_resource* resource,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height) {
- GetUserDataAs<ShellSurface>(resource)->SetRectangularShadow(
- gfx::Rect(x, y, width, height));
-}
-
-void remote_surface_set_title_DEPRECATED(wl_client* client,
- wl_resource* resource,
- const char* title) {
- GetUserDataAs<ShellSurface>(resource)->SetTitle(
- base::string16(base::UTF8ToUTF16(title)));
-}
-
-void remote_surface_set_top_inset_DEPRECATED(wl_client* client,
- wl_resource* resource,
- int32_t height) {
- GetUserDataAs<ShellSurface>(resource)->SetTopInset(height);
-}
-
-void remote_surface_set_system_modal_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true);
-}
-
-void remote_surface_unset_system_modal_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false);
-}
-
-void remote_surface_set_rectangular_shadow_background_opacity_DEPRECATED(
- wl_client* client,
- wl_resource* resource,
- wl_fixed_t opacity) {
- GetUserDataAs<ShellSurface>(resource)->SetRectangularShadowBackgroundOpacity(
- wl_fixed_to_double(opacity));
-}
-
-void remote_surface_activate_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t serial) {
- GetUserDataAs<ShellSurface>(resource)->Activate();
-}
-
-void remote_surface_pin_with_trusted_flag_DEPRECATED(wl_client* client,
- wl_resource* resource,
- int32_t trusted) {
- GetUserDataAs<ShellSurface>(resource)->SetPinned(true, trusted);
-}
-
-const struct zwp_remote_surface_v1_interface
- remote_surface_implementation_DEPRECATED = {
- remote_surface_destroy_DEPRECATED,
- remote_surface_set_app_id_DEPRECATED,
- remote_surface_set_window_geometry_DEPRECATED,
- remote_surface_set_scale_DEPRECATED,
- remote_surface_fullscreen_DEPRECATED,
- remote_surface_maximize_DEPRECATED,
- remote_surface_minimize_DEPRECATED,
- remote_surface_restore_DEPRECATED,
- remote_surface_pin_DEPRECATED,
- remote_surface_unpin_DEPRECATED,
- remote_surface_unfullscreen_DEPRECATED,
- remote_surface_set_rectangular_shadow_DEPRECATED,
- remote_surface_set_title_DEPRECATED,
- remote_surface_set_top_inset_DEPRECATED,
- remote_surface_set_system_modal_DEPRECATED,
- remote_surface_unset_system_modal_DEPRECATED,
- remote_surface_set_rectangular_shadow_background_opacity_DEPRECATED,
- remote_surface_activate_DEPRECATED,
- remote_surface_pin_with_trusted_flag_DEPRECATED};
-
////////////////////////////////////////////////////////////////////////////////
// notification_surface_interface:
@@ -1699,15 +1564,6 @@ void notification_surface_destroy(wl_client* client, wl_resource* resource) {
const struct zcr_notification_surface_v1_interface
notification_surface_implementation = {notification_surface_destroy};
-void notification_surface_destroy_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-const struct zwp_notification_surface_v1_interface
- notification_surface_implementation_DEPRECATED = {
- notification_surface_destroy_DEPRECATED};
-
////////////////////////////////////////////////////////////////////////////////
// remote_shell_interface:
@@ -1911,7 +1767,7 @@ void HandleRemoteSurfaceStateChangedCallback(
state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_PINNED;
break;
case ash::wm::WINDOW_STATE_TYPE_TRUSTED_PINNED:
- state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_TRUSTED_PINNED;
+ state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_TRUSTED_PINNED;
break;
default:
break;
@@ -1994,365 +1850,7 @@ void bind_remote_shell(wl_client* client,
std::min(version, remote_shell_version), id);
SetImplementation(resource, &remote_shell_implementation,
- base::MakeUnique<WaylandRemoteShell>(
- static_cast<Display*>(data), resource));
-}
-
-// Implements remote shell interface and monitors workspace state needed
-// for the remote shell interface.
-class WaylandRemoteShell_DEPRECATED : public WMHelper::MaximizeModeObserver,
- public WMHelper::ActivationObserver,
- public display::DisplayObserver {
- public:
- WaylandRemoteShell_DEPRECATED(Display* display,
- wl_resource* remote_shell_resource)
- : display_(display),
- remote_shell_resource_(remote_shell_resource),
- weak_ptr_factory_(this) {
- auto* helper = WMHelper::GetInstance();
- helper->AddMaximizeModeObserver(this);
- helper->AddActivationObserver(this);
- display::Screen::GetScreen()->AddObserver(this);
-
- layout_mode_ = helper->IsMaximizeModeWindowManagerEnabled()
- ? ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET
- : ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED;
-
- SendPrimaryDisplayMetrics();
- SendActivated(helper->GetActiveWindow(), nullptr);
- }
- ~WaylandRemoteShell_DEPRECATED() override {
- auto* helper = WMHelper::GetInstance();
- helper->RemoveMaximizeModeObserver(this);
- helper->RemoveActivationObserver(this);
- display::Screen::GetScreen()->RemoveObserver(this);
- }
-
- std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface,
- int container) {
- return display_->CreateRemoteShellSurface(surface, container);
- }
-
- std::unique_ptr<NotificationSurface> CreateNotificationSurface(
- Surface* surface,
- const std::string& notification_id) {
- return display_->CreateNotificationSurface(surface, notification_id);
- }
-
- // Overridden from display::DisplayObserver:
- void OnDisplayAdded(const display::Display& new_display) override {}
- void OnDisplayRemoved(const display::Display& new_display) override {}
- void OnDisplayMetricsChanged(const display::Display& display,
- uint32_t changed_metrics) override {
- if (display::Screen::GetScreen()->GetPrimaryDisplay().id() != display.id())
- return;
-
- // No need to update when a primary dislpay has changed without bounds
- // change. See WaylandPrimaryDisplayObserver::OnDisplayMetricsChanged
- // for more details.
- if (changed_metrics &
- (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_DEVICE_SCALE_FACTOR |
- DISPLAY_METRIC_ROTATION | DISPLAY_METRIC_WORK_AREA)) {
- SendDisplayMetrics(display);
- }
- SendConfigure_DEPRECATED(display);
- }
-
- // Overridden from WMHelper::MaximizeModeObserver:
- void OnMaximizeModeStarted() override {
- layout_mode_ = ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_TABLET;
- SendLayoutModeChange_DEPRECATED();
-
- send_configure_after_layout_change_ = true;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&WaylandRemoteShell_DEPRECATED::MaybeSendConfigure,
- weak_ptr_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs));
- }
- void OnMaximizeModeEnded() override {
- layout_mode_ = ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED;
- SendLayoutModeChange_DEPRECATED();
- send_configure_after_layout_change_ = true;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&WaylandRemoteShell_DEPRECATED::MaybeSendConfigure,
- weak_ptr_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(kConfigureDelayAfterLayoutSwitchMs));
- }
-
- // Overridden from WMHelper::ActivationObserver:
- void OnWindowActivated(
- aura::Window* gained_active,
- aura::Window* lost_active) override {
- SendActivated(gained_active, lost_active);
- }
-
- private:
- void SendPrimaryDisplayMetrics() {
- const display::Display primary =
- display::Screen::GetScreen()->GetPrimaryDisplay();
-
- SendConfigure_DEPRECATED(primary);
- SendDisplayMetrics(primary);
- }
-
- void MaybeSendConfigure() {
- if (send_configure_after_layout_change_)
- SendPrimaryDisplayMetrics();
- }
-
- void SendDisplayMetrics(const display::Display& display) {
- send_configure_after_layout_change_ = false;
-
- if (wl_resource_get_version(remote_shell_resource_) < 9)
- return;
-
- const gfx::Insets& work_area_insets = display.GetWorkAreaInsets();
-
- zwp_remote_shell_v1_send_configuration_changed(
- remote_shell_resource_, display.size().width(), display.size().height(),
- OutputTransform(display.rotation()),
- wl_fixed_from_double(display.device_scale_factor()),
- work_area_insets.left(), work_area_insets.top(),
- work_area_insets.right(), work_area_insets.bottom(), layout_mode_);
-
- wl_client_flush(wl_resource_get_client(remote_shell_resource_));
- }
-
- void SendConfigure_DEPRECATED(const display::Display& display) {
- send_configure_after_layout_change_ = false;
-
- if (wl_resource_get_version(remote_shell_resource_) >= 9)
- return;
-
- const gfx::Insets& work_area_insets = display.GetWorkAreaInsets();
- zwp_remote_shell_v1_send_configure(
- remote_shell_resource_, display.size().width(), display.size().height(),
- work_area_insets.left(), work_area_insets.top(),
- work_area_insets.right(), work_area_insets.bottom());
- wl_client_flush(wl_resource_get_client(remote_shell_resource_));
- }
-
- void SendLayoutModeChange_DEPRECATED() {
- if (wl_resource_get_version(remote_shell_resource_) < 8)
- return;
- zwp_remote_shell_v1_send_layout_mode_changed(remote_shell_resource_,
- layout_mode_);
- wl_client_flush(wl_resource_get_client(remote_shell_resource_));
- }
-
- void SendActivated(aura::Window* gained_active, aura::Window* lost_active) {
- Surface* gained_active_surface =
- gained_active ? ShellSurface::GetMainSurface(gained_active) : nullptr;
- Surface* lost_active_surface =
- lost_active ? ShellSurface::GetMainSurface(lost_active) : nullptr;
- wl_resource* gained_active_surface_resource =
- gained_active_surface ? GetSurfaceResource(gained_active_surface)
- : nullptr;
- wl_resource* lost_active_surface_resource =
- lost_active_surface ? GetSurfaceResource(lost_active_surface) : nullptr;
-
- wl_client* client = wl_resource_get_client(remote_shell_resource_);
-
- // If surface that gained active is not owned by remote shell client then
- // set it to null.
- if (gained_active_surface_resource &&
- wl_resource_get_client(gained_active_surface_resource) != client) {
- gained_active_surface_resource = nullptr;
- }
-
- // If surface that lost active is not owned by remote shell client then
- // set it to null.
- if (lost_active_surface_resource &&
- wl_resource_get_client(lost_active_surface_resource) != client) {
- lost_active_surface_resource = nullptr;
- }
-
- zwp_remote_shell_v1_send_activated(remote_shell_resource_,
- gained_active_surface_resource,
- lost_active_surface_resource);
- wl_client_flush(client);
- }
-
- // The exo display instance. Not owned.
- Display* const display_;
-
- // The remote shell resource associated with observer.
- wl_resource* const remote_shell_resource_;
-
- bool send_configure_after_layout_change_ = false;
-
- int layout_mode_ = ZWP_REMOTE_SHELL_V1_LAYOUT_MODE_WINDOWED;
-
- base::WeakPtrFactory<WaylandRemoteShell_DEPRECATED> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(WaylandRemoteShell_DEPRECATED);
-};
-
-void remote_shell_destroy_DEPRECATED(wl_client* client, wl_resource* resource) {
- // Nothing to do here.
-}
-
-int RemoteSurfaceContainer_DEPRECATED(uint32_t container) {
- switch (container) {
- case ZWP_REMOTE_SHELL_V1_CONTAINER_DEFAULT:
- return ash::kShellWindowId_DefaultContainer;
- case ZWP_REMOTE_SHELL_V1_CONTAINER_OVERLAY:
- return ash::kShellWindowId_SystemModalContainer;
- default:
- DLOG(WARNING) << "Unsupported container: " << container;
- return ash::kShellWindowId_DefaultContainer;
- }
-}
-
-void HandleRemoteSurfaceCloseCallback_DEPRECATED(wl_resource* resource) {
- zwp_remote_surface_v1_send_close(resource);
- wl_client_flush(wl_resource_get_client(resource));
-}
-
-void HandleRemoteSurfaceStateChangedCallback_DEPRECATED(
- wl_resource* resource,
- ash::wm::WindowStateType old_state_type,
- ash::wm::WindowStateType new_state_type) {
- DCHECK_NE(old_state_type, new_state_type);
-
- switch (old_state_type) {
- case ash::wm::WINDOW_STATE_TYPE_MINIMIZED:
- if (wl_resource_get_version(resource) >= 2)
- zwp_remote_surface_v1_send_unset_minimized(resource);
- break;
- case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED:
- if (wl_resource_get_version(resource) >= 2)
- zwp_remote_surface_v1_send_unset_maximized(resource);
- break;
- case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN:
- zwp_remote_surface_v1_send_unset_fullscreen(resource);
- break;
- case ash::wm::WINDOW_STATE_TYPE_PINNED:
- case ash::wm::WINDOW_STATE_TYPE_TRUSTED_PINNED:
- if (wl_resource_get_version(resource) >= 3)
- zwp_remote_surface_v1_send_unset_pinned(resource);
- break;
- default:
- break;
- }
-
- uint32_t state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_NORMAL;
- switch (new_state_type) {
- case ash::wm::WINDOW_STATE_TYPE_MINIMIZED:
- state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_MINIMIZED;
- if (wl_resource_get_version(resource) >= 2)
- zwp_remote_surface_v1_send_set_minimized(resource);
- break;
- case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED:
- state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_MAXIMIZED;
- if (wl_resource_get_version(resource) >= 2)
- zwp_remote_surface_v1_send_set_maximized(resource);
- break;
- case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN:
- state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_FULLSCREEN;
- zwp_remote_surface_v1_send_set_fullscreen(resource);
- break;
- case ash::wm::WINDOW_STATE_TYPE_PINNED:
- state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_PINNED;
- if (wl_resource_get_version(resource) >= 3)
- zwp_remote_surface_v1_send_set_pinned(resource);
- break;
- case ash::wm::WINDOW_STATE_TYPE_TRUSTED_PINNED:
- state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_TRUSTED_PINNED;
- if (wl_resource_get_version(resource) >= 3)
- zwp_remote_surface_v1_send_set_pinned(resource);
- break;
- default:
- break;
- }
-
- if (wl_resource_get_version(resource) >= 7)
- zwp_remote_surface_v1_send_state_type_changed(resource, state_type);
-
- wl_client_flush(wl_resource_get_client(resource));
-}
-
-void remote_shell_get_remote_surface_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t id,
- wl_resource* surface,
- uint32_t container) {
- std::unique_ptr<ShellSurface> shell_surface =
- GetUserDataAs<WaylandRemoteShell>(resource)->CreateShellSurface(
- GetUserDataAs<Surface>(surface),
- RemoteSurfaceContainer_DEPRECATED(container));
- if (!shell_surface) {
- wl_resource_post_error(resource, ZWP_REMOTE_SHELL_V1_ERROR_ROLE,
- "surface has already been assigned a role");
- return;
- }
-
- wl_resource* remote_surface_resource =
- wl_resource_create(client, &zwp_remote_surface_v1_interface,
- wl_resource_get_version(resource), id);
-
- shell_surface->set_close_callback(
- base::Bind(&HandleRemoteSurfaceCloseCallback_DEPRECATED,
- base::Unretained(remote_surface_resource)));
- shell_surface->set_state_changed_callback(
- base::Bind(&HandleRemoteSurfaceStateChangedCallback_DEPRECATED,
- base::Unretained(remote_surface_resource)));
-
- SetImplementation(remote_surface_resource,
- &remote_surface_implementation_DEPRECATED,
- std::move(shell_surface));
-}
-
-void remote_shell_get_notification_surface_DEPRECATED(
- wl_client* client,
- wl_resource* resource,
- uint32_t id,
- wl_resource* surface,
- const char* notification_id) {
- if (GetUserDataAs<Surface>(surface)->HasSurfaceDelegate()) {
- wl_resource_post_error(resource, ZWP_REMOTE_SHELL_V1_ERROR_ROLE,
- "surface has already been assigned a role");
- return;
- }
-
- std::unique_ptr<NotificationSurface> notification_surface =
- GetUserDataAs<WaylandRemoteShell>(resource)->CreateNotificationSurface(
- GetUserDataAs<Surface>(surface), std::string(notification_id));
- if (!notification_surface) {
- wl_resource_post_error(resource,
- ZWP_REMOTE_SHELL_V1_ERROR_INVALID_NOTIFICATION_ID,
- "invalid notification id");
- return;
- }
-
- wl_resource* notification_surface_resource =
- wl_resource_create(client, &zwp_notification_surface_v1_interface,
- wl_resource_get_version(resource), id);
- SetImplementation(notification_surface_resource,
- &notification_surface_implementation_DEPRECATED,
- std::move(notification_surface));
-}
-
-const struct zwp_remote_shell_v1_interface
- remote_shell_implementation_DEPRECATED = {
- remote_shell_destroy_DEPRECATED,
- remote_shell_get_remote_surface_DEPRECATED,
- remote_shell_get_notification_surface_DEPRECATED};
-
-const uint32_t remote_shell_version_DEPRECATED = 11;
-
-void bind_remote_shell_DEPRECATED(wl_client* client,
- void* data,
- uint32_t version,
- uint32_t id) {
- wl_resource* resource = wl_resource_create(
- client, &zwp_remote_shell_v1_interface,
- std::min(version, remote_shell_version_DEPRECATED), id);
-
- SetImplementation(resource, &remote_shell_implementation_DEPRECATED,
- base::MakeUnique<WaylandRemoteShell_DEPRECATED>(
+ base::MakeUnique<WaylandRemoteShell>(
static_cast<Display*>(data), resource));
}
@@ -2432,81 +1930,6 @@ void vsync_timing_destroy(wl_client* client, wl_resource* resource) {
const struct zcr_vsync_timing_v1_interface vsync_timing_implementation = {
vsync_timing_destroy};
-// Implements VSync timing interface by monitoring a compositor for updates
-// to VSync parameters.
-class VSyncTiming_DEPRECATED : public ui::CompositorVSyncManager::Observer {
- public:
- ~VSyncTiming_DEPRECATED() { vsync_manager_->RemoveObserver(this); }
-
- static std::unique_ptr<VSyncTiming_DEPRECATED> Create(
- ui::Compositor* compositor,
- wl_resource* timing_resource) {
- std::unique_ptr<VSyncTiming_DEPRECATED> vsync_timing(
- new VSyncTiming_DEPRECATED(compositor, timing_resource));
- // Note: AddObserver() will call OnUpdateVSyncParameters.
- vsync_timing->vsync_manager_->AddObserver(vsync_timing.get());
- return vsync_timing;
- }
-
- // Overridden from ui::CompositorVSyncManager::Observer:
- void OnUpdateVSyncParameters(base::TimeTicks timebase,
- base::TimeDelta interval) override {
- uint64_t timebase_us = timebase.ToInternalValue();
- uint64_t interval_us = interval.ToInternalValue();
-
- // Ignore updates with interval 0.
- if (!interval_us)
- return;
-
- uint64_t offset_us = timebase_us % interval_us;
-
- // Avoid sending update events if interval did not change.
- if (interval_us == last_interval_us_) {
- int64_t offset_delta_us =
- static_cast<int64_t>(last_offset_us_ - offset_us);
-
- // Reduce the amount of events by only sending an update if the offset
- // changed compared to the last offset sent to the client by this amount.
- const int64_t kOffsetDeltaThresholdInMicroseconds = 25;
-
- if (std::abs(offset_delta_us) < kOffsetDeltaThresholdInMicroseconds)
- return;
- }
-
- zwp_vsync_timing_v1_send_update(timing_resource_, timebase_us & 0xffffffff,
- timebase_us >> 32, interval_us & 0xffffffff,
- interval_us >> 32);
- wl_client_flush(wl_resource_get_client(timing_resource_));
-
- last_interval_us_ = interval_us;
- last_offset_us_ = offset_us;
- }
-
- private:
- VSyncTiming_DEPRECATED(ui::Compositor* compositor,
- wl_resource* timing_resource)
- : vsync_manager_(compositor->vsync_manager()),
- timing_resource_(timing_resource) {}
-
- // The VSync manager being observed.
- scoped_refptr<ui::CompositorVSyncManager> vsync_manager_;
-
- // The VSync timing resource.
- wl_resource* const timing_resource_;
-
- uint64_t last_interval_us_{0};
- uint64_t last_offset_us_{0};
-
- DISALLOW_COPY_AND_ASSIGN(VSyncTiming_DEPRECATED);
-};
-
-void vsync_timing_destroy_DEPRECATED(wl_client* client, wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-const struct zwp_vsync_timing_v1_interface
- vsync_timing_implementation_DEPRECATED = {vsync_timing_destroy_DEPRECATED};
-
////////////////////////////////////////////////////////////////////////////////
// vsync_feedback_interface:
@@ -2543,43 +1966,6 @@ void bind_vsync_feedback(wl_client* client,
nullptr, nullptr);
}
-void vsync_feedback_destroy_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-void vsync_feedback_get_vsync_timing_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t id,
- wl_resource* output) {
- wl_resource* timing_resource =
- wl_resource_create(client, &zwp_vsync_timing_v1_interface, 1, id);
-
- // TODO(reveman): Multi-display support.
- ui::Compositor* compositor =
- ash::Shell::GetPrimaryRootWindow()->layer()->GetCompositor();
-
- SetImplementation(
- timing_resource, &vsync_timing_implementation_DEPRECATED,
- VSyncTiming_DEPRECATED::Create(compositor, timing_resource));
-}
-
-const struct zwp_vsync_feedback_v1_interface
- vsync_feedback_implementation_DEPRECATED = {
- vsync_feedback_destroy_DEPRECATED,
- vsync_feedback_get_vsync_timing_DEPRECATED};
-
-void bind_vsync_feedback_DEPRECATED(wl_client* client,
- void* data,
- uint32_t version,
- uint32_t id) {
- wl_resource* resource =
- wl_resource_create(client, &zwp_vsync_feedback_v1_interface, 1, id);
-
- wl_resource_set_implementation(
- resource, &vsync_feedback_implementation_DEPRECATED, nullptr, nullptr);
-}
-
////////////////////////////////////////////////////////////////////////////////
// wl_data_device_interface:
@@ -3255,19 +2641,6 @@ void security_only_visible_on_secure_output(wl_client* client,
const struct zcr_security_v1_interface security_implementation = {
security_destroy, security_only_visible_on_secure_output};
-void security_destroy_DEPRECATED(wl_client* client, wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-void security_only_visible_on_secure_output_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- GetUserDataAs<Security>(resource)->OnlyVisibleOnSecureOutput();
-}
-
-const struct zwp_security_v1_interface security_implementation_DEPRECATED = {
- security_destroy_DEPRECATED,
- security_only_visible_on_secure_output_DEPRECATED};
-
////////////////////////////////////////////////////////////////////////////////
// secure_output_interface:
@@ -3307,45 +2680,6 @@ void bind_secure_output(wl_client* client,
nullptr);
}
-void secure_output_destroy_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-void secure_output_get_security_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t id,
- wl_resource* surface_resource) {
- Surface* surface = GetUserDataAs<Surface>(surface_resource);
- if (surface->GetProperty(kSurfaceHasSecurityKey)) {
- wl_resource_post_error(resource, ZWP_SECURE_OUTPUT_V1_ERROR_SECURITY_EXISTS,
- "a security object for that surface already exists");
- return;
- }
-
- wl_resource* security_resource =
- wl_resource_create(client, &zwp_security_v1_interface, 1, id);
-
- SetImplementation(security_resource, &security_implementation_DEPRECATED,
- base::MakeUnique<Security>(surface));
-}
-
-const struct zwp_secure_output_v1_interface
- secure_output_implementation_DEPRECATED = {
- secure_output_destroy_DEPRECATED,
- secure_output_get_security_DEPRECATED};
-
-void bind_secure_output_DEPRECATED(wl_client* client,
- void* data,
- uint32_t version,
- uint32_t id) {
- wl_resource* resource =
- wl_resource_create(client, &zwp_secure_output_v1_interface, 1, id);
-
- wl_resource_set_implementation(
- resource, &secure_output_implementation_DEPRECATED, data, nullptr);
-}
-
////////////////////////////////////////////////////////////////////////////////
// blending_interface:
@@ -3423,40 +2757,6 @@ void blending_set_alpha(wl_client* client,
const struct zcr_blending_v1_interface blending_implementation = {
blending_destroy, blending_set_blending, blending_set_alpha};
-void blending_destroy_DEPRECATED(wl_client* client, wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-void blending_set_blending_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t equation) {
- switch (equation) {
- case ZWP_BLENDING_V1_BLENDING_EQUATION_NONE:
- GetUserDataAs<Blending>(resource)->SetBlendMode(SkXfermode::kSrc_Mode);
- break;
- case ZWP_BLENDING_V1_BLENDING_EQUATION_PREMULT:
- GetUserDataAs<Blending>(resource)->SetBlendMode(
- SkXfermode::kSrcOver_Mode);
- break;
- case ZWP_BLENDING_V1_BLENDING_EQUATION_COVERAGE:
- NOTIMPLEMENTED();
- break;
- default:
- DLOG(WARNING) << "Unsupported blending equation: " << equation;
- break;
- }
-}
-
-void blending_set_alpha_DEPRECATED(wl_client* client,
- wl_resource* resource,
- wl_fixed_t alpha) {
- GetUserDataAs<Blending>(resource)->SetAlpha(wl_fixed_to_double(alpha));
-}
-
-const struct zwp_blending_v1_interface blending_implementation_DEPRECATED = {
- blending_destroy_DEPRECATED, blending_set_blending_DEPRECATED,
- blending_set_alpha_DEPRECATED};
-
////////////////////////////////////////////////////////////////////////////////
// alpha_compositing_interface:
@@ -3498,46 +2798,6 @@ void bind_alpha_compositing(wl_client* client,
data, nullptr);
}
-void alpha_compositing_destroy_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-void alpha_compositing_get_blending_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t id,
- wl_resource* surface_resource) {
- Surface* surface = GetUserDataAs<Surface>(surface_resource);
- if (surface->GetProperty(kSurfaceHasBlendingKey)) {
- wl_resource_post_error(resource,
- ZWP_ALPHA_COMPOSITING_V1_ERROR_BLENDING_EXISTS,
- "a blending object for that surface already exists");
- return;
- }
-
- wl_resource* blending_resource =
- wl_resource_create(client, &zwp_blending_v1_interface, 1, id);
-
- SetImplementation(blending_resource, &blending_implementation_DEPRECATED,
- base::MakeUnique<Blending>(surface));
-}
-
-const struct zwp_alpha_compositing_v1_interface
- alpha_compositing_implementation_DEPRECATED = {
- alpha_compositing_destroy_DEPRECATED,
- alpha_compositing_get_blending_DEPRECATED};
-
-void bind_alpha_compositing_DEPRECATED(wl_client* client,
- void* data,
- uint32_t version,
- uint32_t id) {
- wl_resource* resource =
- wl_resource_create(client, &zwp_alpha_compositing_v1_interface, 1, id);
-
- wl_resource_set_implementation(
- resource, &alpha_compositing_implementation_DEPRECATED, data, nullptr);
-}
-
////////////////////////////////////////////////////////////////////////////////
// gaming_input_interface:
@@ -3628,94 +2888,6 @@ void bind_gaming_input(wl_client* client,
std::move(gaming_input_thread));
}
-// Gamepad delegate class that forwards gamepad events to the client resource.
-class WaylandGamepadDelegate_DEPRECATED : public GamepadDelegate {
- public:
- explicit WaylandGamepadDelegate_DEPRECATED(wl_resource* gamepad_resource)
- : gamepad_resource_(gamepad_resource) {}
-
- // Overridden from GamepadDelegate:
- void OnGamepadDestroying(Gamepad* gamepad) override { delete this; }
- bool CanAcceptGamepadEventsForSurface(Surface* surface) const override {
- wl_resource* surface_resource = GetSurfaceResource(surface);
- return surface_resource &&
- wl_resource_get_client(surface_resource) == client();
- }
- void OnStateChange(bool connected) override {
- uint32_t status = connected ? ZWP_GAMEPAD_V1_GAMEPAD_STATE_ON
- : ZWP_GAMEPAD_V1_GAMEPAD_STATE_OFF;
- zwp_gamepad_v1_send_state_change(gamepad_resource_, status);
- wl_client_flush(client());
- }
- void OnAxis(int axis, double value) override {
- zwp_gamepad_v1_send_axis(gamepad_resource_, NowInMilliseconds(), axis,
- wl_fixed_from_double(value));
- }
- void OnButton(int button, bool pressed, double value) override {
- uint32_t state = pressed ? ZWP_GAMEPAD_V1_BUTTON_STATE_PRESSED
- : ZWP_GAMEPAD_V1_BUTTON_STATE_RELEASED;
- zwp_gamepad_v1_send_button(gamepad_resource_, NowInMilliseconds(), button,
- state, wl_fixed_from_double(value));
- }
- void OnFrame() override {
- zwp_gamepad_v1_send_frame(gamepad_resource_, NowInMilliseconds());
- wl_client_flush(client());
- }
-
- private:
- // The client who own this gamepad instance.
- wl_client* client() const {
- return wl_resource_get_client(gamepad_resource_);
- }
-
- // The gamepad resource associated with the gamepad.
- wl_resource* const gamepad_resource_;
-
- DISALLOW_COPY_AND_ASSIGN(WaylandGamepadDelegate_DEPRECATED);
-};
-
-void gamepad_destroy_DEPRECATED(wl_client* client, wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-const struct zwp_gamepad_v1_interface gamepad_implementation_DEPRECATED = {
- gamepad_destroy_DEPRECATED};
-
-void gaming_input_get_gamepad_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t id,
- wl_resource* seat) {
- wl_resource* gamepad_resource = wl_resource_create(
- client, &zwp_gamepad_v1_interface, wl_resource_get_version(resource), id);
-
- base::Thread* gaming_input_thread = GetUserDataAs<base::Thread>(resource);
-
- SetImplementation(gamepad_resource, &gamepad_implementation_DEPRECATED,
- base::MakeUnique<Gamepad>(
- new WaylandGamepadDelegate_DEPRECATED(gamepad_resource),
- gaming_input_thread->task_runner().get()));
-}
-
-const struct zwp_gaming_input_v1_interface
- gaming_input_implementation_DEPRECATED = {
- gaming_input_get_gamepad_DEPRECATED};
-
-void bind_gaming_input_DEPRECATED(wl_client* client,
- void* data,
- uint32_t version,
- uint32_t id) {
- wl_resource* resource =
- wl_resource_create(client, &zwp_gaming_input_v1_interface, version, id);
-
- std::unique_ptr<base::Thread> gaming_input_thread(
- new base::Thread("Exo gaming input polling thread."));
- gaming_input_thread->StartWithOptions(
- base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
-
- SetImplementation(resource, &gaming_input_implementation_DEPRECATED,
- std::move(gaming_input_thread));
-}
-
////////////////////////////////////////////////////////////////////////////////
// pointer_stylus interface:
@@ -3766,56 +2938,6 @@ void pointer_stylus_destroy(wl_client* client, wl_resource* resource) {
const struct zcr_pointer_stylus_v1_interface pointer_stylus_implementation = {
pointer_stylus_destroy};
-class WaylandPointerStylusDelegate_DEPRECATED : public PointerStylusDelegate {
- public:
- WaylandPointerStylusDelegate_DEPRECATED(wl_resource* resource,
- Pointer* pointer)
- : resource_(resource), pointer_(pointer) {
- pointer_->SetStylusDelegate(this);
- }
- ~WaylandPointerStylusDelegate_DEPRECATED() override {
- if (pointer_ != nullptr)
- pointer_->SetStylusDelegate(nullptr);
- }
- void OnPointerDestroying(Pointer* pointer) override { pointer_ = nullptr; }
- void OnPointerToolChange(ui::EventPointerType type) override {
- uint wayland_type = ZWP_POINTER_STYLUS_V1_TOOL_TYPE_MOUSE;
- if (type == ui::EventPointerType::POINTER_TYPE_PEN)
- wayland_type = ZWP_POINTER_STYLUS_V1_TOOL_TYPE_PEN;
- else if (type == ui::EventPointerType::POINTER_TYPE_ERASER)
- wayland_type = ZWP_POINTER_STYLUS_V1_TOOL_TYPE_ERASER;
- zwp_pointer_stylus_v1_send_tool_change(resource_, wayland_type);
- }
- void OnPointerForce(base::TimeTicks time_stamp, float force) override {
- zwp_pointer_stylus_v1_send_force(resource_,
- TimeTicksToMilliseconds(time_stamp),
- wl_fixed_from_double(force));
- }
- void OnPointerTilt(base::TimeTicks time_stamp, gfx::Vector2dF tilt) override {
- zwp_pointer_stylus_v1_send_tilt(
- resource_, TimeTicksToMilliseconds(time_stamp),
- wl_fixed_from_double(tilt.x()), wl_fixed_from_double(tilt.y()));
- }
-
- private:
- wl_resource* resource_;
- Pointer* pointer_;
-
- // The client who own this pointer stylus instance.
- wl_client* client() const { return wl_resource_get_client(resource_); }
-
- DISALLOW_COPY_AND_ASSIGN(WaylandPointerStylusDelegate_DEPRECATED);
-};
-
-void pointer_stylus_destroy_DEPRECATED(wl_client* client,
- wl_resource* resource) {
- wl_resource_destroy(resource);
-}
-
-const struct zwp_pointer_stylus_v1_interface
- pointer_stylus_implementation_DEPRECATED = {
- pointer_stylus_destroy_DEPRECATED};
-
////////////////////////////////////////////////////////////////////////////////
// stylus interface:
@@ -3843,33 +2965,6 @@ void bind_stylus(wl_client* client, void* data, uint32_t version, uint32_t id) {
nullptr);
}
-void stylus_get_pointer_stylus_DEPRECATED(wl_client* client,
- wl_resource* resource,
- uint32_t id,
- wl_resource* pointer_resource) {
- Pointer* pointer = GetUserDataAs<Pointer>(pointer_resource);
-
- wl_resource* stylus_resource =
- wl_resource_create(client, &zwp_pointer_stylus_v1_interface, 1, id);
-
- SetImplementation(stylus_resource, &pointer_stylus_implementation_DEPRECATED,
- base::MakeUnique<WaylandPointerStylusDelegate_DEPRECATED>(
- stylus_resource, pointer));
-}
-
-const struct zwp_stylus_v1_interface stylus_implementation_DEPRECATED = {
- stylus_get_pointer_stylus_DEPRECATED};
-
-void bind_stylus_DEPRECATED(wl_client* client,
- void* data,
- uint32_t version,
- uint32_t id) {
- wl_resource* resource =
- wl_resource_create(client, &zwp_stylus_v1_interface, version, id);
- wl_resource_set_implementation(resource, &stylus_implementation_DEPRECATED,
- data, nullptr);
-}
-
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -3896,8 +2991,6 @@ Server::Server(Display* display)
bind_xdg_shell);
wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1,
display_, bind_vsync_feedback);
- wl_global_create(wl_display_.get(), &zwp_vsync_feedback_v1_interface, 1,
- display_, bind_vsync_feedback_DEPRECATED);
wl_global_create(wl_display_.get(), &wl_data_device_manager_interface, 1,
display_, bind_data_device_manager);
wl_global_create(wl_display_.get(), &wl_seat_interface, seat_version,
@@ -3906,25 +2999,14 @@ Server::Server(Display* display)
bind_viewporter);
wl_global_create(wl_display_.get(), &zcr_secure_output_v1_interface, 1,
display_, bind_secure_output);
- wl_global_create(wl_display_.get(), &zwp_secure_output_v1_interface, 1,
- display_, bind_secure_output_DEPRECATED);
wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1,
display_, bind_alpha_compositing);
- wl_global_create(wl_display_.get(), &zwp_alpha_compositing_v1_interface, 1,
- display_, bind_alpha_compositing_DEPRECATED);
wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface,
remote_shell_version, display_, bind_remote_shell);
- wl_global_create(wl_display_.get(), &zwp_remote_shell_v1_interface,
- remote_shell_version_DEPRECATED, display_,
- bind_remote_shell_DEPRECATED);
wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1,
display_, bind_gaming_input);
- wl_global_create(wl_display_.get(), &zwp_gaming_input_v1_interface, 1,
- display_, bind_gaming_input_DEPRECATED);
wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_,
bind_stylus);
- wl_global_create(wl_display_.get(), &zwp_stylus_v1_interface, 1, display_,
- bind_stylus_DEPRECATED);
}
Server::~Server() {}
« no previous file with comments | « no previous file | third_party/wayland-protocols/include/protocol/alpha-compositing-unstable-v1-client-protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698