Пример #1
0
static void
check_weston_surface_description(struct timeline_emit_context *ctx,
				 struct weston_surface *s)
{
	struct weston_surface *mains;
	char d[512];
	char mainstr[32];

	if (!check_series(ctx, &s->timeline))
		return;

	mains = weston_surface_get_main_surface(s);
	if (mains != s) {
		check_weston_surface_description(ctx, mains);
		if (snprintf(mainstr, sizeof(mainstr),
			     ", \"main_surface\":%u", mains->timeline.id) < 0)
			mainstr[0] = '\0';
	} else {
		mainstr[0] = '\0';
	}

	if (!s->get_label || s->get_label(s, d, sizeof(d)) < 0)
		d[0] = '\0';

	fprintf(ctx->out, "{ \"id\":%u, "
		"\"type\":\"weston_surface\", \"desc\":", s->timeline.id);
	fprint_quoted_string(ctx->out, d[0] ? d : NULL);
	fprintf(ctx->out, "%s }\n", mainstr);
}
Пример #2
0
void XdgSurface::resize(wl_client *client, wl_resource *resource, wl_resource *seat, uint32_t serial, uint32_t edges)
{
    weston_seat *ws = static_cast<weston_seat *>(wl_resource_get_user_data(seat));
    weston_surface *surface = weston_surface_get_main_surface(ws->pointer->focus->surface);
    if (ws->pointer->button_count == 0 || ws->pointer->grab_serial != serial || surface != shsurf()->weston_surface()) {
        return;
    }

    shsurf()->dragResize(ws, (ShellSurface::Edges)edges);
}