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

revamp drag-n-drop and clipboard support for X11 / linux #21258

Open
wants to merge 91 commits into
base: main
Choose a base branch
from

Conversation

ThomasKuehne
Copy link
Contributor

  1. moves the content handling from X11Dnd to the new X11SelectionHandler
  2. re-writes the X11 -> mono content detection to deal with mime-type parameters
  3. re-writes the mono -> X11 content detection to deal with native types, URI, IEnumerable and null-objects
  4. expands DataFormats.StringFormat/Text/UnicodeText to properly handle charset encodings support text/plain, UTF8_STRING, text/unicode, TEXT as well as STRING
  5. adds DataFormats.DataFormats.Bitmap support for image/png, image/bmp, image/jpeg, image/gif and image/tiff
  6. adds DataFormats.FileDrop support for FILE_NAME, text/x-moz-url and _NETSCAPE_URL
  7. adds DataFormats.CommaSeparatedValue support for text/csv
  8. DataFormats.Serializable now uses a GUID header bevore the actual payload

regarding 1)
X11's clipboard and DND content handling is identical and differs only in the selection's ID used thus no need to implement it twice
lets find all potential issues in the less critical DND-functions first and then later switch X11Clipboard's content handling to X11SelectionHandler

regarding 2)
for example to deal with "text/plain;charset=utf-8"

regarding 8)
in line with Window implementation

1) moves the content handling from X11Dnd to the new X11SelectionHandler
2) re-writes the X11 -> mono content detection to deal with mime-type parameters
3) re-writes the mono -> X11 content detection to deal with native types, URI, IEnumerable<Uri> and null-objects
4) expands DataFormats.StringFormat/Text/UnicodeText to properly handle charset encodings support text/plain, UTF8_STRING, text/unicode, TEXT as well as STRING
5) adds DataFormats.DataFormats.Bitmap support for image/png, image/bmp, image/jpeg, image/gif and image/tiff
6) adds DataFormats.FileDrop support for FILE_NAME, text/x-moz-url and _NETSCAPE_URL
7) adds DataFormats.CommaSeparatedValue support for text/csv
8) DataFormats.Serializable now uses a GUID header bevore the actual payload

regarding 1)
X11's clipboard and DND content handling is identical and differs only in the selection's ID used thus no need to implement it twice
lets find all potential issues in the less critical DND-functions first and then later switch X11Clipboard's content handling to X11SelectionHandler

regarding 2)
for example to deal with "text/plain;charset=utf-8"

regarding 8)
in line with Window implementation
@dnfadmin
Copy link

dnfadmin commented Oct 24, 2021

CLA assistant check
All CLA requirements met.

…wn format

This reduces the round trips take do identify X11's clipboard content
from at least 21 - all Formats in DataFormats.Init - to just 1.

(cherry picked from commit ca0d6b2)
adjusted redundant and too broad access modifiers
Fixes mono#21276 by returning 'true' (this request was handled by DND) instead
of 'false' (this isn't a DND request)

(cherry picked from commit 18eecf4)
Fixes mono#21278 by ensuring that the SelectionNotifyEvent is handled
by the correct code: dnd or clipboard
Fixes mono#21279 Memory leak in System.Windows.Forms.X11Dnd.EffectsFromX11Source
- unified the X11 content handling for Drag-and-Drop,
    as well as CLIPBOARD and PRIMARY selections
- added inbound and outbound MULTIPLE support
- significantty reduced round-trips and transfered
    data for System.Windows.Forms.Clipboard
- various fixes in X11's DND / clipboard area
@ThomasKuehne
Copy link
Contributor Author

also fixes #12149

@ThomasKuehne
Copy link
Contributor Author

Also:
Fixes #17029
Fixes #18079
Fixes #18923
Fixes #20601

@ThomasKuehne
Copy link
Contributor Author

Also:
Fixes #15511

akoeplinger and others added 27 commits March 23, 2024 10:30
* [mono][loader] Set status on success

Manual backport of dotnet/runtime#80949 to mono/mono

Emebedders that call `mono_assembly_load_from_full` may observe a non-NULL return value and an uninitialized MonoImageOpenStatus, which may lead to incorrect diagnostics in code like:

```
MonoImageOpenStatus status;
MonoAssembly *assembly = mono_assembly_load_from_full (image, name, status, refonly);
if (!assembly || status != MONO_IMAGE_OK) {
   fprintf(stderr, "Failure due to: %s\n", mono_image_strerror (status));
   abort();
}
```
Which will print `Failure due to: Internal error`

Addresses dotnet/android#7658

* [loader] Make mono_image_laod_time_date_stamp a no-op on Android

Avoid an mmap that will fail since Android uses a custom
loader and the assemblies aren't on disk
)

Backport of dotnet/runtime#83273 to mono/mono `main`

The C standard does not specify whether `char` is signed or unsigned, it is implementation defined.

Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results).

Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup.  As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device.

Contributes to dotnet/runtime#82187 
Contributes to dotnet/runtime#78638
* don't use the gcc workaround on clang

clang doesn't need it, and clang also doesn't support the `optimize`
attribute.

* cast _zzq_default to a 64-bit type

Otherwise, clang complains that "value-size does not match register size",
since the 32-bit value (generally a literal 0) doesn't match the 64-bit
x3 register.
Legacy Android and iOS are building from the 2020-02 branch and modern Android/iOS/WebAssembly are built from the https://github.com/dotnet/runtime repo.
…21653)

Changes:

- Support symbol server on mobile devices: port from dotnet/runtime#82555
- Show loaded symbols on VS module window: port from dotnet/runtime#82587
- Added compatibility with CMD_GET_ENC_CAPABILITIES message: even if C# Hot Reload is not supported in Xamarin Forms, the debug client can send this message if the version is at least 2.61, which it is since the latest changes. See code for reference: https://github.com/mono/debugger-libs/blob/main/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs#L799-L800. For that reason and for compatibility, we should support that message and return "Baseline", the same as the client code does with a lower version.

The main motivation of these ports is to support symbol server in Xamarin legacy, however the other ports are needed because we had to bump the minor version from 58 to 63.
…o#21661)

This PR allows the `IServiceProvider` implementation for property grid items to resolve `GetService` requests using the control `Site`, if specified. This is consistent with the original behavior on .NET Framework and is fundamental to enable advanced extensibility scenarios where custom editors require services from the application hosting the property grid.

Fixes mono#21660
Check that the Extended Key Usage extension in the signing certificate contains the OID for code signing so that we reject other types of certificates.
* [libs] Update TimeZoneInfo to read new version of tzdata

* Add braces to help catch indentation mistakes
Fixes issues with scanners that look at the projects.
@sancheolz
Copy link
Contributor

@ThomasKuehne, can I use your PRs in this project https://github.com/DanielVanNoord/System.Windows.Forms?

@ThomasKuehne
Copy link
Contributor Author

@sancheolz , yes you can use my PRs for https://github.com/DanielVanNoord/System.Window

sancheolz added a commit to sancheolz/System.Windows.Forms that referenced this pull request Jun 14, 2024
ported from mono/mono#21258

moves the content handling from X11Dnd to the new X11SelectionHandler
re-writes the X11 -> mono content detection to deal with mime-type parameters
re-writes the mono -> X11 content detection to deal with native types, URI, IEnumerable and null-objects
expands DataFormats.StringFormat/Text/UnicodeText to properly handle charset encodings support text/plain, UTF8_STRING, text/unicode, TEXT as well as STRING
adds DataFormats.DataFormats.Bitmap support for image/png, image/bmp, image/jpeg, image/gif and image/tiff
adds DataFormats.FileDrop support for FILE_NAME, text/x-moz-url and _NETSCAPE_URL
adds DataFormats.CommaSeparatedValue support for text/csv
DataFormats.Serializable now uses a GUID header bevore the actual payload
regarding 1)
X11's clipboard and DND content handling is identical and differs only in the selection's ID used thus no need to implement it twice
lets find all potential issues in the less critical DND-functions first and then later switch X11Clipboard's content handling to X11SelectionHandler

regarding 2)
for example to deal with "text/plain;charset=utf-8"

regarding 8)
in line with Window implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet