Skip to content

Commit 4677289

Browse files
authored
[desktop_drop] Fix not working on Wayland. (MixinNetwork#20)
* add uri targets * add uri targets * update readme docs
1 parent ec4919f commit 4677289

File tree

7 files changed

+17
-189
lines changed

7 files changed

+17
-189
lines changed

packages/desktop_drop/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ build/
88

99
.idea
1010

11-
*.iml
11+
*.iml
12+
13+
pubspec.lock

packages/desktop_drop/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.1.2 (2021/11/10)
4+
5+
[Linux] Fix do not work on Wayland.
6+
37
## 0.1.1 (2021/11/8)
48

59
update plugin description.

packages/desktop_drop/example/pubspec.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.8.1"
10+
version: "2.8.2"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,7 +21,7 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0"
24+
version: "1.2.0"
2525
charcode:
2626
dependency: transitive
2727
description:
@@ -56,7 +56,7 @@ packages:
5656
path: ".."
5757
relative: true
5858
source: path
59-
version: "0.0.1"
59+
version: "0.1.1"
6060
fake_async:
6161
dependency: transitive
6262
description:
@@ -94,7 +94,7 @@ packages:
9494
name: matcher
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "0.12.10"
97+
version: "0.12.11"
9898
meta:
9999
dependency: transitive
100100
description:
@@ -155,7 +155,7 @@ packages:
155155
name: test_api
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "0.4.2"
158+
version: "0.4.3"
159159
typed_data:
160160
dependency: transitive
161161
description:
@@ -169,7 +169,7 @@ packages:
169169
name: vector_math
170170
url: "https://pub.dartlang.org"
171171
source: hosted
172-
version: "2.1.0"
172+
version: "2.1.1"
173173
sdks:
174-
dart: ">=2.12.0 <3.0.0"
174+
dart: ">=2.14.0 <3.0.0"
175175
flutter: ">=1.20.0"

packages/desktop_drop/lib/src/channel.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'dart:convert';
22
import 'dart:io';
3-
import 'dart:ui';
43

54
import 'package:flutter/services.dart';
65
import 'package:flutter/widgets.dart';

packages/desktop_drop/linux/desktop_drop_plugin.cc

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,7 @@ void on_drag_leave(GtkWidget *widget, GdkDragContext *drag_context, guint time,
4949
static void desktop_drop_plugin_handle_method_call(
5050
DesktopDropPlugin *self,
5151
FlMethodCall *method_call) {
52-
g_autoptr(FlMethodResponse) response = nullptr;
53-
54-
const gchar *method = fl_method_call_get_name(method_call);
55-
56-
if (strcmp(method, "getPlatformVersion") == 0) {
57-
struct utsname uname_data = {};
58-
uname(&uname_data);
59-
g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version);
60-
g_autoptr(FlValue) result = fl_value_new_string(version);
61-
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
62-
} else {
63-
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
64-
}
65-
66-
fl_method_call_respond(method_call, response, nullptr);
52+
fl_method_call_respond_not_implemented(method_call, nullptr);
6753
}
6854

6955
static void desktop_drop_plugin_dispose(GObject *object) {
@@ -91,7 +77,7 @@ void desktop_drop_plugin_register_with_registrar(FlPluginRegistrar *registrar) {
9177
{strdup("STRING"), GTK_TARGET_OTHER_APP, 0}
9278
};
9379
gtk_drag_dest_set(GTK_WIDGET(fl_view), GTK_DEST_DEFAULT_ALL, entries, 1, GDK_ACTION_COPY);
94-
gtk_drag_dest_add_text_targets(GTK_WIDGET(fl_view));
80+
gtk_drag_dest_add_uri_targets(GTK_WIDGET(fl_view));
9581

9682
g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
9783
FlMethodChannel *channel =
@@ -109,7 +95,5 @@ void desktop_drop_plugin_register_with_registrar(FlPluginRegistrar *registrar) {
10995
g_signal_connect(GTK_WIDGET(fl_view), "drag-leave",
11096
G_CALLBACK(on_drag_leave), channel);
11197

112-
std::cout << "channel: " << (void *) channel << std::endl;
113-
11498
g_object_unref(plugin);
11599
}

packages/desktop_drop/pubspec.lock

Lines changed: 0 additions & 161 deletions
This file was deleted.

packages/desktop_drop/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: desktop_drop
22
description: A plugin which allows user dragging files to your flutter desktop applications.
3-
version: 0.1.1
3+
version: 0.1.2
44
homepage: https://github.com/MixinNetwork/flutter-plugins/tree/main/packages/desktop_drop
55

66
environment:

0 commit comments

Comments
 (0)