-
Notifications
You must be signed in to change notification settings - Fork 53
[tizen_window_manager] Add tizen-core-wl window backend #1057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JSUYA
wants to merge
1
commit into
flutter-tizen:master
Choose a base branch
from
JSUYA:tizen-core-wl-window-backend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
62 changes: 62 additions & 0 deletions
62
packages/tizen_window_manager/tizen/src/tizen_core_wl_window_proxy.cc
This file contains hidden or 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,62 @@ | ||
| // Copyright 2025 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 "tizen_core_wl_window_proxy.h" | ||
|
|
||
| #include <dlfcn.h> | ||
|
|
||
| #include "log.h" | ||
|
|
||
| TizenCoreWlWindowProxy::TizenCoreWlWindowProxy() { | ||
| handle_ = dlopen("libtizen-core-wl.so.0", RTLD_LAZY); | ||
| if (handle_ == nullptr) { | ||
| LOG_ERROR("Failed to open tizen-core-wl."); | ||
| return; | ||
| } | ||
|
|
||
| get_geometry_ = reinterpret_cast<FuncGetGeometry>( | ||
| dlsym(handle_, "tizen_core_wl_window_get_geometry")); | ||
| activate_ = reinterpret_cast<FuncActivate>( | ||
| dlsym(handle_, "tizen_core_wl_window_activate")); | ||
| lower_ = | ||
| reinterpret_cast<FuncLower>(dlsym(handle_, "tizen_core_wl_window_lower")); | ||
|
|
||
| if (!get_geometry_ || !activate_ || !lower_) { | ||
| LOG_ERROR("Failed to resolve tizen-core-wl symbols."); | ||
| dlclose(handle_); | ||
| handle_ = nullptr; | ||
| } | ||
| } | ||
|
|
||
| TizenCoreWlWindowProxy::~TizenCoreWlWindowProxy() { | ||
| if (handle_) { | ||
| dlclose(handle_); | ||
| handle_ = nullptr; | ||
| } | ||
| } | ||
|
|
||
| void TizenCoreWlWindowProxy::GetGeometry(void *window, int *x, int *y, | ||
| int *width, int *height) { | ||
| if (!handle_) { | ||
| LOG_ERROR("tizen-core-wl handle not valid"); | ||
| return; | ||
| } | ||
| get_geometry_(window, x, y, width, height); | ||
| } | ||
|
|
||
| void TizenCoreWlWindowProxy::Activate(void *window) { | ||
| if (!handle_) { | ||
| LOG_ERROR("tizen-core-wl handle not valid"); | ||
| return; | ||
| } | ||
| activate_(window); | ||
| } | ||
|
|
||
| void TizenCoreWlWindowProxy::Lower(void *window) { | ||
| if (!handle_) { | ||
| LOG_ERROR("tizen-core-wl handle not valid"); | ||
| return; | ||
| } | ||
| lower_(window); | ||
| } |
34 changes: 34 additions & 0 deletions
34
packages/tizen_window_manager/tizen/src/tizen_core_wl_window_proxy.h
This file contains hidden or 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,34 @@ | ||
| // Copyright 2025 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. | ||
|
|
||
| #ifndef FLUTTER_PLUGIN_TIZEN_CORE_WL_WINDOW_PROXY_H_ | ||
| #define FLUTTER_PLUGIN_TIZEN_CORE_WL_WINDOW_PROXY_H_ | ||
|
|
||
| #include "window_proxy_interface.h" | ||
|
|
||
| class TizenCoreWlWindowProxy : public WindowProxyInterface { | ||
| public: | ||
| TizenCoreWlWindowProxy(); | ||
| ~TizenCoreWlWindowProxy() override; | ||
|
|
||
| bool IsValid() const { return handle_ != nullptr; } | ||
|
|
||
| void GetGeometry(void *window, int *x, int *y, int *width, | ||
| int *height) override; | ||
| void Activate(void *window) override; | ||
| void Lower(void *window) override; | ||
|
|
||
| private: | ||
| typedef int (*FuncGetGeometry)(void *window, int *x, int *y, int *width, | ||
| int *height); | ||
| typedef int (*FuncActivate)(void *window); | ||
| typedef int (*FuncLower)(void *window); | ||
|
|
||
| void *handle_ = nullptr; | ||
| FuncGetGeometry get_geometry_ = nullptr; | ||
| FuncActivate activate_ = nullptr; | ||
| FuncLower lower_ = nullptr; | ||
| }; | ||
|
|
||
| #endif // FLUTTER_PLUGIN_TIZEN_CORE_WL_WINDOW_PROXY_H_ | ||
This file contains hidden or 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 hidden or 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 hidden or 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,57 @@ | ||
| // Copyright 2025 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 "window_proxy.h" | ||
|
|
||
| #include <system_info.h> | ||
|
|
||
| #include <cstdlib> | ||
| #include <memory> | ||
| #include <utility> | ||
|
|
||
| #include "ecore_wl2_window_proxy.h" | ||
| #include "log.h" | ||
| #include "tizen_core_wl_window_proxy.h" | ||
|
|
||
| namespace { | ||
|
|
||
| constexpr int kTizenCoreWlMinMajorVersion = 11; | ||
|
|
||
| int GetPlatformMajorVersion() { | ||
| char *version = nullptr; | ||
| int ret = system_info_get_platform_string( | ||
| "http://tizen.org/feature/platform.version", &version); | ||
| if (ret != SYSTEM_INFO_ERROR_NONE || version == nullptr) { | ||
| LOG_ERROR("Failed to get platform version. error: %d", ret); | ||
| return 0; | ||
| } | ||
|
|
||
| int major = std::atoi(version); | ||
| free(version); | ||
| return major; | ||
| } | ||
|
|
||
| } // namespace | ||
|
|
||
| WindowProxy::WindowProxy() { | ||
| if (GetPlatformMajorVersion() >= kTizenCoreWlMinMajorVersion) { | ||
| auto proxy = std::make_unique<TizenCoreWlWindowProxy>(); | ||
| if (proxy->IsValid()) { | ||
| LOG_INFO("Using tizen-core-wl backend."); | ||
| impl_ = std::move(proxy); | ||
| return; | ||
| } | ||
| LOG_INFO("tizen-core-wl unavailable, falling back to ecore_wl2 backend."); | ||
| } | ||
| impl_ = std::make_unique<EcoreWl2WindowProxy>(); | ||
| } | ||
|
|
||
| void WindowProxy::GetGeometry(void *window, int *x, int *y, int *width, | ||
| int *height) { | ||
| impl_->GetGeometry(window, x, y, width, height); | ||
| } | ||
|
|
||
| void WindowProxy::Activate(void *window) { impl_->Activate(window); } | ||
|
|
||
| void WindowProxy::Lower(void *window) { impl_->Lower(window); } |
This file contains hidden or 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,26 @@ | ||
| // Copyright 2025 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. | ||
|
|
||
| #ifndef FLUTTER_PLUGIN_WINDOW_PROXY_H_ | ||
| #define FLUTTER_PLUGIN_WINDOW_PROXY_H_ | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "window_proxy_interface.h" | ||
|
|
||
| class WindowProxy : public WindowProxyInterface { | ||
| public: | ||
| WindowProxy(); | ||
| ~WindowProxy() override = default; | ||
|
|
||
| void GetGeometry(void *window, int *x, int *y, int *width, | ||
| int *height) override; | ||
| void Activate(void *window) override; | ||
| void Lower(void *window) override; | ||
|
|
||
| private: | ||
| std::unique_ptr<WindowProxyInterface> impl_; | ||
| }; | ||
|
|
||
| #endif // FLUTTER_PLUGIN_WINDOW_PROXY_H_ |
18 changes: 18 additions & 0 deletions
18
packages/tizen_window_manager/tizen/src/window_proxy_interface.h
This file contains hidden or 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,18 @@ | ||
| // Copyright 2025 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. | ||
|
|
||
| #ifndef FLUTTER_PLUGIN_WINDOW_PROXY_INTERFACE_H_ | ||
| #define FLUTTER_PLUGIN_WINDOW_PROXY_INTERFACE_H_ | ||
|
|
||
| class WindowProxyInterface { | ||
| public: | ||
| virtual ~WindowProxyInterface() = default; | ||
|
|
||
| virtual void GetGeometry(void *window, int *x, int *y, int *width, | ||
| int *height) = 0; | ||
| virtual void Activate(void *window) = 0; | ||
| virtual void Lower(void *window) = 0; | ||
| }; | ||
|
|
||
| #endif // FLUTTER_PLUGIN_WINDOW_PROXY_INTERFACE_H_ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.