Skip to content
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

Fix clipboard paste functionality not working #19489

Merged
Merged
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
12 changes: 4 additions & 8 deletions shell/platform/linux/fl_platform_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ static constexpr char kChannelName[] = "flutter/platform";
static constexpr char kBadArgumentsError[] = "Bad Arguments";
static constexpr char kUnknownClipboardFormatError[] =
"Unknown Clipboard Format";
static constexpr char kClipboardRequestError[] = "Clipboard Request Failed";
static constexpr char kFailedError[] = "Failed";
static constexpr char kGetClipboardDataMethod[] = "Clipboard.getData";
static constexpr char kSetClipboardDataMethod[] = "Clipboard.setData";
Expand Down Expand Up @@ -43,17 +42,14 @@ static void clipboard_text_cb(GtkClipboard* clipboard,
gpointer user_data) {
g_autoptr(FlMethodCall) method_call = FL_METHOD_CALL(user_data);

g_autoptr(FlMethodResponse) response = nullptr;
g_autoptr(FlValue) result = nullptr;
if (text != nullptr) {
g_autoptr(FlValue) result = fl_value_new_map();
result = fl_value_new_map();
fl_value_set_string_take(result, kTextKey, fl_value_new_string(text));
response = FL_METHOD_RESPONSE(fl_method_success_response_new(nullptr));
} else {
response = FL_METHOD_RESPONSE(fl_method_error_response_new(
kClipboardRequestError, "Failed to retrieve clipboard text from GTK",
nullptr));
}

g_autoptr(FlMethodResponse) response =
FL_METHOD_RESPONSE(fl_method_success_response_new(result));
send_response(method_call, response);
}

Expand Down