mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
HACKING: Describe include order
It's what we ended up with, so lets describe it. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3297>
This commit is contained in:
parent
8f4ab53bd6
commit
da8f881551
55
HACKING.md
55
HACKING.md
@ -75,17 +75,50 @@ MetaUdev * meta_udev_new (MetaBackendNative *backend_native);
|
||||
Keep functions in the following order in source files:
|
||||
|
||||
1. GPL header
|
||||
2. Enums
|
||||
3. Structures
|
||||
4. Function prototypes
|
||||
5. `G_DEFINE_TYPE()`
|
||||
6. Static variables
|
||||
7. Auxiliary functions
|
||||
8. Callbacks
|
||||
9. Interface implementations
|
||||
10. Parent vfunc overrides
|
||||
11. class_init and init
|
||||
12. Public API
|
||||
2. Include header files
|
||||
3. Enums
|
||||
4. Structures
|
||||
5. Function prototypes
|
||||
6. `G_DEFINE_TYPE()`
|
||||
7. Static variables
|
||||
8. Auxiliary functions
|
||||
9. Callbacks
|
||||
10. Interface implementations
|
||||
11. Parent vfunc overrides
|
||||
12. class_init and init
|
||||
13. Public API
|
||||
|
||||
### Include header files
|
||||
|
||||
Source files should use the header include order of the following example:
|
||||
|
||||
* `meta-example.c`:
|
||||
```c
|
||||
#include "config.h"
|
||||
|
||||
#include "meta-example-private.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include <wayland-server-core.h>
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter.h"
|
||||
#include "backends/meta-backend-private.h"
|
||||
#include "mtk/mtk.h"
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "wayland/meta-wayland-surface.h"
|
||||
#endif
|
||||
|
||||
#include "meta-dbus-file-generated-by-gdbus-codegen.h"
|
||||
```
|
||||
|
||||
Include paths for non-system includes should be relative to the corresponding
|
||||
modules source root; i.e. `"backends/meta-backend-private.h"` for
|
||||
`src/backends/` and `"clutter/clutter.h"` for `clutter/clutter/clutter.h`.
|
||||
|
||||
### Structures
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user