doc/sphinx: Include weston-config and shell-utils in docs

libweston contains weston_config and weston_shell_utils utilities
functions so include these in the sphinx documentation as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2022-11-22 15:27:47 +02:00 committed by Daniel Stone
parent 6293ab1f90
commit eeef6be8e2
7 changed files with 96 additions and 4 deletions

View file

@ -789,6 +789,7 @@ WARN_LOGFILE =
INPUT = @SRC_ROOT@/libweston \ INPUT = @SRC_ROOT@/libweston \
@SRC_ROOT@/include/libweston \ @SRC_ROOT@/include/libweston \
@SRC_ROOT@/shared/config-parser.c \
@SRC_ROOT@/tests @SRC_ROOT@/tests
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files

View file

@ -6,6 +6,8 @@ Libweston
:caption: Contents: :caption: Contents:
libweston/compositor.rst libweston/compositor.rst
libweston/weston-config.rst
libweston/shell-utils.rst
libweston/output-management.rst libweston/output-management.rst
libweston/log.rst libweston/log.rst
@ -20,11 +22,12 @@ evolving through many Weston releases before it achieves a stable API and
feature completeness. feature completeness.
`Libweston`'s primary purpose is exporting an API for creating Wayland `Libweston`'s primary purpose is exporting an API for creating Wayland
compositors. Libweston's secondary purpose is to export the weston_config API compositors. Libweston's secondary purpose is to export the :ref:`weston-config` API
so that third party plugins and helper programs can read :file:`weston.ini` if so that third party plugins and helper programs can read :file:`weston.ini` if
they want to. However, these two scopes are orthogonal and independent. At no they want to. However, these two scopes are orthogonal and independent. At no
point will the compositor functionality use or depend on the weston_config point will the compositor functionality use or depend on the :ref:`weston-config`
functionality. functionality. Additional helper functions are grouped together under
:ref:`shell-utils`, to ease out shell development.
Further work Further work
------------ ------------

View file

@ -5,6 +5,8 @@ files = [
'log.rst', 'log.rst',
'output.rst', 'output.rst',
'output-management.rst', 'output-management.rst',
'weston-config.rst',
'shell-utils.rst',
] ]
foreach file : files foreach file : files

View file

@ -0,0 +1,7 @@
.. _shell-utils:
Shell utils
===========
.. doxygengroup:: shell-utils
:content-only:

View file

@ -0,0 +1,7 @@
.. _weston-config:
Weston config
=============
.. doxygengroup:: weston-config
:content-only:

View file

@ -28,6 +28,17 @@
#include <libweston/shell-utils.h> #include <libweston/shell-utils.h>
#include <libweston/desktop.h> #include <libweston/desktop.h>
/**
* \defgroup shell-utils Shell utils
*
* These are some commonly used functions in our shells, useful for other shells
* as well.
*/
/**
* \ingroup shell-utils
*/
WL_EXPORT struct weston_output * WL_EXPORT struct weston_output *
weston_shell_utils_get_default_output(struct weston_compositor *compositor) weston_shell_utils_get_default_output(struct weston_compositor *compositor)
{ {
@ -38,6 +49,9 @@ weston_shell_utils_get_default_output(struct weston_compositor *compositor)
struct weston_output, link); struct weston_output, link);
} }
/**
* \ingroup shell-utils
*/
WL_EXPORT struct weston_output * WL_EXPORT struct weston_output *
weston_shell_utils_get_focused_output(struct weston_compositor *compositor) weston_shell_utils_get_focused_output(struct weston_compositor *compositor)
{ {
@ -69,7 +83,11 @@ weston_shell_utils_get_focused_output(struct weston_compositor *compositor)
return output; return output;
} }
/* TODO: Fix this function to take into account nested subsurfaces. */ /**
* \ingroup shell-utils
*
* TODO: Fix this function to take into account nested subsurfaces.
*/
WL_EXPORT void WL_EXPORT void
weston_shell_utils_subsurfaces_boundingbox(struct weston_surface *surface, weston_shell_utils_subsurfaces_boundingbox(struct weston_surface *surface,
int32_t *x, int32_t *y, int32_t *x, int32_t *y,
@ -104,6 +122,9 @@ weston_shell_utils_subsurfaces_boundingbox(struct weston_surface *surface,
pixman_region32_fini(&region); pixman_region32_fini(&region);
} }
/**
* \ingroup shell-utils
*/
WL_EXPORT void WL_EXPORT void
weston_shell_utils_center_on_output(struct weston_view *view, weston_shell_utils_center_on_output(struct weston_view *view,
struct weston_output *output) struct weston_output *output)
@ -125,6 +146,9 @@ weston_shell_utils_center_on_output(struct weston_view *view,
weston_view_set_position(view, x, y); weston_view_set_position(view, x, y);
} }
/**
* \ingroup shell-utils
*/
WL_EXPORT int WL_EXPORT int
weston_shell_utils_surface_get_label(struct weston_surface *surface, weston_shell_utils_surface_get_label(struct weston_surface *surface,
char *buf, size_t len) char *buf, size_t len)
@ -142,6 +166,9 @@ weston_shell_utils_surface_get_label(struct weston_surface *surface,
c ? " of " : "", c ?: ""); c ? " of " : "", c ?: "");
} }
/**
* \ingroup shell-utils
*/
WL_EXPORT struct weston_curtain * WL_EXPORT struct weston_curtain *
weston_shell_utils_curtain_create(struct weston_compositor *compositor, weston_shell_utils_curtain_create(struct weston_compositor *compositor,
struct weston_curtain_params *params) struct weston_curtain_params *params)
@ -206,6 +233,9 @@ err:
return NULL; return NULL;
} }
/**
* \ingroup shell-utils
*/
WL_EXPORT void WL_EXPORT void
weston_shell_utils_curtain_destroy(struct weston_curtain *curtain) weston_shell_utils_curtain_destroy(struct weston_curtain *curtain)
{ {

View file

@ -45,6 +45,12 @@
#include "helpers.h" #include "helpers.h"
#include "string-helpers.h" #include "string-helpers.h"
/**
* \defgroup weston-config Weston configuration
*
* Helper functions to read out ini configuration file.
*/
struct weston_config_entry { struct weston_config_entry {
char *key; char *key;
char *value; char *value;
@ -130,6 +136,9 @@ config_section_get_entry(struct weston_config_section *section,
return NULL; return NULL;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT struct weston_config_section * WL_EXPORT struct weston_config_section *
weston_config_get_section(struct weston_config *config, const char *section, weston_config_get_section(struct weston_config *config, const char *section,
const char *key, const char *value) const char *key, const char *value)
@ -152,6 +161,9 @@ weston_config_get_section(struct weston_config *config, const char *section,
return NULL; return NULL;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT int WL_EXPORT int
weston_config_section_get_int(struct weston_config_section *section, weston_config_section_get_int(struct weston_config_section *section,
const char *key, const char *key,
@ -174,6 +186,9 @@ weston_config_section_get_int(struct weston_config_section *section,
return 0; return 0;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT int WL_EXPORT int
weston_config_section_get_uint(struct weston_config_section *section, weston_config_section_get_uint(struct weston_config_section *section,
const char *key, const char *key,
@ -210,6 +225,9 @@ weston_config_section_get_uint(struct weston_config_section *section,
return 0; return 0;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT int WL_EXPORT int
weston_config_section_get_color(struct weston_config_section *section, weston_config_section_get_color(struct weston_config_section *section,
const char *key, const char *key,
@ -247,6 +265,9 @@ weston_config_section_get_color(struct weston_config_section *section,
return 0; return 0;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT int WL_EXPORT int
weston_config_section_get_double(struct weston_config_section *section, weston_config_section_get_double(struct weston_config_section *section,
const char *key, const char *key,
@ -272,6 +293,9 @@ weston_config_section_get_double(struct weston_config_section *section,
return 0; return 0;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT int WL_EXPORT int
weston_config_section_get_string(struct weston_config_section *section, weston_config_section_get_string(struct weston_config_section *section,
const char *key, const char *key,
@ -294,6 +318,9 @@ weston_config_section_get_string(struct weston_config_section *section,
return 0; return 0;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT int WL_EXPORT int
weston_config_section_get_bool(struct weston_config_section *section, weston_config_section_get_bool(struct weston_config_section *section,
const char *key, const char *key,
@ -321,6 +348,9 @@ weston_config_section_get_bool(struct weston_config_section *section,
return 0; return 0;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT const char * WL_EXPORT const char *
weston_config_get_name_from_env(void) weston_config_get_name_from_env(void)
{ {
@ -447,6 +477,9 @@ weston_config_parse_fp(FILE *file)
return config; return config;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT struct weston_config * WL_EXPORT struct weston_config *
weston_config_parse(const char *name) weston_config_parse(const char *name)
{ {
@ -498,6 +531,9 @@ weston_config_get_full_path(struct weston_config *config)
return config == NULL ? NULL : config->path; return config == NULL ? NULL : config->path;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT int WL_EXPORT int
weston_config_next_section(struct weston_config *config, weston_config_next_section(struct weston_config *config,
struct weston_config_section **section, struct weston_config_section **section,
@ -521,6 +557,9 @@ weston_config_next_section(struct weston_config *config,
return 1; return 1;
} }
/**
* \ingroup weston-config
*/
WL_EXPORT void WL_EXPORT void
weston_config_destroy(struct weston_config *config) weston_config_destroy(struct weston_config *config)
{ {
@ -543,6 +582,9 @@ weston_config_destroy(struct weston_config *config)
free(config); free(config);
} }
/**
* \ingroup weston-config
*/
WL_EXPORT uint32_t WL_EXPORT uint32_t
weston_config_get_binding_modifier(struct weston_config *config, weston_config_get_binding_modifier(struct weston_config *config,
uint32_t default_mod) uint32_t default_mod)