picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.57k stars 325 forks source link

[GTK2] the descendant from Scrollable does not receive the OnMouseMove event #895

Open Serg-Norseman opened 6 years ago

Serg-Norseman commented 6 years ago

[GTK2] the descendant from Scrollable receives the OnMouseMove event only if any mouse button is pressed, otherwise no event occurs. In the Wpf-platform everything is fine, the event comes.

Serg-Norseman commented 6 years ago

I did a little demo to show this problem. By the code below, the program behaves as follows: on the Wpf-platform both events come, everything is in order. On the Gtk platform, only a double click event occurs, but the mouse move event does not come. Eto version 2.3.0.0.

` using System; using Eto; using Eto.Forms;

namespace Test2.Wpf { class MyForm : Eto.Forms.Form { public MyForm() { this.ClientSize = new Eto.Drawing.Size(400, 300); this.Title = "Hello, Eto.Forms";

        var scrollable = new Scrollable();
        scrollable.MouseMove += (object sender, MouseEventArgs e) => {
            MessageBox.Show("MouseMove", "Event", MessageBoxType.Information);
        };
        scrollable.MouseDoubleClick += (object sender, MouseEventArgs e) => {
            MessageBox.Show("MouseDoubleClick", "Event", MessageBoxType.Information);
        };

        Content = scrollable;
    }
}

public class Program
{
    [STAThread]
    public static void Main(string[] args)
    {
        //var application = new Application(Platforms.Wpf);
        var application = new Application(Platforms.Gtk2);
        application.Run(new MyForm());
    }
}

} `

cwensley commented 6 years ago

Hm, yeah that might need a bit of tweaking to get some events to fire properly for Scrollable. What you can do is try attaching that to the Content of the scrollable instead, which may work better.

Thanks for reporting the issue!

Serg-Norseman commented 2 years ago

In Eto/Gtk, mouse events coming to Scrollable handlers have coordinates with the origin of the Scrollable control if no key is pressed and with the origin of the nested Canvas if any key is pressed.

In Eto/Wpf mouse events coming to Scrollable handlers always have coordinates with the origin of the Scrollable control.