tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright (c) 2014 Red Hat, Inc.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-10 02:57:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Permission is hereby granted, free of charge, to any person obtaining
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * a copy of this software and associated documentation files (the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * "Software"), to deal in the Software without restriction, including
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * without limitation the rights to use, copy, modify, merge, publish,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * distribute, sublicense, and/or sell copies of the Software, and to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * permit persons to whom the Software is furnished to do so, subject to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * the following conditions:
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-10 02:57:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * The above copyright notice and this permission notice (including the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * next paragraph) shall be included in all copies or substantial
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * portions of the Software.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * SOFTWARE.
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-18 12:42:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <stdint.h>
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <unistd.h>
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-15 10:31:41 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <stdatomic.h>
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "wayland-server.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "wayland-client.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* info about a client on server side */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct client_info {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct display *display;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct wl_client *wl_client;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct wl_listener destroy_listener;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									const char *name; /* for debugging */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int pipe;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									pid_t pid;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int exit_code;
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-15 11:21:37 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int kill_code;
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct wl_list link;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void *data; /* for arbitrary use */
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-01 20:02:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int log_fd;
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct display {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct wl_display *wl_display;
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-26 14:50:59 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									struct wl_global *test_global;
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct wl_list clients;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t clients_no;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t clients_terminated_no;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* list of clients waiting for display_resumed event */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct wl_list waiting_for_resume;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t wfr_num;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* This is a helper structure for clients.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Instead of calling wl_display_connect() and all the other stuff,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * client can use client_connect and it will return this structure
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * filled. */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct client {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct wl_display *wl_display;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct test_compositor *tc;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-15 10:31:41 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									atomic_bool display_stopped;
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct client *client_connect(void);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void client_disconnect(struct client *);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								int stop_display(struct client *, int);
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-18 12:36:14 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void noop_request(struct client *);
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Usual workflow:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *    d = display_create();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *    wl_global_create(d->wl_display, ...);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *    ... other setups ...
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-28 11:25:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *    client_create(d, client_main, data);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *    client_create(d, client_main2, data);
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *    display_run(d);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *    display_destroy(d);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct display *display_create(void);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void display_destroy(struct display *d);
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-15 11:21:37 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								void display_destroy_expect_signal(struct display *d, int signum);
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void display_run(struct display *d);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-24 23:57:29 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/* This function posts the display_resumed event to all waiting clients,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * so that after flushing events the clients will stop waiting and continue.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * (Calling `display_run` after this function will resume the display loop.)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void display_post_resume_events(struct display *d);
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* After n clients called stop_display(..., n), the display
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * is stopped and can process the code after display_run().
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-24 23:57:29 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * This function posts the display_resumed event to the waiting
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * clients, so that the clients will stop waiting and continue;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * it then reruns the display. */
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void display_resume(struct display *d);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-01 20:02:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/* The file descriptor containing the client log. This is only valid in the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * test client processes. */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								extern int client_log_fd;
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-24 23:57:29 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct client_info *client_create_with_name(struct display *d,
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-28 11:25:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													    void (*client_main)(void *data),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
													    void *data,
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												tests: add test-compositor
This patch introduces a set of functions that can create a display
and clients for tests.
On server side the user can use functions:
  display_create()
  display_destroy()
  create_client()
  display_run()
  display_resume()
and on client side the user can use:
  client_connect()
  client_disconnect()
  stop_display()
The stop_display() and display_resume() are functions that serve as a barrier
and also allow the display to take some action after the display_run() was called,
because after the display is stopped, it can run arbitrary code until it calls
display_resume().
client_connect() function connects to wayland display and creates a proxy to
test_compositor global object, so it can ask for stopping the display later
using stop_display().
An example:
  void
  client_main()
  {
        /* or client can use wl_display_connect(NULL)
         * and do all the stuff manually */
        struct client *c = client_connect();
        /* do some stuff, ... */
        /* stop the display so that it can
         * do some other stuff */
        stop_display(c, 1);
        /* ... */
        client_disconnect(c);
  }
  TEST(dummy_tst)
  {
       struct display *d = display_create();
       /* set up the display */
       wl_global_create(d->wl_display, ...);
       /* ... */
       create_client(d, client_main);
       display_run();
       /* if we are here, the display has been stopped
        * and we can do some code, i. e. create another global or so */
       wl_global_create(d->wl_display, ...);
       /* ... */
       display_resume(d); /* resume display and clients */
       display_destroy(d);
  }
v2:
  added/changed message in few asserts that were not clear
  fixed codying style issues and typo
  client_create_with_name: fixed a condition in an assert
  get_socket_name: use also pid
  check_error: fix errno -> err
[Pekka Paalanen: added test-compositor.h to SOURCES, added
WL_HIDE_DEPRECATED to get rid of deprecated defs and lots of warnings,
fixed one unchecked return value from write().]
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
											
										 
										
											2014-08-21 16:52:16 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
													    const char *name);
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-28 11:25:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define client_create(d, c, data) client_create_with_name((d), (c), data, (#c))
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-05 12:49:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								static inline void noarg_cb(void *data)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void (*cb)(void) = data;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cb();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								static inline struct client_info *client_create_with_name_noarg(struct display *d,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
																void (*client_main)(void),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
																const char *name)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return client_create_with_name(d, noarg_cb, client_main, name);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-28 11:25:00 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define client_create_noarg(d, c) \
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-05 12:49:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									client_create_with_name_noarg((d), (c), (#c))
							 |