Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flutter/shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import("//flutter/shell/platform/common/client_wrapper/publish.gni")
_public_headers = [
"public/flutter_platform_view.h",
"public/flutter_tizen.h",
"public/flutter_tizen_window.h",
]

config("flutter_tizen_config") {
Expand Down
93 changes: 93 additions & 0 deletions flutter/shell/platform/tizen/flutter_tizen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// found in the LICENSE file.

#include "public/flutter_tizen.h"
#include "public/flutter_tizen_window.h"

#include "flutter/shell/platform/common/client_wrapper/include/flutter/plugin_registrar.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_message_codec.h"
Expand Down Expand Up @@ -295,3 +296,95 @@ FlutterDesktopMessengerRef FlutterDesktopMessengerLock(
}

void FlutterDesktopMessengerUnlock(FlutterDesktopMessengerRef messenger) {}

// ========== Window API ==========

// Returns the TizenWindow associated with the given view, or nullptr if the
// view does not have a TizenWindow.
static flutter::TizenWindow* TizenWindowFromView(
FlutterDesktopViewRef view_ref) {
flutter::FlutterTizenView* view = ViewFromHandle(view_ref);
if (!view || !view->tizen_view()) {
return nullptr;
}
// The tizen_view() returns a TizenViewBase*. We need to check if it's
// actually a TizenWindow by dynamic_cast.
return dynamic_cast<flutter::TizenWindow*>(view->tizen_view());
}

FlutterDesktopWindowGeometry FlutterDesktopWindowGetGeometry(
FlutterDesktopViewRef view) {
FlutterDesktopWindowGeometry result = {0, 0, 0, 0};
flutter::TizenWindow* window = TizenWindowFromView(view);
if (!window) {
return result;
}
flutter::TizenGeometry geometry = window->GetGeometry();
result.x = geometry.left;
result.y = geometry.top;
result.width = geometry.width;
result.height = geometry.height;
return result;
}

bool FlutterDesktopWindowSetGeometry(
FlutterDesktopViewRef view,
const FlutterDesktopWindowGeometry* geometry) {
if (!geometry) {
return false;
}
flutter::TizenWindow* window = TizenWindowFromView(view);
if (!window) {
return false;
}
flutter::TizenGeometry current = window->GetGeometry();
flutter::TizenGeometry target = {
geometry->x != -1 ? geometry->x : current.left,
geometry->y != -1 ? geometry->y : current.top,
geometry->width != -1 ? geometry->width : current.width,
geometry->height != -1 ? geometry->height : current.height,
};
return window->SetGeometry(target);
}

FlutterDesktopScreenGeometry FlutterDesktopWindowGetScreenGeometry(
FlutterDesktopViewRef view) {
FlutterDesktopScreenGeometry result = {0, 0};
flutter::TizenWindow* window = TizenWindowFromView(view);
if (!window) {
return result;
}
flutter::TizenGeometry geometry = window->GetScreenGeometry();
result.width = geometry.width;
result.height = geometry.height;
return result;
}

int32_t FlutterDesktopWindowGetRotation(FlutterDesktopViewRef view) {
flutter::TizenWindow* window = TizenWindowFromView(view);
if (!window) {
return 0;
}
return window->GetRotation();
}

void FlutterDesktopWindowActivate(FlutterDesktopViewRef view) {
flutter::TizenWindow* window = TizenWindowFromView(view);
if (window) {
window->ActivateWindow();
}
}

void FlutterDesktopWindowRaise(FlutterDesktopViewRef view) {
flutter::TizenWindow* window = TizenWindowFromView(view);
if (window) {
window->RaiseWindow();
}
}

void FlutterDesktopWindowLower(FlutterDesktopViewRef view) {
flutter::TizenWindow* window = TizenWindowFromView(view);
if (window) {
window->LowerWindow();
}
}
79 changes: 79 additions & 0 deletions flutter/shell/platform/tizen/public/flutter_tizen_window.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright 2026 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_SHELL_PLATFORM_TIZEN_PUBLIC_FLUTTER_TIZEN_WINDOW_H_
#define FLUTTER_SHELL_PLATFORM_TIZEN_PUBLIC_FLUTTER_TIZEN_WINDOW_H_

#include <stddef.h>
#include <stdint.h>

#include "flutter_export.h"
#include "flutter_tizen.h"

#if defined(__cplusplus)
extern "C" {
#endif

// The geometry (position and size) of a window.
typedef struct {
// The x-coordinate of the top left corner of the window.
int32_t x;
// The y-coordinate of the top left corner of the window.
int32_t y;
// The width of the window.
int32_t width;
// The height of the window.
int32_t height;
} FlutterDesktopWindowGeometry;

// The geometry (size) of the display screen.
typedef struct {
// The width of the screen.
int32_t width;
// The height of the screen.
int32_t height;
} FlutterDesktopScreenGeometry;

// ========== Window ==========

// Returns the geometry (position and size) of the window associated with
// the given view.
FLUTTER_EXPORT FlutterDesktopWindowGeometry
FlutterDesktopWindowGetGeometry(FlutterDesktopViewRef view);

// Sets the geometry (position and size) of the window associated with
// the given view.
//
// If any field of |geometry| is -1, the current value for that field is
// preserved.
//
// Returns true if the geometry was successfully set, false otherwise.
FLUTTER_EXPORT bool FlutterDesktopWindowSetGeometry(
FlutterDesktopViewRef view,
const FlutterDesktopWindowGeometry* geometry);

// Returns the geometry (size) of the screen that the window is on.
FLUTTER_EXPORT FlutterDesktopScreenGeometry
FlutterDesktopWindowGetScreenGeometry(FlutterDesktopViewRef view);

// Returns the current rotation (in degrees) of the window.
FLUTTER_EXPORT int32_t
FlutterDesktopWindowGetRotation(FlutterDesktopViewRef view);

// Activates the window associated with the given view.
FLUTTER_EXPORT void FlutterDesktopWindowActivate(FlutterDesktopViewRef view);

// Raises the window associated with the given view to the top of the
// stacking order.
FLUTTER_EXPORT void FlutterDesktopWindowRaise(FlutterDesktopViewRef view);

// Lowers the window associated with the given view to the bottom of the
// stacking order.
FLUTTER_EXPORT void FlutterDesktopWindowLower(FlutterDesktopViewRef view);

#if defined(__cplusplus)
} // extern "C"
#endif

#endif // FLUTTER_SHELL_PLATFORM_TIZEN_PUBLIC_FLUTTER_TIZEN_WINDOW_H_
Loading