compositor: Make all exported objects wl_resources

dev
Kristian Høgsberg 13 years ago
parent 334182062f
commit 904055a652
  1. 118
      compositor/compositor.c
  2. 2
      compositor/compositor.h
  3. 73
      compositor/meego-tablet-shell.c
  4. 2
      compositor/screenshooter.c
  5. 135
      compositor/shell.c
  6. 44
      compositor/xserver-launcher.c

@ -241,7 +241,7 @@ wlsc_surface_create(struct wlsc_compositor *compositor,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
surface->surface.client = NULL; surface->surface.resource.client = NULL;
surface->compositor = compositor; surface->compositor = compositor;
surface->visual = NULL; surface->visual = NULL;
@ -339,7 +339,7 @@ wlsc_compositor_get_time(void)
} }
static void static void
destroy_surface(struct wl_resource *resource, struct wl_client *client) destroy_surface(struct wl_resource *resource)
{ {
struct wlsc_surface *surface = struct wlsc_surface *surface =
container_of(resource, struct wlsc_surface, surface.resource); container_of(resource, struct wlsc_surface, surface.resource);
@ -704,10 +704,8 @@ wlsc_buffer_post_release(struct wl_buffer *buffer)
if (buffer == NULL || --buffer->busy_count > 0) if (buffer == NULL || --buffer->busy_count > 0)
return; return;
assert(buffer->client != NULL); assert(buffer->resource.client != NULL);
wl_client_post_event(buffer->client, wl_resource_post_event(&buffer->resource, WL_BUFFER_RELEASE);
&buffer->resource.object,
WL_BUFFER_RELEASE);
} }
WL_EXPORT void WL_EXPORT void
@ -899,7 +897,6 @@ wlsc_output_repaint(struct wlsc_output *output)
struct wlsc_frame_callback { struct wlsc_frame_callback {
struct wl_resource resource; struct wl_resource resource;
struct wl_client *client;
struct wl_list link; struct wl_list link;
}; };
@ -917,11 +914,9 @@ repaint(void *data, int msecs)
output->present(output); output->present(output);
wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) { wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
wl_client_post_event(cb->client, &cb->resource.object, wl_resource_post_event(&cb->resource, WL_CALLBACK_DONE, msecs);
WL_CALLBACK_DONE, msecs); wl_resource_destroy(&cb->resource, 0);
wl_resource_destroy(&cb->resource, cb->client, 0);
} }
wl_list_init(&output->frame_callback_list);
wl_list_for_each_safe(animation, next, wl_list_for_each_safe(animation, next,
&compositor->animation_list, link) &compositor->animation_list, link)
@ -986,11 +981,9 @@ wlsc_compositor_fade(struct wlsc_compositor *compositor, float tint)
} }
static void static void
surface_destroy(struct wl_client *client, surface_destroy(struct wl_client *client, struct wl_resource *resource)
struct wl_surface *surface)
{ {
wl_resource_destroy(&surface->resource, client, wl_resource_destroy(resource, wlsc_compositor_get_time());
wlsc_compositor_get_time());
} }
WL_EXPORT void WL_EXPORT void
@ -1020,10 +1013,10 @@ wlsc_surface_assign_output(struct wlsc_surface *es)
static void static void
surface_attach(struct wl_client *client, surface_attach(struct wl_client *client,
struct wl_surface *surface, struct wl_buffer *buffer, struct wl_resource *resource, struct wl_buffer *buffer,
int32_t x, int32_t y) int32_t x, int32_t y)
{ {
struct wlsc_surface *es = (struct wlsc_surface *) surface; struct wlsc_surface *es = resource->data;
buffer->busy_count++; buffer->busy_count++;
wlsc_buffer_post_release(es->buffer); wlsc_buffer_post_release(es->buffer);
@ -1042,33 +1035,36 @@ surface_attach(struct wl_client *client,
wlsc_surface_configure(es, es->x + x, es->y + y, wlsc_surface_configure(es, es->x + x, es->y + y,
buffer->width, buffer->height); buffer->width, buffer->height);
wlsc_buffer_attach(buffer, surface); wlsc_buffer_attach(buffer, &es->surface);
es->compositor->shell->attach(es->compositor->shell, es); es->compositor->shell->attach(es->compositor->shell, es);
} }
static void static void
surface_damage(struct wl_client *client, surface_damage(struct wl_client *client,
struct wl_surface *surface, struct wl_resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height) int32_t x, int32_t y, int32_t width, int32_t height)
{ {
struct wlsc_surface *es = (struct wlsc_surface *) surface; struct wlsc_surface *es = resource->data;
wlsc_surface_damage_rectangle(es, x, y, width, height); wlsc_surface_damage_rectangle(es, x, y, width, height);
} }
static void static void
destroy_frame_callback(struct wl_resource *resource, struct wl_client *client) destroy_frame_callback(struct wl_resource *resource)
{ {
struct wlsc_frame_callback *cb = resource->data;
wl_list_remove(&cb->link);
free(resource); free(resource);
} }
static void static void
surface_frame(struct wl_client *client, surface_frame(struct wl_client *client,
struct wl_surface *surface, uint32_t callback) struct wl_resource *resource, uint32_t callback)
{ {
struct wlsc_frame_callback *cb; struct wlsc_frame_callback *cb;
struct wlsc_surface *es = (struct wlsc_surface *) surface; struct wlsc_surface *es = resource->data;
cb = malloc(sizeof *cb); cb = malloc(sizeof *cb);
if (cb == NULL) { if (cb == NULL) {
@ -1079,8 +1075,9 @@ surface_frame(struct wl_client *client,
cb->resource.object.interface = &wl_callback_interface; cb->resource.object.interface = &wl_callback_interface;
cb->resource.object.id = callback; cb->resource.object.id = callback;
cb->resource.destroy = destroy_frame_callback; cb->resource.destroy = destroy_frame_callback;
cb->resource.client = client;
cb->resource.data = cb;
wl_list_insert(es->output->frame_callback_list.prev, &cb->link); wl_list_insert(es->output->frame_callback_list.prev, &cb->link);
cb->client = client;
wl_client_add_resource(client, &cb->resource); wl_client_add_resource(client, &cb->resource);
} }
@ -1140,9 +1137,9 @@ wlsc_input_device_set_pointer_image(struct wlsc_input_device *device,
static void static void
compositor_create_surface(struct wl_client *client, compositor_create_surface(struct wl_client *client,
struct wl_compositor *compositor, uint32_t id) struct wl_resource *resource, uint32_t id)
{ {
struct wlsc_compositor *ec = (struct wlsc_compositor *) compositor; struct wlsc_compositor *ec = resource->data;
struct wlsc_surface *surface; struct wlsc_surface *surface;
surface = wlsc_surface_create(ec, 0, 0, 0, 0); surface = wlsc_surface_create(ec, 0, 0, 0, 0);
@ -1157,7 +1154,7 @@ compositor_create_surface(struct wl_client *client,
surface->surface.resource.object.interface = &wl_surface_interface; surface->surface.resource.object.interface = &wl_surface_interface;
surface->surface.resource.object.implementation = surface->surface.resource.object.implementation =
(void (**)(void)) &surface_interface; (void (**)(void)) &surface_interface;
surface->surface.client = client; surface->surface.resource.data = surface;
wl_client_add_resource(client, &surface->surface.resource); wl_client_add_resource(client, &surface->surface.resource);
} }
@ -1182,7 +1179,7 @@ pick_surface(struct wl_input_device *device, int32_t *sx, int32_t *sy)
struct wlsc_surface *es; struct wlsc_surface *es;
wl_list_for_each(es, &ec->surface_list, link) { wl_list_for_each(es, &ec->surface_list, link) {
if (es->surface.client == NULL) if (es->surface.resource.client == NULL)
continue; continue;
wlsc_surface_transform(es, device->x, device->y, sx, sy); wlsc_surface_transform(es, device->x, device->y, sx, sy);
if (0 <= *sx && *sx < es->width && if (0 <= *sx && *sx < es->width &&
@ -1203,21 +1200,25 @@ motion_grab_motion(struct wl_grab *grab,
struct wlsc_surface *es = struct wlsc_surface *es =
(struct wlsc_surface *) device->input_device.pointer_focus; (struct wlsc_surface *) device->input_device.pointer_focus;
int32_t sx, sy; int32_t sx, sy;
struct wl_resource *resource;
resource = grab->input_device->pointer_focus_resource;
if (resource) {
wlsc_surface_transform(es, x, y, &sx, &sy); wlsc_surface_transform(es, x, y, &sx, &sy);
wl_client_post_event(es->surface.client, wl_resource_post_event(resource, WL_INPUT_DEVICE_MOTION,
&device->input_device.object,
WL_INPUT_DEVICE_MOTION,
time, x, y, sx, sy); time, x, y, sx, sy);
} }
}
static void static void
motion_grab_button(struct wl_grab *grab, motion_grab_button(struct wl_grab *grab,
uint32_t time, int32_t button, int32_t state) uint32_t time, int32_t button, int32_t state)
{ {
wl_client_post_event(grab->input_device->pointer_focus->client, struct wl_resource *resource;
&grab->input_device->object,
WL_INPUT_DEVICE_BUTTON, resource = grab->input_device->pointer_focus_resource;
if (resource)
wl_resource_post_event(resource, WL_INPUT_DEVICE_BUTTON,
time, button, state); time, button, state);
} }
@ -1330,9 +1331,8 @@ notify_motion(struct wl_input_device *device, uint32_t time, int x, int y)
wl_input_device_set_pointer_focus(device, wl_input_device_set_pointer_focus(device,
&es->surface, &es->surface,
time, x, y, sx, sy); time, x, y, sx, sy);
if (es) if (device->pointer_focus_resource)
wl_client_post_event(es->surface.client, wl_resource_post_event(device->pointer_focus_resource,
&device->object,
WL_INPUT_DEVICE_MOTION, WL_INPUT_DEVICE_MOTION,
time, x, y, sx, sy); time, x, y, sx, sy);
} }
@ -1518,9 +1518,8 @@ notify_key(struct wl_input_device *device,
*k = key; *k = key;
} }
if (device->keyboard_focus != NULL) if (device->keyboard_focus_resource)
wl_client_post_event(device->keyboard_focus->client, wl_resource_post_event(device->keyboard_focus_resource,
&device->object,
WL_INPUT_DEVICE_KEY, time, key, state); WL_INPUT_DEVICE_KEY, time, key, state);
} }
@ -1583,7 +1582,7 @@ notify_keyboard_focus(struct wl_input_device *device,
update_modifier_state(wd, *k, 1); update_modifier_state(wd, *k, 1);
} }
if (es->surface.client) if (es->surface.resource.client)
wl_input_device_set_keyboard_focus(&wd->input_device, wl_input_device_set_keyboard_focus(&wd->input_device,
&es->surface, time); &es->surface, time);
} else { } else {
@ -1600,18 +1599,17 @@ notify_keyboard_focus(struct wl_input_device *device,
static void static void
input_device_attach(struct wl_client *client, input_device_attach(struct wl_client *client,
struct wl_input_device *device_base, struct wl_resource *resource,
uint32_t time, uint32_t time,
struct wl_buffer *buffer, int32_t x, int32_t y) struct wl_buffer *buffer, int32_t x, int32_t y)
{ {
struct wlsc_input_device *device = struct wlsc_input_device *device = resource->data;
(struct wlsc_input_device *) device_base;
if (time < device->input_device.pointer_focus_time) if (time < device->input_device.pointer_focus_time)
return; return;
if (device->input_device.pointer_focus == NULL) if (device->input_device.pointer_focus == NULL)
return; return;
if (device->input_device.pointer_focus->client != client) if (device->input_device.pointer_focus->resource.client != client)
return; return;
if (buffer == NULL) { if (buffer == NULL) {
@ -1633,11 +1631,14 @@ wlsc_input_device_init(struct wlsc_input_device *device,
{ {
wl_input_device_init(&device->input_device, &ec->compositor); wl_input_device_init(&device->input_device, &ec->compositor);
device->input_device.object.interface = &wl_input_device_interface; device->input_device.resource.object.interface = &wl_input_device_interface;
device->input_device.object.implementation = device->input_device.resource.object.implementation =
(void (**)(void)) &input_device_interface; (void (**)(void)) &input_device_interface;
wl_display_add_object(ec->wl_display, &device->input_device.object); device->input_device.resource.data = device;
wl_display_add_global(ec->wl_display, &device->input_device.object, NULL); wl_display_add_object(ec->wl_display,
&device->input_device.resource.object);
wl_display_add_global(ec->wl_display,
&device->input_device.resource.object, NULL);
device->sprite = wlsc_surface_create(ec, device->sprite = wlsc_surface_create(ec,
device->input_device.x, device->input_device.x,
@ -1660,10 +1661,11 @@ wlsc_output_post_geometry(struct wl_client *client,
struct wl_object *global, uint32_t version) struct wl_object *global, uint32_t version)
{ {
struct wlsc_output *output = struct wlsc_output *output =
container_of(global, struct wlsc_output, object); container_of(global, struct wlsc_output, resource.object);
struct wlsc_mode *mode; struct wlsc_mode *mode;
wl_client_post_event(client, global, output->resource.client = client;
wl_resource_post_event(&output->resource,
WL_OUTPUT_GEOMETRY, WL_OUTPUT_GEOMETRY,
output->x, output->x,
output->y, output->y,
@ -1673,10 +1675,12 @@ wlsc_output_post_geometry(struct wl_client *client,
output->make, output->model); output->make, output->model);
wl_list_for_each (mode, &output->mode_list, link) { wl_list_for_each (mode, &output->mode_list, link) {
wl_client_post_event(client, global, wl_resource_post_event(&output->resource,
WL_OUTPUT_MODE, WL_OUTPUT_MODE,
mode->flags, mode->flags,
mode->width, mode->height, mode->refresh); mode->width,
mode->height,
mode->refresh);
} }
} }
@ -1796,7 +1800,7 @@ wlsc_output_destroy(struct wlsc_output *output)
{ {
pixman_region32_fini(&output->region); pixman_region32_fini(&output->region);
pixman_region32_fini(&output->previous_damage); pixman_region32_fini(&output->previous_damage);
destroy_surface(&output->background->surface.resource, NULL); destroy_surface(&output->background->surface.resource);
} }
WL_EXPORT void WL_EXPORT void
@ -1856,9 +1860,9 @@ wlsc_output_init(struct wlsc_output *output, struct wlsc_compositor *c,
wl_list_init(&output->scanout_buffer_destroy_listener.link); wl_list_init(&output->scanout_buffer_destroy_listener.link);
wl_list_init(&output->frame_callback_list); wl_list_init(&output->frame_callback_list);
output->object.interface = &wl_output_interface; output->resource.object.interface = &wl_output_interface;
wl_display_add_object(c->wl_display, &output->object); wl_display_add_object(c->wl_display, &output->resource.object);
wl_display_add_global(c->wl_display, &output->object, wl_display_add_global(c->wl_display, &output->resource.object,
wlsc_output_post_geometry); wlsc_output_post_geometry);
} }

@ -61,7 +61,7 @@ struct wlsc_mode {
}; };
struct wlsc_output { struct wlsc_output {
struct wl_object object; struct wl_resource resource;
struct wl_list link; struct wl_list link;
struct wlsc_compositor *compositor; struct wlsc_compositor *compositor;
struct wlsc_surface *background; struct wlsc_surface *background;

@ -47,7 +47,7 @@ enum {
}; };
struct meego_tablet_shell { struct meego_tablet_shell {
struct wl_object object; struct wl_resource resource;
struct wlsc_shell shell; struct wlsc_shell shell;
@ -224,12 +224,12 @@ meego_tablet_shell_attach(struct wlsc_shell *base,
if (shell->state == STATE_STARTING) { if (shell->state == STATE_STARTING) {
meego_tablet_shell_set_state(shell, STATE_LOCKED); meego_tablet_shell_set_state(shell, STATE_LOCKED);
shell->previous_state = STATE_HOME; shell->previous_state = STATE_HOME;
wl_client_post_event(shell->client, &shell->object, wl_resource_post_event(&shell->resource,
MEEGO_TABLET_SHELL_SHOW_LOCKSCREEN); MEEGO_TABLET_SHELL_SHOW_LOCKSCREEN);
} }
} else if (shell->current_client && } else if (shell->current_client &&
shell->current_client->surface != surface && shell->current_client->surface != surface &&
shell->current_client->client == surface->surface.client) { shell->current_client->client == surface->surface.resource.client) {
meego_tablet_shell_set_state(shell, STATE_TASK); meego_tablet_shell_set_state(shell, STATE_TASK);
shell->current_client->surface = surface; shell->current_client->surface = surface;
meego_tablet_zoom_run(shell, surface, 0.3, 1.0); meego_tablet_zoom_run(shell, surface, 0.3, 1.0);
@ -250,9 +250,10 @@ handle_lockscreen_surface_destroy(struct wl_listener *listener,
static void static void
tablet_shell_set_lockscreen(struct wl_client *client, tablet_shell_set_lockscreen(struct wl_client *client,
struct meego_tablet_shell *shell, struct wl_resource *resource,
struct wl_surface *surface) struct wl_surface *surface)
{ {
struct meego_tablet_shell *shell = resource->data;
struct wlsc_surface *es = (struct wlsc_surface *) surface; struct wlsc_surface *es = (struct wlsc_surface *) surface;
struct wlsc_input_device *device = struct wlsc_input_device *device =
(struct wlsc_input_device *) shell->compositor->input_device; (struct wlsc_input_device *) shell->compositor->input_device;
@ -282,9 +283,10 @@ handle_switcher_surface_destroy(struct wl_listener *listener,
static void static void
tablet_shell_set_switcher(struct wl_client *client, tablet_shell_set_switcher(struct wl_client *client,
struct meego_tablet_shell *shell, struct wl_resource *resource,
struct wl_surface *surface) struct wl_surface *surface)
{ {
struct meego_tablet_shell *shell = resource->data;
struct wlsc_input_device *device = struct wlsc_input_device *device =
(struct wlsc_input_device *) shell->compositor->input_device; (struct wlsc_input_device *) shell->compositor->input_device;
struct wlsc_surface *es = (struct wlsc_surface *) surface; struct wlsc_surface *es = (struct wlsc_surface *) surface;
@ -306,9 +308,10 @@ tablet_shell_set_switcher(struct wl_client *client,
static void static void
tablet_shell_set_homescreen(struct wl_client *client, tablet_shell_set_homescreen(struct wl_client *client,
struct meego_tablet_shell *shell, struct wl_resource *resource,
struct wl_surface *surface) struct wl_surface *surface)
{ {
struct meego_tablet_shell *shell = resource->data;
struct wlsc_input_device *device = struct wlsc_input_device *device =
(struct wlsc_input_device *) shell->compositor->input_device; (struct wlsc_input_device *) shell->compositor->input_device;
@ -366,22 +369,26 @@ meego_tablet_shell_switch_to(struct meego_tablet_shell *shell,
static void static void
tablet_shell_show_grid(struct wl_client *client, tablet_shell_show_grid(struct wl_client *client,
struct meego_tablet_shell *shell, struct wl_resource *resource,
struct wl_surface *surface) struct wl_surface *surface)
{ {
struct meego_tablet_shell *shell = resource->data;
meego_tablet_shell_switch_to(shell, (struct wlsc_surface *) surface); meego_tablet_shell_switch_to(shell, (struct wlsc_surface *) surface);
} }
static void static void
tablet_shell_show_panels(struct wl_client *client, tablet_shell_show_panels(struct wl_client *client,
struct meego_tablet_shell *shell, struct wl_resource *resource,
struct wl_surface *surface) struct wl_surface *surface)
{ {
struct meego_tablet_shell *shell = resource->data;
meego_tablet_shell_switch_to(shell, (struct wlsc_surface *) surface); meego_tablet_shell_switch_to(shell, (struct wlsc_surface *) surface);
} }
static void static void
destroy_tablet_client(struct wl_resource *resource, struct wl_client *client) destroy_tablet_client(struct wl_resource *resource)
{ {
struct meego_tablet_client *tablet_client = struct meego_tablet_client *tablet_client =
container_of(resource, struct meego_tablet_client, resource); container_of(resource, struct meego_tablet_client, resource);
@ -391,17 +398,15 @@ destroy_tablet_client(struct wl_resource *resource, struct wl_client *client)
} }
static void static void
tablet_client_destroy(struct wl_client *client, tablet_client_destroy(struct wl_client *client, struct wl_resource *resource)
struct meego_tablet_client *tablet_client)
{ {
wl_resource_destroy(&tablet_client->resource, wl_resource_destroy(resource, wlsc_compositor_get_time());
client, wlsc_compositor_get_time());
} }
static void static void
tablet_client_activate(struct wl_client *client, tablet_client_activate(struct wl_client *client, struct wl_resource *resource)
struct meego_tablet_client *tablet_client)
{ {
struct meego_tablet_client *tablet_client = resource->data;
struct meego_tablet_shell *shell = tablet_client->shell; struct meego_tablet_shell *shell = tablet_client->shell;
shell->current_client = tablet_client; shell->current_client = tablet_client;
@ -418,9 +423,10 @@ static const struct meego_tablet_client_interface tablet_client_interface = {
static void static void
tablet_shell_create_client(struct wl_client *client, tablet_shell_create_client(struct wl_client *client,
struct meego_tablet_shell *shell, struct wl_resource *resource,
uint32_t id, const char *name, int fd) uint32_t id, const char *name, int fd)
{ {
struct meego_tablet_shell *shell = resource->data;
struct wlsc_compositor *compositor = shell->compositor; struct wlsc_compositor *compositor = shell->compositor;
struct meego_tablet_client *tablet_client; struct meego_tablet_client *tablet_client;
@ -508,11 +514,11 @@ toggle_switcher(struct meego_tablet_shell *shell)
{ {
switch (shell->state) { switch (shell->state) {
case STATE_SWITCHER: case STATE_SWITCHER:
wl_client_post_event(shell->client, &shell->object, wl_resource_post_event(&shell->resource,
MEEGO_TABLET_SHELL_HIDE_SWITCHER); MEEGO_TABLET_SHELL_HIDE_SWITCHER);
break; break;
default: default:
wl_client_post_event(shell->client, &shell->object, wl_resource_post_event(&shell->resource,
MEEGO_TABLET_SHELL_SHOW_SWITCHER); MEEGO_TABLET_SHELL_SHOW_SWITCHER);
meego_tablet_shell_set_state(shell, STATE_SWITCHER); meego_tablet_shell_set_state(shell, STATE_SWITCHER);
break; break;
@ -528,10 +534,10 @@ meego_tablet_shell_lock(struct wlsc_shell *base)
if (shell->state == STATE_LOCKED) if (shell->state == STATE_LOCKED)
return; return;
if (shell->state == STATE_SWITCHER) if (shell->state == STATE_SWITCHER)
wl_client_post_event(shell->client, &shell->object, wl_resource_post_event(&shell->resource,
MEEGO_TABLET_SHELL_HIDE_SWITCHER); MEEGO_TABLET_SHELL_HIDE_SWITCHER);
wl_client_post_event(shell->client, &shell->object, wl_resource_post_event(&shell->resource,
MEEGO_TABLET_SHELL_SHOW_LOCKSCREEN); MEEGO_TABLET_SHELL_SHOW_LOCKSCREEN);
meego_tablet_shell_set_state(shell, STATE_LOCKED); meego_tablet_shell_set_state(shell, STATE_LOCKED);
@ -544,7 +550,7 @@ go_home(struct meego_tablet_shell *shell)
(struct wlsc_input_device *) shell->compositor->input_device; (struct wlsc_input_device *) shell->compositor->input_device;
if (shell->state == STATE_SWITCHER) if (shell->state == STATE_SWITCHER)
wl_client_post_event(shell->client, &shell->object, wl_resource_post_event(&shell->resource,
MEEGO_TABLET_SHELL_HIDE_SWITCHER); MEEGO_TABLET_SHELL_HIDE_SWITCHER);
wlsc_surface_activate(shell->home_surface, device, wlsc_surface_activate(shell->home_surface, device,
@ -615,6 +621,22 @@ meego_tablet_shell_set_selection_focus(struct wlsc_shell *shell,
{ {
} }
static void
bind_shell(struct wl_client *client,
struct wl_object *global, uint32_t version)
{
struct meego_tablet_shell *shell =
container_of(global,
struct meego_tablet_shell, resource.object);
if (shell->client != client)
/* Throw an error or just let the client fail when it
* tries to access the object?. */
return;
shell->resource.client = client;
}
void void
shell_init(struct wlsc_compositor *compositor); shell_init(struct wlsc_compositor *compositor);
@ -631,13 +653,14 @@ shell_init(struct wlsc_compositor *compositor)
memset(shell, 0, sizeof *shell); memset(shell, 0, sizeof *shell);
shell->compositor = compositor; shell->compositor = compositor;
shell->object.interface = &meego_tablet_shell_interface; shell->resource.object.interface = &meego_tablet_shell_interface;
shell->object.implementation = shell->resource.object.implementation =
(void (**)(void)) &tablet_shell_interface; (void (**)(void)) &tablet_shell_interface;
wl_display_add_object(compositor->wl_display, &shell->object); wl_display_add_object(compositor->wl_display, &shell->resource.object);
/* FIXME: This will make the object available to all clients. */ /* FIXME: This will make the object available to all clients. */
wl_display_add_global(compositor->wl_display, &shell->object, NULL); wl_display_add_global(compositor->wl_display,
&shell->resource.object, bind_shell);
loop = wl_display_get_event_loop(compositor->wl_display); loop = wl_display_get_event_loop(compositor->wl_display);
shell->long_press_source = shell->long_press_source =

@ -28,7 +28,7 @@ struct screenshooter {
static void static void
screenshooter_shoot(struct wl_client *client, screenshooter_shoot(struct wl_client *client,
struct screenshooter *shooter, struct wl_resource *resource,
struct wl_output *output_base, struct wl_buffer *buffer) struct wl_output *output_base, struct wl_buffer *buffer)
{ {
struct wlsc_output *output = (struct wlsc_output *) output_base; struct wlsc_output *output = (struct wlsc_output *) output_base;

@ -77,7 +77,7 @@ static const struct wl_grab_interface move_grab_interface = {
}; };
static void static void
shell_move(struct wl_client *client, struct wl_shell *shell, shell_move(struct wl_client *client, struct wl_resource *resource,
struct wl_surface *surface, struct wl_surface *surface,
struct wl_input_device *device, uint32_t time) struct wl_input_device *device, uint32_t time)
{ {
@ -112,6 +112,7 @@ struct wlsc_resize_grab {
int32_t dx, dy, width, height; int32_t dx, dy, width, height;
struct wlsc_surface *surface; struct wlsc_surface *surface;
struct wl_shell *shell; struct wl_shell *shell;
struct wl_resource resource;
}; };
static void static void
@ -139,7 +140,7 @@ resize_grab_motion(struct wl_grab *grab,
height = resize->height; height = resize->height;
} }
wl_client_post_event(surface->client, &resize->shell->object, wl_resource_post_event(&resize->resource,
WL_SHELL_CONFIGURE, time, resize->edges, WL_SHELL_CONFIGURE, time, resize->edges,
surface, width, height); surface, width, height);
} }
@ -171,10 +172,11 @@ static const struct wl_grab_interface resize_grab_interface = {
}; };
static void static void
shell_resize(struct wl_client *client, struct wl_shell *shell, shell_resize(struct wl_client *client, struct wl_resource *resource,
struct wl_surface *surface, struct wl_surface *surface,
struct wl_input_device *device, uint32_t time, uint32_t edges) struct wl_input_device *device, uint32_t time, uint32_t edges)
{ {
struct wl_shell *shell = resource->data;
struct wlsc_input_device *wd = (struct wlsc_input_device *) device; struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
struct wlsc_resize_grab *resize; struct wlsc_resize_grab *resize;
enum wlsc_pointer_type pointer = WLSC_POINTER_LEFT_PTR; enum wlsc_pointer_type pointer = WLSC_POINTER_LEFT_PTR;
@ -197,6 +199,9 @@ shell_resize(struct wl_client *client, struct wl_shell *shell,
resize->surface = es; resize->surface = es;
resize->shell = shell; resize->shell = shell;
resize->resource.object = resource->object;
resize->resource.client = client;
if (edges == 0 || edges > 15 || if (edges == 0 || edges > 15 ||
(edges & 3) == 3 || (edges & 12) == 12) (edges & 3) == 3 || (edges & 12) == 12)
return; return;
@ -238,7 +243,7 @@ shell_resize(struct wl_client *client, struct wl_shell *shell,
static void static void
shell_set_toplevel(struct wl_client *client, shell_set_toplevel(struct wl_client *client,
struct wl_shell *wl_shell, struct wl_resource *resource,
struct wl_surface *surface) struct wl_surface *surface)
{ {
@ -263,7 +268,7 @@ shell_set_toplevel(struct wl_client *client,
static void static void
shell_set_transient(struct wl_client *client, shell_set_transient(struct wl_client *client,
struct wl_shell *wl_shell, struct wl_resource *resource,
struct wl_surface *surface, struct wl_surface *surface,
struct wl_surface *parent, struct wl_surface *parent,
int x, int y, uint32_t flags) int x, int y, uint32_t flags)
@ -283,7 +288,7 @@ shell_set_transient(struct wl_client *client,
static void static void
shell_set_fullscreen(struct wl_client *client, shell_set_fullscreen(struct wl_client *client,
struct wl_shell *wl_shell, struct wl_resource *resource,
struct wl_surface *surface) struct wl_surface *surface)
{ {
@ -306,7 +311,7 @@ shell_set_fullscreen(struct wl_client *client,
} }
static void static void
destroy_drag(struct wl_resource *resource, struct wl_client *client) destroy_drag(struct wl_resource *resource)
{ {
struct wl_drag *drag = struct wl_drag *drag =
container_of(resource, struct wl_drag, resource); container_of(resource, struct wl_drag, resource);
@ -331,28 +336,27 @@ wl_drag_set_pointer_focus(struct wl_drag *drag,
return; return;
if (drag->drag_focus && if (drag->drag_focus &&
(!surface || drag->drag_focus->client != surface->client)) (!surface ||
wl_client_post_event(drag->drag_focus->client, drag->drag_focus->resource.client != surface->resource.client))
&drag->drag_offer.object, wl_resource_post_event(&drag->drag_offer.resource,
WL_DRAG_OFFER_POINTER_FOCUS, WL_DRAG_OFFER_POINTER_FOCUS,
time, NULL, 0, 0, 0, 0); time, NULL, 0, 0, 0, 0);
if (surface && if (surface &&
(!drag->drag_focus || (!drag->drag_focus ||
drag->drag_focus->client != surface->client)) { drag->drag_focus->resource.client != surface->resource.client)) {
wl_client_post_global(surface->client, wl_client_post_global(surface->resource.client,
&drag->drag_offer.object); &drag->drag_offer.resource.object);
drag->drag_offer.resource.client = surface->resource.client;
end = drag->types.data + drag->types.size; end = drag->types.data + drag->types.size;
for (p = drag->types.data; p < end; p++) for (p = drag->types.data; p < end; p++)
wl_client_post_event(surface->client, wl_resource_post_event(&drag->drag_offer.resource,
&drag->drag_offer.object,
WL_DRAG_OFFER_OFFER, *p); WL_DRAG_OFFER_OFFER, *p);
} }
if (surface) { if (surface) {
wl_client_post_event(surface->client, wl_resource_post_event(&drag->drag_offer.resource,
&drag->drag_offer.object,
WL_DRAG_OFFER_POINTER_FOCUS, WL_DRAG_OFFER_POINTER_FOCUS,
time, surface, time, surface,
x, y, sx, sy); x, y, sx, sy);
@ -370,9 +374,10 @@ wl_drag_set_pointer_focus(struct wl_drag *drag,
} }
static void static void
drag_offer_accept(struct wl_client *client, drag_offer_accept(struct wl_client *client, struct wl_resource *resource,
struct wl_drag_offer *offer, uint32_t time, const char *type) uint32_t time, const char *type)
{ {
struct wl_drag_offer *offer = resource->data;
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer);
char **p, **end; char **p, **end;
@ -391,28 +396,27 @@ drag_offer_accept(struct wl_client *client,
if (type && strcmp(*p, type) == 0) if (type && strcmp(*p, type) == 0)
drag->type = *p; drag->type = *p;
wl_client_post_event(drag->source->client, &drag->resource.object, wl_resource_post_event(&drag->resource, WL_DRAG_TARGET, drag->type);
WL_DRAG_TARGET, drag->type);
} }
static void static void
drag_offer_receive(struct wl_client *client, drag_offer_receive(struct wl_client *client,
struct wl_drag_offer *offer, int fd) struct wl_resource *resource, int fd)
{ {
struct wl_drag_offer *offer = resource->data;
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer);
wl_client_post_event(drag->source->client, &drag->resource.object, wl_resource_post_event(&drag->resource, WL_DRAG_FINISH, fd);
WL_DRAG_FINISH, fd);
close(fd); close(fd);
} }
static void static void
drag_offer_reject(struct wl_client *client, struct wl_drag_offer *offer) drag_offer_reject(struct wl_client *client, struct wl_resource *resource)
{ {
struct wl_drag_offer *offer = resource->data;
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer); struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer);
wl_client_post_event(drag->source->client, &drag->resource.object, wl_resource_post_event(&drag->resource, WL_DRAG_REJECT);
WL_DRAG_REJECT);
} }
static const struct wl_drag_offer_interface drag_offer_interface = { static const struct wl_drag_offer_interface drag_offer_interface = {
@ -422,8 +426,10 @@ static const struct wl_drag_offer_interface drag_offer_interface = {
}; };
static void static void
drag_offer(struct wl_client *client, struct wl_drag *drag, const char *type) drag_offer(struct wl_client *client,
struct wl_resource *resource, const char *type)
{ {
struct wl_drag *drag = resource->data;
char **p; char **p;
p = wl_array_add(&drag->types, sizeof *p); p = wl_array_add(&drag->types, sizeof *p);
@ -444,8 +450,7 @@ drag_grab_motion(struct wl_grab *grab,
es = pick_surface(grab->input_device, &sx, &sy); es = pick_surface(grab->input_device, &sx, &sy);
wl_drag_set_pointer_focus(drag, &es->surface, time, x, y, sx, sy); wl_drag_set_pointer_focus(drag, &es->surface, time, x, y, sx, sy);
if (es) if (es)
wl_client_post_event(es->surface.client, wl_resource_post_event(&drag->drag_offer.resource,
&drag->drag_offer.object,
WL_DRAG_OFFER_MOTION, WL_DRAG_OFFER_MOTION,
time, x, y, sx, sy); time, x, y, sx, sy);
} }
@ -465,8 +470,7 @@ drag_grab_end(struct wl_grab *grab, uint32_t time)
int32_t sx, sy; int32_t sx, sy;
if (drag->target) if (drag->target)
wl_client_post_event(drag->target, wl_resource_post_event(&drag->drag_offer.resource,
&drag->drag_offer.object,
WL_DRAG_OFFER_DROP); WL_DRAG_OFFER_DROP);
wl_drag_set_pointer_focus(drag, NULL, time, 0, 0, 0, 0); wl_drag_set_pointer_focus(drag, NULL, time, 0, 0, 0, 0);
@ -485,10 +489,11 @@ static const struct wl_grab_interface drag_grab_interface = {
static void static void
drag_activate(struct wl_client *client, drag_activate(struct wl_client *client,
struct wl_drag *drag, struct wl_resource *resource,
struct wl_surface *surface, struct wl_surface *surface,
struct wl_input_device *device, uint32_t time) struct wl_input_device *device, uint32_t time)
{ {
struct wl_drag *drag = resource->data;
struct wl_display *display = wl_client_get_display (client); struct wl_display *display = wl_client_get_display (client);
struct wlsc_surface *target; struct wlsc_surface *target;
int32_t sx, sy; int32_t sx, sy;
@ -501,11 +506,11 @@ drag_activate(struct wl_client *client,
drag->source = surface; drag->source = surface;
drag->drag_offer.object.interface = &wl_drag_offer_interface; drag->drag_offer.resource.object.interface = &wl_drag_offer_interface;
drag->drag_offer.object.implementation = drag->drag_offer.resource.object.implementation =
(void (**)(void)) &drag_offer_interface; (void (**)(void)) &drag_offer_interface;
wl_display_add_object(display, &drag->drag_offer.object); wl_display_add_object(display, &drag->drag_offer.resource.object);
target = pick_surface(device, &sx, &sy); target = pick_surface(device, &sx, &sy);
wl_input_device_set_pointer_focus(device, NULL, time, 0, 0, 0, 0); wl_input_device_set_pointer_focus(device, NULL, time, 0, 0, 0, 0);
@ -514,10 +519,9 @@ drag_activate(struct wl_client *client,
} }
static void static void
drag_destroy(struct wl_client *client, struct wl_drag *drag) drag_destroy(struct wl_client *client, struct wl_resource *resource)
{ {
wl_resource_destroy(&drag->resource, client, wl_resource_destroy(resource, wlsc_compositor_get_time());
wlsc_compositor_get_time());
} }
static const struct wl_drag_interface drag_interface = { static const struct wl_drag_interface drag_interface = {
@ -540,7 +544,7 @@ drag_handle_surface_destroy(struct wl_listener *listener,
static void static void
shell_create_drag(struct wl_client *client, shell_create_drag(struct wl_client *client,
struct wl_shell *shell, uint32_t id) struct wl_resource *resource, uint32_t id)
{ {
struct wl_drag *drag; struct wl_drag *drag;
@ -575,27 +579,25 @@ wlsc_selection_set_focus(struct wlsc_shell *shell,
return; return;
if (selection->selection_focus != NULL) if (selection->selection_focus != NULL)
wl_client_post_event(selection->selection_focus->client, wl_resource_post_event(&selection->selection_offer.resource,
&selection->selection_offer.object,
WL_SELECTION_OFFER_KEYBOARD_FOCUS, WL_SELECTION_OFFER_KEYBOARD_FOCUS,
NULL); NULL);
if (surface) { if (surface) {
wl_client_post_global(surface->client, wl_client_post_global(surface->resource.client,
&selection->selection_offer.object); &selection->selection_offer.resource.object);
selection->selection_offer.resource.client = surface->resource.client;
end = selection->types.data + selection->types.size; end = selection->types.data + selection->types.size;
for (p = selection->types.data; p < end; p++) for (p = selection->types.data; p < end; p++)
wl_client_post_event(surface->client, wl_resource_post_event(&selection->selection_offer.resource,
&selection->selection_offer.object,
WL_SELECTION_OFFER_OFFER, *p); WL_SELECTION_OFFER_OFFER, *p);
wl_list_remove(&selection->selection_focus_listener.link); wl_list_remove(&selection->selection_focus_listener.link);
wl_list_insert(surface->resource.destroy_listener_list.prev, wl_list_insert(surface->resource.destroy_listener_list.prev,
&selection->selection_focus_listener.link); &selection->selection_focus_listener.link);
wl_client_post_event(surface->client, wl_resource_post_event(&selection->selection_offer.resource,
&selection->selection_offer.object,
WL_SELECTION_OFFER_KEYBOARD_FOCUS, WL_SELECTION_OFFER_KEYBOARD_FOCUS,
selection->input_device); selection->input_device);
} }
@ -610,14 +612,14 @@ wlsc_selection_set_focus(struct wlsc_shell *shell,
static void static void
selection_offer_receive(struct wl_client *client, selection_offer_receive(struct wl_client *client,
struct wl_selection_offer *offer, struct wl_resource *resource,
const char *mime_type, int fd) const char *mime_type, int fd)
{ {
struct wl_selection_offer *offer = resource->data;
struct wl_selection *selection = struct wl_selection *selection =
container_of(offer, struct wl_selection, selection_offer); container_of(offer, struct wl_selection, selection_offer);
wl_client_post_event(selection->client, wl_resource_post_event(&selection->resource,
&selection->resource.object,
WL_SELECTION_SEND, mime_type, fd); WL_SELECTION_SEND, mime_type, fd);
close(fd); close(fd);
} }
@ -628,8 +630,9 @@ static const struct wl_selection_offer_interface selection_offer_interface = {
static void static void
selection_offer(struct wl_client *client, selection_offer(struct wl_client *client,
struct wl_selection *selection, const char *type) struct wl_resource *resource, const char *type)
{ {
struct wl_selection *selection = resource->data;
char **p; char **p;
p = wl_array_add(&selection->types, sizeof *p); p = wl_array_add(&selection->types, sizeof *p);
@ -641,9 +644,10 @@ selection_offer(struct wl_client *client,
static void static void
selection_activate(struct wl_client *client, selection_activate(struct wl_client *client,
struct wl_selection *selection, struct wl_resource *resource,
struct wl_input_device *device, uint32_t time) struct wl_input_device *device, uint32_t time)
{ {
struct wl_selection *selection = resource->data;
struct wlsc_input_device *wd = (struct wlsc_input_device *) device; struct wlsc_input_device *wd = (struct wlsc_input_device *) device;
struct wl_display *display = wl_client_get_display (client); struct wl_display *display = wl_client_get_display (client);
struct wlsc_compositor *compositor = struct wlsc_compositor *compositor =
@ -651,16 +655,16 @@ selection_activate(struct wl_client *client,
selection->input_device = device; selection->input_device = device;
selection->selection_offer.object.interface = selection->selection_offer.resource.object.interface =
&wl_selection_offer_interface; &wl_selection_offer_interface;
selection->selection_offer.object.implementation = selection->selection_offer.resource.object.implementation =
(void (**)(void)) &selection_offer_interface; (void (**)(void)) &selection_offer_interface;
wl_display_add_object(display, &selection->selection_offer.object); wl_display_add_object(display,
&selection->selection_offer.resource.object);
if (wd->selection) { if (wd->selection) {
wl_client_post_event(wd->selection->client, wl_resource_post_event(&wd->selection->resource,
&wd->selection->resource.object,
WL_SELECTION_CANCELLED); WL_SELECTION_CANCELLED);
} }
wd->selection = selection; wd->selection = selection;
@ -670,10 +674,9 @@ selection_activate(struct wl_client *client,
} }
static void static void
selection_destroy(struct wl_client *client, struct wl_selection *selection) selection_destroy(struct wl_client *client, struct wl_resource *resource)
{ {
wl_resource_destroy(&selection->resource, client, wl_resource_destroy(resource, wlsc_compositor_get_time());
wlsc_compositor_get_time());
} }
static const struct wl_selection_interface selection_interface = { static const struct wl_selection_interface selection_interface = {
@ -683,7 +686,7 @@ static const struct wl_selection_interface selection_interface = {
}; };
static void static void
destroy_selection(struct wl_resource *resource, struct wl_client *client) destroy_selection(struct wl_resource *resource)
{ {
struct wl_selection *selection = struct wl_selection *selection =
container_of(resource, struct wl_selection, resource); container_of(resource, struct wl_selection, resource);
@ -711,7 +714,7 @@ selection_handle_surface_destroy(struct wl_listener *listener,
static void static void
shell_create_selection(struct wl_client *client, shell_create_selection(struct wl_client *client,
struct wl_shell *shell, uint32_t id) struct wl_resource *resource, uint32_t id)
{ {
struct wl_selection *selection; struct wl_selection *selection;
@ -752,21 +755,19 @@ static void
move_binding(struct wl_input_device *device, uint32_t time, move_binding(struct wl_input_device *device, uint32_t time,
uint32_t key, uint32_t button, uint32_t state, void *data) uint32_t key, uint32_t button, uint32_t state, void *data)
{ {
struct wl_shell *shell = data;
struct wlsc_surface *surface = struct wlsc_surface *surface =
(struct wlsc_surface *) device->pointer_focus; (struct wlsc_surface *) device->pointer_focus;
if (surface == NULL) if (surface == NULL)
return; return;
shell_move(NULL, shell, &surface->surface, device, time); shell_move(NULL, NULL, &surface->surface, device, time);
} }
static void static void
resize_binding(struct wl_input_device *device, uint32_t time, resize_binding(struct wl_input_device *device, uint32_t time,
uint32_t key, uint32_t button, uint32_t state, void *data) uint32_t key, uint32_t button, uint32_t state, void *data)
{ {
struct wl_shell *shell = data;
struct wlsc_surface *surface = struct wlsc_surface *surface =
(struct wlsc_surface *) device->pointer_focus; (struct wlsc_surface *) device->pointer_focus;
uint32_t edges = 0; uint32_t edges = 0;
@ -792,7 +793,7 @@ resize_binding(struct wl_input_device *device, uint32_t time,
else else
edges |= WL_SHELL_RESIZE_BOTTOM; edges |= WL_SHELL_RESIZE_BOTTOM;
shell_resize(NULL, shell, &surface->surface, device, time, edges); shell_resize(NULL, NULL, &surface->surface, device, time, edges);
} }
static void static void

@ -49,14 +49,13 @@
*/ */
struct xserver { struct xserver {
struct wl_object object; struct wl_resource resource;
}; };
struct wlsc_xserver { struct wlsc_xserver {
struct wl_display *wl_display; struct wl_display *wl_display;
struct wl_event_loop *loop; struct wl_event_loop *loop;
struct wl_event_source *sigchld_source; struct wl_event_source *sigchld_source;
struct wl_client *client;
int abstract_fd; int abstract_fd;
struct wl_event_source *abstract_source; struct wl_event_source *abstract_source;
int unix_fd; int unix_fd;
@ -408,10 +407,8 @@ wlsc_wm_create(struct wlsc_xserver *wxs)
return NULL; return NULL;
} }
wl_client_post_event(wxs->client, wl_resource_post_event(&wxs->xserver.resource, XSERVER_CLIENT, sv[1]);
&wxs->xserver.object, wl_client_flush(wxs->xserver.resource.client);
XSERVER_CLIENT, sv[1]);
wl_client_flush(wxs->client);
close(sv[1]); close(sv[1]);
/* xcb_connect_to_fd takes ownership of the fd. */ /* xcb_connect_to_fd takes ownership of the fd. */
@ -463,15 +460,15 @@ wlsc_wm_destroy(struct wlsc_wm *wm)
static void static void
wlsc_xserver_bind(struct wl_client *client, wlsc_xserver_bind(struct wl_client *client,
struct wl_object *global, struct wl_object *global, uint32_t version)
uint32_t version)
{ {
struct wlsc_xserver *wxs = struct wlsc_xserver *wxs =
container_of(global, struct wlsc_xserver, xserver.object); container_of(global, struct wlsc_xserver,
xserver.resource.object);
/* If it's a different client than the xserver we launched, /* If it's a different client than the xserver we launched,
* don't start the wm. */ * don't start the wm. */
if (client != wxs->client) if (client != wxs->xserver.resource.client)
return; return;
wxs->wm = wlsc_wm_create(wxs); wxs->wm = wlsc_wm_create(wxs);
@ -479,12 +476,10 @@ wlsc_xserver_bind(struct wl_client *client,
fprintf(stderr, "failed to create wm\n"); fprintf(stderr, "failed to create wm\n");
} }
wl_client_post_event(wxs->client, wl_resource_post_event(&wxs->xserver.resource,
&wxs->xserver.object,
XSERVER_LISTEN_SOCKET, wxs->abstract_fd); XSERVER_LISTEN_SOCKET, wxs->abstract_fd);
wl_client_post_event(wxs->client, wl_resource_post_event(&wxs->xserver.resource,
&wxs->xserver.object,
XSERVER_LISTEN_SOCKET, wxs->unix_fd); XSERVER_LISTEN_SOCKET, wxs->unix_fd);
} }
@ -533,7 +528,8 @@ wlsc_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
fprintf(stderr, "forked X server, pid %d\n", mxs->process.pid); fprintf(stderr, "forked X server, pid %d\n", mxs->process.pid);
close(sv[1]); close(sv[1]);
mxs->client = wl_client_create(mxs->wl_display, sv[0]); mxs->xserver.resource.client =
wl_client_create(mxs->wl_display, sv[0]);
wlsc_watch_process(&mxs->process); wlsc_watch_process(&mxs->process);
@ -572,6 +568,7 @@ wlsc_xserver_cleanup(struct wlsc_process *process, int status)
container_of(process, struct wlsc_xserver, process); container_of(process, struct wlsc_xserver, process);
mxs->process.pid = 0; mxs->process.pid = 0;
mxs->xserver.resource.client = NULL;
mxs->abstract_source = mxs->abstract_source =
wl_event_loop_add_fd(mxs->loop, mxs->abstract_fd, wl_event_loop_add_fd(mxs->loop, mxs->abstract_fd,
@ -597,15 +594,14 @@ wlsc_xserver_cleanup(struct wlsc_process *process, int status)
} }
static void static void
xserver_set_window_id(struct wl_client *client, struct xserver *xserver, xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
struct wl_surface *surface, uint32_t id) struct wl_surface *surface, uint32_t id)
{ {
struct wlsc_xserver *wxs = struct wlsc_xserver *wxs = resource->data;
container_of(xserver, struct wlsc_xserver, xserver);
struct wlsc_wm *wm = wxs->wm; struct wlsc_wm *wm = wxs->wm;
struct wlsc_wm_window *window; struct wlsc_wm_window *window;
if (client != wxs->client) if (client != wxs->xserver.resource.client)
return; return;
window = wl_hash_table_lookup(wm->window_hash, id); window = wl_hash_table_lookup(wm->window_hash, id);
@ -798,12 +794,12 @@ wlsc_xserver_init(struct wlsc_compositor *compositor)
WL_EVENT_READABLE, WL_EVENT_READABLE,
wlsc_xserver_handle_event, mxs); wlsc_xserver_handle_event, mxs);
mxs->xserver.object.interface = &xserver_interface; mxs->xserver.resource.object.interface = &xserver_interface;
mxs->xserver.object.implementation = mxs->xserver.resource.object.implementation =
(void (**)(void)) &xserver_implementation; (void (**)(void)) &xserver_implementation;
wl_display_add_object(display, &mxs->xserver.object); wl_display_add_object(display, &mxs->xserver.resource.object);
wl_display_add_global(display, wl_display_add_global(display, &mxs->xserver.resource.object,
&mxs->xserver.object, wlsc_xserver_bind); wlsc_xserver_bind);
compositor->wxs = mxs; compositor->wxs = mxs;

Loading…
Cancel
Save