forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a View Class that supports NUI UIFW that inherits TizenView. NUI is a UIFW based on the C# language that wrapping Dali UIFW. The mouse and the keyboard event callback handling for NUI is handled in embedding(C#). The embedder handles events related to event delivery and rendering. Basically draw a flutter on a NativeImageQueue created from embedding. This corresponds to tbm_surface_queue_h and is rendered flutter view using egl. (When taking tbm_surface_queue_h from NativeImageQueue, typeid() is used inside dali, so -rtti flag is absolutely necessary.) Co-authored-by: Swift Kim <[email protected]>
- Loading branch information
Showing
12 changed files
with
395 additions
and
35 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,58 @@ | ||
// Copyright 2022 Samsung Electronics Co., Ltd. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "public/flutter_tizen.h" | ||
|
||
#include <dali-toolkit/public-api/controls/image-view/image-view.h> | ||
#include <dali/devel-api/adaptor-framework/native-image-source-queue.h> | ||
|
||
#include <memory> | ||
|
||
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h" | ||
#include "flutter/shell/platform/tizen/flutter_tizen_view.h" | ||
#include "flutter/shell/platform/tizen/tizen_view_nui.h" | ||
|
||
namespace { | ||
|
||
// Returns the engine corresponding to the given opaque API handle. | ||
flutter::FlutterTizenEngine* EngineFromHandle(FlutterDesktopEngineRef ref) { | ||
return reinterpret_cast<flutter::FlutterTizenEngine*>(ref); | ||
} | ||
|
||
FlutterDesktopViewRef HandleForView(flutter::FlutterTizenView* view) { | ||
return reinterpret_cast<FlutterDesktopViewRef>(view); | ||
} | ||
|
||
} // namespace | ||
|
||
FlutterDesktopViewRef FlutterDesktopViewCreateFromImageView( | ||
const FlutterDesktopViewProperties& view_properties, | ||
FlutterDesktopEngineRef engine, | ||
void* image_view, | ||
void* native_image_queue, | ||
int32_t default_window_id) { | ||
std::unique_ptr<flutter::TizenViewBase> tizen_view = | ||
std::make_unique<flutter::TizenViewNui>( | ||
view_properties.width, view_properties.height, | ||
reinterpret_cast<Dali::Toolkit::ImageView*>(image_view), | ||
reinterpret_cast<Dali::NativeImageSourceQueue*>(native_image_queue), | ||
default_window_id); | ||
|
||
auto view = | ||
std::make_unique<flutter::FlutterTizenView>(std::move(tizen_view)); | ||
|
||
// Take ownership of the engine, starting it if necessary. | ||
view->SetEngine( | ||
std::unique_ptr<flutter::FlutterTizenEngine>(EngineFromHandle(engine))); | ||
view->CreateRenderSurface(FlutterDesktopRendererType::kEGL); | ||
if (!view->engine()->IsRunning()) { | ||
if (!view->engine()->RunEngine()) { | ||
return nullptr; | ||
} | ||
} | ||
|
||
view->SendInitialGeometry(); | ||
|
||
return HandleForView(view.release()); | ||
} |
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
Oops, something went wrong.