Skip to content

Commit

Permalink
Merge branch 'master' into a11y_do_action_name
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim authored Feb 14, 2025
2 parents 60d0a34 + 45ccc85 commit 1c5e097
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 19 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ deps = {
'src/third_party/libcxx': 'https://llvm.googlesource.com/llvm-project/libcxx@44079a4cc04cdeffb9cfe8067bfb3c276fb2bab0',
'src/third_party/libcxxabi': 'https://llvm.googlesource.com/llvm-project/libcxxabi@2ce528fb5e0f92e57c97ec3ff53b75359d33af12',
'src/third_party/googletest': 'https://github.com/google/googletest@7f036c5563af7d0329f20e8bb42effb04629f0c0',
'src/third_party/dart': 'https://dart.googlesource.com/sdk.git@b9479eb440de7af2c9946931a1ecaabf457b31af',
'src/third_party/dart': 'https://dart.googlesource.com/sdk.git@ae7ca5199a0559db0ae60533e9cedd3ce0d6ab04',
'src/third_party/clang': {
'packages': [
{
'package': 'fuchsia/third_party/clang/linux-amd64',
'version': 'git_revision:20d06c833d833ef6b2d0f519cc4a7998d49a2803'
'version': 'git_revision:725656bdd885483c39f482a01ea25d67acf39c46'
}
],
'dep_type': 'cipd',
Expand Down
8 changes: 4 additions & 4 deletions flutter/shell/platform/common/public/flutter_messenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ FLUTTER_EXPORT void FlutterDesktopMessengerSetCallback(
// Operation is thread-safe.
//
// See also: |FlutterDesktopMessengerRelease|
FLUTTER_EXPORT FlutterDesktopMessengerRef
FlutterDesktopMessengerAddRef(FlutterDesktopMessengerRef messenger);
FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopMessengerAddRef(
FlutterDesktopMessengerRef messenger);

// Decrements the reference count for the |messenger|.
//
Expand Down Expand Up @@ -126,8 +126,8 @@ FLUTTER_EXPORT bool FlutterDesktopMessengerIsAvailable(
// Returns the |messenger| value.
//
// See also: |FlutterDesktopMessengerUnlock|
FLUTTER_EXPORT FlutterDesktopMessengerRef
FlutterDesktopMessengerLock(FlutterDesktopMessengerRef messenger);
FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopMessengerLock(
FlutterDesktopMessengerRef messenger);

// Unlocks the `FlutterDesktopMessengerRef`.
//
Expand Down
79 changes: 74 additions & 5 deletions flutter/shell/platform/embedder/embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ typedef enum {
/// Specifies an OpenGL frame-buffer target type. Framebuffers are specified
/// using the FlutterOpenGLFramebuffer struct.
kFlutterOpenGLTargetTypeFramebuffer,
/// Specifies an OpenGL on-screen surface target type. Surfaces are specified
/// using the FlutterOpenGLSurface struct.
kFlutterOpenGLTargetTypeSurface,
} FlutterOpenGLTargetType;

/// A pixel format to be used for software rendering.
Expand Down Expand Up @@ -401,9 +404,14 @@ typedef struct {
} FlutterOpenGLTexture;

typedef struct {
/// The target of the color attachment of the frame-buffer. For example,
/// GL_TEXTURE_2D or GL_RENDERBUFFER. In case of ambiguity when dealing with
/// Window bound frame-buffers, 0 may be used.
/// The format of the color attachment of the frame-buffer. For example,
/// GL_RGBA8.
///
/// In case of ambiguity when dealing with Window bound frame-buffers, 0 may
/// be used.
///
/// @bug This field is incorrectly named as "target" when it actually
/// refers to a format.
uint32_t target;

/// The name of the framebuffer.
Expand All @@ -417,6 +425,62 @@ typedef struct {
VoidCallback destruction_callback;
} FlutterOpenGLFramebuffer;

typedef bool (*FlutterOpenGLSurfaceCallback)(void* /* user data */,
bool* /* opengl state changed */);

typedef struct {
/// The size of this struct. Must be sizeof(FlutterOpenGLSurface).
size_t struct_size;

/// User data to be passed to the make_current, clear_current and
/// destruction callbacks.
void* user_data;

/// Callback invoked (on an engine-managed thread) that asks the embedder to
/// make the surface current.
///
/// Should return true if the operation succeeded, false if the surface could
/// not be made current and rendering should be cancelled.
///
/// The second parameter 'opengl state changed' should be set to true if
/// any OpenGL API state is different than before this callback was called.
/// In that case, Flutter will invalidate the internal OpenGL API state cache,
/// which is a somewhat expensive operation.
///
/// @attention required. (non-null)
FlutterOpenGLSurfaceCallback make_current_callback;

/// Callback invoked (on an engine-managed thread) when the current surface
/// can be cleared.
///
/// Should return true if the operation succeeded, false if an error ocurred.
/// That error will be logged but otherwise not handled by the engine.
///
/// The second parameter 'opengl state changed' is the same as with the
/// @ref make_current_callback.
///
/// The embedder might clear the surface here after it was previously made
/// current. That's not required however, it's also possible to clear it in
/// the destruction callback. There's no way to signal OpenGL state
/// changes in the destruction callback though.
///
/// @attention required. (non-null)
FlutterOpenGLSurfaceCallback clear_current_callback;

/// Callback invoked (on an engine-managed thread) that asks the embedder to
/// collect the surface.
///
/// @attention required. (non-null)
VoidCallback destruction_callback;

/// The surface format.
///
/// Allowed values:
/// - GL_RGBA8
/// - GL_BGRA8_EXT
uint32_t format;
} FlutterOpenGLSurface;

typedef FlutterTransformation (*TransformationCallback)(void* /* user data */);
typedef uint32_t (*UIntCallback)(void* /* user data */);
typedef bool (*SoftwareSurfacePresentCallback)(void* /* user data */,
Expand Down Expand Up @@ -1546,7 +1610,7 @@ typedef void (*FlutterUpdateSemanticsCallback2)(

/// An update to whether a message channel has a listener set or not.
typedef struct {
// The size of the struct. Must be sizeof(FlutterChannelUpdate).
/// The size of the struct. Must be sizeof(FlutterChannelUpdate).
size_t struct_size;
/// The name of the channel.
const char* channel;
Expand Down Expand Up @@ -1627,6 +1691,9 @@ typedef struct {
/// A framebuffer for Flutter to render into. The embedder must ensure that
/// the framebuffer is complete.
FlutterOpenGLFramebuffer framebuffer;
/// A surface for Flutter to render into. Basically a wrapper around
/// a closure that'll be called when the surface should be made current.
FlutterOpenGLSurface surface;
};
} FlutterOpenGLBackingStore;

Expand All @@ -1648,6 +1715,7 @@ typedef struct {
} FlutterSoftwareBackingStore;

typedef struct {
/// The size of this struct. Must be sizeof(FlutterSoftwareBackingStore2).
size_t struct_size;
/// A pointer to the raw bytes of the allocation described by this software
/// backing store.
Expand Down Expand Up @@ -1821,6 +1889,7 @@ typedef struct {
/// Contains additional information about the backing store provided
/// during presentation to the embedder.
typedef struct {
/// The size of this struct. Must be sizeof(FlutterBackingStorePresentInfo).
size_t struct_size;

/// The area of the backing store that contains Flutter contents. Pixels
Expand Down Expand Up @@ -1982,7 +2051,7 @@ typedef const FlutterLocale* (*FlutterComputePlatformResolvedLocaleCallback)(
size_t /* Number of locales*/);

typedef struct {
/// This size of this struct. Must be sizeof(FlutterDisplay).
/// The size of this struct. Must be sizeof(FlutterEngineDisplay).
size_t struct_size;

FlutterEngineDisplayId display_id;
Expand Down
2 changes: 2 additions & 0 deletions flutter/shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ config("flutter_tizen_config") {
"${sysroot_path}/usr/include/efreet-1",
"${sysroot_path}/usr/include/eina-1",
"${sysroot_path}/usr/include/eina-1/eina",
"${sysroot_path}/usr/include/eldbus-1",
"${sysroot_path}/usr/include/elementary-1",
"${sysroot_path}/usr/include/emile-1",
"${sysroot_path}/usr/include/eo-1",
Expand Down Expand Up @@ -140,6 +141,7 @@ template("embedder") {
"ecore_wl2",
"efl-extension",
"eina",
"eldbus",
"elementary",
"eom",
"evas",
Expand Down
59 changes: 55 additions & 4 deletions flutter/shell/platform/tizen/channels/accessibility_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include "accessibility_channel.h"

#include <Elementary.h>

#include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_message_codec.h"
#include "flutter/shell/platform/tizen/channels/encodable_value_holder.h"
#include "flutter/shell/platform/tizen/logger.h"
Expand All @@ -15,14 +13,54 @@ namespace flutter {
namespace {

constexpr char kChannelName[] = "flutter/accessibility";
constexpr char kAccessibilityDbus[] = "org.a11y.Bus";
constexpr char kAccessibilityDbusPath[] = "/org/a11y/bus";
constexpr char kAccessibilityDbusInterface[] = "org.a11y.Bus";
constexpr char kAtspiDirectReadBus[] = "org.tizen.ScreenReader";
constexpr char kAtspiDirectReadPath[] = "/org/tizen/DirectReading";
constexpr char kAtspiDirectReadInterface[] = "org.tizen.DirectReading";

} // namespace

static void _accessibilityBusAddressGet(void* data,
const Eldbus_Message* message,
Eldbus_Pending* pending) {
Eldbus_Connection** accessibility_bus =
static_cast<Eldbus_Connection**>(data);
const char* error_name = nullptr;
const char* error_message = nullptr;
const char* socket_address = nullptr;

if (eldbus_message_error_get(message, &error_name, &error_message)) {
FT_LOG(Error) << "Eldbus message error. (" << error_name << " : "
<< error_message << ")";
return;
}

if (!eldbus_message_arguments_get(message, "s", &socket_address) ||
!socket_address) {
FT_LOG(Error) << "Could not get A11Y Bus socket address.";
return;
}
*accessibility_bus = eldbus_private_address_connection_get(socket_address);
}

AccessibilityChannel::AccessibilityChannel(BinaryMessenger* messenger)
: channel_(std::make_unique<BasicMessageChannel<EncodableValue>>(
messenger,
kChannelName,
&StandardMessageCodec::GetInstance())) {
eldbus_init();

session_bus_ = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
bus_ = eldbus_object_get(session_bus_, kAccessibilityDbus,
kAccessibilityDbusPath);

Eldbus_Message* method = eldbus_object_method_call_new(
bus_, kAccessibilityDbusInterface, "GetAddress");
eldbus_object_send(bus_, method, _accessibilityBusAddressGet,
&accessibility_bus_, 100);

channel_->SetMessageHandler([&](const auto& message, auto reply) {
if (std::holds_alternative<EncodableMap>(message)) {
auto map = std::get<EncodableMap>(message);
Expand All @@ -33,8 +71,15 @@ AccessibilityChannel::AccessibilityChannel(BinaryMessenger* messenger)
FT_LOG(Info) << "Received " << *type << " message.";
if (*type == "announce" && data) {
EncodableValueHolder<std::string> msg(data.value, "message");
if (msg) {
elm_atspi_bridge_utils_say(msg->c_str(), true, nullptr, nullptr);
if (msg && accessibility_bus_) {
Eldbus_Message* eldbus_message = eldbus_message_method_call_new(
kAtspiDirectReadBus, kAtspiDirectReadPath,
kAtspiDirectReadInterface, "ReadCommand");
Eldbus_Message_Iter* iter = eldbus_message_iter_get(eldbus_message);
eldbus_message_iter_arguments_append(iter, "sb", msg->c_str(),
true);
eldbus_connection_send(accessibility_bus_, eldbus_message, nullptr,
nullptr, -1);
}
}
}
Expand All @@ -45,6 +90,12 @@ AccessibilityChannel::AccessibilityChannel(BinaryMessenger* messenger)

AccessibilityChannel::~AccessibilityChannel() {
channel_->SetMessageHandler(nullptr);

eldbus_connection_unref(accessibility_bus_);
eldbus_connection_unref(session_bus_);
eldbus_object_unref(bus_);

eldbus_shutdown();
}

} // namespace flutter
6 changes: 6 additions & 0 deletions flutter/shell/platform/tizen/channels/accessibility_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef EMBEDDER_ACCESSIBILITY_CHANNEL_H_
#define EMBEDDER_ACCESSIBILITY_CHANNEL_H_

#include <Eldbus.h>

#include <functional>
#include <memory>

Expand All @@ -20,6 +22,10 @@ class AccessibilityChannel {

private:
std::unique_ptr<BasicMessageChannel<EncodableValue>> channel_;

Eldbus_Connection* session_bus_ = nullptr;
Eldbus_Connection* accessibility_bus_ = nullptr;
Eldbus_Object* bus_ = nullptr;
};

} // namespace flutter
Expand Down
2 changes: 2 additions & 0 deletions flutter/shell/platform/tizen/channels/window_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ void WindowChannel::HandleMethodCall(
map[EncodableValue("width")] = EncodableValue(geometry.width);
map[EncodableValue("height")] = EncodableValue(geometry.height);
result->Success(EncodableValue(map));
} else if (method_name == "getRotation") {
result->Success(EncodableValue(window_->GetRotation()));
} else {
result->NotImplemented();
}
Expand Down
8 changes: 4 additions & 4 deletions flutter/shell/platform/tizen/public/flutter_tizen.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ FlutterDesktopEngineGetPluginRegistrar(FlutterDesktopEngineRef engine,
const char* plugin_name);

// Returns the messenger associated with the engine.
FLUTTER_EXPORT FlutterDesktopMessengerRef
FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine);
FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(
FlutterDesktopEngineRef engine);

// Posts an app control to the engine instance.
FLUTTER_EXPORT void FlutterDesktopEngineNotifyAppControl(
Expand Down Expand Up @@ -205,8 +205,8 @@ FLUTTER_EXPORT void* FlutterDesktopViewGetNativeHandle(
FlutterDesktopViewRef view);

// Returns the resource id of current window.
FLUTTER_EXPORT uint32_t
FlutterDesktopViewGetResourceId(FlutterDesktopViewRef view);
FLUTTER_EXPORT uint32_t FlutterDesktopViewGetResourceId(
FlutterDesktopViewRef view);

// Resizes the view.
// @warning This API is a work-in-progress and may change.
Expand Down
1 change: 1 addition & 0 deletions flutter/shell/platform/tizen/tizen_window_ecore_wl2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ void TizenWindowEcoreWl2::RegisterEventHandlers() {
int32_t degree = rotation_event->angle;
self->view_delegate_->OnRotate(degree);
TizenGeometry geometry = self->GetGeometry();
ecore_wl2_window_rotation_set(self->ecore_wl2_window_, degree);
ecore_wl2_window_rotation_change_done_send(
self->ecore_wl2_window_, rotation_event->rotation,
geometry.width, geometry.height);
Expand Down
2 changes: 2 additions & 0 deletions tools/generate_sysroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
'eina',
'eina-devel',
'eina-tools',
'eldbus',
'eldbus-devel',
'elementary',
'elementary-devel',
'emile-devel',
Expand Down

0 comments on commit 1c5e097

Please sign in to comment.