On Thu, Feb 28, 2013 at 01:07:35PM +0200, Pekka Paalanen wrote: > On Wed, 27 Feb 2013 21:31:31 -0600 > Jason Ekstrand <[email protected]> wrote: > > > This patch goes along with the 4 wayland patches and updates weston to build > > against them. The main question I have here is what we should do with the > > shell surface and the input panel surface. For some reason, the creation of > > these two objects is split into two pieces. The wl_resource_init function > > really needs to be called in the first one so it can set up the destroy > > signal, > > however the second one is where the interface and implementaiton are > > assigned. > > In any case, this patch should work and allow weston to build. > > It looks like create_shell_surface() is called for two cases: > > 1. A client sends wl_shell.get_shell_surface, which is > handled in shell_get_shell_surfrace(). This will produce a real new > protocol object, which the wl_resource is needed for. > > 2. The xwayland window manager built into Weston. The X WM is not a > Wayland client, but it must use the shell operations. Hence, it creates > a shell_surface without the wl_resource, as there is no client to > create the protocol object for. Then it proceeds in calling the shell > functions via struct weston_shell_interface with this resourceless > shell_surface. > > I think it might be cleaner to not embed the wl_resource into > shell_surface, but to use wl_client_add_object() instead. That, of > course, would be a whole another patch. I just wonder, if the > shsurf->resource.destroy_signal is being used also in case 2; in that > case shell_surface would need its own destroy signal. *shrug*
Yeah, we use the destroy signal from the resource in both cases, but I'd be ok with using wl_client_add_object() and then adding a destroy signal to shell_surface. > I didn't look into input panel. Maybe it's the same, or maybe it just > copied shell_surface. Not sure, I don't think we use input panel from inside weston like we do for shell surface. Kristian > Thanks, > pq > > > Signed-off-by: Jason Ekstrand <[email protected]> > > --- > > src/compositor.c | 18 ++++++------------ > > src/shell.c | 14 +++++++------- > > src/tablet-shell.c | 16 ++++++---------- > > src/text-backend.c | 15 +++++---------- > > 4 files changed, 24 insertions(+), 39 deletions(-) > > > > diff --git a/src/compositor.c b/src/compositor.c > > index 5ff68d7..ca92e1f 100644 > > --- a/src/compositor.c > > +++ b/src/compositor.c > > @@ -1488,13 +1488,10 @@ compositor_create_surface(struct wl_client *client, > > return; > > } > > > > - surface->surface.resource.destroy = destroy_surface; > > + wl_resource_init(&surface->surface.resource, &wl_surface_interface, > > + &surface_interface, id, surface); > > > > - surface->surface.resource.object.id = id; > > - surface->surface.resource.object.interface = &wl_surface_interface; > > - surface->surface.resource.object.implementation = > > - (void (**)(void)) &surface_interface; > > - surface->surface.resource.data = surface; > > + surface->surface.resource.destroy = destroy_surface; > > > > wl_client_add_resource(client, &surface->surface.resource); > > } > > @@ -1555,13 +1552,10 @@ compositor_create_region(struct wl_client *client, > > return; > > } > > > > - region->resource.destroy = destroy_region; > > + wl_resource_init(®ion->resource, &wl_region_interface, > > + ®ion_interface, id, region); > > > > - region->resource.object.id = id; > > - region->resource.object.interface = &wl_region_interface; > > - region->resource.object.implementation = > > - (void (**)(void)) ®ion_interface; > > - region->resource.data = region; > > + region->resource.destroy = destroy_region; > > > > pixman_region32_init(®ion->region); > > > > diff --git a/src/shell.c b/src/shell.c > > index 6573038..9467483 100644 > > --- a/src/shell.c > > +++ b/src/shell.c > > @@ -2060,6 +2060,8 @@ create_shell_surface(void *shell, struct > > weston_surface *surface, > > return NULL; > > } > > > > + wl_resource_init(&shsurf->resource, NULL, NULL, 0, shsurf); > > + > > surface->configure = shell_surface_configure; > > surface->private = shsurf; > > > > @@ -2074,7 +2076,6 @@ create_shell_surface(void *shell, struct > > weston_surface *surface, > > shsurf->ping_timer = NULL; > > wl_list_init(&shsurf->fullscreen.transform.link); > > > > - wl_signal_init(&shsurf->resource.destroy_signal); > > shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy; > > wl_signal_add(&surface->surface.resource.destroy_signal, > > &shsurf->surface_destroy_listener); > > @@ -2125,9 +2126,7 @@ shell_get_shell_surface(struct wl_client *client, > > shsurf->resource.destroy = shell_destroy_shell_surface; > > shsurf->resource.object.id = id; > > shsurf->resource.object.interface = &wl_shell_surface_interface; > > - shsurf->resource.object.implementation = > > - (void (**)(void)) &shell_surface_implementation; > > - shsurf->resource.data = shsurf; > > + shsurf->resource.object.implementation = &shell_surface_implementation; > > > > wl_client_add_resource(client, &shsurf->resource); > > } > > @@ -3438,6 +3437,9 @@ create_input_panel_surface(struct desktop_shell > > *shell, > > if (!input_panel_surface) > > return NULL; > > > > + wl_resource_init(&input_panel_surface->resource, NULL, NULL, 0, > > + input_panel_surface); > > + > > surface->configure = input_panel_configure; > > surface->private = input_panel_surface; > > > > @@ -3445,7 +3447,6 @@ create_input_panel_surface(struct desktop_shell > > *shell, > > > > input_panel_surface->surface = surface; > > > > - wl_signal_init(&input_panel_surface->resource.destroy_signal); > > input_panel_surface->surface_destroy_listener.notify = > > input_panel_handle_surface_destroy; > > wl_signal_add(&surface->surface.resource.destroy_signal, > > &input_panel_surface->surface_destroy_listener); > > @@ -3508,8 +3509,7 @@ input_panel_get_input_panel_surface(struct wl_client > > *client, > > ipsurf->resource.object.id = id; > > ipsurf->resource.object.interface = &input_panel_surface_interface; > > ipsurf->resource.object.implementation = > > - (void (**)(void)) &input_panel_surface_implementation; > > - ipsurf->resource.data = ipsurf; > > + &input_panel_surface_implementation; > > > > wl_client_add_resource(client, &ipsurf->resource); > > } > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
