All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
demo_client.c: A simple mir client

demo_client shows the use of mir API. This program opens a mir connection and creates a surface.


Opens a mir connection and creates a surface and advances the current buffer before closing the surface and connection.

request and wait for connection handle

// Call mir_connect and wait for callback to complete.
mir_wait_for(mir_connect(server, __PRETTY_FUNCTION__, connection_callback, &mcd));

request and wait for surface handle

// ...we create a surface using that format and wait for callback to complete.
mir_wait_for(mir_connection_create_surface(mcd.connection, &request_params, surface_create_callback, &mcd));
puts("Surface created");

exchange the current buffer for a new one

mir_wait_for(mir_surface_swap_buffers(mcd.surface, surface_swap_buffers_callback, &mcd));

We release our surface

// We should release our surface
mir_wait_for(mir_surface_release(mcd.surface, surface_release_callback, &mcd));
puts("Surface released");

We release our connection

// We should release our connection
puts("Connection released");

the raw, platform-specific buffer handle for the current buffer

MirNativeBuffer* buffer_package = NULL;
mir_surface_get_current_buffer(mcd.surface, &buffer_package);
assert(buffer_package != NULL);
// Interpret buffer_package as MirBufferPackage
// Interpret buffer_package as ANativeWindowBuffer

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Aug 28 09:23:12 UTC 2013