Dockable windows cannot be dragged below screen limits in Linux

Docking/MDI for Avalonia Forum

Posted 16 days ago by Muammer Buğra Kurnaz
Version: 25.2.0
Platform: .NET 8
Environment: Linux
Avatar

Hello. I am trying to evaluate the Docking/MDI features of Actipro controls. I have downloaded the sample browser app from github, and I can run it in Windows with no problems. However, when I use it in Linux, there is a problem. In tabbed MDI mode, I cannot drag a floating window below screen border. 

Steps to reproduce:

  1. Clone Actipro Avalonia-Controls from github. 
  2. Open Simple IDE Demo.
  3. Click and drag any document or tool window (such as Document2.txt) and try to drag it below the bottom screen limit. It will not go below the limit. 

Actual Behavior: The floating window cannot be dragged below the bottom screen limit. This makes docking tools to the hosts in the bottom of the screen very hard.

Expected Behavior: A floating window (as any window) should be draggable below the window to a certain extent. This is also the case in Windows and it works just fine when I have tried it Windows.

I have experienced the problem in Ubuntu 22.04 LTS. 

Thank you in advance.

Comments (3)

Answer - Posted 15 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thank you for evaluating our Docking/MDI controls, and we appreciate you sharing the experience you are having on Linux.  We can confirm that we are reproducing the same behavior.

Any docking solution that supports floating windows needs to be able to track the position of the pointer during a window drag.  Windows OS makes that easy.  Linux OS, unfortunately, does not expose any pointer events during a drag.  We are forced to work around this by not using native Linux drag and, instead, manually emulating a window drag by tracking change in pointer position and moving the window with the pointer.

What we discovered, and what you are seeing, is that the Linux window managers simply do not allow you to manually position a window that is not fully visible in the working area.  Native dragging allows it (which we can't use), but if you attempt to just set the window location it will always shift the window to be fully visible.  It's a great idea in principle, but clearly causing issues with our specific use case.  We reached out to the Avalonia team and they confirmed this is an issue with Linux.

We are going to continue to investigate to see if we can find a solution that improves this experience on Linux.

In the meantime, the good news is that even though the dragged window is blocking your view of what is behind it, our docking controls are still properly tracking the pointer location and you can successfully dock the window.  One option make it easier to know where the pointer is positioned is to make the dragged window semi-transparent.

You can actually test that out today by updating our the Simple IDE demo of our Sample Browser.  The DockSite control has a "WindowsDragging" event that is raised when drag begins and a "WindowsDragged" event that is raised at the end.  Update the OnDockSiteWindowsDragging event handler to insert this code at the top of the method.  It finds the parent Window that is being dragged and makes it semi-transparent.

/// <summary>
/// Occurs before one or more docking windows are dragged by the end user.
/// </summary>
/// <param name="sender">The sender of the event.</param>
/// <param name="e">The <c>DockingWindowsEventArgs</c> that contains data related to this event.</param>
private void OnDockSiteWindowsDragging(object sender, DockingWindowsEventArgs e) {
    if (((DockSite)sender).UseHostedFloatingWindows == false) {
        // Find the native window containing the docking window(s) being dragged
        var containerWindow = e.Windows.Select(w => w.GetVisualRoot() as Window).FirstOrDefault();
        if (containerWindow is not null)
            containerWindow.Opacity = 0.3;
    }
    // Additional logic here
}

Then update the OnDockSiteWindowsDragged event handler to restore the opacity:

/// <summary>
/// Occurs after one or more docking windows are dragged by the end user.
/// </summary>
/// <param name="sender">The sender of the event.</param>
/// <param name="e">The <c>DockingWindowsEventArgs</c> that contains data related to this event.</param>
private void OnDockSiteWindowsDragged(object sender, DockingWindowsEventArgs e) {
    if (((DockSite)sender).UseHostedFloatingWindows == false) {
        // Find the native window containing the docking window(s) being dragged
        var containerWindow = e.Windows.Select(w => w.GetVisualRoot() as Window).FirstOrDefault();
        if (containerWindow is not null)
            containerWindow.Opacity = 1.0;
    }
    // Additional logic here
}

This concept should help make the Linux issue less of an issue, and is a built-in feature we will plan on adding to the next release.  For Linux, we'll make sure this is turned on by default.


Actipro Software Support

Posted 13 days ago by Muammer Buğra Kurnaz
Avatar

Hi! Thank you for the quick response, I understand the limitation. Opacity is indeed a good idea. 

Posted 13 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The next release will include a DockSite.NonHostedFloatingWindowDragOpacity property that defaults to 0.3 on Linux and 1.0 on other operating systems.  This should improve the out-of-the-box experience of using our Docking/MDI controls on Linux.  Thanks, again, for bringing this to our attention.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.