if (!strcmp(global->interface, "tizen_remote_surface_manager")) {
__rsm = wl_registry_bind(registry, global->id,
&tizen_remote_surface_manager_interface,
- global->version < 4 ? global->version : 4);
+ global->version < 6 ? global->version : 6);
}
}
RemoteSurface::Impl::Impl(RemoteSurface* parent,
const std::string& id,
- RemoteSurface::Type type, bool mock)
- : inst_id_(id), pid_(0), rid_(0),
+ RemoteSurface::Type type,
+ std::shared_ptr<WlSurface> wl_surface, bool mock)
+ : inst_id_(id), pid_(0), rid_(0), wl_surface_(std::move(wl_surface)),
aul_handle_(mock ?
new test::AulHandleMock(this, (aul_screen_type_e)type) :
new AulHandle(this, (aul_screen_type_e)type)),
RemoteSurface::Impl::Impl(RemoteSurface* parent, int rid,
const std::string& id,
- RemoteSurface::Type type, bool mock)
- : inst_id_(id), pid_(0), rid_(rid),
+ RemoteSurface::Type type,
+ std::shared_ptr<WlSurface> wl_surface, bool mock)
+ : inst_id_(id), pid_(0), rid_(rid), wl_surface_(std::move(wl_surface)),
aul_handle_(mock ?
new test::AulHandleMock(this, (aul_screen_type_e)type) :
new AulHandle(this, (aul_screen_type_e)type)),
Redirect();
}
-RemoteSurface::RemoteSurface(const std::string& id, Type type, bool mock)
- : impl_(new Impl(this, id, type, mock)) {
+RemoteSurface::RemoteSurface(const std::string& id, Type type,
+ std::shared_ptr<WlSurface> wl_surface, bool mock)
+ : impl_(new Impl(this, id, type, std::move(wl_surface), mock)) {
}
RemoteSurface::RemoteSurface(int rid, const std::string& id,
- Type type, bool mock)
- : impl_(new Impl(this, rid, id, type, mock)) {
+ Type type, std::shared_ptr<WlSurface> wl_surface, bool mock)
+ : impl_(new Impl(this, rid, id, type, std::move(wl_surface), mock)) {
impl_->Redirect();
}
}
void RemoteSurface::Impl::Redirect() {
- surface_.reset(RemoteSurfaceManager::GetInst(mock_).CreateTRS(rid_, mock_));
+ surface_.reset(RemoteSurfaceManager::GetInst(mock_)
+ .CreateTRS(rid_, wl_surface_, mock_));
LOGD("resource_id : %d, (%p), %s",
rid_, surface_->GetHandle(), inst_id_.c_str());
KEY
};
- RemoteSurface(const std::string& id, Type type, bool mock = false);
- RemoteSurface(int rid, const std::string& id, Type type, bool mock = false);
+ RemoteSurface(const std::string& id, Type type,
+ std::shared_ptr<WlSurface> wl_surface, bool mock = false);
+ RemoteSurface(int rid, const std::string& id, Type type,
+ std::shared_ptr<WlSurface> wl_surface, bool mock = false);
RemoteSurface(RemoteSurface&&) noexcept;
RemoteSurface& operator=(RemoteSurface&&) noexcept;
virtual ~RemoteSurface();
private:
friend class RemoteSurface;
- Impl(RemoteSurface* parent, const std::string& id,
- RemoteSurface::Type type, bool mock);
+ Impl(RemoteSurface* parent, const std::string& id, RemoteSurface::Type type,
+ std::shared_ptr<WlSurface> wl_surface, bool mock);
Impl(RemoteSurface* parent, int rid, const std::string& id,
- RemoteSurface::Type type, bool mock);
+ RemoteSurface::Type type, std::shared_ptr<WlSurface> wl_surface, bool mock);
void ClearResumingTimer();
void SetResumingTimer();
int pid_;
unsigned int rid_;
std::unique_ptr<ITRS> surface_;
+ std::shared_ptr<WlSurface> wl_surface_;
std::shared_ptr<WlSurface> bind_surface_;
std::unique_ptr<AulHandle> aul_handle_;
RemoteSurface::Type type_;
return sInst;
}
-ITRS* RemoteSurfaceManager::CreateTRS(int rid, bool mock) {
- return mock ?
- new test::TRSMock() :
- new TRS(tizen_remote_surface_manager_create_surface(rsm_,
- (uint32_t)rid, tbm_), true);
+ITRS* RemoteSurfaceManager::CreateTRS(int rid, std::shared_ptr<WlSurface> surf,
+ bool mock) {
+ struct tizen_remote_surface *tzrs = (surf != nullptr) ?
+ tizen_remote_surface_manager_create_surface_with_wl_surface(rsm_,
+ (uint32_t)rid, tbm_, surf->GetRaw()) :
+ tizen_remote_surface_manager_create_surface(rsm_, (uint32_t)rid, tbm_);
+
+ return mock ? new test::TRSMock() : new TRS(tzrs, true);
}
RemoteSurfaceManager::RemoteSurfaceManager() {
if (!strcmp(global->interface, "tizen_remote_surface_manager")) {
rsm_ = (struct tizen_remote_surface_manager*)wl_registry_bind(registry,
global->id, &tizen_remote_surface_manager_interface,
- global->version < 5 ? global->version : 5);
+ global->version < 6 ? global->version : 6);
}
}
RemoteSurfaceManager& operator = (const RemoteSurfaceManager&) = delete;
static RemoteSurfaceManager& GetInst(bool mock = false);
- ITRS* CreateTRS(int rid, bool mock = false);
+ ITRS* CreateTRS(int rid, std::shared_ptr<WlSurface> suf, bool mock = false);
void Dispose();
void Bind(const ITRS& trs, const WlSurface& suf);
void Unbind(const ITRS& trs);
#include "screen_connector_remote_surface_evas/remote_surface_evas.h"
#include "screen_connector_remote_surface_evas/remote_surface_evas_implementation.h"
#include "screen_connector_remote_surface_evas/image_mock_internal.h"
+#include "screen_connector_remote_surface_evas/util.h"
#ifdef LOG_TAG
#undef LOG_TAG
RemoteSurface::Type type,
std::shared_ptr<EvasObject> viewerWin,
bool mock)
- : RemoteSurface(id, type, mock),
+ : RemoteSurface(id, type, util::GetWlSurface(*viewerWin.get()), mock),
impl_(new Impl(this, viewerWin, mock)),
win_ctx_(new WindowContext()) {
}
RemoteSurface::Type type,
std::shared_ptr<EvasObject> viewerWin,
bool mock)
- : RemoteSurface(rid, id, type, mock),
+ : RemoteSurface(rid, id, type, util::GetWlSurface(*viewerWin.get()), mock),
impl_(new Impl(this, viewerWin, mock)),
win_ctx_(new WindowContext()) {
}
#include <memory>
#include "screen_connector_remote_surface_evas/remote_surface_mixed_internal.h"
+#include "screen_connector_remote_surface_evas/util.h"
#ifdef LOG_TAG
#undef LOG_TAG
RemoteSurface::Type type,
std::shared_ptr<EvasObject> viewer_win,
IWatcherEvent* listener)
- : RemoteSurface(id, type), listener_(listener), viewer_win_(viewer_win) {
+ : RemoteSurface(id, type, util::GetWlSurface(*viewer_win.get())),
+ listener_(listener), viewer_win_(viewer_win) {
}
RemoteSurfaceMixed:: ~RemoteSurfaceMixed() {
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dlog.h>
+
+#include "screen_connector_remote_surface_evas/util.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "SC_REMOTE_SURFACE"
+
+using namespace std;
+namespace screen_connector {
+namespace util {
+
+ std::shared_ptr<WlSurface> GetWlSurface(const EvasObject& win) {
+ struct wl_surface* surface;
+ Ecore_Wl2_Window* wl_win;
+ Ecore_Evas *ee = ecore_evas_ecore_evas_get(
+ evas_object_evas_get(win.GetRaw()));
+
+ wl_win = ecore_evas_wayland2_window_get(ee);
+ if (!wl_win) {
+ LOGE("failed to get wl_win");
+ return nullptr;
+ }
+
+ surface = ecore_wl2_window_surface_get(wl_win);
+ if (!surface) {
+ LOGE("failed to get surface");
+ return nullptr;
+ }
+ return std::shared_ptr<WlSurface>(new WlSurface(surface, false));
+ }
+
+} // namespace util
+} // namespace watchface_complication
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_UTIL_H_
+#define SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_UTIL_H_
+
+#include <memory>
+
+#include "screen_connector_remote_surface_evas/evas_object.h"
+#include "screen_connector_remote_surface/remote_surface.h"
+
+namespace screen_connector {
+namespace util {
+ EXPORT_API std::shared_ptr<WlSurface> GetWlSurface(const EvasObject& win);
+} // namespace util
+} // namespace screen_connector
+
+#endif // SCREEN_CONNECTOR_REMOTE_SURFACE_EVAS_UTIL_H_
screen_connector_toolkit_h screen_connector_toolkit_add_by_rid(
screen_connector_toolkit_ops *ops, const char* id,
screen_connector_screen_type_e type, int surface_id,
- void* data);
+ struct wl_surface* surface, void* data);
+screen_connector_toolkit_h screen_connector_toolkit_add_with_surface(
+ screen_connector_toolkit_ops *ops,
+ const char *id,
+ screen_connector_screen_type_e type,
+ struct wl_surface *surface,
+ void *data);
struct tizen_remote_surface *screen_connector_toolkit_get_trs(
screen_connector_toolkit_h h);
int screen_connector_toolkit_redirect_surface(screen_connector_toolkit_h info);
#include "screen_connector_toolkit.h"
#include "screen_connector_remote_surface/remote_surface.h"
+#include "screen_connector_remote_surface/trs_interface.h"
+#include "screen_connector_remote_surface/handle.h"
#ifdef LOG_TAG
#undef LOG_TAG
RemoteSurfaceToolkit(const std::string& id,
screen_connector::RemoteSurface::Type type,
screen_connector_toolkit_ops *ops,
+ std::shared_ptr<screen_connector::WlSurface> wl_surface,
void* data)
- : screen_connector::RemoteSurface(id, type),
+ : screen_connector::RemoteSurface(id, type, wl_surface),
ops_(*ops), data_(data) {
}
RemoteSurfaceToolkit(const std::string& id,
screen_connector::RemoteSurface::Type type,
- screen_connector_toolkit_ops *ops,
- int rid, void* data)
- : screen_connector::RemoteSurface(rid, id, type),
+ screen_connector_toolkit_ops *ops, int rid,
+ std::shared_ptr<screen_connector::WlSurface> wl_surface,
+ void* data)
+ : screen_connector::RemoteSurface(rid, id, type, wl_surface),
ops_(*ops), data_(data) {
}
const char* id,
screen_connector_screen_type_e type,
int surface_id,
+ struct wl_surface* surface,
void* data) {
if (screen_connector_toolkit_is_exist(id, type)) {
LOGE("Already exists %s", id);
}
auto rs = new RemoteSurfaceToolkit(id,
- (screen_connector::RemoteSurface::Type)type, ops, surface_id, data);
+ (screen_connector::RemoteSurface::Type)type, ops, surface_id,
+ std::shared_ptr<screen_connector::WlSurface>(
+ new screen_connector::WlSurface(surface, false)), data);
__toolkits[static_cast<int>(type)]->Add(rs);
}
auto rs = new RemoteSurfaceToolkit(id,
- (screen_connector::RemoteSurface::Type)type, ops, data);
+ (screen_connector::RemoteSurface::Type)type, ops, nullptr, data);
+
+ __toolkits[static_cast<int>(type)]->Add(rs);
+
+ return static_cast<void*>(rs);
+}
+
+extern "C" EXPORT_API screen_connector_toolkit_h
+screen_connector_toolkit_add_with_surface(screen_connector_toolkit_ops *ops,
+ const char* id,
+ screen_connector_screen_type_e type,
+ struct wl_surface* surface,
+ void* data) {
+ if (screen_connector_toolkit_is_exist(id, type)) {
+ LOGE("Already exists %s", id);
+ return NULL;
+ }
+
+ auto rs = new RemoteSurfaceToolkit(id,
+ (screen_connector::RemoteSurface::Type)type,
+ ops, std::shared_ptr<screen_connector::WlSurface>(
+ new screen_connector::WlSurface(surface, false)), data);
__toolkits[static_cast<int>(type)]->Add(rs);
int curType = -1;
SimpleRs(const std::string& id,
screen_connector::RemoteSurface::Type type, bool mock, Event evType)
- : screen_connector::RemoteSurface(id, type, mock), curEvent(evType) {
+ : screen_connector::RemoteSurface(id, type, nullptr, mock),
+ curEvent(evType) {
}
void OnBufferAdded(const std::string& appId,
const std::string& instId, int pid) override {