Пример #1
0
static void
wayland_swap_buffers (ClutterStageWayland *stage_wayland)
{
  ClutterBackend *backend = clutter_get_default_backend ();
  ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
  ClutterStageWaylandWaylandBuffer *buffer;

  buffer = stage_wayland->front_buffer;
  stage_wayland->front_buffer = stage_wayland->back_buffer;
  stage_wayland->back_buffer = buffer;

  wayland_damage_buffer(stage_wayland->front_buffer);

  wl_surface_attach (stage_wayland->wayland_surface,
                     stage_wayland->front_buffer->wayland_buffer,
  /* 0,0 here is "relative to the old buffer," not absolute */
                     0, 0);
  wl_surface_map_toplevel (stage_wayland->wayland_surface);

  stage_wayland->pending_swaps++;
  wl_display_frame_callback (backend_wayland->wayland_display,
			     wayland_frame_callback,
			     stage_wayland);

  _cogl_swap_buffers_notify ();
}
Пример #2
0
static void
window_attach_surface(struct window *window)
{
	struct display *display = window->display;
	struct wl_buffer *buffer;
	int32_t x, y;

	if (window->pending_surface != NULL)
		return;

	window->pending_surface = window->cairo_surface;
	window->cairo_surface = NULL;

	buffer = display_get_buffer_for_surface(display,
						window->pending_surface);
	if (window->resize_edges & WINDOW_RESIZING_LEFT)
		x = window->server_allocation.width -
			window->allocation.width;
	else
		x = 0;

	if (window->resize_edges & WINDOW_RESIZING_TOP)
		y = window->server_allocation.height -
			window->allocation.height;
	else
		y = 0;

	window->server_allocation = window->allocation;
	window->resize_edges = 0;
	wl_surface_attach(window->surface, buffer, x, y);
	wl_display_sync_callback(display->display, free_surface, window);

	if (!window->mapped) {
		wl_surface_map_toplevel(window->surface);
		window->mapped = 1;
	}

	wl_surface_damage(window->surface, 0, 0,
			  window->allocation.width,
			  window->allocation.height);
}