Skip to content

Commit

Permalink
hacking-howto: Sync with i3 (#126)
Browse files Browse the repository at this point in the history
Includes:
- i3/i3#5463
- i3/i3#5464
  • Loading branch information
orestisfl authored May 30, 2023
1 parent 6019af6 commit c3705dd
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 130 deletions.
62 changes: 23 additions & 39 deletions _docs/hacking-howto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ you find necessary, please do not hesitate to contact me.
<p>
++++
This document is not 100% up to date. Specifically, everything up to and
including <<data_structures>> has been updated recently. The rest might contain
including <<startup>> has been updated recently. The rest might contain
outdated information.
++++
</p>
Expand All @@ -34,30 +34,18 @@ Guide → Compiling a Meson project]. In case you’re unfamiliar:

=== Build system features

* We use the +AX_ENABLE_BUILDDIR+ macro to enforce builds happening in a separate
directory. This is a prerequisite for the +AX_EXTEND_SRCDIR+ macro and building
in a separate directory is common practice anyway. In case this causes any
trouble when packaging i3 for your distribution, please open an issue.
* +ninja test+ runs the i3 testsuite. See docs/testsuite for details.

* +make check+ runs the i3 testsuite. See docs/testsuite for details.
* +meson dist+ builds a release tarball and runs tests on the result.

* +make distcheck+ (runs testsuite on +make dist+ result, tiny bit quicker
feedback cycle than waiting for the travis build to catch the issue).
* +meson -Ddocs=true -Dmans=true+ will enable the options to build docs and
manpages. These options require additional dependencies that are normally not
required for users who just want to build i3.

* +make uninstall+ (occasionally requested by users who compile from source)

* +make+ will build manpages/docs by default if the tools are installed.
Conversely, manpages/docs are not tried to be built for users who don’t want
to install all these dependencies to get started hacking on i3. Manpages and
docs can be disabled with the +--disable-mans++ and ++--disable-docs++
configure options respectively.

* non-release builds will enable address sanitizer by default. Use the
+--disable-sanitizers+ configure option to turn off all sanitizers, and see
+--help+ for available sanitizers.

* Coverage reports are now generated using +make check-code-coverage+, which
requires specifying +--enable-code-coverage+ when calling configure.
* +meson -Db_sanitize=address+ will enable the address sanitizer which is
disabled by default. A summary of memory leaks will be printed on program
exit. This can include false-positives. For other options of the +b_sanitize+
flag see https://mesonbuild.com/Builtin-options.html.

== Pull requests

Expand Down Expand Up @@ -341,30 +329,26 @@ ensure that the operating system on which i3 is compiled has all the expected
features, i3 comes with +include/queue.h+. On BSD systems, you can use +man
queue(3)+. On Linux, you have to use google (or read the source).

The lists used are +SLIST+ (single linked lists), +CIRCLEQ+ (circular
queues) and +TAILQ+ (tail queues). Usually, only forward traversal is necessary,
so an +SLIST+ works fine. If inserting elements at arbitrary positions or at
the end of a list is necessary, a +TAILQ+ is used instead. However, for the
windows inside a container, a +CIRCLEQ+ is necessary to go from the currently
selected window to the window above/below.

== Naming conventions

There is a row of standard variables used in many events. The following names
should be chosen for those:
The lists used are +SLIST+ (single linked lists), +CIRCLEQ+ (circular queues)
and +TAILQ+ (tail queues). Usually, +TAILQ+ is used which allows inserting
elements at arbitrary positions or at the end of the list. If only forward
traversal is necessary, an +SLIST+ can be used. +CIRCLEQ+ is used just to
manage the X11 state of each window.

* +conn+ is the xcb_connection_t
* +event+ is the event of the particular type
* +con+ names a container
* +current+ is a loop variable when using +TAILQ_FOREACH+ etc.
[[startup]]
== Startup (src/main.c, main())

== Startup (src/mainx.c, main())
Among other things, the main() function does the following:

* Establish the xcb connection
* Load the i3 config
* Check for XKB extension on the separate X connection, load Xcursor
* Check for RandR screens (with a fall-back to Xinerama)
* Set up EWMH hints
* Grab the keycodes for which bindings exist
* Check for XRandR screens
* Manage all existing windows
* Exec configured startup processes
* Start i3bar if configured
* Enter the event loop

== Keybindings
Expand Down
Loading

0 comments on commit c3705dd

Please sign in to comment.