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

Add a way to create drag-and-drop source #3229

Open
emilk opened this issue Nov 17, 2023 · 8 comments
Open

Add a way to create drag-and-drop source #3229

emilk opened this issue Nov 17, 2023 · 8 comments
Labels
S - api Design and usability

Comments

@emilk
Copy link
Contributor

emilk commented Nov 17, 2023

I want something like window.is_dragged() to check if a window is being dragged.

The use-case I want to support is docking of window: I want to check if one winit window is being dragged onto another winit window, and if so collapse one into the other.

@kchibisov
Copy link
Member

I don't think that's how it works? Maybe it's like that on macOS though, but I don't think it's how it's done in general.

if you're talking about firefox like tab dragging.

@kchibisov
Copy link
Member

It usually works with the help of Drag and Drop and you get notified that you dropped a window into another window by that basically. You also need to create a drag with some handle identifying your window.

@emilk
Copy link
Contributor Author

emilk commented Nov 17, 2023

That's exactly what I'm talking about - detaching a tab into a new window, then drag it back to the original window again.

@kchibisov
Copy link
Member

Yeah, you need drag and drop for that.

@emilk emilk changed the title Query a Window if it is being dragged Drag-and-drop one window onto another Nov 17, 2023
@emilk
Copy link
Contributor Author

emilk commented Nov 17, 2023

Thanks - I renamed the issue accordingly!

@kchibisov
Copy link
Member

I'm impressed that we don't have issue to create drag and drop source.

@kchibisov kchibisov added the S - api Design and usability label Nov 17, 2023
@kchibisov kchibisov changed the title Drag-and-drop one window onto another Add a way to create drag-and-drop source Nov 17, 2023
@kchibisov
Copy link
Member

kchibisov commented Nov 17, 2023

Just in general, winit needs a way to create drag and drop sources, then you'll natively get a notification that you've dropped something into window Y, then by determining what you've dropped you perform an action.

Let's say you define that DND source is of mime type egui/surface and you pass some identifier as a part of DND operation. Then you use that ID to delete a window (if it was standalone) and put a content in a subview you have.

You can also use that to move view out of a window(creating a new window for it), etc.

@kchibisov
Copy link
Member

The issue with all of that is that winit needs clipboard first, because DND sources are basically the same thing with a bit of extra as setting a custom surface along the drag and drop (you can draw a window preview there). But fundamentally it's the same things.

@kchibisov kchibisov added this to the Version 0.30.0 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S - api Design and usability
Development

No branches or pull requests

2 participants