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>
{
int demo_client(
const char* server,
int buffer_swap_count)
{
mcd.connection = 0;
mcd.window = 0;
puts("Starting");
puts("Connected");
{
const char *
error =
"Unknown error";
if (mcd.connection != NULL)
fprintf(stderr, "Failed to connect to server `%s': %s\n",
server == NULL ? "<default>" : server, error);
return 1;
}
{
assert(ext);
assert(NULL != properties.
name);
}
unsigned int valid_formats;
assert(spec != NULL);
puts("Window created");
assert(mcd.window != NULL);
{
fprintf(stderr, "Failed to create surface: %s",
return 1;
}
else
for (int i = 0; i < buffer_swap_count; i++)
{
{
assert(buffer_package != NULL);
}
}
puts("Window released");
puts("Connection released");
return 0;
}
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:hm:")) != -1)
{
switch (arg)
{
case 'c':
buffer_swap_count = atoi(optarg);
break;
case 'm':
server = optarg;
break;
case '?':
case 'h':
default:
puts(argv[0]);
puts("Usage:");
puts(" -m <Mir server socket>");
puts(" -h: this help text");
return -1;
}
}
}
}