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

Copying from Mono port of Windows Forms doesn't work in some programs on Linux #14255

Closed
ForNeVeR opened this issue Apr 28, 2019 · 0 comments · Fixed by #14256

Comments

@ForNeVeR
Copy link
Contributor

@ForNeVeR ForNeVeR commented Apr 28, 2019

Steps to Reproduce

  1. Create a following program, compile it and run with Mono:
    using System.Windows.Forms;
    
    namespace ConsoleApplication1
    {
        internal class Program
        {
            public static void Main(string[] args)
            {
                var form = new Form();
                var textBox = new TextBox();
                form.Controls.Add(textBox);
                Application.Run(form);
            }
        }
    }
  2. Enter any text into a text box, select it and press Ctrl-C (or other default keyboard shortcut for Copy action).

Current Behavior

  1. Try to paste the result:

    • into gedit: success
    • into gnome-terminal: failure
    • into any Swing-based Java application: failure
  2. Try to call xclip -selection clipboard -o -t TARGETS > targets.txt: it will output 40 bytes of garbage instead of a list of newline-separated targets supported by Mono.

Expected Behavior

  1. Paste into gnome-terminal and into any Swing-based Java application should work by default.
  2. xclip -selection clipboard -o -t TARGETS should output a list of newline-separated targets, not garbage.

On which platforms did you notice this

  • Linux (I was testing on a 64-bit Ubuntu 18.04)

Version Used:

Latest master, commit 90a91429ae75240b4d0e791a563a9d553be09d56, and latest stable, version 5.20.1.19.

Analysis

The information provided by Mono into X11 clipboard mechanism is wrong in two ways:

  1. Mono claims to provide the information of type TARGETS instead of type ATOM, so XGetWindowProperty will fail if asked to get information of type ATOM when performing a paste action.
  2. The corresponding Mono code seems to think that X11 Atom is 32-bit always, but it is not the case: Atom is 64-bit on a 64-bit system.

I will send a patch fixing the issues soon.

@ForNeVeR ForNeVeR changed the title Copying from Mono port of Windows Forms doesn't work in some programs Copying from Mono port of Windows Forms doesn't work in some programs on Linux Apr 28, 2019
@marek-safar marek-safar added this to the Community milestone Apr 30, 2019
marek-safar added a commit that referenced this issue May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.