imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Support multi-viewport on Wayland via xdg-toplevel-drag

Open azonenberg opened this issue 7 months ago • 9 comments

Version/Branch of Dear ImGui:

latest docking

Back-ends:

any

Compiler, OS:

Linux

Full config/build information:

No response

Details:

Multi-viewport is currently not supported on Wayland (#8587 and others).

It appears that the new xdg-toplevel-drag protocol https://wayland.app/protocols/xdg-toplevel-drag-v1 is designed to enable exactly this sort of use case. Some new backend code would be needed to reflect the fact that we need to rely on drag/drop evens and can't use global coordinates to determine which window is being dragged where. But I disagree with previous statements that multi-viewport is impossible to implement on Wayland. This may have been true prior to the creation of xdg-toplevel-drag but if Firefox/Chrome can drag tabs into new windows and back, so can we.

Note that this will only be possible if the user is using a compositor implementing this protocol (e.g. KWin) so we will still need a check to disable multi-viewport if xdg-toplevel-drag is not available.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

azonenberg avatar May 01 '25 22:05 azonenberg

Hi All,

I'm working on a native Wayland backend for imgui (my project requires features SDL doesn't support), and I'd be interested in working on this.

Image

tokyovigilante avatar May 08 '25 21:05 tokyovigilante

this will be great since latest kde6 already try to drop the support of x11

GADDQ avatar Jun 22 '25 08:06 GADDQ

kde6 already try to drop the support of x11

While proper Wayland support is definitely valuable, this is not true. See this article:

Plasma’s X11 session continues to be maintained.

As for when Plasma will drop support for X11? There’s currently no firm timeline for this, and I certainly don’t expect it to happen in the next year, or even the next two years.

PathogenDavid avatar Jun 22 '25 15:06 PathogenDavid

We are very interested in this for ngscopeclient and I'm talking with a sponsor who is interested in funding work on this.

@tokyovigilante what are the features you want that SDL doesn't support? Are you interested in getting multi viewport on Wayland to work in the SDL and/or GLFW back ends (so we can have dual X11/Wayland functionality) in addition to the native Wayland one?

(the goal is to avoid having two separate backends we have to switch between at compile time or something, since AFAIK imgui doesn't let you do runtime backend swaps)

azonenberg avatar Jul 14 '25 05:07 azonenberg

(the goal is to avoid having two separate backends we have to switch between at compile time or something, since AFAIK imgui doesn't let you do runtime backend swaps)

Backends may be swapped at runtime.

ocornut avatar Jul 14 '25 07:07 ocornut

Ah ok, in that case it's plausible we could have a command line arg or config file setting or look for DISPLAY env variables to decide which to use and simply choosing between glfw for X11/macos/win32 and native wayland is plausible.

azonenberg avatar Jul 14 '25 15:07 azonenberg

We are very interested in this for ngscopeclient and I'm talking with a sponsor who is interested in funding work on this.

@tokyovigilante what are the features you want that SDL doesn't support?

I have an application that doesn't require a render loop and is instead event driven, so prefer an async display callback (which Wayland provides natively). I previously submitted a patch for this to SDL and it was not accepted.

I am also using some less common Wayland features such as direct scan-out and require a 10-bit color depth pipeline which makes it easier to use Wayland directly.

Are you interested in getting multi viewport on Wayland to work in the SDL and/or GLFW back ends (so we can have dual X11/Wayland functionality) in addition to the native Wayland one?

I'm not targeting any platform other than Wayland on Linux currently hence my work on a Wayland backend, however I don't see any reason why SDL and GLFW couldn't adopt similar code once it is written.

tokyovigilante avatar Jul 14 '25 19:07 tokyovigilante

Hello world. This topic was sent to the main developer of Kwin and co-author of wayland-protocols Xaver Hugl. Here is his answer

`Hi,

I don't think there's anything to say about this - they should definitely use xdg toplevel drag, but it doesn't look like anything's unclear on their side. Thanks for making me aware of it though, I'll follow the thread and if any questions come up I can answer them there.

  • Xaver`

alexeysvrv avatar Aug 03 '25 08:08 alexeysvrv

KDE Plasma is dropping the X11 session: https://blogs.kde.org/2025/11/26/going-all-in-on-a-wayland-future/

flying-sheep avatar Nov 27 '25 16:11 flying-sheep