Change weston_surface.resource to a wl_resource pointer.

This is the first in what will be a series of weston patches to convert
instances of wl_resource to pointers so we can make wl_resource opaque.
This patch handles weston_surface and should be the most invasive of the
entire series.  I am sending this one out ahead of the rest for review.

Specifically, my machine is not set up to build XWayland so I have no
ability to test it fully.  Could someone please test with XWayland and let
me know if this causes problems?

Because a surface may be created from XWayland, the resource may not always
exist.  Therefore, a destroy signal was added to weston_surface and
everything used to listen to surface->resource.destroy_signal now listens
to surface->destroy_signal.
This commit is contained in:
Jason Ekstrand 2013-06-06 22:34:41 -05:00 committed by Kristian Høgsberg
parent a2ce68fd03
commit 26ed73cee8
10 changed files with 73 additions and 69 deletions

View File

@ -188,7 +188,7 @@ weston_surface_animation_run(struct weston_surface *surface,
weston_surface_animation_frame(&animation->animation, NULL, 0); weston_surface_animation_frame(&animation->animation, NULL, 0);
animation->listener.notify = handle_animation_surface_destroy; animation->listener.notify = handle_animation_surface_destroy;
wl_signal_add(&surface->resource.destroy_signal, &animation->listener); wl_signal_add(&surface->destroy_signal, &animation->listener);
wl_list_insert(&surface->output->animation_list, wl_list_insert(&surface->output->animation_list,
&animation->animation.link); &animation->animation.link);

View File

@ -276,13 +276,13 @@ weston_surface_create(struct weston_compositor *compositor)
if (surface == NULL) if (surface == NULL)
return NULL; return NULL;
wl_signal_init(&surface->resource.destroy_signal); wl_signal_init(&surface->destroy_signal);
surface->resource = NULL;
wl_list_init(&surface->link); wl_list_init(&surface->link);
wl_list_init(&surface->layer_link); wl_list_init(&surface->layer_link);
surface->resource.client = NULL;
surface->compositor = compositor; surface->compositor = compositor;
surface->alpha = 1.0; surface->alpha = 1.0;
@ -523,14 +523,16 @@ weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask)
uint32_t left = es->output_mask & different; uint32_t left = es->output_mask & different;
struct weston_output *output; struct weston_output *output;
struct wl_resource *resource = NULL; struct wl_resource *resource = NULL;
struct wl_client *client = es->resource.client; struct wl_client *client;
es->output_mask = mask; es->output_mask = mask;
if (es->resource.client == NULL) if (es->resource == NULL)
return; return;
if (different == 0) if (different == 0)
return; return;
client = wl_resource_get_client(es->resource);
wl_list_for_each(output, &es->compositor->output_list, link) { wl_list_for_each(output, &es->compositor->output_list, link) {
if (1 << output->id & different) if (1 << output->id & different)
resource = resource =
@ -539,9 +541,9 @@ weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask)
if (resource == NULL) if (resource == NULL)
continue; continue;
if (1 << output->id & entered) if (1 << output->id & entered)
wl_surface_send_enter(&es->resource, resource); wl_surface_send_enter(es->resource, resource);
if (1 << output->id & left) if (1 << output->id & left)
wl_surface_send_leave(&es->resource, resource); wl_surface_send_leave(es->resource, resource);
} }
} }
@ -882,7 +884,7 @@ weston_surface_set_transform_parent(struct weston_surface *surface,
surface->geometry.parent_destroy_listener.notify = surface->geometry.parent_destroy_listener.notify =
transform_parent_handle_parent_destroy; transform_parent_handle_parent_destroy;
if (parent) { if (parent) {
wl_signal_add(&parent->resource.destroy_signal, wl_signal_add(&parent->destroy_signal,
&surface->geometry.parent_destroy_listener); &surface->geometry.parent_destroy_listener);
wl_list_insert(&parent->geometry.child_list, wl_list_insert(&parent->geometry.child_list,
&surface->geometry.parent_link); &surface->geometry.parent_link);
@ -1004,11 +1006,15 @@ struct weston_frame_callback {
struct wl_list link; struct wl_list link;
}; };
static void
destroy_surface(struct wl_resource *resource) WL_EXPORT void
weston_surface_destroy(struct weston_surface *surface)
{ {
struct weston_surface *surface = /* Not a valid way to destroy a client surface */
container_of(resource, struct weston_surface, resource); assert(surface->resource == NULL);
wl_signal_emit(&surface->destroy_signal, &surface->resource);
struct weston_compositor *compositor = surface->compositor; struct weston_compositor *compositor = surface->compositor;
struct weston_frame_callback *cb, *next; struct weston_frame_callback *cb, *next;
@ -1048,14 +1054,13 @@ destroy_surface(struct wl_resource *resource)
free(surface); free(surface);
} }
WL_EXPORT void static void
weston_surface_destroy(struct weston_surface *surface) destroy_surface(struct wl_resource *resource)
{ {
/* Not a valid way to destroy a client surface */ struct weston_surface *surface = wl_resource_get_user_data(resource);
assert(surface->resource.client == NULL);
wl_signal_emit(&surface->resource.destroy_signal, &surface->resource); surface->resource = NULL;
destroy_surface(&surface->resource); weston_surface_destroy(surface);
} }
static void static void
@ -1660,15 +1665,10 @@ compositor_create_surface(struct wl_client *client,
return; return;
} }
surface->resource.destroy = destroy_surface; surface->resource = wl_client_add_object(client, &wl_surface_interface,
&surface_interface,
surface->resource.object.id = id; id, surface);
surface->resource.object.interface = &wl_surface_interface; wl_resource_set_destructor(surface->resource, destroy_surface);
surface->resource.object.implementation =
(void (**)(void)) &surface_interface;
surface->resource.data = surface;
wl_client_add_resource(client, &surface->resource);
} }
static void static void
@ -2035,7 +2035,7 @@ subsurface_sibling_check(struct weston_subsurface *sub,
wl_resource_post_error(sub->resource, wl_resource_post_error(sub->resource,
WL_SUBSURFACE_ERROR_BAD_SURFACE, WL_SUBSURFACE_ERROR_BAD_SURFACE,
"%s: wl_surface@%d is not a parent or sibling", "%s: wl_surface@%d is not a parent or sibling",
request, surface->resource.object.id); request, wl_resource_get_id(surface->resource));
return NULL; return NULL;
} }
@ -2043,7 +2043,7 @@ subsurface_sibling_check(struct weston_subsurface *sub,
wl_resource_post_error(sub->resource, wl_resource_post_error(sub->resource,
WL_SUBSURFACE_ERROR_BAD_SURFACE, WL_SUBSURFACE_ERROR_BAD_SURFACE,
"%s: wl_surface@%d has a different parent", "%s: wl_surface@%d has a different parent",
request, surface->resource.object.id); request, wl_resource_get_id(surface->resource));
return NULL; return NULL;
} }
@ -2204,7 +2204,7 @@ weston_subsurface_link_parent(struct weston_subsurface *sub,
{ {
sub->parent = parent; sub->parent = parent;
sub->parent_destroy_listener.notify = subsurface_handle_parent_destroy; sub->parent_destroy_listener.notify = subsurface_handle_parent_destroy;
wl_signal_add(&parent->resource.destroy_signal, wl_signal_add(&parent->destroy_signal,
&sub->parent_destroy_listener); &sub->parent_destroy_listener);
wl_list_insert(&parent->subsurface_list, &sub->parent_link); wl_list_insert(&parent->subsurface_list, &sub->parent_link);
@ -2219,7 +2219,7 @@ weston_subsurface_link_surface(struct weston_subsurface *sub,
sub->surface = surface; sub->surface = surface;
sub->surface_destroy_listener.notify = sub->surface_destroy_listener.notify =
subsurface_handle_surface_destroy; subsurface_handle_surface_destroy;
wl_signal_add(&surface->resource.destroy_signal, wl_signal_add(&surface->destroy_signal,
&sub->surface_destroy_listener); &sub->surface_destroy_listener);
} }
@ -2266,12 +2266,13 @@ weston_subsurface_create(uint32_t id, struct weston_surface *surface,
struct weston_surface *parent) struct weston_surface *parent)
{ {
struct weston_subsurface *sub; struct weston_subsurface *sub;
struct wl_client *client = wl_resource_get_client(surface->resource);
sub = calloc(1, sizeof *sub); sub = calloc(1, sizeof *sub);
if (!sub) if (!sub)
return NULL; return NULL;
sub->resource = wl_client_add_object(surface->resource.client, sub->resource = wl_client_add_object(client,
&wl_subsurface_interface, &wl_subsurface_interface,
&subsurface_implementation, &subsurface_implementation,
id, sub); id, sub);

View File

@ -651,7 +651,8 @@ struct weston_subsurface {
*/ */
struct weston_surface { struct weston_surface {
struct wl_resource resource; struct wl_resource *resource;
struct wl_signal destroy_signal;
struct weston_compositor *compositor; struct weston_compositor *compositor;
pixman_region32_t clip; pixman_region32_t clip;
pixman_region32_t damage; pixman_region32_t damage;

View File

@ -230,11 +230,12 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
if (!surface) if (!surface)
return; return;
if (!drag->data_source && surface->resource.client != drag->client) if (!drag->data_source &&
wl_resource_get_client(surface->resource) != drag->client)
return; return;
resource = find_resource(&pointer->seat->drag_resource_list, resource = find_resource(&pointer->seat->drag_resource_list,
surface->resource.client); wl_resource_get_client(surface->resource));
if (!resource) if (!resource)
return; return;
@ -244,7 +245,7 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
if (drag->data_source) if (drag->data_source)
offer = wl_data_source_send_offer(drag->data_source, resource); offer = wl_data_source_send_offer(drag->data_source, resource);
wl_data_device_send_enter(resource, serial, &surface->resource, wl_data_device_send_enter(resource, serial, surface->resource,
sx, sy, offer); sx, sy, offer);
drag->focus = surface; drag->focus = surface;
@ -405,7 +406,7 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
if (icon) { if (icon) {
drag->icon = icon; drag->icon = icon;
drag->icon_destroy_listener.notify = handle_drag_icon_destroy; drag->icon_destroy_listener.notify = handle_drag_icon_destroy;
wl_signal_add(&icon->resource.destroy_signal, wl_signal_add(&icon->destroy_signal,
&drag->icon_destroy_listener); &drag->icon_destroy_listener);
icon->configure = drag_surface_configure; icon->configure = drag_surface_configure;

View File

@ -178,7 +178,7 @@ default_grab_touch_down(struct weston_touch_grab *grab, uint32_t time,
display = wl_client_get_display(touch->focus_resource->client); display = wl_client_get_display(touch->focus_resource->client);
serial = wl_display_next_serial(display); serial = wl_display_next_serial(display);
wl_touch_send_down(touch->focus_resource, serial, time, wl_touch_send_down(touch->focus_resource, serial, time,
&touch->focus->resource, touch->focus->resource,
touch_id, sx, sy); touch_id, sx, sy);
} }
} }
@ -242,7 +242,7 @@ find_resource_for_surface(struct wl_list *list, struct weston_surface *surface)
return NULL; return NULL;
wl_list_for_each(r, list, link) { wl_list_for_each(r, list, link) {
if (r->client == surface->resource.client) if (r->client == wl_resource_get_client(surface->resource))
return r; return r;
} }
@ -437,7 +437,7 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
display = wl_client_get_display(resource->client); display = wl_client_get_display(resource->client);
serial = wl_display_next_serial(display); serial = wl_display_next_serial(display);
wl_pointer_send_leave(resource, serial, wl_pointer_send_leave(resource, serial,
&pointer->focus->resource); pointer->focus->resource);
wl_list_remove(&pointer->focus_listener.link); wl_list_remove(&pointer->focus_listener.link);
} }
@ -460,7 +460,7 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
kbd->modifiers.group); kbd->modifiers.group);
} }
} }
wl_pointer_send_enter(resource, serial, &surface->resource, wl_pointer_send_enter(resource, serial, surface->resource,
sx, sy); sx, sy);
wl_signal_add(&resource->destroy_signal, wl_signal_add(&resource->destroy_signal,
&pointer->focus_listener); &pointer->focus_listener);
@ -485,7 +485,7 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard,
display = wl_client_get_display(resource->client); display = wl_client_get_display(resource->client);
serial = wl_display_next_serial(display); serial = wl_display_next_serial(display);
wl_keyboard_send_leave(resource, serial, wl_keyboard_send_leave(resource, serial,
&keyboard->focus->resource); keyboard->focus->resource);
wl_list_remove(&keyboard->focus_listener.link); wl_list_remove(&keyboard->focus_listener.link);
} }
@ -501,7 +501,7 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard,
keyboard->modifiers.mods_latched, keyboard->modifiers.mods_latched,
keyboard->modifiers.mods_locked, keyboard->modifiers.mods_locked,
keyboard->modifiers.group); keyboard->modifiers.group);
wl_keyboard_send_enter(resource, serial, &surface->resource, wl_keyboard_send_enter(resource, serial, surface->resource,
&keyboard->keys); &keyboard->keys);
wl_signal_add(&resource->destroy_signal, wl_signal_add(&resource->destroy_signal,
&keyboard->focus_listener); &keyboard->focus_listener);
@ -963,7 +963,7 @@ notify_keyboard_focus_out(struct weston_seat *seat)
seat->saved_kbd_focus = keyboard->focus; seat->saved_kbd_focus = keyboard->focus;
seat->saved_kbd_focus_listener.notify = seat->saved_kbd_focus_listener.notify =
destroy_device_saved_kbd_focus; destroy_device_saved_kbd_focus;
wl_signal_add(&keyboard->focus->resource.destroy_signal, wl_signal_add(&keyboard->focus->destroy_signal,
&seat->saved_kbd_focus_listener); &seat->saved_kbd_focus_listener);
} }
@ -1112,14 +1112,14 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
if (pointer->focus == NULL) if (pointer->focus == NULL)
return; return;
if (pointer->focus->resource.client != client) if (wl_resource_get_client(pointer->focus->resource) != client)
return; return;
if (pointer->focus_serial - serial > UINT32_MAX / 2) if (pointer->focus_serial - serial > UINT32_MAX / 2)
return; return;
if (surface && surface != pointer->sprite) { if (surface && surface != pointer->sprite) {
if (surface->configure) { if (surface->configure) {
wl_resource_post_error(&surface->resource, wl_resource_post_error(surface->resource,
WL_DISPLAY_ERROR_INVALID_OBJECT, WL_DISPLAY_ERROR_INVALID_OBJECT,
"surface->configure already " "surface->configure already "
"set"); "set");
@ -1133,7 +1133,7 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
if (!surface) if (!surface)
return; return;
wl_signal_add(&surface->resource.destroy_signal, wl_signal_add(&surface->destroy_signal,
&pointer->sprite_destroy_listener); &pointer->sprite_destroy_listener);
surface->configure = pointer_cursor_surface_configure; surface->configure = pointer_cursor_surface_configure;
@ -1167,7 +1167,7 @@ seat_get_pointer(struct wl_client *client, struct wl_resource *resource,
cr->destroy = unbind_resource; cr->destroy = unbind_resource;
if (seat->pointer->focus && if (seat->pointer->focus &&
seat->pointer->focus->resource.client == client) { wl_resource_get_client(seat->pointer->focus->resource) == client) {
struct weston_surface *surface; struct weston_surface *surface;
wl_fixed_t sx, sy; wl_fixed_t sx, sy;
@ -1204,7 +1204,7 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource,
seat->xkb_info.keymap_size); seat->xkb_info.keymap_size);
if (seat->keyboard->focus && if (seat->keyboard->focus &&
seat->keyboard->focus->resource.client == client) { wl_resource_get_client(seat->keyboard->focus->resource) == client) {
weston_keyboard_set_focus(seat->keyboard, weston_keyboard_set_focus(seat->keyboard,
seat->keyboard->focus); seat->keyboard->focus);
wl_data_device_set_keyboard_focus(seat); wl_data_device_set_keyboard_focus(seat);

View File

@ -2001,7 +2001,7 @@ popup_grab_focus(struct weston_pointer_grab *grab)
pointer->x, pointer->y, pointer->x, pointer->y,
&sx, &sy); &sx, &sy);
if (surface && surface->resource.client == client) { if (surface && wl_resource_get_client(surface->resource) == client) {
weston_pointer_set_focus(pointer, surface, sx, sy); weston_pointer_set_focus(pointer, surface, sx, sy);
} else { } else {
weston_pointer_set_focus(pointer, NULL, weston_pointer_set_focus(pointer, NULL,
@ -2263,7 +2263,7 @@ create_shell_surface(void *shell, struct weston_surface *surface,
wl_signal_init(&shsurf->resource.destroy_signal); wl_signal_init(&shsurf->resource.destroy_signal);
shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy; shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy;
wl_signal_add(&surface->resource.destroy_signal, wl_signal_add(&surface->destroy_signal,
&shsurf->surface_destroy_listener); &shsurf->surface_destroy_listener);
/* init link so its safe to always remove it in destroy_shell_surface */ /* init link so its safe to always remove it in destroy_shell_surface */
@ -2937,8 +2937,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
state->keyboard_focus = es; state->keyboard_focus = es;
wl_list_remove(&state->surface_destroy_listener.link); wl_list_remove(&state->surface_destroy_listener.link);
wl_signal_add(&es->resource.destroy_signal, wl_signal_add(&es->destroy_signal, &state->surface_destroy_listener);
&state->surface_destroy_listener);
switch (get_shell_surface_type(main_surface)) { switch (get_shell_surface_type(main_surface)) {
case SHELL_SURFACE_FULLSCREEN: case SHELL_SURFACE_FULLSCREEN:
@ -3789,7 +3788,7 @@ create_input_panel_surface(struct desktop_shell *shell,
wl_signal_init(&input_panel_surface->resource.destroy_signal); wl_signal_init(&input_panel_surface->resource.destroy_signal);
input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy; input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy;
wl_signal_add(&surface->resource.destroy_signal, wl_signal_add(&surface->destroy_signal,
&input_panel_surface->surface_destroy_listener); &input_panel_surface->surface_destroy_listener);
wl_list_init(&input_panel_surface->link); wl_list_init(&input_panel_surface->link);
@ -3956,7 +3955,7 @@ switcher_next(struct switcher *switcher)
return; return;
wl_list_remove(&switcher->listener.link); wl_list_remove(&switcher->listener.link);
wl_signal_add(&next->resource.destroy_signal, &switcher->listener); wl_signal_add(&next->destroy_signal, &switcher->listener);
switcher->current = next; switcher->current = next;
next->alpha = 1.0; next->alpha = 1.0;
@ -4213,7 +4212,7 @@ force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
wl_signal_emit(&compositor->kill_signal, focus_surface); wl_signal_emit(&compositor->kill_signal, focus_surface);
client = focus_surface->resource.client; client = wl_resource_get_client(focus_surface->resource);
wl_client_get_credentials(client, &pid, NULL, NULL); wl_client_get_credentials(client, &pid, NULL, NULL);
/* Skip clients that we launched ourselves (the credentials of /* Skip clients that we launched ourselves (the credentials of

View File

@ -152,7 +152,7 @@ tablet_shell_surface_configure(struct weston_surface *surface,
} }
} 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->resource.client) { shell->current_client->client == wl_resource_get_client(surface->resource)) {
tablet_shell_set_state(shell, STATE_TASK); tablet_shell_set_state(shell, STATE_TASK);
shell->current_client->surface = surface; shell->current_client->surface = surface;
weston_zoom_run(surface, 0.3, 1.0, NULL, NULL); weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
@ -186,8 +186,7 @@ tablet_shell_set_lockscreen(struct wl_client *client,
shell->lockscreen_surface = es; shell->lockscreen_surface = es;
shell->lockscreen_surface->configure = tablet_shell_surface_configure; shell->lockscreen_surface->configure = tablet_shell_surface_configure;
shell->lockscreen_listener.notify = handle_lockscreen_surface_destroy; shell->lockscreen_listener.notify = handle_lockscreen_surface_destroy;
wl_signal_add(&es->resource.destroy_signal, wl_signal_add(&es->destroy_signal, &shell->lockscreen_listener);
&shell->lockscreen_listener);
} }
static void static void
@ -218,7 +217,7 @@ tablet_shell_set_switcher(struct wl_client *client,
weston_surface_set_position(shell->switcher_surface, 0, 0); weston_surface_set_position(shell->switcher_surface, 0, 0);
shell->switcher_listener.notify = handle_switcher_surface_destroy; shell->switcher_listener.notify = handle_switcher_surface_destroy;
wl_signal_add(&es->resource.destroy_signal, &shell->switcher_listener); wl_signal_add(&es->destroy_signal, &shell->switcher_listener);
} }
static void static void

View File

@ -197,7 +197,7 @@ text_input_activate(struct wl_client *client,
wl_signal_emit(&ec->update_input_panel_signal, &text_input->cursor_rectangle); wl_signal_emit(&ec->update_input_panel_signal, &text_input->cursor_rectangle);
} }
wl_text_input_send_enter(&text_input->resource, &text_input->surface->resource); wl_text_input_send_enter(&text_input->resource, text_input->surface->resource);
} }
static void static void

View File

@ -1621,7 +1621,7 @@ weston_wm_create(struct weston_xserver *wxs)
} }
xserver_send_client(wxs->resource, sv[1]); xserver_send_client(wxs->resource, sv[1]);
wl_client_flush(wxs->resource->client); wl_client_flush(wl_resource_get_client(wxs->resource));
close(sv[1]); close(sv[1]);
/* xcb_connect_to_fd takes ownership of the fd. */ /* xcb_connect_to_fd takes ownership of the fd. */
@ -1715,10 +1715,9 @@ surface_destroy(struct wl_listener *listener, void *data)
static struct weston_wm_window * static struct weston_wm_window *
get_wm_window(struct weston_surface *surface) get_wm_window(struct weston_surface *surface)
{ {
struct wl_resource *resource = &surface->resource;
struct wl_listener *listener; struct wl_listener *listener;
listener = wl_signal_get(&resource->destroy_signal, surface_destroy); listener = wl_signal_get(&surface->destroy_signal, surface_destroy);
if (listener) if (listener)
return container_of(listener, struct weston_wm_window, return container_of(listener, struct weston_wm_window,
surface_destroy_listener); surface_destroy_listener);
@ -1850,9 +1849,10 @@ static void
xserver_set_window_id(struct wl_client *client, struct wl_resource *resource, xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
struct wl_resource *surface_resource, uint32_t id) struct wl_resource *surface_resource, uint32_t id)
{ {
struct weston_xserver *wxs = resource->data; struct weston_xserver *wxs = wl_resource_get_user_data(resource);
struct weston_wm *wm = wxs->wm; struct weston_wm *wm = wxs->wm;
struct weston_surface *surface = surface_resource->data; struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
struct weston_wm_window *window; struct weston_wm_window *window;
if (client != wxs->client) if (client != wxs->client)
@ -1870,7 +1870,7 @@ xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
window->surface = (struct weston_surface *) surface; window->surface = (struct weston_surface *) surface;
window->surface_destroy_listener.notify = surface_destroy; window->surface_destroy_listener.notify = surface_destroy;
wl_signal_add(&surface->resource.destroy_signal, wl_signal_add(&surface->destroy_signal,
&window->surface_destroy_listener); &window->surface_destroy_listener);
weston_wm_window_schedule_repaint(window); weston_wm_window_schedule_repaint(window);

View File

@ -40,7 +40,10 @@ text_cursor_position_notify(struct wl_client *client,
struct wl_resource *surface_resource, struct wl_resource *surface_resource,
wl_fixed_t x, wl_fixed_t y) wl_fixed_t x, wl_fixed_t y)
{ {
weston_text_cursor_position_notify((struct weston_surface *) surface_resource, x, y); struct weston_surface *surface =
wl_resource_get_user_data(surface_resource);
weston_text_cursor_position_notify(surface, x, y);
} }
struct text_cursor_position_interface text_cursor_position_implementation = { struct text_cursor_position_interface text_cursor_position_implementation = {