flacjacket / pywayland

Python bindings for the libwayland library
Apache License 2.0
79 stars 16 forks source link

new_id not implemented #33

Closed and3rson closed 3 months ago

and3rson commented 2 years ago

I'm trying to use wlr-foreign-toplevel-management-unstable-v1.xml and I'm getting this error:

Exception ignored from cffi callback <function dispatcher_func at 0x7f90641e6820>:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pywayland/dispatcher.py", line 41, in dispatcher_func
    args = self.dispatcher.messages[opcode].c_to_arguments(c_args)
  File "/usr/lib/python3.9/site-packages/pywayland/protocol_core/message.py", line 147, in c_to_arguments
    raise NotImplementedError

Relevant event:

    <event name="toplevel">
      <description summary="a toplevel has been created">
        This event is emitted whenever a new toplevel window is created. It
        is emitted for all toplevels, regardless of the app that has created
        them.

        All initial details of the toplevel(title, app_id, states, etc.) will
        be sent immediately after this event via the corresponding events in
        zwlr_foreign_toplevel_handle_v1.
      </description>
      <arg name="toplevel" type="new_id" interface="zwlr_foreign_toplevel_handle_v1"/>
    </event>

It seems like new_id type is not implemented in pywayland/protocol_core/message.py:145:

            elif argument.argument_type == ArgumentType.NewId:
                # TODO
                raise NotImplementedError

Any thoughts or plans on this? Thank you!

heuer commented 6 months ago

I ran into the same problem. Are there any plans to implement it? Almost all protocols, or at least the ones I am interested in, use new_id

heuer commented 6 months ago

@flacjacket, I attempted to address this issue with PR #64

Unfortunately, I couldn't think of a more elegant way to get the required WlDisplay object, so I'm trying to do it via the WlRegistry.

Please review.

heuer commented 6 months ago

@flacjacket, thoughts on this? Or a better idea how to get access to the WlDisplay?