Use typesafe server-side stubs

Kristian Høgsberg 13 years ago
parent b41c0810ea
commit 0b5cd0cb4c
  1. 44
      src/compositor.c
  2. 56
      src/shell.c
  3. 19
      src/tablet-shell.c
  4. 13
      src/xserver-launcher.c

@ -965,7 +965,7 @@ weston_output_repaint(struct weston_output *output, int msecs)
output->repaint_needed = 0;
wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
wl_resource_post_event(&cb->resource, WL_CALLBACK_DONE, msecs);
wl_callback_send_done(&cb->resource, msecs);
wl_resource_destroy(&cb->resource, 0);
}
@ -1765,10 +1765,9 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
}
if (wd->touch_focus_resource && wd->touch_focus)
wl_resource_post_event(wd->touch_focus_resource,
touch_type, time,
wd->touch_focus,
touch_id, sx, sy);
wl_input_device_send_touch_down(wd->touch_focus_resource,
time, &wd->touch_focus->resource,
touch_id, sx, sy);
break;
case WL_INPUT_DEVICE_TOUCH_MOTION:
es = (struct weston_surface *) wd->touch_focus;
@ -1777,17 +1776,16 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
weston_surface_from_global(es, x, y, &sx, &sy);
if (wd->touch_focus_resource)
wl_resource_post_event(wd->touch_focus_resource,
touch_type, time,
touch_id, sx, sy);
wl_input_device_send_touch_motion(wd->touch_focus_resource,
time, touch_id, sx, sy);
break;
case WL_INPUT_DEVICE_TOUCH_UP:
weston_compositor_idle_release(ec);
wd->num_tp--;
if (wd->touch_focus_resource)
wl_resource_post_event(wd->touch_focus_resource,
touch_type, time, touch_id);
wl_input_device_send_touch_up(wd->touch_focus_resource,
time, touch_id);
if (wd->num_tp == 0)
touch_set_focus(wd, NULL, time);
break;
@ -2004,22 +2002,20 @@ bind_output(struct wl_client *client,
resource = wl_client_add_object(client,
&wl_output_interface, NULL, id, data);
wl_resource_post_event(resource,
WL_OUTPUT_GEOMETRY,
output->x,
output->y,
output->mm_width,
output->mm_height,
output->subpixel,
output->make, output->model);
wl_output_send_geometry(resource,
output->x,
output->y,
output->mm_width,
output->mm_height,
output->subpixel,
output->make, output->model);
wl_list_for_each (mode, &output->mode_list, link) {
wl_resource_post_event(resource,
WL_OUTPUT_MODE,
mode->flags,
mode->width,
mode->height,
mode->refresh);
wl_output_send_mode(resource,
mode->flags,
mode->width,
mode->height,
mode->refresh);
}
}

@ -292,9 +292,8 @@ resize_grab_motion(struct wl_pointer_grab *grab,
height = resize->height;
}
wl_resource_post_event(&resize->shsurf->resource,
WL_SHELL_SURFACE_CONFIGURE, time, resize->edges,
width, height);
wl_shell_surface_send_configure(&resize->shsurf->resource,
time, resize->edges, width, height);
}
static void
@ -513,11 +512,11 @@ shell_surface_set_maximized(struct wl_client *client,
wlshell = shell_surface_get_shell(shsurf);
panel_height = get_output_panel_height(wlshell, es->output);
edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT;
wl_resource_post_event(&shsurf->resource,
WL_SHELL_SURFACE_CONFIGURE,
weston_compositor_get_time(), edges,
es->output->current->width,
es->output->current->height - panel_height);
wl_shell_surface_send_configure(&shsurf->resource,
weston_compositor_get_time(), edges,
es->output->current->width,
es->output->current->height - panel_height);
shsurf->type = SHELL_SURFACE_MAXIMIZED;
}
@ -641,11 +640,10 @@ shell_surface_set_fullscreen(struct wl_client *client,
if (es->output)
shsurf->surface->force_configure = 1;
wl_resource_post_event(resource,
WL_SHELL_SURFACE_CONFIGURE,
weston_compositor_get_time(), 0,
shsurf->output->current->width,
shsurf->output->current->height);
wl_shell_surface_send_configure(&shsurf->resource,
weston_compositor_get_time(), 0,
shsurf->output->current->width,
shsurf->output->current->height);
}
static void
@ -674,8 +672,7 @@ popup_grab_motion(struct wl_pointer_grab *grab,
resource = grab->input_device->pointer_focus_resource;
if (resource)
wl_resource_post_event(resource, WL_INPUT_DEVICE_MOTION,
time, sx, sy);
wl_input_device_send_motion(resource, time, sx, sy);
}
static void
@ -688,13 +685,11 @@ popup_grab_button(struct wl_pointer_grab *grab,
resource = grab->input_device->pointer_focus_resource;
if (resource) {
wl_resource_post_event(resource, WL_INPUT_DEVICE_BUTTON,
time, button, state);
wl_input_device_send_button(resource, time, button, state);
} else if (state == 0 &&
(shsurf->popup.initial_up ||
time - shsurf->popup.time > 500)) {
wl_resource_post_event(&shsurf->resource,
WL_SHELL_SURFACE_POPUP_DONE);
wl_shell_surface_send_popup_done(&shsurf->resource);
wl_input_device_end_pointer_grab(grab->input_device, time);
shsurf->popup.grab.input_device = NULL;
}
@ -962,11 +957,11 @@ desktop_shell_set_background(struct wl_client *client,
weston_surface_set_position(surface, shsurf->output->x,
shsurf->output->y);
wl_resource_post_event(resource,
DESKTOP_SHELL_CONFIGURE,
weston_compositor_get_time(), 0, surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
desktop_shell_send_configure(resource,
weston_compositor_get_time(), 0,
surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
}
static void
@ -1000,11 +995,11 @@ desktop_shell_set_panel(struct wl_client *client,
weston_surface_set_position(surface, shsurf->output->x,
shsurf->output->y);
wl_resource_post_event(resource,
DESKTOP_SHELL_CONFIGURE,
weston_compositor_get_time(), 0, surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
desktop_shell_send_configure(resource,
weston_compositor_get_time(), 0,
surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
}
static void
@ -1505,8 +1500,7 @@ unlock(struct weston_shell *base)
if (shell->prepare_event_sent)
return;
wl_resource_post_event(shell->child.desktop_shell,
DESKTOP_SHELL_PREPARE_LOCK_SURFACE);
desktop_shell_send_prepare_lock_surface(shell->child.desktop_shell);
shell->prepare_event_sent = true;
}

@ -120,8 +120,7 @@ tablet_shell_map(struct weston_shell *base, struct weston_surface *surface,
if (shell->state == STATE_STARTING) {
tablet_shell_set_state(shell, STATE_LOCKED);
shell->previous_state = STATE_HOME;
wl_resource_post_event(&shell->resource,
TABLET_SHELL_SHOW_LOCKSCREEN);
tablet_shell_send_show_lockscreen(&shell->resource);
}
} else if (shell->current_client &&
shell->current_client->surface != surface &&
@ -373,12 +372,10 @@ toggle_switcher(struct tablet_shell *shell)
{
switch (shell->state) {
case STATE_SWITCHER:
wl_resource_post_event(&shell->resource,
TABLET_SHELL_HIDE_SWITCHER);
tablet_shell_send_hide_switcher(&shell->resource);
break;
default:
wl_resource_post_event(&shell->resource,
TABLET_SHELL_SHOW_SWITCHER);
tablet_shell_send_show_switcher(&shell->resource);
tablet_shell_set_state(shell, STATE_SWITCHER);
break;
}
@ -393,12 +390,9 @@ tablet_shell_lock(struct weston_shell *base)
if (shell->state == STATE_LOCKED)
return;
if (shell->state == STATE_SWITCHER)
wl_resource_post_event(&shell->resource,
TABLET_SHELL_HIDE_SWITCHER);
tablet_shell_send_hide_switcher(&shell->resource);
wl_resource_post_event(&shell->resource,
TABLET_SHELL_SHOW_LOCKSCREEN);
tablet_shell_send_show_lockscreen(&shell->resource);
tablet_shell_set_state(shell, STATE_LOCKED);
}
@ -418,8 +412,7 @@ go_home(struct tablet_shell *shell)
(struct weston_input_device *) shell->compositor->input_device;
if (shell->state == STATE_SWITCHER)
wl_resource_post_event(&shell->resource,
TABLET_SHELL_HIDE_SWITCHER);
tablet_shell_send_hide_switcher(&shell->resource);
weston_surface_activate(shell->home_surface, device,
weston_compositor_get_time());

@ -856,8 +856,8 @@ weston_wm_send_data(struct weston_wm *wm, xcb_atom_t target, const char *mime_ty
weston_wm_read_data_source,
wm);
wl_resource_post_event(&device->selection_data_source->resource,
WL_DATA_SOURCE_SEND, mime_type, p[1]);
wl_data_source_send_send(&device->selection_data_source->resource,
mime_type, p[1]);
close(p[1]);
}
@ -1277,7 +1277,7 @@ weston_wm_create(struct weston_xserver *wxs)
return NULL;
}
wl_resource_post_event(wxs->resource, XSERVER_CLIENT, sv[1]);
xserver_send_client(wxs->resource, sv[1]);
wl_client_flush(wxs->resource->client);
close(sv[1]);
@ -1556,11 +1556,8 @@ bind_xserver(struct wl_client *client,
fprintf(stderr, "failed to create wm\n");
}
wl_resource_post_event(wxs->resource,
XSERVER_LISTEN_SOCKET, wxs->abstract_fd);
wl_resource_post_event(wxs->resource,
XSERVER_LISTEN_SOCKET, wxs->unix_fd);
xserver_send_listen_socket(wxs->resource, wxs->abstract_fd);
xserver_send_listen_socket(wxs->resource, wxs->unix_fd);
}
static int

Loading…
Cancel
Save