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

wayland-server: Add ways of adding sockets to Display. #71

Closed
trissylegs opened this issue Oct 20, 2016 · 1 comment
Closed

wayland-server: Add ways of adding sockets to Display. #71

trissylegs opened this issue Oct 20, 2016 · 1 comment

Comments

@trissylegs
Copy link

trissylegs commented Oct 20, 2016

Wayland servers can have sockets added in several ways:

  • via wl_display_add_socket. Which either: uses a given display name, WAYLAND_DISPLAY or wayland-0. (In that order)
  • via wl_display_add_socket_auto. Which scans through $XDG_RUNTIME_DIR for an unused wayland-$d (where $d is < 32) and binds the first available.
  • via wl_display_add_socket_fd. Which accepts a file descriptor. This can be for:
    sockets created and passed in by parent for socket activation, (eg by systemd),
    or created specifically by the library user for fine grained control.

My initial thoughts:

The first method seems to be the documented behavior of create_display. But, I'm not seeing it happen. Although it may not be the best behavior. By which I mean create_display should probably only do what wl_display_create does (the get event loop is probably fine).

Perhaps adding add_socket methods to Display or EventLoop. eg:

  • fn add_socket(&mut self, name: Option<&OsStr>) -> Result<()>
    just calls wl_display_add_socket
  • fn add_socket_auto(&mut self) -> Result<String>
    calls wl_display_add_socket_auto. Returns the resulting string. (Which should be utf8, although an OsString might be better anyway)
  • fn add_socket_rawfd(&mut self, fd: RawFd) -> Result<()>
    calls wl_display_add_socket_fd with the passed fd.
  • fn add_socket_intofd<F>(&mut self, fd: F) -> Result<()> where F: IntoRawFd
    converts fd to a RawFd and calls add_socket_rawfd.
    This as a convience method for use with unix-sockets.

I might be able to do somethings about this, but I'm a bit busy over the next week or two.

@elinorbgr
Copy link
Member

Hmm, indeed, there is a doc issue on create_display, which really just creates a display. I'm not sure what I did here.

I completely agree with you here, I was planning to add these various methods at some point, in a quite similar way as you suggested. But I'm quite busy as well, an focused my efforts on wayland-client at first.

I'll add them as soon as I have the opportunity, should not be a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants