Shell-private object information

Pekka Paalanen ppaalanen at gmail.com
Wed Nov 23 00:03:08 PST 2011


Hi Kristian,

yesterday in irc you sketched how the shell plugin could attach
shell-private information to surfaces. AFAIU:

- design a new wl_shell_surface interface

- clients should always create surfaces like this:
  1. call wl_compositor::create_surface to create a wl_surface
  2. call wl_shell::get_surface to create a wl_shell_surface from the
  wl_surface
  3. set surface type by calling wl_shell_surface::set_toplevel etc.
  4. attach a wl_buffer the first time (map the window)

(Note that we cannot use desktop_shell interface as that is reserved
for the desktop-shell client and is private.)

< krh> which will let shell.c create a custom struct per surface
< krh> it's almost like a cast
< krh> the idea is that the client will call into shell.c and give
you the private data directly

You suggested, that in the compositor, we could go from wl_surface
to wl_shell_surface by looking through the
wl_surface::resource.destroy_listener_list. What if we just added a
void *shell_priv; field to wlsc_surface to avoid going through a list?

The mapping between wl_surface and wl_shell_surface will probably have
to be 1:{0,1} anyway, so there would not be confusion in the shell
plugin if there were multiple wl_shell_surface with different
information for a single wl_surface.

Suppose the client destroys a wl_surface, what happens to the
corresponding wl_shell_surface? We cannot force-delete client side
views of the object, right?

Which brings me to think about wl_surface vs. wl_buffer. What happens
if the wl_buffer attached to a wl_surface gets destroyed?

Are both of these just considered as client programming errors?

Stepping back to my current work, I would probably need a shell-private
field in wlsc_output, too. How should I associate shell-private data to
a wlsc_output?

If you propose wl_shell_output, similar to wl_shell_surface, would that
not get out of hands very soon?

What if I needed shell-private data for wl_grab? wl_drag? wl_selection?
wl_input_device?


Thanks,
pq


More information about the wayland-devel mailing list