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

Cannot redock DockWidgets on Wayland #451

Open
yaminb opened this issue Sep 27, 2023 · 13 comments
Open

Cannot redock DockWidgets on Wayland #451

yaminb opened this issue Sep 27, 2023 · 13 comments
Labels
linux Related specifically to Linux-based OSs qt Qt bugs or issues

Comments

@yaminb
Copy link

yaminb commented Sep 27, 2023

Steps to reproduce:

  1. Check View-FolderAsWorkspace
  2. Undock the FolderAsWorkspace Window
  3. You cannot redock it on the left pane as it original
@dail8859
Copy link
Owner

What OS and Notepad Next version are you using?

On Windows 10 and Notepad Next v0.6.3 it works fine for me.

@yaminb
Copy link
Author

yaminb commented Sep 27, 2023 via email

@dail8859
Copy link
Owner

Thanks for the info! I don't have access to any Linux platforms currently...hopefully someone else will be able to test this out.

@dail8859 dail8859 added the linux Related specifically to Linux-based OSs label Sep 27, 2023
@yaminb
Copy link
Author

yaminb commented Sep 27, 2023 via email

@dail8859
Copy link
Owner

@yaminb Any help would be greatly appreciated! 😄

@yaminb
Copy link
Author

yaminb commented Sep 27, 2023 via email

@dail8859 dail8859 added the qt Qt bugs or issues label Sep 27, 2023
@dail8859
Copy link
Owner

That's unfortunate to hear it is a Qt bug, but at least there is a known reason now! Thanks for looking into that!

@yaminb
Copy link
Author

yaminb commented Sep 27, 2023

Might be a silly question, but I'm using QT Creator. It came with QT 6.3.1.
Do you know how/where to download 6.7 or higher? I can try it and test it out to make sure that is fixed.
Surprisingly hard to find.

@dail8859
Copy link
Owner

According to https://wiki.qt.io/Qt_6.7_Release the first beta release isn't supposed to be available until December of this year and an official release is next March.

On Windows I use the Qt installer and v6.6 is in preview release still.

@yaminb
Copy link
Author

yaminb commented Sep 28, 2023

It's been a while since I developed in QT. Not sure if you can assist, but I tried to make the DockWidget to not be moved into a window if we're in wayland. I can add another check for the version of QT... but something is not right here.
It does set the feature flags and everything, yet the dockable windows can still be made floating (removed from the dock and into a window) This shouldn't be linux/wayland specific. Any ideas? I've tried placing code at other locatoins, but it doesn't seem to behave how I want it to. Seems pretty straight forward, but not behaving as such.

void MainWindow::applyPlatformWorkArounds()
{
    /* Linux Wayland does not play nice with Dockable Windows.
     * It is supposed to be fixed in QT 6.7 (unreleased)
     * see https://github.com/dail8859/NotepadNext/issues/451
     *  called after MainWindow(NotepadNextApplication *app)- after     restoreSettings();
     *
     * Disable undocking for this platform
     */

    if( QGuiApplication::platformName().compare("wayland")==0 )
    {
        QList<QDockWidget *> dockWidgets = findChildren<QDockWidget *>();

        for( int i=0; i < dockWidgets.count(); i++ )
        {
            QDockWidget* dw = dockWidgets.at(i);
            dw->setFloating(false);
            dw->setFeatures(dw->features() & (~QDockWidget::DockWidgetFloatable));
            dw->setFloating(false);
        }
    }


}

@dail8859
Copy link
Owner

I simplified it down a bit to just the findChildren() call and the loop and tested it on Windows.

If the QDockWidget is drug out it will "snap" back to the original position, or it will be dropped on whatever valid area it was hovering over. My assumption is that Qt temporarily creates a floating window for the animation. Possibly another Qt bug related to the floating widgets? Maybe turn off QDockWidget::DockWidgetMovable so it cannot be clicked and dragged.

Here is what your suggested code changes look like on Windows for reference:
dockwidget

@dail8859 dail8859 changed the title Cannot redock FilesAsFolders window Cannot redock DockWidgets on Wayland Sep 28, 2023
@yaminb
Copy link
Author

yaminb commented Sep 29, 2023

Yeah, QT is just not playing nice with wayland. Probably just wait till 6.7 release of QT and see if that fixes all this.

@dail8859
Copy link
Owner

@yaminb Thanks so much for looking into this and attempting at a possible workaround! We'll wait for v6.7 and keep our fingers crossed 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linux Related specifically to Linux-based OSs qt Qt bugs or issues
Projects
None yet
Development

No branches or pull requests

2 participants