forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ozone/wayland] Factor "data device manager" out of WaylandConnection
CL adds a WaylandDataDeviceManager class and moves that handle wl_data_device_manager logic out of WaylandConnection into it. It brings no functionality change, but makes it easier to be extended to support primary selection (middle-click to paste). BUG=578890 Change-Id: I8c04035bf4d3e9de5a0c2cac5c83d4552912cc0d Reviewed-on: https://chromium-review.googlesource.com/1035943 Reviewed-by: Michael Spang <spang@chromium.org> Commit-Queue: Antonio Gomes <tonikitoo@igalia.com> Cr-Commit-Position: refs/heads/master@{#554910}
- Loading branch information
Showing
5 changed files
with
82 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 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 "ui/ozone/platform/wayland/wayland_data_device_manager.h" | ||
|
||
#include "ui/ozone/platform/wayland/wayland_connection.h" | ||
|
||
namespace ui { | ||
|
||
WaylandDataDeviceManager::WaylandDataDeviceManager( | ||
wl_data_device_manager* device_manager) | ||
: device_manager_(device_manager) {} | ||
|
||
WaylandDataDeviceManager::~WaylandDataDeviceManager() = default; | ||
|
||
wl_data_device* WaylandDataDeviceManager::GetDevice() { | ||
DCHECK(connection_->seat()); | ||
return wl_data_device_manager_get_data_device(device_manager_, | ||
connection_->seat()); | ||
} | ||
|
||
wl_data_source* WaylandDataDeviceManager::CreateSource() { | ||
return wl_data_device_manager_create_data_source(device_manager_); | ||
} | ||
|
||
} // namespace ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 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. | ||
|
||
#ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_DATA_DEVICE_MANAGER_H_ | ||
#define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_DATA_DEVICE_MANAGER_H_ | ||
|
||
#include <wayland-client.h> | ||
|
||
#include "base/logging.h" | ||
#include "base/macros.h" | ||
|
||
namespace ui { | ||
|
||
class WaylandConnection; | ||
|
||
class WaylandDataDeviceManager { | ||
public: | ||
explicit WaylandDataDeviceManager(wl_data_device_manager* device_manager); | ||
~WaylandDataDeviceManager(); | ||
|
||
wl_data_device* GetDevice(); | ||
wl_data_source* CreateSource(); | ||
|
||
void set_connection(WaylandConnection* connection) { | ||
DCHECK(connection); | ||
connection_ = connection; | ||
} | ||
|
||
private: | ||
wl_data_device_manager* device_manager_; | ||
|
||
WaylandConnection* connection_ = nullptr; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(WaylandDataDeviceManager); | ||
}; | ||
|
||
} // namespace ui | ||
|
||
#endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_DATA_DEVICE_MANAGER_H_ |