Rules applied to pcb-rnd, especially in directories:

src_plugins
├── hid_gtk
├── hid_gtk3
├── lib_gtk_common
├── lib_gtk_config

In .h files

Rule 1

Look at the .h file only ; #include everything you need in that given file, directly, to let the compiler understands the structures and function protoypes used there.

Rule 2

Don’t be afraid to have indirect #include`s (`fileA is including fileB and fileC, but fileB already includes fileC)

Here, do both includes, not only fileB.

Rule 3

Circular #include ? : fileA includes fileB which itself includes fileA…​ It’s perfectly fine ;)

Rule 4

Frame your .h code with a #define allowing single definition if multiple calls. Example:
#ifdef  PCB_FILEA_H
#define PCB_FILEA_H

the code

#endif  /* PCB_FILEA_H */

Rule 5

Name those define PCB_GTK…​ according to following table:
Directory Prefix

lib_gtk_common

PCB_GTK_

lib_gtk_config

PCB_GTK_

hid_gtk

PCB_GTK2_

hid_gtk3

PCB_GTK3_

In .c files

Rule 1

#include "config.h" first…​

This is an essential mechanism for porting.

Rule 2

If the file is fileA.c, then #include "fileA.h"

Rule 3

refer to .h rules that can be applied to .c files.

Rule 4

please do not remove obj_elem.h in favor of obj_all.h - obj_all.h is a temporary construct that will be gone…​