Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f3ab78d

Browse files
Fix clipboard paste functionality not working (#19489)
1 parent c479b93 commit f3ab78d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

shell/platform/linux/fl_platform_plugin.cc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ static constexpr char kChannelName[] = "flutter/platform";
1212
static constexpr char kBadArgumentsError[] = "Bad Arguments";
1313
static constexpr char kUnknownClipboardFormatError[] =
1414
"Unknown Clipboard Format";
15-
static constexpr char kClipboardRequestError[] = "Clipboard Request Failed";
1615
static constexpr char kFailedError[] = "Failed";
1716
static constexpr char kGetClipboardDataMethod[] = "Clipboard.getData";
1817
static constexpr char kSetClipboardDataMethod[] = "Clipboard.setData";
@@ -43,17 +42,14 @@ static void clipboard_text_cb(GtkClipboard* clipboard,
4342
gpointer user_data) {
4443
g_autoptr(FlMethodCall) method_call = FL_METHOD_CALL(user_data);
4544

46-
g_autoptr(FlMethodResponse) response = nullptr;
45+
g_autoptr(FlValue) result = nullptr;
4746
if (text != nullptr) {
48-
g_autoptr(FlValue) result = fl_value_new_map();
47+
result = fl_value_new_map();
4948
fl_value_set_string_take(result, kTextKey, fl_value_new_string(text));
50-
response = FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
51-
} else {
52-
response = FL_METHOD_RESPONSE(fl_method_error_response_new(
53-
kClipboardRequestError, "Failed to retrieve clipboard text from GTK",
54-
nullptr));
5549
}
5650

51+
g_autoptr(FlMethodResponse) response =
52+
FL_METHOD_RESPONSE(fl_method_success_response_new(result));
5753
send_response(method_call, response);
5854
}
5955

0 commit comments

Comments
 (0)