Skip to content

egui_winit::State::new should not depend on &EventLoopWindowTarget just for wayland clipboard init #2912

Closed

Description

@lunixbochs

I cannot construct a egui_winit::State at all on egui HEAD, as of #2765.

I use egui in an actor model system I built that allows me to treat winit windows as actors. This works is great, it allows me to create and use multiple windows, and multiple instances of a single window type. I can also control these windows from any thread in my app. To make this work, I can't pass the EventLoopWindowTarget into an actor's window constructor, because my winit user_event references the message types for all of the actor types. No actor's constructor actually knows the concrete type of the EventLoopWindowTarget UserEvent, because I don't have a circular type dependency from each actor impl -> all actor definitions (I don't know if that's even possible).

I'm currently constructing egui_winit::State myself, without access to an EventLoopWindowTarget. I use my own ActorWindowTarget type, which implements HasRawDisplayHandle.

I also don't use egui_winit's clipboard support at all (I have my own clipboard backend that is constructed and managed entirely outside of the egui state).

I think a good solution is to switch from requiring an EventLoopWindowTarget handle, to just impl HasRawDisplayHandle (which is implemented by EventLoopWindowTarget), if all you're looking for is a wayland display handle.

Activity

  1. added
    bug
    on Apr 17, 2023
  2. bu5hm4nn commented on Jan 5, 2024

    @bu5hm4nn
    Contributor

    I believe this can be closed with the merge of #2914

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions