The handles needs to be accessible both to callbacks and to the control function.
This program opens a mir connection and creates a surface. The handles needs to be accessible both to callbacks and to the control function.
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
{
static void connection_callback(
MirConnection *new_connection,
void *context)
{
}
static void surface_create_callback(
MirSurface *new_surface,
void *context)
{
}
static void surface_swap_buffers_callback(
MirSurface* surface,
void *context)
{
(void) surface;
(void) context;
}
static void surface_release_callback(
MirSurface *old_surface,
void *context)
{
(void)old_surface;
}
void demo_client(
const char* server,
int buffer_swap_count)
{
puts("Starting");
puts("Connected");
{
}
unsigned int valid_formats;
{__PRETTY_FUNCTION__, 640, 480, pixel_format,
puts("Surface created");
{
assert(request_params.
width == response_params.
width);
}
for (int i = 0; i < buffer_swap_count; i++)
{
{
assert(buffer_package != NULL);
{
{
}
}
}
puts("Surface released");
puts("Connection released");
}
int main(
int argc,
char* argv[])
{
char const *server = NULL;
int buffer_swap_count = 0;
{
int arg;
opterr = 0;
while ((arg = getopt (argc, argv, "c:hf:")) != -1)
{
switch (arg)
{
case 'c':
buffer_swap_count = atoi(optarg);
break;
case 'f':
server = optarg;
break;
case '?':
case 'h':
default:
puts(argv[0]);
puts("Usage:");
puts(" -f <server name>");
puts(" -h: this help text");
return -1;
}
}
}
return 0;
}