Codebase list i3-gaps / e0eccab
Import upstream version 4.19 Kali Janitor 3 years ago
176 changed file(s) with 2788 addition(s) and 4317 deletion(s). Raw diff Collapse all Expand all
99 SpaceBeforeParens: ControlStatements
1010 SortIncludes: false
1111 ForEachMacros: [ TAILQ_FOREACH, TAILQ_FOREACH_REVERSE, SLIST_FOREACH, CIRCLEQ_FOREACH, CIRCLEQ_FOREACH_REVERSE, NODES_FOREACH, NODES_FOREACH_REVERSE, FOREACH_NONINTERNAL]
12 TypenameMacros: [ SLIST_HEAD, SLIST_ENTRY, LIST_HEAD, LIST_ENTRY, SIMPLEQ_HEAD, SIMPLEQ_ENTRY, TAILQ_HEAD, TAILQ_ENTRY, CIRCLEQ_HEAD, CIRCLEQ_ENTRY ]
0 # Contributing
1
2 ## i3status/i3lock bug reports and feature requests
3
4 Note that bug reports and feature requests for related projects should be filed in the corresponding repositories for [i3status](https://github.com/i3/i3status) and [i3lock](https://github.com/i3/i3lock).
5
6 ## i3 bug reports and feature requests
7
8 1. Read the [debugging instructions](https://i3wm.org/docs/debugging.html).
9 2. Make sure you include a link to your logfile in your report (section 3).
10 3. Make sure you include the i3 version number in your report (section 1).
11 4. Please be aware that we cannot support compatibility issues with
12 closed-source software, as digging into compatibility problems without
13 having access to the source code is too time-consuming. Additionally,
14 experience has shown that often, the software in question is responsible for
15 the issue. Please raise an issue with the software in question, not i3.
16 5. Please note that i3 does not support compositors (e.g. compton). If you
17 encountered the issue you are about to report while using a compositor,
18 please try reproducing it without a compositor.
19
20 ## Pull requests
21
22 * Before sending a pull request for new features, please check with us that the
23 feature is something we want to see in i3 by opening an issue which has
24 ”feature request” or ”enhancement” in its title.
25 * Use the `next` branch for developing and sending your pull request.
26 * Use `clang-format` to format your code.
27 * Run the [testsuite](https://i3wm.org/docs/testsuite.html)
28 * If your changes should be reported on the next release's changelog, also
29 update the [RELEASE-notes-next](../RELEASE-notes-next) file in the root
30 folder. Example of changes that should be reported are bug fixes present in
31 the latest stable version of i3 and new enhancements. Example of changes that
32 should not be reported are minor code improvements, documentation, regression
33 and fixes for bugs that were introduced in the `next` branch.
34
35 ## Finding something to do
36
37 * Find a [reproducible bug](https://github.com/i3/i3/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3Areproducible+label%3Abug+) from the issue tracker. These issues have been reviewed and confirmed by a project contributor.
38 * Find an [accepted enhancement](https://github.com/i3/i3/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3Aaccepted+label%3Aenhancement) from the issue tracker. These have been approved and are ok to start working on.
39
40 There's an [overview of the codebase](https://i3wm.org/docs/hacking-howto.html) available to get you started.
0 # i3 project governance
1
2 ## Overview
3
4 The i3 project uses a governance model commonly described as Benevolent
5 Dictator For Life (BDFL). This document outlines our understanding of what this
6 means.
7
8 ## Roles
9
10 * user: anyone who interacts with the i3 project
11 * core contributor: a handful of people who have contributed significantly to
12 the project by any means (issue triage, support, documentation, code, etc.).
13 Core contributors are recognizable via GitHub’s “Member” badge.
14 * BDFL: a single individual who makes decisions when consensus cannot be
15 reached. i3’s current BDFL is [@stapelberg](https://github.com/stapelberg).
16
17 ## Decision making process
18
19 In general, we try to reach consensus in discussions. In case consensus cannot
20 be reached, the BDFL makes a decision.
21
22 For feature requests and code contributions specifically, the values with which
23 we consider them can be found on the bottom of https://i3wm.org/. These values
24 are not set in stone and are to be treated as guiding principles, not absolute
25 rules that must be followed in every case.
26
27 ## Contribution process
28
29 Please see [CONTRIBUTING](CONTRIBUTING.md).
0 ---
1 name: Bug report
2 about: Create a report to help us improve
3 ---
4
5 <!--
6 PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
7 -->
8
9 ## I'm submitting a…
10 <!-- Please check one of the following options with "x" -->
11 <pre>
12 [x] Bug
13 [ ] Feature Request
14 [ ] Documentation Request
15 [ ] Other (Please describe in detail)
16 </pre>
17
18 ## Current Behavior
19 <!--
20 Describe the current behavior,
21 e.g., »When pressing Alt+j (focus left), the window above the current window is focused.«
22 -->
23
24 ## Expected Behavior
25 <!--
26 Describe the desired behavior you expect after mitigation of the issue,
27 e.g., »The window left next to the current window should be focused.«
28 -->
29
30 ## Reproduction Instructions
31 <!--
32 Please provide detailed instructions on how the bug can be reproduced.
33 E.g., »Open three windows in a V[A H[B C]] layout on a new workspace«
34 -->
35
36 ## Environment
37 <!--
38 Please include your exact i3 version.
39 Note that we only support the latest major release and the current development version. If you are using an older version of i3, please first update to the current release version and reproduce the issue there.
40 -->
41 Output of `i3 --moreversion 2>&-`:
42 <pre>
43 i3 version:
44 </pre>
45
46 <!--
47 Please include your (complete) i3 config with which the issue occurs. You can either paste the file directly or provide a link to a service such as pastebin.
48
49 If you would like to help debugging the issue, please try to reduce the config such that it is as close to the default config as possible while still reproducing the issue. This can help us bisect the root cause.
50 -->
51 <details><summary>Config file</summary><pre>
52 </pre>
53 </details>
54
55 <!--
56 Providing a logfile can help us trace the root cause of an issue much quicker. You can learn how to generate the logfile here:
57 https://i3wm.org/docs/debugging.html
58
59 Providing the logfile is optional.
60 -->
61 <pre>
62 Logfile URL:
63 </pre>
64
65 <!--
66 Please also answer the questions below to help us process your issue faster. If you have any other information to share, please add it here as well.
67 -->
68 <pre>
69 - Linux Distribution & Version:
70 - Are you using a compositor (e.g., xcompmgr or compton):
71 </pre>
0 ---
1 name: Feature request
2 about: Suggest an idea for this project
3 ---
4
5 <!--
6 PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
7 -->
8
9 ## I'm submitting a…
10 <!-- Please check one of the following options with "x" -->
11 <pre>
12 [ ] Bug
13 [x] Feature Request
14 [ ] Documentation Request
15 [ ] Other (Please describe in detail)
16 </pre>
17
18 ## Current Behavior
19 <!--
20 Describe the current behavior,
21 e.g., »When pressing Alt+j (focus left), the window above the current window is focused.«
22 -->
23
24 ## Desired Behavior
25 <!--
26 Describe the desired behavior you expect after mitigation of the issue,
27 e.g., »The window left next to the current window should be focused.«
28 -->
29
30 ## Environment
31 <!--
32 Please include your exact i3 version.
33 Note that we only support the latest major release and the current development version. If you are using an older version of i3, please first update to the current release version and reproduce the issue there.
34 -->
35 Output of `i3 --moreversion 2>&-`:
36 <pre>
37 i3 version:
38 </pre>
39
40 <!--
41 Please also answer the questions below to help us process your issue faster. If you have any other information to share, please add it here as well.
42 -->
43 <pre>
44 - Linux Distribution & Version:
45 - Are you using a compositor (e.g., xcompmgr or compton):
46 </pre>
0 <!--
1 PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
2
3 IMPORTANT NOTE: If your issue is not specific to any feature provided by i3-gaps but
4 to i3 in general, please open the issue upstream against i3/i3.
5 -->
6
7 ## I'm submitting a…
8 <!-- Please check one of the following options with "x" -->
9 <pre>
10 [ ] Bug
11 [ ] Feature Request
12 [ ] Documentation Request
13 [ ] Other (Please describe in detail)
14 </pre>
15
16 ## Current Behavior
17 <!--
18 Describe the current behavior,
19 e.g., »When pressing Alt+j (focus left), the window above the current window is focused.«
20 -->
21
22 ## Expected Behavior
23 <!--
24 Describe the desired behavior you expect after mitigation of the issue,
25 e.g., »The window left next to the current window should be focused.«
26 -->
27
28 ## Reproduction Instructions
29 <!--
30 For bug reports, please provide detailed instructions on how the bug can be reproduced.
31 For feature requests you can remove this section.
32
33 E.g., »Open three windows in a V[A H[B C]] layout on a new workspace«
34 -->
35
36 ## Environment
37 <!--
38 Please include your exact i3 version.
39 Note that we only support the latest major release and the current development version. If you are using an older version of i3, please first update to the current release version and reproduce the issue there.
40 -->
41 Output of `i3 --moreversion 2>&-`:
42 <pre>
43 i3 version:
44 </pre>
45
46 <!--
47 For bug reports, please include your (complete) i3 config with which the issue occurs. You can either paste the file directly or provide a link to a service such as pastebin.
48
49 If you would like to help debugging the issue, please try to reduce the config such that it is as close to the default config as possible while still reproducing the issue. This can help us bisect the root cause.
50 -->
51 <pre>
52 </pre>
53
54 <!--
55 Providing a logfile can help us trace the root cause of an issue much quicker. You can learn how to generate the logfile here:
56 https://i3wm.org/docs/debugging.html
57
58 Providing the logfile is optional.
59 -->
60 <pre>
61 Logfile URL:
62 </pre>
63
64 <!--
65 Please also answer the questions below to help us process your issue faster. If you have any other information to share, please add it here as well.
66 -->
67 <pre>
68 - Linux Distribution & Version:
69 - Are you using a compositor (e.g., xcompmgr or compton):
70 </pre>
0 *.o
1 tags
2 include/GENERATED_*.h
3 include/all.h.pch
4 *~
5 *.swp
6 *.gcda
7 *.gcno
8 *.dSYM
9 test.commands_parser
10 test.config_parser
11 testcases/MYMETA.json
12 testcases/MYMETA.yml
13 testcases/blib/
14 testcases/pm_to_blib
15 AnyEvent-I3/Makefile
16 AnyEvent-I3/META.yml
17 AnyEvent-I3/MYMETA.json
18 AnyEvent-I3/MYMETA.yml
19 AnyEvent-I3/blib/
20 AnyEvent-I3/inc/
21 AnyEvent-I3/pm_to_blib
22 *.output
23 *.tab.*
24 *.yy.c
25 man/*.1
26 man/*.xml
27 man/*.html
28 *.tar.bz2*
29 *.tar.xz*
30 i3
31 i3-input/i3-input
32 i3-nagbar/i3-nagbar
33 i3-msg/i3-msg
34 i3-config-wizard/i3-config-wizard
35 i3-dump-log/i3-dump-log
36 libi3.a
37 docs/*.pdf
38 docs/*.html
39 !/docs/refcard.html
40 i3-command-parser.stamp
41 i3-config-parser.stamp
42 .clang_complete
43 compile_commands.json
44 /.ccls-cache
45 /.clangd
46 LAST_VERSION
47 build
48
49 # We recommend building in a subdirectory called build.
50 # If you chose a different directory name,
51 # it is up to you to arrange for it to be ignored by git,
52 # e.g. by listing your directory in .git/info/exclude.
53 /build
54
3030 script:
3131 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh
3232 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh
33 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common"'
33 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'rm -rf build; mkdir -p build && cd build && CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common" meson .. -Ddocs=true -Dmans=true -Db_sanitize=address && ninja -v'
3434 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl
3535 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh
36 - docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'rm -rf distbuild; mkdir distbuild && cd distbuild && meson .. -Ddocs=true -Dmans=true && ninja -v dist'
3637 - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST
3738 - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME_UBUNTU} ./travis/debian-build.sh deb/ubuntu-amd64/DIST
3839 - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME_386} linux32 ./travis/debian-build.sh deb/debian-i386/DIST
100100 use constant TYPE_GET_CONFIG => 9;
101101 use constant TYPE_SEND_TICK => 10;
102102 use constant TYPE_SYNC => 11;
103 use constant TYPE_GET_BINDING_STATE => 12;
103104
104105 our %EXPORT_TAGS = ( 'all' => [
105106 qw(i3 TYPE_RUN_COMMAND TYPE_COMMAND TYPE_GET_WORKSPACES TYPE_SUBSCRIBE TYPE_GET_OUTPUTS
106107 TYPE_GET_TREE TYPE_GET_MARKS TYPE_GET_BAR_CONFIG TYPE_GET_VERSION
107 TYPE_GET_BINDING_MODES TYPE_GET_CONFIG TYPE_SEND_TICK TYPE_SYNC)
108 TYPE_GET_BINDING_MODES TYPE_GET_CONFIG TYPE_SEND_TICK TYPE_SYNC
109 TYPE_GET_BINDING_STATE)
108110 ] );
109111
110112 our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } );
+0
-1
I3_VERSION less more
0 4.18.1-non-git
00 Copyright © 2009, Michael Stapelberg and contributors
1 All rights reserved.
21
32 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions are met:
3 modification, are permitted provided that the following conditions
4 are met:
55
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
6 1. Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8 2. Redistributions in binary form must reproduce the above copyright
9 notice, this list of conditions and the following disclaimer in the
10 documentation and/or other materials provided with the distribution.
11 3. Neither the name of the copyright holder nor the names of its
12 contributors may be used to endorse or promote products derived
13 from this software without specific prior written permission.
814
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12
13 * Neither the name of Michael Stapelberg nor the
14 names of contributors may be used to endorse or promote products
15 derived from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY Michael Stapelberg ''AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Michael Stapelberg BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2625 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+0
-644
Makefile.am less more
0 @CODE_COVERAGE_RULES@
1
2 echo-version:
3 @echo "@I3_VERSION@"
4
5 bin_PROGRAMS = \
6 i3 \
7 i3bar/i3bar \
8 i3-config-wizard/i3-config-wizard \
9 i3-dump-log/i3-dump-log \
10 i3-input/i3-input \
11 i3-msg/i3-msg \
12 i3-nagbar/i3-nagbar
13
14 install-exec-hook:
15 $(LN_S) -f i3 $(DESTDIR)$(bindir)/i3-with-shmlog
16
17 uninstall-hook:
18 rm -f $(DESTDIR)$(bindir)/i3-with-shmlog
19
20 i3includedir=$(includedir)/i3
21 i3include_HEADERS = \
22 include/i3/ipc.h
23
24 dist_bin_SCRIPTS = \
25 i3-dmenu-desktop \
26 i3-migrate-config-to-v4 \
27 i3-save-tree \
28 i3-sensible-editor \
29 i3-sensible-pager \
30 i3-sensible-terminal
31
32 i3confdir = $(sysconfdir)/i3
33 dist_i3conf_DATA = \
34 etc/config \
35 etc/config.keycodes
36
37 I3STATUS_INSTALL_NAME = $(shell echo i3status | sed '@program_transform_name@')
38
39 etc/config: etc/$(dirstamp)
40 $(AM_V_GEN) sed "s,status_command i3status,status_command $(I3STATUS_INSTALL_NAME),g" $(top_srcdir)/etc/config > etc/config
41
42 etc/config.keycodes: etc/$(dirstamp)
43 $(AM_V_GEN) sed "s,status_command i3status,status_command $(I3STATUS_INSTALL_NAME),g" $(top_srcdir)/etc/config.keycodes > etc/config.keycodes
44
45 applicationsdir = $(datarootdir)/applications
46 xsessionsdir = $(datarootdir)/xsessions
47 dist_applications_DATA = \
48 share/applications/i3.desktop
49 dist_xsessions_DATA = \
50 share/xsessions/i3.desktop \
51 share/xsessions/i3-with-shmlog.desktop
52
53 noinst_LIBRARIES = libi3.a
54
55 check_PROGRAMS = \
56 test.commands_parser \
57 test.config_parser \
58 test.inject_randr15
59
60 check_SCRIPTS = \
61 testcases/complete-run.pl
62
63 check_DATA = \
64 anyevent-i3.stamp
65
66 clean-check:
67 rm -rf testsuite-* latest i3-cfg-for-* _Inline
68 clean-local: clean-check
69
70 TESTS = testcases/complete-run.pl
71
72 EXTRA_DIST = \
73 $(dist_docs_toc_DATA:.html=) \
74 $(dist_docs_notoc_DATA:.html=) \
75 AnyEvent-I3/Changes \
76 AnyEvent-I3/MANIFEST \
77 AnyEvent-I3/MANIFEST.SKIP \
78 AnyEvent-I3/Makefile.PL \
79 AnyEvent-I3/README \
80 AnyEvent-I3/lib/AnyEvent/I3.pm \
81 AnyEvent-I3/t/00-load.t \
82 AnyEvent-I3/t/01-workspaces.t \
83 AnyEvent-I3/t/02-sugar.t \
84 AnyEvent-I3/t/boilerplate.t \
85 AnyEvent-I3/t/manifest.t \
86 AnyEvent-I3/t/pod-coverage.t \
87 AnyEvent-I3/t/pod.t \
88 contrib/dump-asy.pl \
89 contrib/gtk-tree-watch.pl \
90 contrib/i3-wsbar \
91 contrib/per-workspace-layout.pl \
92 contrib/trivial-bar-script.sh \
93 docs/asciidoc-git.conf \
94 docs/bigpicture.png \
95 docs/i3-pod2html \
96 docs/i3-sync.dia \
97 docs/i3-sync.png \
98 docs/i3-sync-working.dia \
99 docs/i3-sync-working.png \
100 docs/keyboard-layer1.png \
101 docs/keyboard-layer2.png \
102 docs/layout-saving-1.png \
103 docs/logo-30.png \
104 docs/modes.png \
105 docs/refcard.html \
106 docs/refcard_style.css \
107 docs/single_terminal.png \
108 docs/snapping.png \
109 docs/tree-layout1.png \
110 docs/tree-layout2.png \
111 docs/tree-shot1.png \
112 docs/tree-shot2.png \
113 docs/tree-shot3.png \
114 docs/tree-shot4.png \
115 docs/two_columns.png \
116 docs/two_terminals.png \
117 docs/wsbar.dia \
118 docs/wsbar.png \
119 i3bar/LICENSE \
120 libi3/README \
121 $(asciidoc_MANS:.1=.man) \
122 $(asciidoc_MANS:.1=.man) \
123 man/asciidoc.conf.in \
124 DEPENDS \
125 I3_VERSION \
126 LICENSE \
127 PACKAGE-MAINTAINER \
128 RELEASE-NOTES-4.18.1 \
129 generate-command-parser.pl \
130 parser-specs/commands.spec \
131 parser-specs/config.spec \
132 parser-specs/highlighting.vim \
133 pseudo-doc.doxygen \
134 testcases/complete-run.pl.in \
135 testcases/i3-test.config \
136 testcases/lib/i3test/Test.pm \
137 testcases/lib/i3test/Util.pm \
138 testcases/lib/i3test/XTEST.pm \
139 testcases/lib/i3test.pm.in \
140 testcases/lib/SocketActivation.pm \
141 testcases/lib/StartXServer.pm \
142 testcases/lib/StatusLine.pm \
143 testcases/lib/TestWorker.pm \
144 testcases/Makefile.PL \
145 testcases/new-test \
146 testcases/restart-state.golden \
147 testcases/t \
148 testcases/valgrind.supp
149
150 # dirstamps contains directories which we want to be created in $(top_builddir)
151 # so that our custom rules can store files in them.
152 dirstamp = .dirstamp
153 dirstamps = \
154 docs/$(dirstamp) \
155 man/$(dirstamp) \
156 parser/$(dirstamp) \
157 etc/$(dirstamp)
158 DISTCLEANFILES = $(dirstamps)
159
160 $(dirstamps):
161 @stamp='$@'; $(MKDIR_P) "$${stamp%/*}"
162 @: > $@
163
164 ################################################################################
165 # docs generation
166 ################################################################################
167
168 docs_tocdir = ${docdir}
169 docs_notocdir = ${docdir}
170 docs_poddir = ${docdir}
171 if BUILD_DOCS
172 dist_docs_toc_DATA = \
173 docs/hacking-howto.html \
174 docs/userguide.html \
175 docs/ipc.html \
176 docs/multi-monitor.html \
177 docs/wsbar.html \
178 docs/testsuite.html \
179 docs/i3bar-protocol.html \
180 docs/layout-saving.html
181
182 dist_docs_notoc_DATA = \
183 docs/debugging.html
184
185 dist_docs_pod_DATA = \
186 docs/lib-i3test.html \
187 docs/lib-i3test-test.html
188
189 $(dist_docs_toc_DATA): docs/%.html: docs/% docs/$(dirstamp)
190 $(AM_V_GEN) @PATH_ASCIIDOC@ -a toc -n -o $@ $<
191
192 $(dist_docs_notoc_DATA): docs/%.html: docs/% docs/$(dirstamp)
193 $(AM_V_GEN) @PATH_ASCIIDOC@ -n -o $@ $<
194
195 docs/lib-i3test.html: testcases/lib/i3test.pm docs/$(dirstamp)
196 $(AM_V_GEN) $(top_srcdir)/docs/i3-pod2html $< $@
197
198 docs/lib-i3test-test.html: testcases/lib/i3test/Test.pm docs/$(dirstamp)
199 $(AM_V_GEN) $(top_srcdir)/docs/i3-pod2html $< $@
200
201 else
202 dist_docs_toc_DATA =
203 dist_docs_notoc_DATA =
204 dist_docs_pod_DATA =
205 endif
206
207 ################################################################################
208 # manpage generation
209 ################################################################################
210
211 if BUILD_MANS
212 dist_man1_MANS = \
213 $(asciidoc_MANS) \
214 $(pod_MANS)
215
216 asciidoc_MANS = \
217 man/i3.1 \
218 man/i3bar.1 \
219 man/i3-msg.1 \
220 man/i3-input.1 \
221 man/i3-nagbar.1 \
222 man/i3-config-wizard.1 \
223 man/i3-migrate-config-to-v4.1 \
224 man/i3-sensible-editor.1 \
225 man/i3-sensible-pager.1 \
226 man/i3-sensible-terminal.1 \
227 man/i3-dump-log.1
228
229 pod_MANS = \
230 man/i3-dmenu-desktop.1 \
231 man/i3-save-tree.1
232
233 $(asciidoc_MANS): man/%.1: man/%.xml man/$(dirstamp)
234 $(AM_V_GEN) out='$@'; @PATH_XMLTO@ man -o "$${out%/*}" $<
235 @stamp='$@'; $(MKDIR_P) "$${stamp%/*}"
236
237 man/%.xml: man/%.man man/asciidoc.conf man/$(dirstamp)
238 $(AM_V_GEN) @PATH_ASCIIDOC@ -d manpage -b docbook -f $(top_builddir)/man/asciidoc.conf -o $@ $<
239
240 $(pod_MANS): man/%.1: % man/$(dirstamp)
241 $(AM_V_GEN) @PATH_POD2MAN@ --utf8 $< > $@
242 else
243 asciidoc_MANS =
244 endif
245
246 AM_CPPFLAGS = \
247 -DSYSCONFDIR="\"$(sysconfdir)\"" \
248 -I$(top_builddir)/parser \
249 -I$(top_srcdir)/include \
250 @AX_EXTEND_SRCDIR_CPPFLAGS@
251
252 i3_CFLAGS = \
253 $(AM_CFLAGS) \
254 $(libi3_CFLAGS) \
255 $(LIBSN_CFLAGS) \
256 $(XCB_CFLAGS) \
257 $(XCB_UTIL_CURSOR_CFLAGS) \
258 $(XCB_UTIL_KEYSYM_CFLAGS) \
259 $(XCB_UTIL_WM_CFLAGS) \
260 $(XCB_UTIL_XRM_CFLAGS) \
261 $(XKBCOMMON_CFLAGS) \
262 $(YAJL_CFLAGS) \
263 $(LIBPCRE_CFLAGS) \
264 $(PTHREAD_CFLAGS) \
265 $(CODE_COVERAGE_CFLAGS)
266
267 i3_CPPFLAGS = \
268 $(AM_CPPFLAGS) \
269 $(CODE_COVERAGE_CPPFLAGS)
270
271 i3_LDADD = \
272 $(libi3_LIBS) \
273 $(LIBSN_LIBS) \
274 $(XCB_LIBS) \
275 $(XCB_UTIL_CURSOR_LIBS) \
276 $(XCB_UTIL_KEYSYMS_LIBS) \
277 $(XCB_UTIL_WM_LIBS) \
278 $(XCB_UTIL_XRM_LIBS) \
279 $(XKBCOMMON_LIBS) \
280 $(YAJL_LIBS) \
281 $(LIBPCRE_LIBS) \
282 $(PANGOCAIRO_LIBS) \
283 $(PTHREAD_LIBS) \
284 $(CODE_COVERAGE_LDFLAGS)
285
286 libi3_CFLAGS = \
287 $(AM_CFLAGS) \
288 $(GLIBGOBJECT_CFLAGS) \
289 $(XCB_CFLAGS) \
290 $(XCB_UTIL_CFLAGS) \
291 $(XCB_UTIL_XRM_CFLAGS) \
292 $(YAJL_CFLAGS) \
293 $(PANGOCAIRO_CFLAGS)
294
295 libi3_LIBS = \
296 $(top_builddir)/libi3.a \
297 $(GLIBGOBJECT_LIBS) \
298 $(XCB_LIBS) \
299 $(XCB_UTIL_LIBS) \
300 $(XCB_UTIL_XRM_LIBS) \
301 $(YAJL_LIBS) \
302 $(PANGOCAIRO_LIBS)
303
304 libi3_a_CFLAGS = \
305 $(libi3_CFLAGS)
306
307 libi3_a_SOURCES = \
308 include/libi3.h \
309 libi3/dpi.c \
310 libi3/draw_util.c \
311 libi3/fake_configure_notify.c \
312 libi3/font.c \
313 libi3/format_placeholders.c \
314 libi3/g_utf8_make_valid.c \
315 libi3/get_colorpixel.c \
316 libi3/get_config_path.c \
317 libi3/get_exe_path.c \
318 libi3/get_mod_mask.c \
319 libi3/get_process_filename.c \
320 libi3/get_visualtype.c \
321 libi3/ipc_connect.c \
322 libi3/ipc_recv_message.c \
323 libi3/ipc_send_message.c \
324 libi3/is_debug_build.c \
325 libi3/mkdirp.c \
326 libi3/resolve_tilde.c \
327 libi3/root_atom_contents.c \
328 libi3/safewrappers.c \
329 libi3/string.c \
330 libi3/strndup.c \
331 libi3/ucs2_conversion.c
332
333 i3_dump_log_i3_dump_log_CFLAGS = \
334 $(AM_CFLAGS) \
335 $(PTHREAD_CFLAGS) \
336 $(libi3_CFLAGS)
337
338 i3_dump_log_i3_dump_log_LDADD = \
339 $(PTHREAD_LIBS) \
340 $(libi3_LIBS)
341
342 i3_dump_log_i3_dump_log_SOURCES = \
343 i3-dump-log/main.c
344
345 i3_input_i3_input_CFLAGS = \
346 $(AM_CFLAGS) \
347 $(libi3_CFLAGS)
348
349 i3_input_i3_input_LDADD = \
350 $(libi3_LIBS) \
351 $(XCB_UTIL_KEYSYMS_LIBS)
352
353 i3_input_i3_input_SOURCES = \
354 i3-input/i3-input.h \
355 i3-input/keysym2ucs.c \
356 i3-input/keysym2ucs.h \
357 i3-input/main.c
358
359 i3_msg_i3_msg_CFLAGS = \
360 $(AM_CFLAGS) \
361 $(libi3_CFLAGS)
362
363 i3_msg_i3_msg_LDADD = \
364 $(libi3_LIBS)
365
366 i3_msg_i3_msg_SOURCES = \
367 i3-msg/main.c
368
369 i3_nagbar_i3_nagbar_CFLAGS = \
370 $(AM_CFLAGS) \
371 $(LIBSN_CFLAGS) \
372 $(libi3_CFLAGS)
373
374 i3_nagbar_i3_nagbar_LDADD = \
375 $(libi3_LIBS) \
376 $(LIBSN_LIBS) \
377 $(XCB_UTIL_CURSOR_LIBS)
378
379 i3_nagbar_i3_nagbar_SOURCES = \
380 i3-nagbar/atoms.xmacro \
381 i3-nagbar/i3-nagbar.h \
382 i3-nagbar/main.c
383
384 i3bar_i3bar_CPPFLAGS = \
385 $(AM_CPPFLAGS) \
386 -I$(top_srcdir)/i3bar/include
387
388 i3bar_i3bar_CFLAGS = \
389 $(AM_CFLAGS) \
390 $(libi3_CFLAGS) \
391 $(XCB_CFLAGS) \
392 $(XKBCOMMON_CFLAGS) \
393 $(PANGOCAIRO_CFLAGS) \
394 $(YAJL_CFLAGS)
395
396 i3bar_i3bar_LDADD = \
397 $(libi3_LIBS) \
398 $(XCB_LIBS) \
399 $(XCB_UTIL_CURSOR_LIBS) \
400 $(XKBCOMMON_LIBS) \
401 $(PANGOCAIRO_LIBS) \
402 $(YAJL_LIBS)
403
404 i3bar_i3bar_SOURCES = \
405 i3bar/include/child.h \
406 i3bar/include/common.h \
407 i3bar/include/configuration.h \
408 i3bar/include/ipc.h \
409 i3bar/include/mode.h \
410 i3bar/include/outputs.h \
411 i3bar/include/parse_json_header.h \
412 i3bar/include/trayclients.h \
413 i3bar/include/util.h \
414 i3bar/include/workspaces.h \
415 i3bar/include/xcb_atoms.def \
416 i3bar/include/xcb.h \
417 i3bar/src/child.c \
418 i3bar/src/config.c \
419 i3bar/src/ipc.c \
420 i3bar/src/main.c \
421 i3bar/src/mode.c \
422 i3bar/src/outputs.c \
423 i3bar/src/parse_json_header.c \
424 i3bar/src/workspaces.c \
425 i3bar/src/xcb.c
426
427 i3_config_wizard_i3_config_wizard_CFLAGS = \
428 $(AM_CFLAGS) \
429 $(libi3_CFLAGS) \
430 $(LIBSN_CFLAGS) \
431 $(XKBCOMMON_CFLAGS)
432
433 i3_config_wizard_i3_config_wizard_LDADD = \
434 $(libi3_LIBS) \
435 $(LIBSN_LIBS) \
436 $(XCB_UTIL_KEYSYMS_LIBS) \
437 $(XKBCOMMON_LIBS)
438
439 i3_config_wizard_i3_config_wizard_SOURCES = \
440 i3-config-wizard/atoms.xmacro \
441 i3-config-wizard/main.c \
442 i3-config-wizard/xcb.h
443
444 i3_config_wizard_i3_config_wizard_DEPENDENCIES = \
445 $(config_parser_SOURCES)
446
447 test_inject_randr15_CPPFLAGS = \
448 $(AM_CPPFLAGS)
449
450 test_inject_randr15_CFLAGS = \
451 $(AM_CFLAGS) \
452 $(i3_CFLAGS)
453
454 test_inject_randr15_SOURCES = \
455 testcases/inject_randr1.5.c
456
457 test_inject_randr15_LDADD = \
458 $(i3_LDADD)
459
460 test_commands_parser_CPPFLAGS = \
461 $(AM_CPPFLAGS) \
462 -DTEST_PARSER
463
464 test_commands_parser_CFLAGS = \
465 $(AM_CFLAGS) \
466 $(i3_CFLAGS)
467
468 test_commands_parser_SOURCES = \
469 src/commands_parser.c
470
471 test_commands_parser_LDADD = \
472 $(i3_LDADD)
473
474 test_config_parser_CPPFLAGS = \
475 $(AM_CPPFLAGS) \
476 -DTEST_PARSER
477
478 test_config_parser_CFLAGS = \
479 $(AM_CFLAGS) \
480 $(i3_CFLAGS)
481
482 test_config_parser_SOURCES = \
483 src/config_parser.c
484
485 test_config_parser_LDADD = \
486 $(i3_LDADD)
487
488 command_parser_SOURCES = \
489 parser/GENERATED_command_enums.h \
490 parser/GENERATED_command_tokens.h \
491 parser/GENERATED_command_call.h
492
493 config_parser_SOURCES = \
494 parser/GENERATED_config_enums.h \
495 parser/GENERATED_config_tokens.h \
496 parser/GENERATED_config_call.h
497
498 i3_SOURCES = \
499 $(command_parser_SOURCES) \
500 $(config_parser_SOURCES) \
501 include/all.h \
502 include/assignments.h \
503 include/atoms_NET_SUPPORTED.xmacro \
504 include/atoms_rest.xmacro \
505 include/atoms.xmacro \
506 include/bindings.h \
507 include/click.h \
508 include/cmdparse.h \
509 include/commands.h \
510 include/commands_parser.h \
511 include/config_directives.h \
512 include/configuration.h \
513 include/config_parser.h \
514 include/con.h \
515 include/data.h \
516 include/display_version.h \
517 include/drag.h \
518 include/ewmh.h \
519 include/fake_outputs.h \
520 include/floating.h \
521 include/handlers.h \
522 include/i3.h \
523 include/ipc.h \
524 include/key_press.h \
525 include/load_layout.h \
526 include/log.h \
527 include/main.h \
528 include/manage.h \
529 include/match.h \
530 include/move.h \
531 include/output.h \
532 include/queue.h \
533 include/randr.h \
534 include/regex.h \
535 include/render.h \
536 include/resize.h \
537 include/restore_layout.h \
538 include/scratchpad.h \
539 include/sd-daemon.h \
540 include/shmlog.h \
541 include/sighandler.h \
542 include/startup.h \
543 include/sync.h \
544 include/tree.h \
545 include/util.h \
546 include/window.h \
547 include/workspace.h \
548 include/xcb.h \
549 include/xcursor.h \
550 include/x.h \
551 include/xinerama.h \
552 include/yajl_utils.h \
553 src/assignments.c \
554 src/bindings.c \
555 src/click.c \
556 src/commands.c \
557 src/commands_parser.c \
558 src/con.c \
559 src/config.c \
560 src/config_directives.c \
561 src/config_parser.c \
562 src/display_version.c \
563 src/drag.c \
564 src/ewmh.c \
565 src/fake_outputs.c \
566 src/floating.c \
567 src/handlers.c \
568 src/ipc.c \
569 src/key_press.c \
570 src/load_layout.c \
571 src/log.c \
572 src/main.c \
573 src/manage.c \
574 src/match.c \
575 src/move.c \
576 src/output.c \
577 src/randr.c \
578 src/regex.c \
579 src/render.c \
580 src/resize.c \
581 src/restore_layout.c \
582 src/scratchpad.c \
583 src/sd-daemon.c \
584 src/sighandler.c \
585 src/startup.c \
586 src/sync.c \
587 src/tree.c \
588 src/util.c \
589 src/version.c \
590 src/window.c \
591 src/workspace.c \
592 src/x.c \
593 src/xcb.c \
594 src/xcursor.c \
595 src/xinerama.c
596
597 ################################################################################
598 # parser generation
599 ################################################################################
600
601 $(command_parser_SOURCES): %.h: i3-command-parser.stamp
602
603 $(config_parser_SOURCES): %.h: i3-config-parser.stamp
604
605 src/i3-commands_parser.$(OBJEXT): i3-command-parser.stamp
606
607 src/i3-config_parser.$(OBJEXT): i3-config-parser.stamp
608
609 i3-command-parser.stamp: parser/$(dirstamp) generate-command-parser.pl parser-specs/commands.spec
610 $(AM_V_GEN) $(top_srcdir)/generate-command-parser.pl --input=$(top_srcdir)/parser-specs/commands.spec --prefix=command
611 $(AM_V_at) mv GENERATED_command_* $(top_builddir)/parser
612 $(AM_V_at) touch $@
613
614 i3-config-parser.stamp: parser/$(dirstamp) generate-command-parser.pl parser-specs/config.spec
615 $(AM_V_GEN) $(top_srcdir)/generate-command-parser.pl --input=$(top_srcdir)/parser-specs/config.spec --prefix=config
616 $(AM_V_at) mv GENERATED_config_* $(top_builddir)/parser
617 $(AM_V_at) touch $@
618
619 ################################################################################
620 # AnyEvent-I3 build process
621 ################################################################################
622
623 anyevent-i3.stamp: AnyEvent-I3/lib/AnyEvent/I3.pm
624 $(AM_V_BUILD) (cd $(top_srcdir)/AnyEvent-I3 && perl Makefile.PL && make)
625 $(AM_V_at) touch $@
626
627 CLEANFILES = \
628 i3-command-parser.stamp \
629 i3-config-parser.stamp \
630 anyevent-i3.stamp
631
632 ################################################################################
633 # Language Server support
634 ################################################################################
635
636 # Recursively run make through https://github.com/rizsotto/Bear,
637 # which generates a compile_commands.json file in the source directory.
638 # This is useful for running e.g. the clangd or ccls language servers:
639 # https://clang.llvm.org/extra/clangd/
640 # https://github.com/MaskRay/ccls/wiki
641 .PHONY: bear
642 bear: clean
643 bear -o $(top_srcdir)/compile_commands.json $(MAKE) $(MAKEFLAGS)
2020 If your distribution has a mechanism to get the preferred terminal, such as the
2121 x-terminal-emulator symlink in Debian, please use it in i3-sensible-terminal.
2222
23 On debian, compilation and installing the manpages looks like this:
23 You can build i3 like you build any other software package which uses
24 https://mesonbuild.com/; see
25 https://mesonbuild.com/Quick-guide.html#compiling-a-meson-project
26 In case you’re unfamiliar:
2427
25 autoreconf -fi
26 mkdir -p build && cd build
27 ../configure
28 make -j8 install
28 $ mkdir -p build && cd build
29 $ meson ..
30 $ ninja
2931
3032 Please make sure that i3-migrate-config-to-v4 and i3-config-wizard are
3133 installed with i3. The Perl script is necessary to (automatically) convert v3
3436 start of i3 (it will automatically exit if it finds a config file).
3537
3638 If you have any questions, ideas, hints, problems or whatever, please do not
37 hesitate to contact me. I will help you out. Just drop me an E-Mail (find the
38 address at https://michael.stapelberg.de/Impressum/, scroll down to bottom),
39 contact me using the same address in jabber or ask on our IRC channel:
40 (#i3 on irc.freenode.net).
39 hesitate to contact me. I will help you out. Please see
40 https://i3wm.org/contact/
4141
4242 Thanks again for your efforts,
4343 Michael
1212
1313 ## How do I install i3-gaps?
1414
15 Please refer to the [wiki](https://github.com/Airblader/i3/wiki).
15 Please refer to the [wiki](https://github.com/Airblader/i3/wiki/installation).
1616
1717 ## Where can I get help?
1818
+0
-32
RELEASE-NOTES-4.18.1 less more
0
1 ┌──────────────────────────────┐
2 │ Release notes for i3 v4.18.1 │
3 └──────────────────────────────┘
4
5 This is i3 v4.18.1. This version is considered stable. All users of i3 are
6 strongly encouraged to upgrade.
7
8 This is a bugfix release for v4.18.
9
10 ┌────────────────────────────┐
11 │ Bugfixes │
12 └────────────────────────────┘
13
14 • Move parent nodes in scratchpad correctly
15 • i3bar: Call cont_child() more liberally
16 • Fix load_layout crash when floating node doesn't have CT_FLOATING_CON parent
17 • Fix SEGFAULT when i3bar receives invalid input
18 • Revert "floating_reposition: avoid extra tree_render"
19 • Call tree_render if floating move changes workspace
20 • Update EWMH properties on workspace move
21 • cmd_focus_sibling: Fix crash on workspace level
22
23 ┌────────────────────────────┐
24 │ Thanks! │
25 └────────────────────────────┘
26
27 Thanks for testing, bugfixes, discussions and everything I forgot go out to:
28
29 Heman Gandhi, Orestis Floros
30
31 -- Michael Stapelberg, 2020-04-22
0
1 ┌──────────────────────────────┐
2 │ Release notes for i3 v4.19 │
3 └──────────────────────────────┘
4
5 This is i3 v4.19. This version is considered stable. All users of i3 are
6 strongly encouraged to upgrade.
7
8 In this release, we switched from the autotools build system to the meson build
9 system (https://mesonbuild.com/). Check https://github.com/i3/i3/issues/4086 for
10 details. If this causes problems for you, you can revert the commit which
11 removed autotools from the tree: we tried our best to keep both build systems
12 working. Please reach out to us in that case!
13
14 ┌────────────────────────────┐
15 │ Changes in i3 v4.19 │
16 └────────────────────────────┘
17
18 • userguide: explain button6 and button7 (scroll wheel right/left)
19 • ipc: always include the marks property (even if empty)
20 • ipc: introduce GET_BINDING_STATE command
21 • ipc: clarify workspace name field semantics
22 • ipc: document parse_error COMMAND reply field
23 • i3bar: launch using exec to avoid leaving useless shell process
24 • i3bar: make dock client order deterministic (sorted by class/instance) as a
25 side effect, i3bars without an explicit bar-id will be sorted according
26 to their definition order in the config file
27 • i3bar: update config when necessary (reduces redraws on bar mode changes)
28 • i3bar: add coordinates relative to the current output in i3bar click events
29 • i3bar: add “nonprimary” output option
30 • i3bar: set WM_CLASS instance to bar id
31 • i3-input: add different exit codes for when i3-input fails
32 • i3-dmenu-desktop: Support symlinks in search path
33 • pod2html: render without stylesheet by default
34 • introduce “tiling_from” and ”floating_from” criteria
35 • mention rofi in default config file
36 • allow ppt values in move direction and move position commands
37 • allow matching on empty properties like class, title, etc.
38
39 ┌────────────────────────────┐
40 │ Bugfixes │
41 └────────────────────────────┘
42
43 • i3-nagbar: Use _PATH_BSHELL to ensure using a bourne shell
44 • i3bar: fix Xorg memory leak
45 • i3bar: fix hang when pausing/resuming bar program
46 • i3bar: fix crash on invalid JSON input
47 • i3bar: kick tray clients before destroying the bar
48 • ensure client windows have a size of at least 1px after resize
49 • correctly handle overlapping decorations
50 • limit workspace numbers within 0..INT32_MAX
51 • fix a bug with tiling resize inside floating container
52 • correctly handle mouse resize in fullscreen containers by
53 not propagating $mod+right click to fullscreen clients
54 • do not try to resize fullscreen and non-fullscreen windows
55 • do not focus floating windows changing workspace with ConfigureNotify
56 • set _NET_DESKTOP_VIEWPORT after randr changes
57 • fix a bug with i3-nagbar not starting after it has already started once
58 • fix conflict when moving parent of fullscreen window to workspace
59 • fix named workspace assignments on output changes
60 • fix named workspace assignment precedence on workspace renames
61 • fix windows getting swallowed more than once
62 • erase i3 --moreversion progress line before overwriting
63 • fix test case 180-fd-leaks when running on Fedora
64 • fix crash in `focus next sibling`
65 • fix moving tiling windows out of the scratchpad
66 • floating_maybe_reassign_ws: only re-focus if previously focused
67 (fixes a focus issue with KDE notifications)
68 • fix crash on invalid JSON input in stored layouts
69 • fix monitor change during/with i3 restart by moving
70 content for non-existing output containers
71
72 Thanks for testing, bugfixes, discussions and everything I forgot go out to:
73
74 6144, acheronfail, Albert Safin, Alessandro Vinciguerra, Andrey Burov,
75 Francesc Hervada-Sala, Heman Gandhi, Ian Fan, Ingo Bürk, izzel, Jason, Jason
76 Nader, Jorg Heymans, Joseph, Konstantin Kharlamov, Lukas Kern, Mark Guptill,
77 Martin T. H. Sandsmark, Matthew Martin, Maxim Schuwalow, Mike Sharov, Orestis
78 Floros, Vasily Fomin, Wilhelm Schuster, xzfc, zero77
79
80 -- Michael Stapelberg, 2020-11-15
+0
-202
configure.ac less more
0 # -*- Autoconf -*-
1 # Run autoreconf -fi to generate a configure script from this file.
2
3 AC_PREREQ([2.69])
4 AC_INIT([i3], [4.18.1], [https://github.com/i3/i3/issues])
5 # For AX_EXTEND_SRCDIR
6 AX_ENABLE_BUILDDIR
7 AM_INIT_AUTOMAKE([foreign subdir-objects -Wall no-dist-gzip dist-bzip2])
8 # Default to silent rules, use V=1 to get verbose compilation output.
9 AM_SILENT_RULES([yes])
10 # Make it possible to disable maintainer mode to disable re-generation of build
11 # system files.
12 AM_MAINTAINER_MODE([enable])
13 AC_CONFIG_SRCDIR([libi3/ipc_recv_message.c])
14 AC_CONFIG_HEADERS([config.h])
15 AC_CONFIG_MACRO_DIR([m4])
16
17 dnl Verify macros defined in m4/ such as AX_SANITIZERS are not present in the
18 dnl output, i.e. are replaced as expected. This line results in a better error
19 dnl message when using aclocal < 1.13 (which does not understand
20 dnl AC_CONFIG_MACRO_DIR) without passing the -I m4 parameter.
21 m4_pattern_forbid([AX_SANITIZERS])
22
23 # Verify we are using GNU make because we use '%'-style pattern rules in
24 # Makefile.am, which are a GNU make extension. Pull requests to replace
25 # '%'-style pattern rules with a more portable alternative are welcome.
26 AX_CHECK_GNU_MAKE
27 AS_VAR_IF([_cv_gnu_make_command], [""], [AC_MSG_ERROR([the i3 Makefile.am requires GNU make])])
28
29 AX_EXTEND_SRCDIR
30
31 AS_IF([test -e ${srcdir}/.git],
32 [
33 VERSION="$(git -C ${srcdir} describe --tags --abbrev=0)"
34 I3_VERSION="$(git -C ${srcdir} describe --tags --always) ($(git -C ${srcdir} rev-list --format=%cd --date=short -n1 $(git rev-parse HEAD) | tail -n1), branch \\\"$(git -C ${srcdir} describe --tags --always --all | sed s:heads/::)\\\")"
35 # Mirrors what libi3/is_debug_build.c does:
36 is_release=$(test $(echo "${I3_VERSION}" | cut -d '(' -f 1 | wc -m) -lt 10 && echo yes || echo no)
37 ],
38 [
39 VERSION="$(cut -d '-' -f 1 ${srcdir}/I3_VERSION | cut -d ' ' -f 1)"
40 I3_VERSION="$(sed -e 's/@<:@\"?\\@:>@/\\&/g' ${srcdir}/I3_VERSION)"
41 is_release="$(grep -q non-git ${srcdir}/I3_VERSION && echo no || echo yes)"
42 ])
43 AC_SUBST([I3_VERSION], [$I3_VERSION])
44 MAJOR_VERSION="$(echo ${VERSION} | cut -d '.' -f 1)"
45 MINOR_VERSION="$(echo ${VERSION} | cut -d '.' -f 2)"
46 PATCH_VERSION="$(echo ${VERSION} | cut -d '.' -f 3)"
47 AS_IF([test "x${PATCH_VERSION}" = x], [PATCH_VERSION=0])
48 AC_DEFINE_UNQUOTED([I3_VERSION], ["${I3_VERSION}"], [i3 version])
49 AC_DEFINE_UNQUOTED([MAJOR_VERSION], [${MAJOR_VERSION}], [i3 major version])
50 AC_DEFINE_UNQUOTED([MINOR_VERSION], [${MINOR_VERSION}], [i3 minor version])
51 AC_DEFINE_UNQUOTED([PATCH_VERSION], [${PATCH_VERSION}], [i3 patch version])
52
53 AX_CODE_COVERAGE
54
55 dnl is_release must be lowercase because AX_CHECK_ENABLE_DEBUG calls m4_tolower
56 dnl on its fourth argument.
57 AX_CHECK_ENABLE_DEBUG([yes], , [UNUSED_NDEBUG], [$is_release])
58
59 AC_PROG_CC_C99
60
61 # For strnlen() and vasprintf().
62 AC_USE_SYSTEM_EXTENSIONS
63
64 # Checks for typedefs, structures, and compiler characteristics.
65 AC_CHECK_HEADER_STDBOOL
66 dnl The error message should include the specific type which could not be
67 dnl found, but I do not see a way to achieve that.
68 AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t], , [AC_MSG_FAILURE([cannot find required type])])
69
70 # Checks for library functions.
71 AC_FUNC_FORK
72 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
73 AC_FUNC_STRNLEN
74 AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3 requires])])
75 AC_REPLACE_FUNCS([mkdirp strndup])
76
77 # Checks for libraries.
78
79 AC_SEARCH_LIBS([floor], [m], , [AC_MSG_FAILURE([cannot find the required floor() function despite trying to link with -lm])])
80
81 # libev does not ship with a pkg-config file :(.
82 AC_SEARCH_LIBS([ev_run], [ev], , [AC_MSG_FAILURE([cannot find the required ev_run() function despite trying to link with -lev])])
83
84 AC_SEARCH_LIBS([shm_open], [rt], [], [], [-pthread])
85
86 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0, 0)])], ,
87 [LIBS="-liconv $LIBS"
88 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0, 0)])], ,
89 [AC_MSG_FAILURE([cannot find the required iconv_open() function despite trying to link with -liconv])])]
90 )
91
92 AX_PTHREAD
93
94 dnl Each prefix corresponds to a source tarball which users might have
95 dnl downloaded in a newer version and would like to overwrite.
96 PKG_CHECK_MODULES([LIBSN], [libstartup-notification-1.0])
97 PKG_CHECK_MODULES([XCB], [xcb xcb-xkb xcb-xinerama xcb-randr xcb-shape])
98 PKG_CHECK_MODULES([XCB_UTIL], [xcb-event xcb-util])
99 PKG_CHECK_MODULES([XCB_UTIL_CURSOR], [xcb-cursor])
100 PKG_CHECK_MODULES([XCB_UTIL_KEYSYMS], [xcb-keysyms])
101 PKG_CHECK_MODULES([XCB_UTIL_WM], [xcb-icccm])
102 PKG_CHECK_MODULES([XCB_UTIL_XRM], [xcb-xrm])
103 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon xkbcommon-x11])
104 PKG_CHECK_MODULES([YAJL], [yajl])
105 PKG_CHECK_MODULES([LIBPCRE], [libpcre >= 8.10])
106 PKG_CHECK_MODULES([PANGOCAIRO], [cairo >= 1.14.4 pangocairo])
107 PKG_CHECK_MODULES([GLIBGOBJECT], [glib-2.0 gobject-2.0])
108
109 # Checks for programs.
110 AC_PROG_AWK
111 AC_PROG_CPP
112 AC_PROG_INSTALL
113 AC_PROG_MAKE_SET
114 AC_PROG_RANLIB
115 AC_PROG_LN_S
116
117 AC_ARG_ENABLE(docs,
118 AS_HELP_STRING(
119 [--disable-docs],
120 [disable building documentation]),
121 [ax_docs=$enableval],
122 [ax_docs=yes])
123 AC_ARG_ENABLE(mans,
124 AS_HELP_STRING(
125 [--disable-mans],
126 [disable building manual pages]),
127 [ax_mans=$enableval],
128 [ax_mans=yes])
129 AS_IF([test x$ax_docs = xyes || test x$ax_mans = xyes], [
130 AC_PATH_PROG([PATH_ASCIIDOC], [asciidoc])
131 ])
132 AS_IF([test x$ax_mans = xyes], [
133 AC_PATH_PROG([PATH_XMLTO], [xmlto])
134 AC_PATH_PROG([PATH_POD2MAN], [pod2man])
135 ])
136 AM_CONDITIONAL([BUILD_MANS], [test x$ax_mans = xyes && test x$PATH_ASCIIDOC != x && test x$PATH_XMLTO != x && test x$PATH_POD2MAN != x])
137 AM_CONDITIONAL([BUILD_DOCS], [test x$ax_docs = xyes && test x$PATH_ASCIIDOC != x])
138
139 AM_PROG_AR
140
141 AX_FLAGS_WARN_ALL
142 AX_CHECK_COMPILE_FLAG([-Wunused-value], [AX_APPEND_FLAG([-Wunused-value], [AM_CFLAGS])])
143 AC_SUBST(AM_CFLAGS)
144
145 # Checks for header files.
146 AC_CHECK_HEADERS([fcntl.h float.h inttypes.h limits.h locale.h netinet/in.h paths.h stddef.h stdint.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h unistd.h], , [AC_MSG_FAILURE([cannot find the $ac_header header, which i3 requires])])
147
148 AC_CONFIG_FILES([Makefile testcases/lib/i3test.pm man/asciidoc.conf])
149 AC_CONFIG_FILES([testcases/complete-run.pl], [chmod +x testcases/complete-run.pl])
150
151 # Enable address sanitizer for non-release builds. The performance hit is a
152 # 50% increase of wallclock time for the testsuite on my machine.
153 if test x$is_release = xyes; then
154 default_sanitizers=
155 else
156 default_sanitizers=address
157 fi
158 AX_SANITIZERS(, [$default_sanitizers], [AC_DEFINE([I3_ASAN_ENABLED], [], [Enable ASAN])])
159
160 AC_OUTPUT
161
162 if test -z "${BUILD_DOCS_TRUE}"; then
163 print_BUILD_DOCS=yes
164 else
165 print_BUILD_DOCS=no
166 fi
167
168
169 if test -z "${BUILD_MANS_TRUE}"; then
170 print_BUILD_MANS=yes
171 else
172 print_BUILD_MANS=no
173 fi
174
175 in_git_worktree=`git rev-parse --is-inside-work-tree 2>/dev/null`
176 if [[ "$in_git_worktree" = "true" ]]; then
177 git_dir=`git rev-parse --git-dir 2>/dev/null`
178 srcdir=`dirname "$git_dir"`
179 exclude_dir=`pwd | sed "s,^$srcdir,,g"`
180 if ! grep -q "^$exclude_dir" "$git_dir/info/exclude"; then
181 echo "$exclude_dir" >> "$git_dir/info/exclude"
182 fi
183 fi
184
185 echo \
186 "--------------------------------------------------------------------------------
187 build configured:
188
189 AS_HELP_STRING([i3 version:], [`echo ${I3_VERSION} | sed 's,\\\\,,g'`])
190 AS_HELP_STRING([is release version:], [${is_release}])
191
192 AS_HELP_STRING([build manpages:], [${print_BUILD_MANS}])
193 AS_HELP_STRING([build docs:], [${print_BUILD_DOCS}])
194 AS_HELP_STRING([enable debug flags:], [${ax_enable_debug}])
195 AS_HELP_STRING([code coverage:], [${CODE_COVERAGE_ENABLED}])
196 AS_HELP_STRING([enabled sanitizers:], [${ax_enabled_sanitizers}])
197
198 To compile, run:
199
200 cd `pwd` && make -j8
201 --------------------------------------------------------------------------------"
0 i3-wm (4.19.1-1) unstable; urgency=medium
1
2 * New upstream release.
3
4 -- Michael Stapelberg <[email protected]> Mon, 19 Oct 2020 22:48:30 +0200
5
6 i3-wm (4.19-1) unstable; urgency=medium
7
8 * New upstream release.
9
10 -- Michael Stapelberg <[email protected]> Sun, 15 Nov 2020 18:28:11 +0100
11
12 i3-wm (4.18.3-1) unstable; urgency=medium
13
14 * New upstream release.
15
16 -- Michael Stapelberg <[email protected]> Mon, 19 Oct 2020 22:48:30 +0200
17
18 i3-wm (4.18.2-1) unstable; urgency=medium
19
20 * New upstream release.
21
22 -- Michael Stapelberg <[email protected]> Sun, 26 Jul 2020 10:24:46 +0200
23
024 i3-wm (4.18.1-1) unstable; urgency=medium
125
226 * New upstream release.
11 Section: x11
22 Priority: extra
33 Maintainer: Michael Stapelberg <[email protected]>
4 Build-Depends: debhelper (>= 9),
5 dh-autoreconf,
4 Build-Depends: debhelper (>= 10),
5 meson,
66 libx11-dev,
77 libxcb-util0-dev (>= 0.3.8),
88 libxcb-keysyms1-dev,
+0
-32
debian/i3-wm.docs less more
0 docs/debugging.html
1 docs/hacking-howto.html
2 docs/i3bar-protocol.html
3 docs/userguide.html
4 docs/bigpicture.png
5 docs/single_terminal.png
6 docs/snapping.png
7 docs/two_columns.png
8 docs/two_terminals.png
9 docs/modes.png
10 docs/ipc.html
11 docs/multi-monitor.html
12 docs/wsbar.html
13 docs/wsbar.png
14 docs/keyboard-layer1.png
15 docs/keyboard-layer2.png
16 docs/testsuite.html
17 docs/i3-sync-working.png
18 docs/i3-sync.png
19 docs/tree-layout1.png
20 docs/tree-layout2.png
21 docs/tree-shot1.png
22 docs/tree-shot2.png
23 docs/tree-shot3.png
24 docs/tree-shot4.png
25 docs/refcard.html
26 docs/refcard_style.css
27 docs/logo-30.png
28 docs/lib-i3test.html
29 docs/lib-i3test-test.html
30 docs/layout-saving.html
31 docs/layout-saving-1.png
+0
-13
debian/i3-wm.manpages less more
0 man/i3.1
1 man/i3-msg.1
2 man/i3-input.1
3 man/i3-nagbar.1
4 man/i3-config-wizard.1
5 man/i3-dump-log.1
6 man/i3-migrate-config-to-v4.1
7 man/i3-sensible-pager.1
8 man/i3-sensible-editor.1
9 man/i3-sensible-terminal.1
10 man/i3-dmenu-desktop.1
11 man/i3-save-tree.1
12 man/i3bar.1
1313 # TODO: enable tests
1414
1515 override_dh_auto_configure:
16 # The default is /usr/share/doc/i3
17 dh_auto_configure -- --docdir=/usr/share/doc/i3-wm
16 # Set -Ddocdir; the default is /usr/share/doc/i3
17 dh_auto_configure -- -Ddocdir=/usr/share/doc/i3-wm -Dmans=true
1818
1919 override_dh_builddeb:
2020 # bintray does not support xz currently.
2121 dh_builddeb -- -Zgzip
2222
2323 %:
24 dh $@ --parallel --builddirectory=build --with=autoreconf
24 dh $@ --buildsystem=meson
0 import drawtree;
1 treeLevelStep = 2cm;
2 TreeNode n94457831379296 = makeNode("``root'' (splith) []");
3 TreeNode n94457831380944 = makeNode(n94457831379296, "``\_\_i3'' (output) []");
4 TreeNode n94457831384048 = makeNode(n94457831380944, "``content'' (splith) []");
5 TreeNode n94457831387184 = makeNode(n94457831384048, "``\_\_i3\_scratch'' (splith) []");
6 TreeNode n94457831390576 = makeNode(n94457831379296, "``eDP-1'' (output) []");
7 TreeNode n94457831393744 = makeNode(n94457831390576, "``topdock'' (dockarea) []");
8 TreeNode n94457831396992 = makeNode(n94457831390576, "``content'' (splith) []");
9 TreeNode n94457831628304 = makeNode(n94457831396992, "``1'' (splith) []");
10 TreeNode n94457831571040 = makeNode(n94457831628304, "``Hacking i3: How To - Mozilla Firefox'' (leaf) []");
11 TreeNode n94457831246384 = makeNode(n94457831628304, "``vim'' (leaf) []");
12 TreeNode n94457831461088 = makeNode(n94457831396992, "``Named workspace'' (splith) []");
13 TreeNode n94457831471424 = makeNode(n94457831461088, "``[Empty]'' (tabbed) []");
14 TreeNode n94457831570576 = makeNode(n94457831471424, "``contrib/dump-asy.pl --no-gv'' (leaf) [Marks go here]");
15 TreeNode n94457831645488 = makeNode(n94457831471424, "``ipython'' (leaf) []");
16 TreeNode n94457831400192 = makeNode(n94457831390576, "``bottomdock'' (dockarea) []");
17 TreeNode n94457831424848 = makeNode(n94457831400192, "``i3bar for output eDP-1'' (leaf) []");
18 draw(n94457831379296, (0, 0));
Binary diff not shown
docs/bigpicture.xcf less more
Binary diff not shown
77 you understand why things are like they are. If it does not mention something
88 you find necessary, please do not hesitate to contact me.
99
10 ++++
11 <div style="background-color:red; color:white; padding:20px;">
12 <strong style="color:white;">WARNING!</strong>
13 <p>
14 ++++
15 This document is not 100% up to date. Specifically, everything up to and
16 including <<data_structures>> has been updated recently. The rest might contain
17 outdated information.
18 ++++
19 </p>
20 </div>
21 ++++
22
1023 == Building i3
1124
12 You can build i3 like you build any other software package which uses autotools.
13 Here’s a memory refresher:
14
15 $ autoreconf -fi
25 You can build i3 like you build any other software package which uses
26 https://mesonbuild.com/[The Meson Build system]; see
27 https://mesonbuild.com/Quick-guide.html#compiling-a-meson-project[Quickstart
28 Guide → Compiling a Meson project]. In case you’re unfamiliar:
29
1630 $ mkdir -p build && cd build
17 $ ../configure
18 $ make -j8
19
20 (The autoreconf -fi step is unnecessary if you are building from a release tarball,
21 but shouldn’t hurt either.)
31 $ meson ..
32 $ ninja
2233
2334 === Build system features
2435
25 * We use the AX_ENABLE_BUILDDIR macro to enforce builds happening in a separate
26 directory. This is a prerequisite for the AX_EXTEND_SRCDIR macro and building
36 * We use the +AX_ENABLE_BUILDDIR+ macro to enforce builds happening in a separate
37 directory. This is a prerequisite for the +AX_EXTEND_SRCDIR+ macro and building
2738 in a separate directory is common practice anyway. In case this causes any
2839 trouble when packaging i3 for your distribution, please open an issue.
2940
30 * “make check” runs the i3 testsuite. See docs/testsuite for details.
31
32 * “make distcheck” (runs testsuite on “make dist” result, tiny bit quicker
41 * +make check+ runs the i3 testsuite. See docs/testsuite for details.
42
43 * +make distcheck+ (runs testsuite on +make dist+ result, tiny bit quicker
3344 feedback cycle than waiting for the travis build to catch the issue).
3445
35 * “make uninstall” (occasionally requested by users who compile from source)
36
37 * “make” will build manpages/docs by default if the tools are installed.
46 * +make uninstall+ (occasionally requested by users who compile from source)
47
48 * +make+ will build manpages/docs by default if the tools are installed.
3849 Conversely, manpages/docs are not tried to be built for users who don’t want
39 to install all these dependencies to get started hacking on i3.
50 to install all these dependencies to get started hacking on i3. Manpages and
51 docs can be disabled with the +--disable-mans++ and ++--disable-docs++
52 configure options respectively.
4053
4154 * non-release builds will enable address sanitizer by default. Use the
42 --disable-sanitizers configure option to turn off all sanitizers, and see
43 --help for available sanitizers.
44
45 * Support for pre-compiled headers (PCH) has been dropped for now in the
46 interest of simplicity. If you need support for PCH, please open an issue.
47
48 * Coverage reports are now generated using “make check-code-coverage”, which
49 requires specifying --enable-code-coverage when calling configure.
50
51 == Using git / sending patches
52
53 For a short introduction into using git, see
54 https://web.archive.org/web/20121024222556/http://www.spheredev.org/wiki/Git_for_the_lazy
55 or, for more documentation, see https://git-scm.com/documentation
55 +--disable-sanitizers+ configure option to turn off all sanitizers, and see
56 +--help+ for available sanitizers.
57
58 * Coverage reports are now generated using +make check-code-coverage+, which
59 requires specifying +--enable-code-coverage+ when calling configure.
60
61 == Pull requests
5662
5763 Please talk to us before working on new features to see whether they will be
5864 accepted. A good way for this is to open an issue and asking for opinions on it.
59 Even for accepted features, this can be a good way to refine an idea upfront. However,
60 we don't want to see certain features in i3, e.g., switching window focus in an
61 Alt+Tab like way.
62
63 When working on bugfixes, please make sure you mention that you are working on
64 it in the corresponding bug report at https://github.com/i3/i3/issues. In case
65 there is no bug report yet, please create one.
65 Even for accepted features, this can be a good way to refine an idea upfront.
66 However, we don't want to see certain features in i3, e.g., switching window
67 focus in an Alt+Tab like way.
68
69 When working on bugfixes, please make sure you mention that you are working on it
70 in the corresponding bug report at https://github.com/i3/i3/issues. In case there
71 is no bug report yet, please create one.
6672
6773 After you are done, please submit your work for review as a pull request at
68 https://github.com/i3/i3.
69
70 Do not send emails to the mailing list or any author directly, and don’t submit
71 them in the bugtracker, since all reviews should be done in public at
72 https://github.com/i3/i3. In order to make your review go as fast as possible, you
73 could have a look at previous reviews and see what the common mistakes are.
74 https://github.com/i3/i3. In order to make your review go as fast as possible,
75 you could have a look at previous reviews and see what the common mistakes are.
7476
7577 === Which branch to use?
7678
77 Work on i3 generally happens in two branches: “master” and “next” (the latter
78 being the default branch, the one that people get when they check out the git
79 repository).
80
81 The contents of “master” are always stable. That is, it contains the source code
79 Work on i3 generally happens in two branches: “next” (default) and “stable”.
80
81 The contents of “stable” are always stable. That is, it contains the source code
8282 of the latest release, plus any bugfixes that were applied since that release.
8383
84 New features are only found in the “next” branch. Therefore, if you are working
85 on a new feature, use the “next” branch. If you are working on a bugfix, use the
86 “next” branch, too, but make sure your code also works on “master”.
84 New features are only found in the “next” branch. Always use this branch when
85 writing new code (both bugfixes and features).
8786
8887 == Window Managers
8988
105104 the first client of X) and manage them (reparent them, create window
106105 decorations, etc.)
107106 . When new windows are created, manage them
108 . Handle the client’s `_WM_STATE` property, but only `_WM_STATE_FULLSCREEN` and
109 `_NET_WM_STATE_DEMANDS_ATTENTION`
110 . Handle the client’s `WM_NAME` property
107 . Handle the client’s +_WM_STATE+ property, but only +_WM_STATE_FULLSCREEN+ and
108 +_NET_WM_STATE_DEMANDS_ATTENTION+
109 . Handle the client’s +WM_NAME+ property
111110 . Handle the client’s size hints to display them proportionally
112111 . Handle the client’s urgency hint
113112 . Handle enter notifications (focus follows mouse)
122121
123122 === Tiling window managers
124123
125 Traditionally, there are two approaches to managing windows: The most common
126 one nowadays is floating, which means the user can freely move/resize the
127 windows. The other approach is called tiling, which means that your window
128 manager distributes windows to use as much space as possible while not
129 overlapping each other.
124 Traditionally, there are two approaches to managing windows: The most common one
125 nowadays is stacking (or floating, using i3's terminology), which means the user
126 can freely move/resize the windows, potentially overlapping them. The other
127 approach is called tiling, which means that the window manager distributes
128 windows to use as much space as possible while not overlapping each other.
130129
131130 The idea behind tiling is that you should not need to waste your time
132131 moving/resizing windows while you usually want to get some work done. After
160159
161160 == Files
162161
163 include/atoms.xmacro::
164 A file containing all X11 atoms which i3 uses. This file will be included
165 various times (for defining, requesting and receiving the atoms), each time
166 with a different definition of xmacro().
162 i3's source code is in the +src+ folder while header files reside in +include+.
163 Other tools such as i3bar and i3-nagbar have their own folders. i3 and its tools
164 share an internal library called ``libi3'' which also has its own folder.
165
166 The following list gives an overview of the codebase, explaining the
167 functionality of the most important, core source code files. Other files in the
168 tree that are not mentioned here implement specific functionalities: for example,
169 +src/scratchpad.c+ is obviously about the scratchpad functionality.
167170
168171 include/data.h::
169 Contains data definitions used by nearly all files. You really need to read
170 this first.
172 Contains data definitions used by nearly all files.
171173
172174 include/*.h::
173175 Contains forward definitions for all public functions, as well as
174176 doxygen-compatible comments (so if you want to get a bit more of the big
175177 picture, either browse all header files or use doxygen if you prefer that).
176178
177 src/config_parser.c::
178 Contains a custom configuration parser. See src/command_parser.c for rationale
179 on why we use a custom parser.
180
181 src/click.c::
182 Contains all functions which handle mouse button clicks (right mouse button
183 clicks initiate resizing and thus are relatively complex).
184
185 src/command_parser.c::
186 Contains a hand-written parser to parse commands (commands are what
187 you bind on keys and what you can send to i3 using the IPC interface, like
188 'move left' or 'workspace 4').
179 src/config_directives.c::
180 src/commands.c::
181 Contain the definitions for all high-level config and command directives. These
182 are excellent places to start with a top-to-bottom approach to understand
183 specific i3 behavior. For example, if you want to investigate a bug that happens
184 for the +move to mark+ command, you can use gdb to pause in
185 +cmd_move_con_to_mark+ and then work your way from there, stepping into
186 lower-level functions.
189187
190188 src/con.c::
191 Contains all functions which deal with containers directly (creating
192 containers, searching containers, getting specific properties from containers,
193 …).
194
195 src/config.c::
196 Contains all functions handling the configuration file (calling the parser
197 src/config_parser.c) with the correct path, switching key bindings mode).
198
199 src/ewmh.c::
200 Functions to get/set certain EWMH properties easily.
201
202 src/floating.c::
203 Contains functions for floating mode (mostly resizing/dragging).
189 Contains all functions which deal with containers directly (creating containers,
190 searching containers, getting specific properties from containers, …). Contains
191 abstractions and auxiliary functions necessary to work with the container
192 structure which is used in almost all parts of the codebase.
193
194 src/tree.c::
195 Contains functions which deal with the tree abstraction. However, be aware that
196 +src/con.c+ also contains functions that heavily interact with the tree
197 structure. Some functions that are included in +str/tree.c+ are those that handle
198 opening and closing containers in the tree, finding the container that should be
199 focused next and flattening the tree. See also +src/move.c+ for other
200 move-specific functions that interact with the tree, which were moved into their
201 own file because they are so long.
202
203 src/workspace.c::
204 Contains functions which deal with workspaces. Includes code that creates new
205 workspaces, shows existing ones and deals with workspace assignments.
204206
205207 src/handlers.c::
206208 Contains all handlers for all kinds of X events (new window title, new hints,
207 unmapping, key presses, button presses, …).
208
209 src/ipc.c::
210 Contains code for the IPC interface.
211
212 src/load_layout.c::
213 Contains code for loading layouts from JSON files.
214
215 src/log.c::
216 Contains the logging functions.
217
218 src/main.c::
219 Initializes the window manager.
209 unmapping, key presses, button presses, …). This is a very important file to
210 understand how i3 interacts with changes to its environment.
211
212 src/command_parser.c::
213 src/config_parser.c::
214 Contain a hand-written parser to parse commands and configuration (commands are what
215 you bind on keys and what you can send to i3 using the IPC interface, like
216 +move left+ or +workspace 4+). +src/config.c+ is responsible for calling the
217 configuration parser.
218
219 src/click.c::
220 src/resize.c::
221 Contain functions which handle mouse button clicks (right mouse button
222 clicks initiate resizing and thus are relatively complex).
220223
221224 src/manage.c::
222225 Looks at existing or new windows and decides whether to manage them. If so, it
225228 src/match.c::
226229 A "match" is a data structure which acts like a mask or expression to match
227230 certain windows or not. For example, when using commands, you can specify a
228 command like this: [title="*Firefox*"] kill. The title member of the match
231 command like this: +[title="*Firefox*"] kill+. The title member of the match
229232 data structure will then be filled and i3 will check each window using
230 match_matches_window() to find the windows affected by this command.
231
232 src/move.c::
233 Contains code to move a container in a specific direction.
234
235 src/output.c::
236 Functions to handle CT_OUTPUT cons.
233 +match_matches_window()+ to find the windows affected by this command.
237234
238235 src/randr.c::
239236 The RandR API is used to get (and re-query) the configured outputs (monitors,
240 …).
237 …). Legacy Xinerama support resides in +src/xinerama.c+.
241238
242239 src/render.c::
243240 Renders the tree data structure by assigning coordinates to every node. These
244241 values will later be pushed to X11 in +src/x.c+.
245242
246 src/resize.c::
247 Contains the functions to resize containers.
248
249 src/restore_layout.c::
250 Everything for restored containers that is not pure state parsing (which can be
251 found in load_layout.c).
252
253243 src/sighandler.c::
254244 Handles +SIGSEGV+, +SIGABRT+ and +SIGFPE+ by showing a dialog that i3 crashed.
255 You can chose to let it dump core, to restart it in-place or to restart it
256 in-place but forget about the layout.
257
258 src/tree.c::
259 Contains functions which open or close containers in the tree, change focus or
260 cleanup ("flatten") the tree. See also +src/move.c+ for another similar
261 function, which was moved into its own file because it is so long.
262
263 src/util.c::
264 Contains useful functions which are not really dependent on anything.
245 You can choose to let it dump core and restart i3 in-place (either trying to
246 preserve layout or forget about it).
265247
266248 src/window.c::
267249 Handlers to update X11 window properties like +WM_CLASS+, +_NET_WM_NAME+,
268250 +CLIENT_LEADER+, etc.
269251
270 src/workspace.c::
271 Contains all functions related to workspaces (displaying, hiding, renaming…)
272
273 src/x.c::
274 Transfers our in-memory tree (see +src/render.c+) to X11.
275
276 src/xcb.c::
277 Contains wrappers to use xcb more easily.
278
279 src/xcursor.c::
280 XCursor functions (for cursor themes).
281
282 src/xinerama.c::
283 Legacy support for Xinerama. See +src/randr.c+ for the preferred API.
284
252 include/*.xmacro.*::
253 A file containing all X11 atoms which i3 uses. This file will be included
254 various times (for defining, requesting and receiving the atoms), each time
255 with a different definition of xmacro().
256
257 [[data_structures]]
285258 == Data structures
286259
287
288 See include/data.h for documented data structures. The most important ones are
289 explained right here.
290
291 /////////////////////////////////////////////////////////////////////////////////
292 // TODO: update image
293
294 image:bigpicture.png[The Big Picture]
295
296 /////////////////////////////////////////////////////////////////////////////////
297
298 So, the hierarchy is:
299
300 . *X11 root window*, the root container
301 . *Output container* (LVDS1 in this example)
302 . *Content container* (there are also containers for dock windows)
303 . *Workspaces* (Workspace 1 in this example, with horizontal orientation)
304 . *Split container* (vertically split)
305 . *X11 window containers*
260 See +include/data.h+ for documented data structures. The most important ones are
261 explained here.
262
263 The following picture is generated by the +contrib/dump-asy.pl+ script.
264
265 image:bigpicture.png["The Big Picture",width=1000,link="bigpicture.png"]
266
267 The hierarchy is:
268
269 . *Root container*
270 . *Output containers*: +eDP-1+ in this example and the internal +__i3++ output
271 . *Content and 2 dockarea containers*
272 . *Workspaces*: Numbered workspace ``1'' and a ``Named workspace''
273 . *Split containers*: One horizontal in the first workspace and a tabbed one in
274 the named one.
275 . *Leaf containers*: Windows like vim and an i3bar dock.
306276
307277 The data type is +Con+, in all cases.
308278
309 === X11 root window
310
311 The X11 root window is a single window per X11 display (a display is identified
312 by +:0+ or +:1+ etc.). The root window is what you draw your background image
313 on. It spans all the available outputs, e.g. +VGA1+ is a specific part of the
314 root window and +LVDS1+ is a specific part of the root window.
279 === Root container
280
281 The root container (global variable +croot+) is the up-most ascendant of every i3
282 container. It can be used to iterate over the whole tree structure. E.g., it is
283 used to reply to the +GET_WORKSPACES+ request, iterating over it's children to
284 find all workspaces. This is different from the X11 root window.
285
286 The X11 root window (global variable +root+) is a single window per X11 display
287 (a display is identified by +:0+ or +:1+ etc.). The root window is what you draw
288 your background image on. It spans all the available outputs, e.g. +VGA1+ is a
289 specific part of the root window and +LVDS1+ is a specific part of the root
290 window.
315291
316292 === Output container
317293
333309 === Content container
334310
335311 Each output has multiple children. Two of them are dock containers which hold
336 dock clients. The other one is the content container, which holds the actual
337 content (workspaces) of this output.
312 the top and bottom dock clients. The other one is the content container, which
313 holds the actual content (workspaces) of this output.
338314
339315 === Workspace
340316
353329 Split containers (and X11 window containers, which are a subtype of split
354330 containers) can have different border styles.
355331
356 === X11 window container
357
358 An X11 window container holds exactly one X11 window. These are the leaf nodes
359 of the layout tree, they cannot have any children.
332 === Leaf containers
333
334 A leaf container holds exactly one X11 window. They can't have any children.
360335
361336 == List/queue macros
362337
363338 i3 makes heavy use of the list macros defined in BSD operating systems. To
364339 ensure that the operating system on which i3 is compiled has all the expected
365 features, i3 comes with `include/queue.h`. On BSD systems, you can use man
366 `queue(3)`. On Linux, you have to use google (or read the source).
340 features, i3 comes with +include/queue.h+. On BSD systems, you can use +man
341 queue(3)+. On Linux, you have to use google (or read the source).
367342
368343 The lists used are +SLIST+ (single linked lists), +CIRCLEQ+ (circular
369344 queues) and +TAILQ+ (tail queues). Usually, only forward traversal is necessary,
370 so an `SLIST` works fine. If inserting elements at arbitrary positions or at
345 so an +SLIST+ works fine. If inserting elements at arbitrary positions or at
371346 the end of a list is necessary, a +TAILQ+ is used instead. However, for the
372347 windows inside a container, a +CIRCLEQ+ is necessary to go from the currently
373348 selected window to the window above/below.
377352 There is a row of standard variables used in many events. The following names
378353 should be chosen for those:
379354
380 * ``conn'' is the xcb_connection_t
381 * ``event'' is the event of the particular type
382 * ``con'' names a container
383 * ``current'' is a loop variable when using +TAILQ_FOREACH+ etc.
355 * +conn+ is the xcb_connection_t
356 * +event+ is the event of the particular type
357 * +con+ names a container
358 * +current+ is a loop variable when using +TAILQ_FOREACH+ etc.
384359
385360 == Startup (src/mainx.c, main())
386361
429404
430405 == Manage windows (src/main.c, manage_window() and reparent_window())
431406
432 `manage_window()` does some checks to decide whether the window should be
407 +manage_window()+ does some checks to decide whether the window should be
433408 managed at all:
434409
435410 * Windows have to be mapped, that is, visible on screen
437412 not be managed by a window manager
438413
439414 Afterwards, i3 gets the initial geometry and reparents the window (see
440 `reparent_window()`) if it wasn’t already managed.
415 +reparent_window()+) if it wasn’t already managed.
441416
442417 Reparenting means that for each window which is reparented, a new window,
443418 slightly larger than the original one, is created. The original window is then
444419 reparented to the bigger one (called "frame").
445420
446 After reparenting, the window type (`_NET_WM_WINDOW_TYPE`) is checked to see
447 whether this window is a dock (`_NET_WM_WINDOW_TYPE_DOCK`), like dzen2 for
421 After reparenting, the window type (+_NET_WM_WINDOW_TYPE+) is checked to see
422 whether this window is a dock (+_NET_WM_WINDOW_TYPE_DOCK+), like dzen2 for
448423 example. Docks are handled differently, they don’t have decorations and are not
449424 assigned to a specific container. Instead, they are positioned at the bottom
450425 or top of the screen (in the appropriate dock area containers). To get the
451 height which needs to be reserved for the window, the `_NET_WM_STRUT_PARTIAL`
426 height which needs to be reserved for the window, the +_NET_WM_STRUT_PARTIAL+
452427 property is used.
453428
454429 Furthermore, the list of assignments (to other workspaces, which may be on
459434 == What happens when an application is started?
460435
461436 i3 does not care about applications. All it notices is when new windows are
462 mapped (see `src/handlers.c`, `handle_map_request()`). The window is then
437 mapped (see +src/handlers.c+, +handle_map_request()+). The window is then
463438 reparented (see section "Manage windows").
464439
465 After reparenting the window, `render_tree()` is called which renders the
440 After reparenting the window, +render_tree()+ is called which renders the
466441 internal layout table. The new window has been placed in the currently focused
467442 container and therefore the new window and the old windows (if any) need to be
468443 moved/resized so that the currently active layout (default/stacking/tabbed mode)
481456 Only the _NET_WM_STATE_FULLSCREEN and _NET_WM_STATE_DEMANDS_ATTENTION atoms
482457 are handled.
483458
484 The former calls ``toggle_fullscreen()'' for the specific client which just
459 The former calls +toggle_fullscreen()+ for the specific client which just
485460 configures the client to use the whole screen on which it currently is.
486461 Also, it is set as fullscreen_client for the i3Screen.
487462
538513
539514 === Rendering the root container
540515
541 The i3 root container (`con->type == CT_ROOT`) represents the X11 root window.
516 The i3 root container (+con->type == CT_ROOT+) represents the X11 root window.
542517 It contains one child container for every output (like LVDS1, VGA1, …), which
543518 is available on your computer.
544519
557532
558533 === Rendering an output
559534
560 Output containers (`con->layout == L_OUTPUT`) represent a hardware output like
535 Output containers (+con->layout == L_OUTPUT+) represent a hardware output like
561536 LVDS1, VGA1, etc. An output container has three children (at the moment): One
562537 content container (having workspaces as children) and the top/bottom dock area
563538 containers.
565540 The rendering happens in the function +render_l_output()+ in the following
566541 steps:
567542
568 1. Find the content container (`con->type == CT_CON`)
543 1. Find the content container (+con->type == CT_CON+)
569544 2. Get the currently visible workspace (+con_get_fullscreen_con(content,
570545 CF_OUTPUT)+).
571546 3. If there is a fullscreened window on that workspace, directly render it and
573548 4. Sum up the space used by all the dock windows (they have a variable height
574549 only).
575550 5. Set the workspace rects (x/y/width/height) based on the position of the
576 output (stored in `con->rect`) and the usable space
577 (`con->rect.{width,height}` without the space used for dock windows).
551 output (stored in +con->rect+) and the usable space
552 (+con->rect.{width,height}+ without the space used for dock windows).
578553 6. Recursively raise and render the output’s child containers (meaning dock
579554 area containers and the content container).
580555
581556 === Rendering a workspace or split container
582557
583558 From here on, there really is no difference anymore. All containers are of
584 `con->type == CT_CON` (whether workspace or split container) and some of them
585 have a `con->window`, meaning they represent an actual window instead of a
559 +con->type == CT_CON+ (whether workspace or split container) and some of them
560 have a +con->window+, meaning they represent an actual window instead of a
586561 split container.
587562
588563 ==== Default layout
589564
590565 In default layout, containers are placed horizontally or vertically next to
591 each other (depending on the `con->orientation`). If a child is a leaf node (as
566 each other (depending on the +con->orientation+). If a child is a leaf node (as
592567 opposed to a split container) and has border style "normal", appropriate space
593568 will be reserved for its window decoration.
594569
834809 the beginning. +
835810
836811 NOTE: Note that you can specify multiple literals in the same line. This has
837 exactly the same effect as if you specified `direction =
838 'next_on_output' -> call cmd_workspace($direction)` and so forth. +
812 exactly the same effect as if you specified +direction =
813 'next_on_output' -> call cmd_workspace($direction)+ and so forth. +
839814
840815 NOTE: Also note that the order of literals is important here: If 'next' were
841816 ordered before 'next_on_output', then 'next_on_output' would never
1019994
1020995 == Gotchas
1021996
1022 * Forgetting to call `xcb_flush(conn);` after sending a request. This usually
997 * Forgetting to call +xcb_flush(conn);+ after sending a request. This usually
1023998 leads to code which looks like it works fine but which does not work under
1024999 certain conditions.
10251000
1026 * Forgetting to call `floating_fix_coordinates(con, old_rect, new_rect)` after
1001 * Forgetting to call +floating_fix_coordinates(con, old_rect, new_rect)+ after
10271002 moving workspaces across outputs. Coordinates for floating containers are
10281003 not relative to workspace boundaries, so you must correct their coordinates
10291004 or those containers will show up in the wrong workspace or not at all.
102102 version::
103103 The version number (as an integer) of the i3bar protocol you will use.
104104 stop_signal::
105 Specify to i3bar the signal (as an integer) to send to stop your
106 processing.
107 The default value (if none is specified) is SIGSTOP.
105 Specify the signal (as an integer) that i3bar should send to request that you
106 pause your output. This is used to conserve battery power when the bar is
107 hidden by not unnecessarily computing bar updates. The default value is SIGSTOP,
108 which will unconditionally stop your process. If this is an issue, this feature
109 can be disabled by setting the value to 0.
108110 cont_signal::
109111 Specify to i3bar the signal (as an integer) to send to continue your
110112 processing.
257259 relative_x, relative_y::
258260 Coordinates where the click occurred, with respect to the top left corner
259261 of the block
262 output_x, output_y::
263 Coordinates relative to the current output where the click occurred
260264 width, height::
261265 Width and height (in px) of the block
262266 modifiers::
270274 "instance": "eth0",
271275 "button": 1,
272276 "modifiers": ["Shift", "Mod1"],
273 "x": 1320,
277 "x": 1925,
274278 "y": 1400,
275279 "relative_x": 12,
276280 "relative_y": 8,
281 "output_x": 5,
282 "output_y": 1400,
277283 "width": 50,
278284 "height": 22
279285 }
00 IPC interface (interprocess communication)
11 ==========================================
22 Michael Stapelberg <[email protected]>
3 September 2017
3 June 2020
44
55 This document describes how to interface with i3 from a separate process. This
66 is useful for example to remote-control i3 (to write test cases for example) or
6565 | 9 | +GET_CONFIG+ | <<_config_reply,CONFIG>> | Returns the last loaded i3 config.
6666 | 10 | +SEND_TICK+ | <<_tick_reply,TICK>> | Sends a tick event with the specified payload.
6767 | 11 | +SYNC+ | <<_sync_reply,SYNC>> | Sends an i3 sync event with the specified random value to the specified window.
68 | 12 | +GET_BINDING_STATE+ | <<_binding_state_reply,BINDING_STATE>> | Request the current binding state, i.e. the currently active binding mode name.
6869 |======================================================
6970
7071 So, a typical message could look like this:
130131 Reply to the GET_CONFIG message.
131132 TICK (10)::
132133 Reply to the SEND_TICK message.
134 GET_BINDING_STATE (12)::
135 Reply to the GET_BINDING_STATE message.
133136
134137 [[_command_reply]]
135138 === COMMAND reply
155158 *Example:*
156159 -------------------
157160 [{ "success": true }]
161 -------------------
162
163 When the specified command cannot be parsed, `success` will be false and
164 `parse_error` will be true:
165
166 *Example:*
167 -------------------
168 [{ "success": false, "parse_error": true }]
158169 -------------------
159170
160171 [[_workspaces_reply]]
171182 The logical number of the workspace. Corresponds to the command
172183 to switch to this workspace. For named workspaces, this will be -1.
173184 name (string)::
174 The name of this workspace (by default num+1), as changed by the
175 user. Encoded in UTF-8.
185 The name of this workspace if changed by the user, otherwise defaults
186 to the string representation of the +num+ field). Encoded in UTF-8.
176187 visible (boolean)::
177188 Whether this workspace is currently visible on an output (multiple
178189 workspaces can be visible at the same time).
708719 { "success": true }
709720 -------------------
710721
722 [[_binding_state_reply]]
723 === GET_BINDING_STATE reply
724
725 The binding_state reply is a map which currently only contains the "name"
726 member, which is the name of the currently active binding mode as a string.
727
728 *Example:*
729 -------------------
730 { "name": "default" }
731 -------------------
732
711733 == Events
712734
713735 [[events]]
1414 h1 { font-size: 1.1em; }
1515 header a { font-size: 0.7em; }
1616 header p { margin: 5px 0; font-size: 0.8em; text-align: left; }
17 kbd { font-family: LinuxBiolinumKeyboard, Linux Biolinum Keyboard O, Linux Biolinum Keyboard, DejaVu Sans Mono, monospace; font-size: 0.9em; }
17 kbd { font-family: LinuxBiolinumKeyboard, Linux Biolinum Keyboard O, Linux Biolinum Keyboard, DejaVu Sans Mono, monospace; font-size: 1.2em; }
1818 code { font-family: DejaVu Sans Mono, monospace; font-size: 0.8em; }
1919 section { break-inside: avoid-column; -moz-break-inside: -moz-avoid-column; -webkit-break-inside: avoid-column; }
2020 h2 { margin: 7px 0 2px; padding: 2px 4px; font-size: 1.1em; font-family: LinuxBiolinum, Linux Biolinum O, Linux Biolinum, sans; background-color: #b3b3b3; }
119119 ---------------------------------------
120120 $ cd ~/i3
121121
122 $ autoreconf -fi
123
124122 $ mkdir -p build && cd build
125123
126 $ ../configure
127
128 $ make -j8
124 $ meson ..
125
126 $ ninja
129127 # output omitted because it is very long
130128
131129 $ cd testcases
182180 ---------------------------------------
183181 $ cd ~/i3
184182
185 $ autoreconf -fi
186
187183 $ mkdir -p build && cd build
188184
189 $ ../configure
190
191 $ make -j8
185 $ meson ..
186
187 $ ninja
192188 # output omitted because it is very long
193189
194190 $ make check
5353 image:two_terminals.png[Two terminals]
5454
5555 To move the focus between the two terminals, you can use the direction keys
56 which you may know from the editor +vi+. However, in i3, your homerow is used
56 which you might know from the editor +vi+. However, in i3, your homerow is used
5757 for these keys (in +vi+, the keys are shifted to the left by one for
5858 compatibility with most keyboard layouts). Therefore, +$mod+j+ is left, +$mod+k+
5959 is down, +$mod+l+ is up and `$mod+;` is right. So, to switch between the
244244
245245 So, how can you open a new terminal window to the *right* of the current one?
246246 The solution is to use +focus parent+, which will focus the +Parent Container+ of
247 the current +Container+. In default configuration, use +$mod+a+ to navigate one
247 the current +Container+. In default configuration, use +$mod+a+ to navigate one
248248 +Container+ up the tree (you can repeat this multiple times until you get to the
249249 +Workspace Container+). In this case, you would focus the +Vertical Split Container+
250250 which is *inside* the horizontally oriented workspace. Thus, now new windows will be
262262 windows are directly attached to one node inside i3’s layout tree, the
263263 workspace node. By default, the workspace node’s orientation is +horizontal+.
264264
265 Now you move one of these terminals down (+$mod+Shift+k+ by default). The
265 Now you move one of these terminals down (+$mod+Shift+j+ by default). The
266266 workspace node’s orientation will be changed to +vertical+. The terminal window
267267 you moved down is directly attached to the workspace and appears on the bottom
268268 of the screen. A new (horizontal) container was created to accommodate the
923923 If your X server supports RandR 1.5 or newer, i3 will use RandR monitor objects
924924 instead of output objects. Run +xrandr --listmonitors+ to see a list. Usually,
925925 a monitor object contains exactly one output, and has the same name as the
926 output; but should that not be the case, you may specify the name of either the
926 output; but should that not be the case, you can specify the name of either the
927927 monitor or the output in i3's configuration. For example, the Dell UP2414Q uses
928928 two scalers internally, so its output names might be “DP1” and “DP2”, but the
929929 monitor name is “Dell UP2414Q”.
10651065 === Popups during fullscreen mode
10661066
10671067 When you are in fullscreen mode, some applications still open popup windows
1068 (take Xpdf for example). This is because these applications may not be aware
1068 (take Xpdf for example). This is because these applications might not be aware
10691069 that they are in fullscreen mode (they do not check the corresponding hint).
10701070 There are three things which are possible to do in this situation:
10711071
11751175 === Delaying urgency hint reset on workspace change
11761176
11771177 If an application on another workspace sets an urgency hint, switching to this
1178 workspace may lead to immediate focus of the application, which also means the
1178 workspace might lead to immediate focus of the application, which also means the
11791179 window decoration color would be immediately reset to +client.focused+. This
1180 may make it unnecessarily hard to tell which window originally raised the
1180 might make it unnecessarily hard to tell which window originally raised the
11811181 event.
11821182
11831183 In order to prevent this, you can tell i3 to delay resetting the urgency state
12001200 === Focus on window activation
12011201
12021202 If a window is activated, e.g., via +google-chrome www.google.com+, it may request
1203 to take focus. Since this may not be preferable, different reactions can be configured.
1204
1205 Note that this may not affect windows that are being opened. To prevent new windows
1203 to take focus. Since this might not be preferable, different reactions can be configured.
1204
1205 Note that this might not affect windows that are being opened. To prevent new windows
12061206 from being focused, see <<no_focus>>.
12071207
12081208 *Syntax*:
13491349 The mode option can be changed during runtime through the +bar mode+ command.
13501350 On reload the mode will be reverted to its configured value.
13511351
1352 The hide mode maximizes screen space that can be used for actual windows. Also,
1353 i3bar sends the +SIGSTOP+ and +SIGCONT+ signals to the statusline process to
1354 save battery power.
1352 The hide mode maximizes screen space that can be used for actual windows. When
1353 the bar is hidden, i3bar sends the +SIGSTOP+ and +SIGCONT+ signals to the
1354 +status_command+ process in order to conserve battery power. This feature can
1355 be disabled by the +status_command+ process by setting the appropriate values
1356 in its JSON header message.
13551357
13561358 Invisible mode allows to permanently maximize screen space, as the bar is never
13571359 shown. Thus, you can configure i3bar to not disturb you by popping up because
14121414 Scroll wheel right.
14131415 button7::
14141416 Scroll wheel left.
1415
1417
14161418
14171419 Please note that the old +wheel_up_cmd+ and +wheel_down_cmd+ commands are deprecated
14181420 and will be removed in a future release. We strongly recommend using the more general
14811483 To make a particular i3bar instance handle multiple outputs, specify the output
14821484 directive multiple times.
14831485
1486 These output names have a special meaning:
1487
1488 primary::
1489 Selects the output that is configured as primary in the X server.
1490 nonprimary::
1491 Selects every output that is not configured as primary in the X server.
1492
14841493 *Syntax*:
14851494 ---------------
1486 output primary|<output>
1495 output primary|nonprimary|<output>
14871496 ---------------
14881497
14891498 *Example*:
16391648
16401649 By default, the width a workspace button is determined by the width of the text
16411650 showing the workspace name. If the name is too short (say, one letter), then the
1642 workspace button may look too small.
1651 workspace button might look too small.
16431652
16441653 This option specifies the minimum width for workspace buttons. If the name of
16451654 a workspace is too short to cover the button, an additional padding is added on
16491658
16501659 The setting also applies to the current binding mode indicator.
16511660
1652 Note that the specified pixels refer to logical pixels, which may translate
1661 Note that the specified pixels refer to logical pixels, which might translate
16531662 into more pixels on HiDPI displays.
16541663
16551664 *Syntax*:
16791688 the form "[n][:][NAME]" will display only the number.
16801689
16811690 The default is to display the full name within the workspace button. Be aware
1682 that the colon in the workspace name is optional, so `[n][NAME]` will also
1683 have the the workspace name and number stripped correctly.
1691 that the colon in the workspace name is optional, so `[n][NAME]` will also
1692 have the workspace name and number stripped correctly.
16841693
16851694 *Syntax*:
16861695 ------------------------------
21542163 # Moves the container into the given direction.
21552164 # The optional pixel argument specifies how far the
21562165 # container should be moved if it is floating and
2157 # defaults to 10 pixels.
2158 move <left|right|down|up> [<px> px]
2166 # defaults to 10 pixels. The optional ppt argument
2167 # means "percentage points", and if specified it indicates
2168 # how many points the container should be moved if it is
2169 # floating rather than by a pixel value.
2170 move <left|right|down|up> [<amount> [px|ppt]]
21592171
21602172 # Moves the container to the specified pos_x and pos_y
21612173 # coordinates on the screen.
2162 move position <pos_x> [px] <pos_y> [px]
2174 move position <pos_x> [px|ppt] <pos_y> [px|ppt]
21632175
21642176 # Moves the container to the center of the screen.
21652177 # If 'absolute' is used, it is moved to the center of
24752487 === Jumping to specific windows
24762488
24772489 Often when in a multi-monitor environment, you want to quickly jump to a
2478 specific window. For example, while working on workspace 3 you may want to
2490 specific window. For example, while working on workspace 3 you might want to
24792491 jump to your mail client to email your boss that you’ve achieved some
24802492 important goal. Instead of figuring out how to navigate to your mail client,
24812493 it would be more convenient to have a shortcut. You can use the +focus+ command
25102522 can also prefix this command and display a custom prompt for the input dialog.
25112523
25122524 The additional +--toggle+ option will remove the mark if the window already has
2513 this mark or add it otherwise. Note that you may need to use this in
2525 this mark or add it otherwise. Note that you might need to use this in
25142526 combination with +--add+ (see below) as any other marks will otherwise be
25152527 removed.
25162528
26092621 to the normal and pixel styles.
26102622
26112623 Note that "pixel" refers to logical pixel. On HiDPI displays, a logical pixel
2612 may be represented by multiple physical pixels, so +pixel 1+ might not
2624 is represented by multiple physical pixels, so +pixel 1+ might not
26132625 necessarily translate into a single pixel row wide border.
26142626
26152627 *Syntax*:
28722884
28732885 === Interesting configuration for multi-monitor environments
28742886
2875 There are several things to configure in i3 which may be interesting if you
2887 There are several things to configure in i3 which might be interesting if you
28762888 have more than one monitor:
28772889
28782890 1. You can specify which workspace should be put on which screen. This
5151 bindsym Mod1+Shift+q kill
5252
5353 # start dmenu (a program launcher)
54 bindsym Mod1+d exec dmenu_run
55 # There also is the (new) i3-dmenu-desktop which only displays applications
56 # shipping a .desktop file. It is a wrapper around dmenu, so you need that
57 # installed.
54 bindsym Mod1+d exec --no-startup-id dmenu_run
55 # A more modern dmenu replacement is rofi:
56 # bindsym Mod1+d exec rofi -modi drun,run -show drun
57 # There also is i3-dmenu-desktop which only displays applications shipping a
58 # .desktop file. It is a wrapper around dmenu, so you need that installed.
5859 # bindsym Mod1+d exec --no-startup-id i3-dmenu-desktop
5960
6061 # change focus
4545 bindcode $mod+Shift+24 kill
4646
4747 # start dmenu (a program launcher)
48 bindcode $mod+40 exec dmenu_run
49 # There also is the (new) i3-dmenu-desktop which only displays applications
50 # shipping a .desktop file. It is a wrapper around dmenu, so you need that
51 # installed.
52 # bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
48 bindcode $mod+40 exec --no-startup-id dmenu_run
49 # A more modern dmenu replacement is rofi:
50 # bindcode $mod+40 exec rofi -modi drun,run -show drun
51 # There also is i3-dmenu-desktop which only displays applications shipping a
52 # .desktop file. It is a wrapper around dmenu, so you need that installed.
53 bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
5354
5455 # change focus
5556 bindcode $mod+44 focus left
116116 open(my $enumfh, '>', "GENERATED_${prefix}_enums.h");
117117
118118 my %statenum;
119 say $enumfh '#pragma once';
119120 say $enumfh 'typedef enum {';
120121 my $cnt = 0;
121122 for my $state (@keys, '__CALL') {
130131 # Third step: Generate the call function.
131132 open(my $callfh, '>', "GENERATED_${prefix}_call.h");
132133 my $resultname = uc(substr($prefix, 0, 1)) . substr($prefix, 1) . 'ResultIR';
134 say $callfh '#pragma once';
133135 say $callfh "static void GENERATED_call(const int call_identifier, struct $resultname *result) {";
134136 say $callfh ' switch (call_identifier) {';
135137 my $call_id = 0;
205207 # Fourth step: Generate the token datastructures.
206208
207209 open(my $tokfh, '>', "GENERATED_${prefix}_tokens.h");
210 say $tokfh '#pragma once';
208211
209212 for my $state (@keys) {
210213 my $tokens = $states{$state};
+0
-6
i3-config-wizard/atoms.xmacro less more
0 xmacro(_NET_WM_NAME)
1 xmacro(_NET_WM_WINDOW_TYPE)
2 xmacro(_NET_WM_WINDOW_TYPE_DIALOG)
3 xmacro(ATOM)
4 xmacro(CARDINAL)
5 xmacro(UTF8_STRING)
0 // clang-format off
1 #define CONFIG_WIZARD_ATOMS_XMACRO \
2 xmacro(_NET_WM_NAME) \
3 xmacro(_NET_WM_WINDOW_TYPE) \
4 xmacro(_NET_WM_WINDOW_TYPE_DIALOG) \
5 xmacro(ATOM) \
6 xmacro(CARDINAL) \
7 xmacro(UTF8_STRING)
99 */
1010 #include <config.h>
1111
12 #include "libi3.h"
13
1214 #if defined(__FreeBSD__)
1315 #include <sys/param.h>
1416 #endif
2224 #define _WITH_GETLINE
2325 #endif
2426
25 #include <stdio.h>
26 #include <sys/types.h>
27 #include <stdlib.h>
28 #include <stdbool.h>
29 #include <unistd.h>
30 #include <string.h>
3127 #include <ctype.h>
28 #include <err.h>
3229 #include <errno.h>
33 #include <err.h>
34 #include <stdint.h>
30 #include <fcntl.h>
3531 #include <getopt.h>
3632 #include <limits.h>
33 #include <stdlib.h>
34 #include <string.h>
3735 #include <sys/stat.h>
38 #include <fcntl.h>
39 #include <glob.h>
40 #include <assert.h>
36 #include <sys/types.h>
37 #include <unistd.h>
4138
4239 #include <xcb/xcb.h>
4340 #include <xcb/xcb_aux.h>
4441 #include <xcb/xcb_event.h>
4542 #include <xcb/xcb_keysyms.h>
46
43 #include <xkbcommon/xkbcommon-x11.h>
4744 #include <xkbcommon/xkbcommon.h>
48 #include <xkbcommon/xkbcommon-x11.h>
4945
5046 #define SN_API_NOT_YET_FROZEN 1
5147 #include <libsn/sn-launchee.h>
5248
49 #include <X11/XKBlib.h>
5350 #include <X11/Xlib.h>
5451 #include <X11/keysym.h>
55 #include <X11/XKBlib.h>
52
53 #include "i3-config-wizard-atoms.xmacro.h"
5654
5755 /* We need SYSCONFDIR for the path to the keycode config template, so raise an
5856 * error if it’s not defined for whatever reason */
6866
6967 #include "xcb.h"
7068 xcb_visualtype_t *visual_type = NULL;
71 #include "libi3.h"
7269
7370 #define TEXT_PADDING logical_px(4)
7471 #define WIN_POS_X logical_px(490)
847844 /* Place requests for the atoms we need as soon as possible */
848845 #define xmacro(atom) \
849846 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
850 #include "atoms.xmacro"
847 CONFIG_WIZARD_ATOMS_XMACRO
851848 #undef xmacro
852849
853850 /* Init startup notification. */
904901 A_##name = reply->atom; \
905902 free(reply); \
906903 } while (0);
907 #include "atoms.xmacro"
904 CONFIG_WIZARD_ATOMS_XMACRO
908905 #undef xmacro
909906
910907 /* Set dock mode */
22 /* from X11/keysymdef.h */
33 #define XCB_NUM_LOCK 0xff7f
44
5 #include "i3-config-wizard-atoms.xmacro.h"
6
57 #define xmacro(atom) xcb_atom_t A_##atom;
6 #include "atoms.xmacro"
8 CONFIG_WIZARD_ATOMS_XMACRO
79 #undef xmacro
1212 use File::Find;
1313 use File::Basename qw(basename);
1414 use File::Temp qw(tempfile);
15 use List::Util 'first';
1516 use Getopt::Long;
1617 use Pod::Usage;
1718 use v5.10;
122123 # Cleanup the paths, maybe some application does not cope with double slashes
123124 # (the field code %k is replaced with the .desktop file location).
124125 @searchdirs = map { s,//,/,g; $_ } @searchdirs;
126 # Also remove any trailing slashes.
127 @searchdirs = map { s,/*$,,g; $_ } @searchdirs;
125128
126129 # To avoid errors by File::Find’s find(), only pass existing directories.
127130 @searchdirs = grep { -d $_ } @searchdirs;
132135 return unless substr($_, -1 * length('.desktop')) eq '.desktop';
133136 my $relative = $File::Find::name;
134137
135 # + 1 for the trailing /, which is missing in ::topdir.
136 substr($relative, 0, length($File::Find::topdir) + 1) = '';
138 # Find and then replace the directory in @searchdirs in which the
139 # current file is located. We used to do this with
140 # $File::Find::topdir but it is not supported when using the
141 # 'follow' or 'follow_fast' options.
142 # See #3973, #4031.
143 my $topdir = first { substr($relative, 0, length($_)) eq $_ } @searchdirs;
144
145 # + 1 for the trailing /, which is missing in $topdir.
146 substr($relative, 0, length($topdir) + 1) = '';
137147
138148 # Don’t overwrite files with the same relative path, we search in
139149 # descending order of importance.
88 */
99 #include <config.h>
1010
11 #include "libi3.h"
12 #include "shmlog.h"
13
14 #include <err.h>
15 #include <fcntl.h>
16 #include <getopt.h>
17 #include <i3/ipc.h>
18 #include <signal.h>
19 #include <stdbool.h>
20 #include <stdint.h>
1121 #include <stdio.h>
12 #include <stdbool.h>
13 #include <sys/types.h>
14 #include <sys/socket.h>
15 #include <sys/un.h>
1622 #include <stdlib.h>
17 #include <unistd.h>
1823 #include <string.h>
19 #include <errno.h>
20 #include <err.h>
21 #include <stdint.h>
22 #include <getopt.h>
23 #include <limits.h>
24 #include <fcntl.h>
2524 #include <sys/mman.h>
2625 #include <sys/stat.h>
27 #include <signal.h>
28
29 #include "libi3.h"
30 #include "shmlog.h"
31 #include <i3/ipc.h>
26 #include <unistd.h>
3227
3328 #if !defined(__OpenBSD__)
3429 static uint32_t offset_next_write;
3030 * This software is in the public domain. Share and enjoy!
3131 */
3232
33 #include "keysym2ucs.h"
34
3335 #include <xcb/xcb.h>
34 #include "keysym2ucs.h"
3536
3637 struct codepair {
3738 unsigned short keysym;
77 * to i3.
88 *
99 */
10 #include <getopt.h>
11 #include <stdbool.h>
12 #include <stdint.h>
1013 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
1116 #include <sys/types.h>
12 #include <stdlib.h>
13 #include <stdbool.h>
1417 #include <unistd.h>
15 #include <string.h>
16 #include <errno.h>
17 #include <err.h>
18 #include <stdint.h>
19 #include <getopt.h>
20 #include <limits.h>
2118
2219 #include <xcb/xcb.h>
2320 #include <xcb/xcb_aux.h>
24 #include <xcb/xcb_event.h>
2521 #include <xcb/xcb_keysyms.h>
2622
2723 xcb_visualtype_t *visual_type = NULL;
24 #include "i3-input.h"
25 #include "keysym2ucs.h"
2826 #include "libi3.h"
2927
3028 #include <X11/keysym.h>
31
32 #include "keysym2ucs.h"
33
34 #include "i3-input.h"
3529
3630 #define MAX_WIDTH logical_px(500)
3731 #define BORDER logical_px(2)
3832 #define PADDING logical_px(2)
33
34 /* Exit codes for i3-input:
35 * 0 if i3-input exited successfully and the command was run
36 * 1 if the user canceled input
37 * 2 if i3-input fails for any other reason */
38 const int EXIT_OK = 0;
39 const int EXIT_CANCEL = 1;
40 const int EXIT_ERROR = 2;
3941
4042 /* IPC format string. %s will be replaced with what the user entered, then
4143 * the command will be sent to i3 */
191193 /* prefix the command if a prefix was specified on commandline */
192194 printf("command = %s\n", full);
193195
194 ipc_send_message(sockfd, strlen(full), 0, (uint8_t *)full);
196 int ret = ipc_send_message(sockfd, strlen(full), 0, (uint8_t *)full);
195197
196198 free(full);
197199
198 exit(0);
200 exit(ret == 0 ? EXIT_OK : EXIT_ERROR);
199201 }
200202
201203 /*
244246 return 1;
245247 }
246248 if (sym == XK_Escape) {
247 exit(0);
249 exit(EXIT_CANCEL);
248250 }
249251
250252 /* TODO: handle all of these? */
302304 xcb_intern_atom_reply_t *nswc_reply = xcb_intern_atom_reply(conn, nswc_cookie, NULL);
303305 if (nswc_reply == NULL) {
304306 ELOG("Could not intern atom _NET_SUPPORTING_WM_CHECK\n");
305 exit(-1);
307 exit(EXIT_ERROR);
306308 }
307309 A__NET_SUPPORTING_WM_CHECK = nswc_reply->atom;
308310 free(nswc_reply);
372374 }
373375
374376 int main(int argc, char *argv[]) {
375 format = sstrdup("%s");
376377 char *socket_path = NULL;
377 char *pattern = sstrdup("pango:monospace 8");
378 char *pattern = NULL;
378379 int o, option_index = 0;
379380
380381 static struct option long_options[] = {
398399 break;
399400 case 'v':
400401 printf("i3-input " I3_VERSION);
401 return 0;
402 return EXIT_OK;
402403 case 'p':
403404 /* This option is deprecated, but will still work in i3 v4.1, 4.2 and 4.3 */
404405 fprintf(stderr, "i3-input: WARNING: the -p option is DEPRECATED in favor of the -F (format) option\n");
426427 printf("\n");
427428 printf("Example:\n");
428429 printf(" i3-input -F 'workspace \"%%s\"' -P 'Switch to workspace: '\n");
429 return 0;
430 return EXIT_OK;
430431 }
432 }
433 if (!format) {
434 format = "%s";
431435 }
432436
433437 printf("using format \"%s\"\n", format);
445449 symbols = xcb_key_symbols_alloc(conn);
446450
447451 init_dpi();
448 font = load_font(pattern, true);
452 font = load_font(pattern ? pattern : "pango:monospace 8", true);
449453 set_font(&font);
450454
451455 if (prompt != NULL)
494498
495499 if (reply->status != XCB_GRAB_STATUS_SUCCESS) {
496500 fprintf(stderr, "Could not grab keyboard, status = %d\n", reply->status);
497 exit(-1);
501 exit(EXIT_ERROR);
498502 }
499503
500504 xcb_flush(conn);
530534 }
531535
532536 draw_util_surface_free(conn, &surface);
533 return 0;
534 }
537 return EXIT_OK;
538 }
1515 */
1616 #include "libi3.h"
1717
18 #include <err.h>
19 #include <getopt.h>
20 #include <i3/ipc.h>
21 #include <stdbool.h>
22 #include <stdint.h>
1823 #include <stdio.h>
19 #include <stdbool.h>
20 #include <sys/types.h>
21 #include <sys/socket.h>
22 #include <sys/un.h>
2324 #include <stdlib.h>
25 #include <string.h>
2426 #include <unistd.h>
25 #include <string.h>
26 #include <errno.h>
27 #include <err.h>
28 #include <stdint.h>
29 #include <getopt.h>
30 #include <limits.h>
3127
3228 #include <yajl/yajl_parse.h>
33 #include <yajl/yajl_version.h>
34
35 #include <xcb/xcb.h>
36 #include <xcb/xcb_aux.h>
37
38 #include <i3/ipc.h>
3929
4030 /*
4131 * Having verboselog() and errorlog() is necessary when using libi3.
198188 message_type = I3_IPC_MESSAGE_TYPE_GET_BAR_CONFIG;
199189 } else if (strcasecmp(optarg, "get_binding_modes") == 0) {
200190 message_type = I3_IPC_MESSAGE_TYPE_GET_BINDING_MODES;
191 } else if (strcasecmp(optarg, "get_binding_state") == 0) {
192 message_type = I3_IPC_MESSAGE_TYPE_GET_BINDING_STATE;
201193 } else if (strcasecmp(optarg, "get_version") == 0) {
202194 message_type = I3_IPC_MESSAGE_TYPE_GET_VERSION;
203195 } else if (strcasecmp(optarg, "get_config") == 0) {
208200 message_type = I3_IPC_MESSAGE_TYPE_SUBSCRIBE;
209201 } else {
210202 printf("Unknown message type\n");
211 printf("Known types: run_command, get_workspaces, get_outputs, get_tree, get_marks, get_bar_config, get_binding_modes, get_version, get_config, send_tick, subscribe\n");
203 printf("Known types: run_command, get_workspaces, get_outputs, get_tree, get_marks, get_bar_config, get_binding_modes, get_binding_state, get_version, get_config, send_tick, subscribe\n");
212204 exit(EXIT_FAILURE);
213205 }
214206 } else if (o == 'q') {
+0
-6
i3-nagbar/atoms.xmacro less more
0 xmacro(_NET_WM_WINDOW_TYPE)
1 xmacro(_NET_WM_WINDOW_TYPE_DOCK)
2 xmacro(_NET_WM_STRUT_PARTIAL)
3 xmacro(I3_SOCKET_PATH)
4 xmacro(ATOM)
5 xmacro(CARDINAL)
0 // clang-format off
1 #define NAGBAR_ATOMS_XMACRO \
2 xmacro(_NET_WM_WINDOW_TYPE) \
3 xmacro(_NET_WM_WINDOW_TYPE_DOCK) \
4 xmacro(_NET_WM_STRUT_PARTIAL) \
5 xmacro(I3_SOCKET_PATH) \
6 xmacro(ATOM) \
7 xmacro(CARDINAL)
+0
-18
i3-nagbar/i3-nagbar.h less more
0 #pragma once
1
2 #include <config.h>
3
4 #include <err.h>
5
6 #define die(...) errx(EXIT_FAILURE, __VA_ARGS__);
7 #define FREE(pointer) \
8 do { \
9 free(pointer); \
10 pointer = NULL; \
11 } while (0)
12
13 #define xmacro(atom) xcb_atom_t A_##atom;
14 #include "atoms.xmacro"
15 #undef xmacro
16
17 extern xcb_window_t root;
77 * when the user has an error in their configuration file.
88 *
99 */
10 #include <stdio.h>
11 #include <sys/types.h>
12 #include <sys/stat.h>
13 #include <sys/wait.h>
14 #include <stdlib.h>
15 #include <stdbool.h>
16 #include <unistd.h>
17 #include <string.h>
18 #include <errno.h>
10 #include <config.h>
11
12 #include "libi3.h"
13
1914 #include <err.h>
20 #include <stdint.h>
15 #include <fcntl.h>
2116 #include <getopt.h>
2217 #include <limits.h>
23 #include <fcntl.h>
2418 #include <paths.h>
25
19 #include <stdint.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <sys/stat.h>
23 #include <sys/types.h>
24 #include <sys/wait.h>
25 #include <unistd.h>
26
27 #include <xcb/randr.h>
2628 #include <xcb/xcb.h>
2729 #include <xcb/xcb_aux.h>
28 #include <xcb/xcb_event.h>
29 #include <xcb/randr.h>
3030 #include <xcb/xcb_cursor.h>
3131
3232 xcb_visualtype_t *visual_type = NULL;
33 #include "libi3.h"
3433
3534 #define SN_API_NOT_YET_FROZEN 1
3635 #include <libsn/sn-launchee.h>
3736
38 #include "i3-nagbar.h"
37 #include "i3-nagbar-atoms.xmacro.h"
3938
4039 #define MSG_PADDING logical_px(8)
4140 #define BTN_PADDING logical_px(3)
4342 #define BTN_GAP logical_px(20)
4443 #define CLOSE_BTN_GAP logical_px(15)
4544 #define BAR_BORDER logical_px(2)
45
46 #define xmacro(atom) xcb_atom_t A_##atom;
47 NAGBAR_ATOMS_XMACRO
48 #undef xmacro
49
50 #define die(...) errx(EXIT_FAILURE, __VA_ARGS__);
4651
4752 static char *argv0 = NULL;
4853
313318 goto free_resources;
314319
315320 free_resources:
316 FREE(res);
317 FREE(primary);
321 free(res);
322 free(primary);
318323 return result;
319324 }
320325
422427 /* Place requests for the atoms we need as soon as possible */
423428 #define xmacro(atom) \
424429 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
425 #include "atoms.xmacro"
430 NAGBAR_ATOMS_XMACRO
426431 #undef xmacro
427432
428433 /* Init startup notification. */
504509 A_##name = reply->atom; \
505510 free(reply); \
506511 } while (0);
507 #include "atoms.xmacro"
512 NAGBAR_ATOMS_XMACRO
508513 #undef xmacro
509514
510515 /* Set dock mode */
597602 free(event);
598603 }
599604
600 FREE(pattern);
605 free(pattern);
601606 draw_util_surface_free(conn, &bar);
602607
603608 return 0;
8484 * Generates a click event, if enabled.
8585 *
8686 */
87 void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int width, int height, int mods);
87 void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int out_x, int out_y, int width, int height, int mods);
88
99 #include <config.h>
1010
11 #include <stdbool.h>
1211 #include <xcb/xcb.h>
1312 #include <xcb/xproto.h>
1413 #include "libi3.h"
7776 char *name;
7877 char *instance;
7978
80 TAILQ_ENTRY(status_block)
81 blocks;
79 TAILQ_ENTRY(status_block) blocks;
8280 };
8381
84 extern TAILQ_HEAD(statusline_head, status_block)
85 statusline_head;
82 extern TAILQ_HEAD(statusline_head, status_block) statusline_head;
8683
8784 #include "child.h"
8885 #include "ipc.h"
9390 #include "trayclients.h"
9491 #include "xcb.h"
9592 #include "configuration.h"
96 #include "libi3.h"
9793 #include "parse_json_header.h"
2828 char *command;
2929 bool release;
3030
31 TAILQ_ENTRY(binding_t)
32 bindings;
31 TAILQ_ENTRY(binding_t) bindings;
3332 } binding_t;
3433
3534 typedef struct tray_output_t {
3635 char *output;
3736
38 TAILQ_ENTRY(tray_output_t)
39 tray_outputs;
37 TAILQ_ENTRY(tray_output_t) tray_outputs;
4038 } tray_output_t;
4139
4240 typedef struct config_t {
4341 uint32_t modifier;
44
45 TAILQ_HEAD(bindings_head, binding_t)
46 bindings;
47
42 TAILQ_HEAD(bindings_head, binding_t) bindings;
4843 position_t position;
4944 bool verbose;
5045 uint32_t bar_height;
5954 char *command;
6055 char *fontname;
6156 i3String *separator_symbol;
62
63 TAILQ_HEAD(tray_outputs_head, tray_output_t)
64 tray_outputs;
65
57 TAILQ_HEAD(tray_outputs_head, tray_output_t) tray_outputs;
6658 int tray_padding;
6759 int num_outputs;
6860 char **outputs;
7272 struct ws_head* workspaces; /* The workspaces on this output */
7373 struct tc_head* trayclients; /* The tray clients on this output */
7474
75 SLIST_ENTRY(i3_output)
76 slist; /* Pointer for the SLIST-Macro */
75 SLIST_ENTRY(i3_output) slist; /* Pointer for the SLIST-Macro */
7776 };
2020 char *class_class;
2121 char *class_instance;
2222
23 TAILQ_ENTRY(trayclient)
24 tailq; /* Pointer for the TAILQ-Macro */
23 TAILQ_ENTRY(trayclient) tailq; /* Pointer for the TAILQ-Macro */
2524 };
4040 rect rect; /* The rect of the ws (not used (yet)) */
4141 struct i3_output *output; /* The current output of the ws */
4242
43 TAILQ_ENTRY(i3_ws)
44 tailq; /* Pointer for the TAILQ-Macro */
43 TAILQ_ENTRY(i3_ws) tailq; /* Pointer for the TAILQ-Macro */
4544 };
99 #include "common.h"
1010 #include "yajl_utils.h"
1111
12 #include <err.h>
13 #include <errno.h>
14 #include <ev.h>
15 #include <fcntl.h>
16 #include <paths.h>
17 #include <signal.h>
18 #include <stdarg.h>
19 #include <stdio.h>
1220 #include <stdlib.h>
21 #include <string.h>
22 #include <sys/wait.h>
1323 #include <unistd.h>
14 #include <sys/types.h>
15 #include <sys/wait.h>
16 #include <signal.h>
17 #include <stdio.h>
18 #include <stdarg.h>
19 #include <fcntl.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <err.h>
23 #include <ev.h>
24 #include <yajl/yajl_common.h>
24
25 #include <yajl/yajl_gen.h>
2526 #include <yajl/yajl_parse.h>
26 #include <yajl/yajl_version.h>
27 #include <yajl/yajl_gen.h>
28 #include <paths.h>
29
30 #include <xcb/xcb_keysyms.h>
3127
3228 /* Global variables for child_*() */
3329 i3bar_child child;
637633 * Generates a click event, if enabled.
638634 *
639635 */
640 void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int width, int height, int mods) {
636 void send_block_clicked(int button, const char *name, const char *instance, int x, int y, int x_rel, int y_rel, int out_x, int out_y, int width, int height, int mods) {
641637 if (!child.click_events) {
642638 return;
643639 }
689685 ystr("relative_y");
690686 yajl_gen_integer(gen, y_rel);
691687
688 ystr("output_x");
689 yajl_gen_integer(gen, out_x);
690
691 ystr("output_y");
692 yajl_gen_integer(gen, out_y);
693
692694 ystr("width");
693695 yajl_gen_integer(gen, width);
694696
88 */
99 #include "common.h"
1010
11 #include <stdio.h>
12 #include <stdlib.h>
1113 #include <string.h>
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <errno.h>
15 #include <i3/ipc.h>
14
15 #include <X11/Xlib.h>
1616 #include <yajl/yajl_parse.h>
17 #include <yajl/yajl_version.h>
18
19 #include <X11/Xlib.h>
2017
2118 config_t config;
2219 static char *cur_key;
88 */
99 #include "common.h"
1010
11 #include <errno.h>
12 #include <ev.h>
13 #include <i3/ipc.h>
14 #include <stdint.h>
1115 #include <stdlib.h>
12 #include <stdio.h>
16 #include <string.h>
1317 #include <unistd.h>
14 #include <stdint.h>
15 #include <string.h>
16 #include <errno.h>
17 #include <sys/socket.h>
18 #include <sys/un.h>
19 #include <i3/ipc.h>
20 #include <ev.h>
2118 #ifdef I3_ASAN_ENABLED
2219 #include <sanitizer/lsan_interface.h>
2320 #endif
66 */
77 #include "common.h"
88
9 #include <stdio.h>
10 #include <i3/ipc.h>
11 #include <string.h>
12 #include <unistd.h>
13 #include <stdlib.h>
14 #include <errno.h>
159 #include <ev.h>
1610 #include <getopt.h>
1711 #include <glob.h>
12 #include <i3/ipc.h>
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
1816
1917 struct ev_loop *main_loop;
2018
88 */
99 #include "common.h"
1010
11 #include <stdlib.h>
1112 #include <string.h>
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <errno.h>
13
1514 #include <yajl/yajl_parse.h>
16 #include <yajl/yajl_version.h>
1715
1816 /* A datatype to pass through the callbacks to save the state */
1917 struct mode_json_params {
88 */
99 #include "common.h"
1010
11 #include <errno.h>
12 #include <stdio.h>
13 #include <stdlib.h>
1114 #include <string.h>
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <errno.h>
15 #include <i3/ipc.h>
15
1616 #include <yajl/yajl_parse.h>
17 #include <yajl/yajl_version.h>
1817
1918 /* A datatype to pass through the callbacks to save the state */
2019 struct outputs_json_params {
192191
193192 /* See if we actually handle that output */
194193 if (config.num_outputs > 0) {
194 const bool is_primary = params->outputs_walk->primary;
195195 bool handle_output = false;
196196 for (int c = 0; c < config.num_outputs; c++) {
197 if (strcasecmp(params->outputs_walk->name, config.outputs[c]) == 0 ||
198 (strcasecmp(config.outputs[c], "primary") == 0 &&
199 params->outputs_walk->primary)) {
197 if ((strcasecmp(params->outputs_walk->name, config.outputs[c]) == 0) ||
198 (strcasecmp(config.outputs[c], "primary") == 0 && is_primary) ||
199 (strcasecmp(config.outputs[c], "nonprimary") == 0 && !is_primary)) {
200200 handle_output = true;
201201 break;
202202 }
99 */
1010 #include "common.h"
1111
12 #include <stdlib.h>
13 #include <unistd.h>
14 #include <sys/types.h>
15 #include <sys/wait.h>
1612 #include <signal.h>
17 #include <stdio.h>
18 #include <fcntl.h>
1913 #include <string.h>
20 #include <errno.h>
21 #include <err.h>
22 #include <ev.h>
23 #include <stdbool.h>
24 #include <stdint.h>
25 #include <yajl/yajl_common.h>
14
2615 #include <yajl/yajl_parse.h>
27 #include <yajl/yajl_version.h>
2816
2917 static enum {
3018 KEY_VERSION,
88 */
99 #include "common.h"
1010
11 #include <stdlib.h>
1112 #include <string.h>
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <errno.h>
13
1514 #include <yajl/yajl_parse.h>
16 #include <yajl/yajl_version.h>
1715
1816 /* A datatype to pass through the callbacks to save the state */
1917 struct workspaces_json_params {
88 */
99 #include "common.h"
1010
11 #include <xcb/xcb.h>
12 #include <xcb/xkb.h>
13 #include <xcb/xproto.h>
11 #include <err.h>
12 #include <ev.h>
13 #include <i3/ipc.h>
14 #include <stdlib.h>
15 #include <string.h>
16
1417 #include <xcb/xcb_aux.h>
1518 #include <xcb/xcb_cursor.h>
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <unistd.h>
20 #include <fcntl.h>
21 #include <string.h>
22 #include <i3/ipc.h>
23 #include <ev.h>
24 #include <errno.h>
25 #include <limits.h>
26 #include <err.h>
27
28 #include <X11/Xlib.h>
29 #include <X11/XKBlib.h>
30 #include <X11/extensions/XKB.h>
19 #include <xcb/xkb.h>
3120
3221 #ifdef I3_ASAN_ENABLED
3322 #include <sanitizer/lsan_interface.h>
453442 return false;
454443 }
455444
456 static void child_handle_button(xcb_button_press_event_t *event, i3_output *output, uint32_t statusline_x) {
445 static void child_handle_button(xcb_button_press_event_t *event, i3_output *output, uint32_t statusline_x, uint32_t statusline_y) {
457446 if (statusline_x > (uint32_t)output->statusline_width) {
458447 return;
459448 }
482471 /* x of the click event relative to the current block. */
483472 const uint32_t relative_x = statusline_x - last_block_x;
484473 if (relative_x <= full_render_width) {
474 const uint32_t output_x = event->event_x;
475 const uint32_t output_y = statusline_y + event->event_y;
476
485477 send_block_clicked(event->detail, block->name, block->instance,
486478 event->root_x, event->root_y, relative_x,
487 event->event_y, full_render_width, bar_height,
479 event->event_y, output_x, output_y,
480 full_render_width, bar_height,
488481 event->state);
489482 return;
490483 }
552545 /* Calculate the horizontal coordinate (x) of the start of the
553546 * statusline by subtracting its width and the width of the tray from
554547 * the bar width. */
555 const int offset = walk->rect.w - walk->statusline_width -
556 tray_width - logical_px((tray_width > 0) * sb_hoff_px);
557 if (x >= offset) {
548 const int offset_x = walk->rect.w - walk->statusline_width -
549 tray_width - logical_px((tray_width > 0) * sb_hoff_px);
550 if (x >= offset_x) {
558551 /* Click was after the start of the statusline, return to avoid
559552 * executing any other actions even if a click event is not
560553 * produced eventually. */
562555 if (!event_is_release) {
563556 /* x of the click event relative to the start of the
564557 * statusline. */
565 const uint32_t statusline_x = x - offset;
566 child_handle_button(event, walk, statusline_x);
558 const uint32_t statusline_x = x - offset_x;
559 const uint32_t statusline_y = event->root_y - walk->rect.y - event->event_y;
560
561 child_handle_button(event, walk, statusline_x, statusline_y);
567562 }
568563
569564 return;
16271622 *
16281623 */
16291624 void destroy_window(i3_output *output) {
1630 if (output == NULL) {
1625 if (output == NULL || output->bar.id == XCB_NONE) {
16311626 return;
16321627 }
1633 if (output->bar.id == XCB_NONE) {
1634 return;
1635 }
16361628
16371629 kick_tray_clients(output);
1630
1631 draw_util_surface_free(xcb_connection, &(output->bar));
1632 draw_util_surface_free(xcb_connection, &(output->buffer));
1633 draw_util_surface_free(xcb_connection, &(output->statusline_buffer));
16381634 xcb_destroy_window(xcb_connection, output->bar.id);
1635 xcb_free_pixmap(xcb_connection, output->buffer.id);
1636 xcb_free_pixmap(xcb_connection, output->statusline_buffer.id);
16391637 output->bar.id = XCB_NONE;
16401638 }
16411639
1414 #include <config.h>
1515
1616 #include <assert.h>
17 #include <err.h>
18 #include <errno.h>
19 #include <limits.h>
20 #include <stdarg.h>
1721 #include <stdbool.h>
22 #include <stdint.h>
23 #include <stdio.h>
1824 #include <stdlib.h>
19 #include <stdio.h>
2025 #include <string.h>
21 #include <locale.h>
22 #include <getopt.h>
23 #include <unistd.h>
2426 #include <sys/stat.h>
2527 #include <sys/types.h>
26 #include <glob.h>
27 #include <errno.h>
28 #include <err.h>
29 #include <stdint.h>
30 #include <inttypes.h>
31 #include <math.h>
32 #include <limits.h>
3328
3429 #include <xcb/xcb.h>
3530 #include <xcb/xcb_aux.h>
31 #include <xcb/xcb_icccm.h>
3632 #include <xcb/xcb_keysyms.h>
37 #include <xcb/xcb_icccm.h>
3833
39 #include <yajl/yajl_gen.h>
40 #include <yajl/yajl_version.h>
41
34 #include "libi3.h"
4235 #include "data.h"
4336 #include "util.h"
4437 #include "ipc.h"
7164 #include "ewmh.h"
7265 #include "assignments.h"
7366 #include "regex.h"
74 #include "libi3.h"
7567 #include "startup.h"
7668 #include "scratchpad.h"
7769 #include "commands.h"
+0
-2
include/atoms.xmacro less more
0 #include "atoms_NET_SUPPORTED.xmacro"
1 #include "atoms_rest.xmacro"
+0
-35
include/atoms_NET_SUPPORTED.xmacro less more
0 xmacro(_NET_SUPPORTED)
1 xmacro(_NET_SUPPORTING_WM_CHECK)
2 xmacro(_NET_WM_NAME)
3 xmacro(_NET_WM_VISIBLE_NAME)
4 xmacro(_NET_WM_MOVERESIZE)
5 xmacro(_NET_WM_STATE_STICKY)
6 xmacro(_NET_WM_STATE_FULLSCREEN)
7 xmacro(_NET_WM_STATE_DEMANDS_ATTENTION)
8 xmacro(_NET_WM_STATE_MODAL)
9 xmacro(_NET_WM_STATE_HIDDEN)
10 xmacro(_NET_WM_STATE_FOCUSED)
11 xmacro(_NET_WM_STATE)
12 xmacro(_NET_WM_WINDOW_TYPE)
13 xmacro(_NET_WM_WINDOW_TYPE_NORMAL)
14 xmacro(_NET_WM_WINDOW_TYPE_DOCK)
15 xmacro(_NET_WM_WINDOW_TYPE_DIALOG)
16 xmacro(_NET_WM_WINDOW_TYPE_UTILITY)
17 xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR)
18 xmacro(_NET_WM_WINDOW_TYPE_SPLASH)
19 xmacro(_NET_WM_WINDOW_TYPE_MENU)
20 xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
21 xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU)
22 xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP)
23 xmacro(_NET_WM_WINDOW_TYPE_NOTIFICATION)
24 xmacro(_NET_WM_DESKTOP)
25 xmacro(_NET_WM_STRUT_PARTIAL)
26 xmacro(_NET_CLIENT_LIST)
27 xmacro(_NET_CLIENT_LIST_STACKING)
28 xmacro(_NET_CURRENT_DESKTOP)
29 xmacro(_NET_NUMBER_OF_DESKTOPS)
30 xmacro(_NET_DESKTOP_NAMES)
31 xmacro(_NET_DESKTOP_VIEWPORT)
32 xmacro(_NET_ACTIVE_WINDOW)
33 xmacro(_NET_CLOSE_WINDOW)
34 xmacro(_NET_MOVERESIZE_WINDOW)
+0
-20
include/atoms_rest.xmacro less more
0 xmacro(_NET_WM_USER_TIME)
1 xmacro(_NET_STARTUP_ID)
2 xmacro(_NET_WORKAREA)
3 xmacro(WM_PROTOCOLS)
4 xmacro(WM_DELETE_WINDOW)
5 xmacro(UTF8_STRING)
6 xmacro(WM_STATE)
7 xmacro(WM_CLIENT_LEADER)
8 xmacro(WM_TAKE_FOCUS)
9 xmacro(WM_WINDOW_ROLE)
10 xmacro(I3_SOCKET_PATH)
11 xmacro(I3_CONFIG_PATH)
12 xmacro(I3_SYNC)
13 xmacro(I3_SHMLOG_PATH)
14 xmacro(I3_PID)
15 xmacro(I3_FLOATING_WINDOW)
16 xmacro(_NET_REQUEST_FRAME_EXTENTS)
17 xmacro(_NET_FRAME_EXTENTS)
18 xmacro(_MOTIF_WM_HINTS)
19 xmacro(WM_CHANGE_STATE)
218218 void cmd_sticky(I3_CMD, const char *action);
219219
220220 /**
221 * Implementation of 'move <direction> [<pixels> [px]]'.
222 *
223 */
224 void cmd_move_direction(I3_CMD, const char *direction_str, long move_px);
221 * Implementation of 'move <direction> [<amount> [px|ppt]]'.
222 *
223 */
224 void cmd_move_direction(I3_CMD, const char *direction_str, long amount, const char *mode);
225225
226226 /**
227227 * Implementation of 'layout default|stacked|stacking|tabbed|splitv|splith'.
266266 void cmd_focus_output(I3_CMD, const char *name);
267267
268268 /**
269 * Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px]
270 *
271 */
272 void cmd_move_window_to_position(I3_CMD, long x, long y);
269 * Implementation of 'move [window|container] [to] [absolute] position [<pos_x> [px|ppt] <pos_y> [px|ppt]]
270 *
271 */
272 void cmd_move_window_to_position(I3_CMD, long x, const char *mode_x, long y, const char *mode_y);
273273
274274 /**
275275 * Implementation of 'move [window|container] [to] [absolute] position center
314314 void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name);
315315
316316 /**
317 * Implementation of 'bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]'
318 *
319 */
320 void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id);
317 * Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]'
318 *
319 */
320 void cmd_bar_mode(I3_CMD, const char *bar_mode, const char *bar_id);
321
322 /**
323 * Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]'
324 *
325 */
326 void cmd_bar_hidden_state(I3_CMD, const char *bar_hidden_state, const char *bar_id);
321327
322328 /**
323329 * Implementation of 'shmlog <size>|toggle|on|off'
1111 */
1212 #pragma once
1313
14 #include "libi3.h"
15
16 #include <stdbool.h>
1714 #include "queue.h"
1815 #include "i3.h"
1916
6865 char *value;
6966 char *next_match;
7067
71 SLIST_ENTRY(Variable)
72 variables;
68 SLIST_ENTRY(Variable) variables;
7369 };
7470
7571 /**
8379 bool pango_markup;
8480 struct bindings_head *bindings;
8581
86 SLIST_ENTRY(Mode)
87 modes;
82 SLIST_ENTRY(Mode) modes;
8883 };
8984
9085 /**
283278 /* List of outputs on which the tray is allowed to be shown, in order.
284279 * The special value "none" disables it (per default, it will be shown) and
285280 * the special value "primary" enabled it on the primary output. */
286 TAILQ_HEAD(tray_outputs_head, tray_output_t)
287 tray_outputs;
281 TAILQ_HEAD(tray_outputs_head, tray_output_t) tray_outputs;
288282
289283 /* Padding around the tray icons. */
290284 int tray_padding;
306300 /** Bar modifier (to show bar when in hide mode). */
307301 uint32_t modifier;
308302
309 TAILQ_HEAD(bar_bindings_head, Barbinding)
310 bar_bindings;
303 TAILQ_HEAD(bar_bindings_head, Barbinding) bar_bindings;
311304
312305 /** Bar position (bottom by default). */
313306 enum { P_BOTTOM = 0,
384377 char *binding_mode_text;
385378 } colors;
386379
387 TAILQ_ENTRY(Barconfig)
388 configs;
380 TAILQ_ENTRY(Barconfig) configs;
389381 };
390382
391383 /**
403395 /** If true, the command will be executed after the button is released. */
404396 bool release;
405397
406 TAILQ_ENTRY(Barbinding)
407 bindings;
398 TAILQ_ENTRY(Barbinding) bindings;
408399 };
409400
410401 struct tray_output_t {
411402 char *output;
412403
413 TAILQ_ENTRY(tray_output_t)
414 tray_outputs;
404 TAILQ_ENTRY(tray_output_t) tray_outputs;
415405 };
416406
417407 typedef enum {
439429 *
440430 */
441431 void ungrab_all_keys(xcb_connection_t *conn);
442
443 /**
444 * Sends the current bar configuration as an event to all barconfig_update listeners.
445 *
446 */
447 void update_barconfig(void);
88 */
99 #pragma once
1010
11 #include "libi3.h"
12
1311 #define SN_API_NOT_YET_FROZEN 1
1412 #include <libsn/sn-launcher.h>
1513
1614 #include <xcb/randr.h>
17 #include <stdbool.h>
1815 #include <pcre.h>
1916 #include <sys/time.h>
2017
227224 char *output;
228225 gaps_t gaps;
229226
230 TAILQ_ENTRY(Workspace_Assignment)
231 ws_assignments;
227 TAILQ_ENTRY(Workspace_Assignment) ws_assignments;
232228 };
233229
234230 struct Ignore_Event {
236232 int response_type;
237233 time_t added;
238234
239 SLIST_ENTRY(Ignore_Event)
240 ignore_events;
235 SLIST_ENTRY(Ignore_Event) ignore_events;
241236 };
242237
243238 /**
256251 * completed) */
257252 time_t delete_at;
258253
259 TAILQ_ENTRY(Startup_Sequence)
260 sequences;
254 TAILQ_ENTRY(Startup_Sequence) sequences;
261255 };
262256
263257 /**
283277 struct Binding_Keycode {
284278 xcb_keycode_t keycode;
285279 i3_event_state_mask_t modifiers;
286
287 TAILQ_ENTRY(Binding_Keycode)
288 keycodes;
280 TAILQ_ENTRY(Binding_Keycode) keycodes;
289281 };
290282
291283 /******************************************************************************
346338 /** Only in use if symbol != NULL. Contains keycodes which generate the
347339 * specified symbol. Useful for unbinding and checking which binding was
348340 * used when a key press event comes in. */
349 TAILQ_HEAD(keycodes_head, Binding_Keycode)
350 keycodes_head;
341 TAILQ_HEAD(keycodes_head, Binding_Keycode) keycodes_head;
351342
352343 /** Command, like in command mode */
353344 char *command;
354345
355 TAILQ_ENTRY(Binding)
356 bindings;
346 TAILQ_ENTRY(Binding) bindings;
357347 };
358348
359349 /**
369359 /** no_startup_id flag for start_application(). Determines whether a
370360 * startup notification context/ID should be created. */
371361 bool no_startup_id;
372
373 TAILQ_ENTRY(Autostart)
374 autostarts;
375
376 TAILQ_ENTRY(Autostart)
377 autostarts_always;
362 TAILQ_ENTRY(Autostart) autostarts;
363 TAILQ_ENTRY(Autostart) autostarts_always;
378364 };
379365
380366 struct output_name {
381367 char *name;
382
383 SLIST_ENTRY(output_name)
384 names;
368 SLIST_ENTRY(output_name) names;
385369 };
386370
387371 /**
408392 /** List of names for the output.
409393 * An output always has at least one name; the first name is
410394 * considered the primary one. */
411 SLIST_HEAD(names_head, output_name)
412 names_head;
395 SLIST_HEAD(names_head, output_name) names_head;
413396
414397 /** Pointer to the Con which represents this output */
415398 Con *con;
417400 /** x, y, width, height */
418401 Rect rect;
419402
420 TAILQ_ENTRY(xoutput)
421 outputs;
403 TAILQ_ENTRY(xoutput) outputs;
422404 };
423405
424406 /**
512494 /* Time when the window became managed. Used to determine whether a window
513495 * should be swallowed after initial management. */
514496 time_t managed_since;
497
498 /* The window has been swallowed. */
499 bool swallowed;
515500 };
516501
517502 /**
569554 M_ASSIGN_WS,
570555 M_BELOW } insert_where;
571556
572 TAILQ_ENTRY(Match)
573 matches;
557 TAILQ_ENTRY(Match) matches;
574558
575559 /* Whether this match was generated when restarting i3 inplace.
576560 * Leads to not setting focus when managing a new window, because the old
617601 char *output;
618602 } dest;
619603
620 TAILQ_ENTRY(Assignment)
621 assignments;
604 TAILQ_ENTRY(Assignment) assignments;
622605 };
623606
624607 /** Fullscreen modes. Used by Con.fullscreen_mode. */
629612 struct mark_t {
630613 char *name;
631614
632 TAILQ_ENTRY(mark_t)
633 marks;
615 TAILQ_ENTRY(mark_t) marks;
634616 };
635617
636618 /**
697679 char *sticky_group;
698680
699681 /* user-definable marks to jump to this container later */
700 TAILQ_HEAD(marks_head, mark_t)
701 marks_head;
682 TAILQ_HEAD(marks_head, mark_t) marks_head;
702683 /* cached to decide whether a redraw is needed */
703684 bool mark_changed;
704685
717698 struct deco_render_params *deco_render_params;
718699
719700 /* Only workspace-containers can have floating clients */
720 TAILQ_HEAD(floating_head, Con)
721 floating_head;
722
723 TAILQ_HEAD(nodes_head, Con)
724 nodes_head;
725
726 TAILQ_HEAD(focus_head, Con)
727 focus_head;
728
729 TAILQ_HEAD(swallow_head, Match)
730 swallow_head;
701 TAILQ_HEAD(floating_head, Con) floating_head;
702
703 TAILQ_HEAD(nodes_head, Con) nodes_head;
704 TAILQ_HEAD(focus_head, Con) focus_head;
705
706 TAILQ_HEAD(swallow_head, Match) swallow_head;
731707
732708 fullscreen_mode_t fullscreen_mode;
733709
765741 FLOATING_USER_ON = 3
766742 } floating;
767743
768 TAILQ_ENTRY(Con)
769 nodes;
770
771 TAILQ_ENTRY(Con)
772 focused;
773
774 TAILQ_ENTRY(Con)
775 all_cons;
776
777 TAILQ_ENTRY(Con)
778 floating_windows;
744 TAILQ_ENTRY(Con) nodes;
745 TAILQ_ENTRY(Con) focused;
746 TAILQ_ENTRY(Con) all_cons;
747 TAILQ_ENTRY(Con) floating_windows;
779748
780749 /** callbacks */
781750 void (*on_remove_child)(Con *);
2424 * floating_windows list of the workspace.
2525 *
2626 */
27 void floating_enable(Con *con, bool automatic);
27 bool floating_enable(Con *con, bool automatic);
2828
2929 /**
3030 * Disables floating mode for the given container by re-attaching the container
4646 *
4747 */
4848 void property_handlers_init(void);
49
50 #if 0
51 /**
52 * Configuration notifies are only handled because we need to set up ignore
53 * for the following enter notify events
54 *
55 */
56 int handle_configure_event(void *prophs, xcb_connection_t *conn, xcb_configure_notify_event_t *event);
57 #endif
58
59 #if 0
60 /**
61 * Handles _NET_WM_WINDOW_TYPE changes
62 *
63 */
64 int handle_window_type(void *data, xcb_connection_t *conn, uint8_t state,
65 xcb_window_t window, xcb_atom_t atom,
66 xcb_get_property_reply_t *property);
67 #endif
6565 /** Trigger an i3 sync protocol message via IPC. */
6666 #define I3_IPC_MESSAGE_TYPE_SYNC 11
6767
68 /** Request the current binding state. */
69 #define I3_IPC_MESSAGE_TYPE_GET_BINDING_STATE 12
70
6871 /*
6972 * Messages from i3 to clients
7073 *
8184 #define I3_IPC_REPLY_TYPE_CONFIG 9
8285 #define I3_IPC_REPLY_TYPE_TICK 10
8386 #define I3_IPC_REPLY_TYPE_SYNC 11
87 #define I3_IPC_REPLY_TYPE_GET_BINDING_STATE 12
8488
8589 /*
8690 * Events from i3 to clients. Events have the first bit set high.
0 // clang-format off
1 #define I3_NET_SUPPORTED_ATOMS_XMACRO \
2 xmacro(_NET_SUPPORTED) \
3 xmacro(_NET_SUPPORTING_WM_CHECK) \
4 xmacro(_NET_WM_NAME) \
5 xmacro(_NET_WM_VISIBLE_NAME) \
6 xmacro(_NET_WM_MOVERESIZE) \
7 xmacro(_NET_WM_STATE_STICKY) \
8 xmacro(_NET_WM_STATE_FULLSCREEN) \
9 xmacro(_NET_WM_STATE_DEMANDS_ATTENTION) \
10 xmacro(_NET_WM_STATE_MODAL) \
11 xmacro(_NET_WM_STATE_HIDDEN) \
12 xmacro(_NET_WM_STATE_FOCUSED) \
13 xmacro(_NET_WM_STATE) \
14 xmacro(_NET_WM_WINDOW_TYPE) \
15 xmacro(_NET_WM_WINDOW_TYPE_NORMAL) \
16 xmacro(_NET_WM_WINDOW_TYPE_DOCK) \
17 xmacro(_NET_WM_WINDOW_TYPE_DIALOG) \
18 xmacro(_NET_WM_WINDOW_TYPE_UTILITY) \
19 xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR) \
20 xmacro(_NET_WM_WINDOW_TYPE_SPLASH) \
21 xmacro(_NET_WM_WINDOW_TYPE_MENU) \
22 xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) \
23 xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU) \
24 xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP) \
25 xmacro(_NET_WM_WINDOW_TYPE_NOTIFICATION) \
26 xmacro(_NET_WM_DESKTOP) \
27 xmacro(_NET_WM_STRUT_PARTIAL) \
28 xmacro(_NET_CLIENT_LIST) \
29 xmacro(_NET_CLIENT_LIST_STACKING) \
30 xmacro(_NET_CURRENT_DESKTOP) \
31 xmacro(_NET_NUMBER_OF_DESKTOPS) \
32 xmacro(_NET_DESKTOP_NAMES) \
33 xmacro(_NET_DESKTOP_VIEWPORT) \
34 xmacro(_NET_ACTIVE_WINDOW) \
35 xmacro(_NET_CLOSE_WINDOW) \
36 xmacro(_NET_MOVERESIZE_WINDOW)
0 // clang-format off
1 #define I3_REST_ATOMS_XMACRO \
2 xmacro(_NET_WM_USER_TIME) \
3 xmacro(_NET_STARTUP_ID) \
4 xmacro(_NET_WORKAREA) \
5 xmacro(WM_PROTOCOLS) \
6 xmacro(WM_DELETE_WINDOW) \
7 xmacro(UTF8_STRING) \
8 xmacro(WM_STATE) \
9 xmacro(WM_CLIENT_LEADER) \
10 xmacro(WM_TAKE_FOCUS) \
11 xmacro(WM_WINDOW_ROLE) \
12 xmacro(I3_SOCKET_PATH) \
13 xmacro(I3_CONFIG_PATH) \
14 xmacro(I3_SYNC) \
15 xmacro(I3_SHMLOG_PATH) \
16 xmacro(I3_PID) \
17 xmacro(I3_FLOATING_WINDOW) \
18 xmacro(_NET_REQUEST_FRAME_EXTENTS) \
19 xmacro(_NET_FRAME_EXTENTS) \
20 xmacro(_MOTIF_WM_HINTS) \
21 xmacro(WM_CHANGE_STATE)
5656 extern char **start_argv;
5757 extern Display *xlibdpy, *xkbdpy;
5858 extern int xkb_current_group;
59 extern TAILQ_HEAD(bindings_head, Binding) * bindings;
59 extern TAILQ_HEAD(bindings_head, Binding) *bindings;
60 extern const char *current_binding_mode;
6061 extern TAILQ_HEAD(autostarts_head, Autostart) autostarts;
6162 extern TAILQ_HEAD(autostarts_always_head, Autostart) autostarts_always;
6263 extern TAILQ_HEAD(ws_assignments_head, Workspace_Assignment) ws_assignments;
1111 #include <config.h>
1212
1313 #include <ev.h>
14 #include <stdbool.h>
1514 #include <yajl/yajl_gen.h>
1615 #include <yajl/yajl_parse.h>
1716
4039 uint8_t *buffer;
4140 size_t buffer_size;
4241
43 TAILQ_ENTRY(ipc_client)
44 clients;
42 TAILQ_ENTRY(ipc_client) clients;
4543 } ipc_client;
4644
4745 /*
100100 #if !defined(DLOG)
101101 void debuglog(char *fmt, ...)
102102 __attribute__((format(printf, 1, 2)));
103 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
103 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
104104 #endif
105105
106106 /**
346346 */
347347 uint32_t get_colorpixel(const char *hex) __attribute__((const));
348348
349 #ifndef HAVE_strndup
349 #ifndef HAVE_STRNDUP
350350 /**
351351 * Taken from FreeBSD
352352 * Returns a pointer to a new string which is a duplicate of the
531531 */
532532 char *get_config_path(const char *override_configpath, bool use_system_paths);
533533
534 #ifndef HAVE_mkdirp
534 #ifndef HAVE_MKDIRP
535535 /**
536536 * Emulates mkdir -p (creates any missing folders)
537537 *
542542 /** Helper structure for usage in format_placeholders(). */
543543 typedef struct placeholder_t {
544544 /* The placeholder to be replaced, e.g., "%title". */
545 char *name;
545 const char *name;
546546 /* The value this placeholder should be replaced with. */
547 char *value;
547 const char *value;
548548 } placeholder_t;
549549
550550 /**
99 #pragma once
1010
1111 #include <config.h>
12
13 #include <stdarg.h>
14 #include <stdbool.h>
1512
1613 /* We will include libi3.h which define its own version of LOG, ELOG.
1714 * We want *our* version, so we undef the libi3 one. */
2825 is, delete the preceding comma */
2926 #define LOG(fmt, ...) verboselog(fmt, ##__VA_ARGS__)
3027 #define ELOG(fmt, ...) errorlog("ERROR: " fmt, ##__VA_ARGS__)
31 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, STRIPPED__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
28 #define DLOG(fmt, ...) debuglog("%s:%s:%d - " fmt, __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__)
3229
3330 extern char *errorfilename;
3431 extern char *shmlogname;
1111
1212 #include <config.h>
1313
14 #include <stdint.h>
1514 #if !defined(__OpenBSD__)
1615 #include <pthread.h>
1716 #endif
142142 void start_nagbar(pid_t *nagbar_pid, char *argv[]);
143143
144144 /**
145 * Kills the i3-nagbar process, if *nagbar_pid != -1.
145 * Kills the i3-nagbar process, if nagbar_pid != -1.
146146 *
147147 * If wait_for_it is set (restarting i3), this function will waitpid(),
148148 * otherwise, ev is assumed to handle it (reloading).
149149 *
150150 */
151 void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it);
151 void kill_nagbar(pid_t nagbar_pid, bool wait_for_it);
152152
153153 /**
154154 * Converts a string into a long using strtol().
4545 Con *get_existing_workspace_by_num(int num);
4646
4747 /**
48 * Returns the first output that is assigned to a workspace specified by the
49 * given name or number. Returns NULL if no such output exists.
50 *
51 * If an assignment matches by number but there is an assignment later that
52 * matches by name, the second one is preferred.
53 * The order of the 'ws_assignments' queue is respected: if multiple
54 * assignments match the criteria, the first one is returned.
55 * 'name' is ignored when NULL, 'parsed_num' is ignored when it is -1.
56 *
57 */
58 Con *get_assigned_output(const char *name, long parsed_num);
59
60 /**
4861 * Returns true if the first output assigned to a workspace with the given
4962 * workspace assignment is the same as the given output.
5063 *
5669 * creating the workspace if necessary (by allocating the necessary amount of
5770 * memory and initializing the data structures correctly).
5871 *
59 * If created is not NULL, *created will be set to whether or not the
60 * workspace has just been created.
61 *
6272 */
63 Con *workspace_get(const char *num, bool *created);
73 Con *workspace_get(const char *num);
6474
6575 /**
6676 * Extracts workspace names from keybindings (e.g. “web” from “bindsym $mod+1
135145 */
136146 Con *workspace_back_and_forth_get(void);
137147
138 #if 0
139 /**
140 * Assigns the given workspace to the given screen by correctly updating its
141 * state and reconfiguring all the clients on this workspace.
142 *
143 * This is called when initializing a screen and when re-assigning it to a
144 * different screen which just got available (if you configured it to be on
145 * screen 1 and you just plugged in screen 1).
146 *
147 */
148 void workspace_assign_to(Workspace *ws, Output *screen, bool hide_it);
149
150 /**
151 * Initializes the given workspace if it is not already initialized. The given
152 * screen is to be understood as a fallback, if the workspace itself either
153 * was not assigned to a particular screen or cannot be placed there because
154 * the screen is not attached at the moment.
155 *
156 */
157 void workspace_initialize(Workspace *ws, Output *screen, bool recheck);
158
159 /**
160 * Gets the first unused workspace for the given screen, taking into account
161 * the preferred_screen setting of every workspace (workspace assignments).
162 *
163 */
164 Workspace *get_first_workspace_for_output(Output *screen);
165
166 /**
167 * Unmaps all clients (and stack windows) of the given workspace.
168 *
169 * This needs to be called separately when temporarily rendering a workspace
170 * which is not the active workspace to force reconfiguration of all clients,
171 * like in src/xinerama.c when re-assigning a workspace to another screen.
172 *
173 */
174 void workspace_unmap_clients(xcb_connection_t *conn, Workspace *u_ws);
175
176 /**
177 * Maps all clients (and stack windows) of the given workspace.
178 *
179 */
180 void workspace_map_clients(xcb_connection_t *conn, Workspace *ws);
181 #endif
182
183148 /**
184149 * Goes through all clients on the given workspace and updates the workspace’s
185150 * urgent flag accordingly.
4848 XCB_EVENT_MASK_FOCUS_CHANGE | \
4949 XCB_EVENT_MASK_ENTER_WINDOW)
5050
51 #include "i3-atoms_rest.xmacro.h"
52 #include "i3-atoms_NET_SUPPORTED.xmacro.h"
53
5154 #define xmacro(atom) extern xcb_atom_t A_##atom;
52 #include "atoms.xmacro"
55 I3_NET_SUPPORTED_ATOMS_XMACRO
56 I3_REST_ATOMS_XMACRO
5357 #undef xmacro
5458
5559 extern unsigned int xcb_numlock_mask;
1212
1313 #include <config.h>
1414
15 #include "data.h"
16
1715 /**
1816 * We have just established a connection to the X server and need the initial
1917 * Xinerama information to setup workspaces for each screen.
88
99 #include <math.h>
1010 #include <stdlib.h>
11
1112 #include <xcb/xcb_xrm.h>
1213
1314 static long dpi;
88 #include "libi3.h"
99
1010 #include <stdlib.h>
11 #include <err.h>
1211 #include <string.h>
12
1313 #include <xcb/xcb.h>
1414 #include <xcb/xcb_aux.h>
15 #include <cairo/cairo-xcb.h>
1615
1716 /* The default visual_type to use if none is specified when creating the surface. Must be defined globally. */
1817 extern xcb_visualtype_t *visual_type;
77 #include "libi3.h"
88
99 #include <stdlib.h>
10 #include <stdbool.h>
1110
1211 #include <xcb/xcb.h>
1312 #include <xcb/xproto.h>
77 #include "libi3.h"
88
99 #include <assert.h>
10 #include <cairo/cairo-xcb.h>
11 #include <err.h>
12 #include <pango/pangocairo.h>
1013 #include <stdint.h>
1114 #include <stdlib.h>
1215 #include <string.h>
13 #include <stdbool.h>
14 #include <err.h>
15
16 #include <cairo/cairo-xcb.h>
17 #include <pango/pangocairo.h>
1816
1917 static const i3Font *savedFont = NULL;
2018
77 #include "libi3.h"
88
99 #include <stdlib.h>
10 #include <stdint.h>
1110 #include <string.h>
1211
1312 #ifndef CS_STARTS_WITH
1818
1919 #include "libi3.h"
2020
21 #include <glib.h>
2122 #include <string.h>
22 #include <glib.h>
2323
2424 /* Copied from:
2525 * https://gitlab.gnome.org/GNOME/glib/blob/f928dfdf57bf92c883b53b16d7a9d49add504f52/glib/gutf8.c#L1752-1815 */
55 *
66 */
77 #include "libi3.h"
8 #include "queue.h"
89
10 #include <stdint.h>
911 #include <stdlib.h>
10 #include <stdint.h>
1112 #include <string.h>
12
13 #include "queue.h"
1413 struct Colorpixel {
1514 char hex[8];
1615 uint32_t pixel;
1716
18 SLIST_ENTRY(Colorpixel)
19 colorpixels;
17 SLIST_ENTRY(Colorpixel) colorpixels;
2018 };
2119
22 SLIST_HEAD(colorpixel_head, Colorpixel)
23 colorpixels;
20 SLIST_HEAD(colorpixel_head, Colorpixel) colorpixels;
2421
2522 /*
2623 * Returns the colorpixel to use for the given hex color (think of HTML).
66 */
77 #include "libi3.h"
88
9 #include <errno.h>
10 #include <stdlib.h>
11 #include <string.h>
912 #include <unistd.h>
10 #include <string.h>
11 #include <stdio.h>
12 #include <limits.h>
13 #include <stdlib.h>
14 #include <errno.h>
1513
1614 /*
1715 * This function returns the absolute path to the executable it is running in.
88
99 #include <stdint.h>
1010 #include <stdlib.h>
11
1112 #include <xcb/xcb.h>
1213 #include <xcb/xcb_keysyms.h>
1314
66 */
77 #include "libi3.h"
88
9 #include <assert.h>
10 #include <stdint.h>
9 #include <err.h>
10 #include <pwd.h>
1111 #include <stdlib.h>
12 #include <string.h>
13 #include <stdbool.h>
14 #include <err.h>
1512 #include <sys/stat.h>
16 #include <sys/types.h>
17 #include <pwd.h>
1813 #include <unistd.h>
19 #include <err.h>
2014
2115 /*
2216 * Returns the name of a temporary file with the specified prefix.
66 */
77 #include "libi3.h"
88
9 #include <sys/types.h>
9 #include <err.h>
10 #include <fcntl.h>
11 #include <stdlib.h>
12 #include <string.h>
1013 #include <sys/socket.h>
1114 #include <sys/un.h>
12 #include <string.h>
13 #include <err.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <fcntl.h>
1715
1816 /*
1917 * Connects to the i3 IPC socket and returns the file descriptor for the
66 */
77 #include "libi3.h"
88
9 #include <errno.h>
10 #include <i3/ipc.h>
11 #include <inttypes.h>
12 #include <stdint.h>
913 #include <string.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <stdint.h>
1314 #include <unistd.h>
14 #include <errno.h>
15 #include <inttypes.h>
16
17 #include <i3/ipc.h>
1815
1916 /*
2017 * Reads a message from the given socket file descriptor and stores its length
66 */
77 #include "libi3.h"
88
9 #include <string.h>
10 #include <stdlib.h>
11 #include <unistd.h>
9 #include <i3/ipc.h>
1210 #include <stdint.h>
13 #include <err.h>
14 #include <errno.h>
15
16 #include <i3/ipc.h>
1711
1812 /*
1913 * Formats a message (payload) of the given size and type and sends it to i3 via
77 #include "libi3.h"
88
99 #include <string.h>
10 #include <stdbool.h>
1110
1211 /*
1312 * Returns true if this version of i3 is a debug build (anything which is not a
1615 */
1716 bool is_debug_build(void) {
1817 /* i3_version contains either something like this:
19 * "4.0.2 (2011-11-11, branch "release")".
20 * or: "4.0.2-123-gCOFFEEBABE (2011-11-11, branch "next")".
18 * "4.0.2 (2011-11-11)" (release version)
19 * or: "4.0.2-123-gC0FFEE" (debug version)
2120 *
2221 * So we check for the offset of the first opening round bracket to
2322 * determine whether this is a git version or a release version. */
23 if (strchr(I3_VERSION, '(') == NULL) {
24 return true; // e.g. 4.0.2-123-gC0FFEE
25 }
26 /* In practice, debug versions do not contain parentheses at all,
27 * but leave the logic as it was before so that we can re-add
28 * parentheses if we chose to. */
2429 return ((strchr(I3_VERSION, '(') - I3_VERSION) > 10);
2530 }
1111 #include <string.h>
1212 #include <sys/stat.h>
1313
14 #ifndef HAVE_mkdirp
14 #ifndef HAVE_MKDIRP
1515 /*
1616 * Emulates mkdir -p (creates any missing folders)
1717 *
66 */
77 #include "libi3.h"
88
9 #include <stdio.h>
9 #include <math.h>
10 #include <stdlib.h>
1011 #include <string.h>
11 #include <stdbool.h>
12 #include <limits.h>
13 #include <stdlib.h>
14 #include <math.h>
1512
1613 #include <xcb/xcb.h>
1714 #include <xcb/xcb_aux.h>
66 */
77 #include "libi3.h"
88
9 #include <string.h>
10 #include <stdlib.h>
11 #include <stdarg.h>
12 #include <unistd.h>
13 #include <stdio.h>
149 #include <err.h>
1510 #include <errno.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <unistd.h>
1614
1715 /*
1816 * The s* functions (safe) are wrappers around malloc, strdup, …, which exits if one of
1010 */
1111 #include "libi3.h"
1212
13 #include <glib.h>
1314 #include <stdlib.h>
1415 #include <string.h>
15
16 #include <glib.h>
1716
1817 struct _i3String {
1918 char *utf8;
66 */
77 #include "libi3.h"
88
9 #include <sys/types.h>
109 #include <string.h>
1110
12 #ifndef HAVE_strndup
11 #ifndef HAVE_STRNDUP
1312 /*
1413 * Taken from FreeBSD
1514 * Returns a pointer to a new string which is a duplicate of the
77 #include "libi3.h"
88
99 #include <err.h>
10 #include <errno.h>
1110 #include <iconv.h>
1211 #include <stdlib.h>
1312 #include <string.h>
+0
-71
m4/ax_append_flag.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
7 #
8 # DESCRIPTION
9 #
10 # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
11 # added in between.
12 #
13 # If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
14 # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
15 # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
16 # FLAG.
17 #
18 # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
19 #
20 # LICENSE
21 #
22 # Copyright (c) 2008 Guido U. Draheim <[email protected]>
23 # Copyright (c) 2011 Maarten Bosmans <[email protected]>
24 #
25 # This program is free software: you can redistribute it and/or modify it
26 # under the terms of the GNU General Public License as published by the
27 # Free Software Foundation, either version 3 of the License, or (at your
28 # option) any later version.
29 #
30 # This program is distributed in the hope that it will be useful, but
31 # WITHOUT ANY WARRANTY; without even the implied warranty of
32 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
33 # Public License for more details.
34 #
35 # You should have received a copy of the GNU General Public License along
36 # with this program. If not, see <http://www.gnu.org/licenses/>.
37 #
38 # As a special exception, the respective Autoconf Macro's copyright owner
39 # gives unlimited permission to copy, distribute and modify the configure
40 # scripts that are the output of Autoconf when processing the Macro. You
41 # need not follow the terms of the GNU General Public License when using
42 # or distributing such scripts, even though portions of the text of the
43 # Macro appear in them. The GNU General Public License (GPL) does govern
44 # all other use of the material that constitutes the Autoconf Macro.
45 #
46 # This special exception to the GPL applies to versions of the Autoconf
47 # Macro released by the Autoconf Archive. When you make and distribute a
48 # modified version of the Autoconf Macro, you may extend this special
49 # exception to the GPL to apply to your modified version as well.
50
51 #serial 6
52
53 AC_DEFUN([AX_APPEND_FLAG],
54 [dnl
55 AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
56 AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
57 AS_VAR_SET_IF(FLAGS,[
58 AS_CASE([" AS_VAR_GET(FLAGS) "],
59 [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
60 [
61 AS_VAR_APPEND(FLAGS,[" $1"])
62 AC_RUN_LOG([: FLAGS="$FLAGS"])
63 ])
64 ],
65 [
66 AS_VAR_SET(FLAGS,[$1])
67 AC_RUN_LOG([: FLAGS="$FLAGS"])
68 ])
69 AS_VAR_POPDEF([FLAGS])dnl
70 ])dnl AX_APPEND_FLAG
+0
-122
m4/ax_cflags_warn_all.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
7 # AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
8 # AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
9 #
10 # DESCRIPTION
11 #
12 # Try to find a compiler option that enables most reasonable warnings.
13 #
14 # For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
15 # is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
16 #
17 # Currently this macro knows about the GCC, Solaris, Digital Unix, AIX,
18 # HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and
19 # Intel compilers. For a given compiler, the Fortran flags are much more
20 # experimental than their C equivalents.
21 #
22 # - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS
23 # - $2 add-value-if-not-found : nothing
24 # - $3 action-if-found : add value to shellvariable
25 # - $4 action-if-not-found : nothing
26 #
27 # NOTE: These macros depend on AX_APPEND_FLAG.
28 #
29 # LICENSE
30 #
31 # Copyright (c) 2008 Guido U. Draheim <[email protected]>
32 # Copyright (c) 2010 Rhys Ulerich <[email protected]>
33 #
34 # This program is free software; you can redistribute it and/or modify it
35 # under the terms of the GNU General Public License as published by the
36 # Free Software Foundation; either version 3 of the License, or (at your
37 # option) any later version.
38 #
39 # This program is distributed in the hope that it will be useful, but
40 # WITHOUT ANY WARRANTY; without even the implied warranty of
41 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
42 # Public License for more details.
43 #
44 # You should have received a copy of the GNU General Public License along
45 # with this program. If not, see <http://www.gnu.org/licenses/>.
46 #
47 # As a special exception, the respective Autoconf Macro's copyright owner
48 # gives unlimited permission to copy, distribute and modify the configure
49 # scripts that are the output of Autoconf when processing the Macro. You
50 # need not follow the terms of the GNU General Public License when using
51 # or distributing such scripts, even though portions of the text of the
52 # Macro appear in them. The GNU General Public License (GPL) does govern
53 # all other use of the material that constitutes the Autoconf Macro.
54 #
55 # This special exception to the GPL applies to versions of the Autoconf
56 # Macro released by the Autoconf Archive. When you make and distribute a
57 # modified version of the Autoconf Macro, you may extend this special
58 # exception to the GPL to apply to your modified version as well.
59
60 #serial 15
61
62 AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
63 AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
64 AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
65 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
66 VAR,[VAR="no, unknown"
67 ac_save_[]FLAGS="$[]FLAGS"
68 for ac_arg dnl
69 in "-warn all % -warn all" dnl Intel
70 "-pedantic % -Wall" dnl GCC
71 "-xstrconst % -v" dnl Solaris C
72 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
73 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
74 "-ansi -ansiE % -fullwarn" dnl IRIX
75 "+ESlit % +w1" dnl HP-UX C
76 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
77 "-h conform % -h msglevel 2" dnl Cray C (Unicos)
78 #
79 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
80 AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
81 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
82 done
83 FLAGS="$ac_save_[]FLAGS"
84 ])
85 AS_VAR_POPDEF([FLAGS])dnl
86 AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
87 case ".$VAR" in
88 .ok|.ok,*) m4_ifvaln($3,$3) ;;
89 .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
90 *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;;
91 esac
92 AS_VAR_POPDEF([VAR])dnl
93 ])dnl AX_FLAGS_WARN_ALL
94 dnl implementation tactics:
95 dnl the for-argument contains a list of options. The first part of
96 dnl these does only exist to detect the compiler - usually it is
97 dnl a global option to enable -ansi or -extrawarnings. All other
98 dnl compilers will fail about it. That was needed since a lot of
99 dnl compilers will give false positives for some option-syntax
100 dnl like -Woption or -Xoption as they think of it is a pass-through
101 dnl to later compile stages or something. The "%" is used as a
102 dnl delimiter. A non-option comment can be given after "%%" marks
103 dnl which will be shown but not added to the respective C/CXXFLAGS.
104
105 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
106 AC_LANG_PUSH([C])
107 AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
108 AC_LANG_POP([C])
109 ])
110
111 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
112 AC_LANG_PUSH([C++])
113 AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
114 AC_LANG_POP([C++])
115 ])
116
117 AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
118 AC_LANG_PUSH([Fortran])
119 AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
120 AC_LANG_POP([Fortran])
121 ])
+0
-74
m4/ax_check_compile_flag.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
7 #
8 # DESCRIPTION
9 #
10 # Check whether the given FLAG works with the current language's compiler
11 # or gives an error. (Warnings, however, are ignored)
12 #
13 # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
14 # success/failure.
15 #
16 # If EXTRA-FLAGS is defined, it is added to the current language's default
17 # flags (e.g. CFLAGS) when the check is done. The check is thus made with
18 # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
19 # force the compiler to issue an error when a bad flag is given.
20 #
21 # INPUT gives an alternative input source to AC_COMPILE_IFELSE.
22 #
23 # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
24 # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
25 #
26 # LICENSE
27 #
28 # Copyright (c) 2008 Guido U. Draheim <[email protected]>
29 # Copyright (c) 2011 Maarten Bosmans <[email protected]>
30 #
31 # This program is free software: you can redistribute it and/or modify it
32 # under the terms of the GNU General Public License as published by the
33 # Free Software Foundation, either version 3 of the License, or (at your
34 # option) any later version.
35 #
36 # This program is distributed in the hope that it will be useful, but
37 # WITHOUT ANY WARRANTY; without even the implied warranty of
38 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
39 # Public License for more details.
40 #
41 # You should have received a copy of the GNU General Public License along
42 # with this program. If not, see <http://www.gnu.org/licenses/>.
43 #
44 # As a special exception, the respective Autoconf Macro's copyright owner
45 # gives unlimited permission to copy, distribute and modify the configure
46 # scripts that are the output of Autoconf when processing the Macro. You
47 # need not follow the terms of the GNU General Public License when using
48 # or distributing such scripts, even though portions of the text of the
49 # Macro appear in them. The GNU General Public License (GPL) does govern
50 # all other use of the material that constitutes the Autoconf Macro.
51 #
52 # This special exception to the GPL applies to versions of the Autoconf
53 # Macro released by the Autoconf Archive. When you make and distribute a
54 # modified version of the Autoconf Macro, you may extend this special
55 # exception to the GPL to apply to your modified version as well.
56
57 #serial 4
58
59 AC_DEFUN([AX_CHECK_COMPILE_FLAG],
60 [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
61 AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
62 AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
63 ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
64 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
65 AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
66 [AS_VAR_SET(CACHEVAR,[yes])],
67 [AS_VAR_SET(CACHEVAR,[no])])
68 _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
69 AS_VAR_IF(CACHEVAR,yes,
70 [m4_default([$2], :)],
71 [m4_default([$3], :)])
72 AS_VAR_POPDEF([CACHEVAR])dnl
73 ])dnl AX_CHECK_COMPILE_FLAGS
+0
-124
m4/ax_check_enable_debug.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE])
7 #
8 # DESCRIPTION
9 #
10 # Check for the presence of an --enable-debug option to configure, with
11 # the specified default value used when the option is not present. Return
12 # the value in the variable $ax_enable_debug.
13 #
14 # Specifying 'yes' adds '-g -O0' to the compilation flags for all
15 # languages. Specifying 'info' adds '-g' to the compilation flags.
16 # Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to
17 # the linking flags. Otherwise, nothing is added.
18 #
19 # Define the variables listed in the second argument if debug is enabled,
20 # defaulting to no variables. Defines the variables listed in the third
21 # argument if debug is disabled, defaulting to NDEBUG. All lists of
22 # variables should be space-separated.
23 #
24 # If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
25 # Should be invoked prior to any AC_PROG_* compiler checks.
26 #
27 # IS-RELEASE can be used to change the default to 'no' when making a
28 # release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it
29 # uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE
30 # macro, there is no need to pass this parameter.
31 #
32 # AX_IS_RELEASE([git-directory])
33 # AX_CHECK_ENABLE_DEBUG()
34 #
35 # LICENSE
36 #
37 # Copyright (c) 2011 Rhys Ulerich <[email protected]>
38 # Copyright (c) 2014, 2015 Philip Withnall <[email protected]>
39 #
40 # Copying and distribution of this file, with or without modification, are
41 # permitted in any medium without royalty provided the copyright notice
42 # and this notice are preserved.
43
44 #serial 5
45
46 AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
47 AC_BEFORE([$0],[AC_PROG_CC])dnl
48 AC_BEFORE([$0],[AC_PROG_CXX])dnl
49 AC_BEFORE([$0],[AC_PROG_F77])dnl
50 AC_BEFORE([$0],[AC_PROG_FC])dnl
51
52 AC_MSG_CHECKING(whether to enable debugging)
53
54 ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))
55 ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],,
56 [$ax_is_release],
57 [$4])))
58
59 # If this is a release, override the default.
60 AS_IF([test "$ax_enable_debug_is_release" = "yes"],
61 [ax_enable_debug_default="no"])
62
63 m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
64 m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
65
66 AC_ARG_ENABLE(debug,
67 [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])],
68 [],enable_debug=$ax_enable_debug_default)
69
70 # empty mean debug yes
71 AS_IF([test "x$enable_debug" = "x"],
72 [enable_debug="yes"])
73
74 # case of debug
75 AS_CASE([$enable_debug],
76 [yes],[
77 AC_MSG_RESULT(yes)
78 CFLAGS="${CFLAGS} -g -O0"
79 CXXFLAGS="${CXXFLAGS} -g -O0"
80 FFLAGS="${FFLAGS} -g -O0"
81 FCFLAGS="${FCFLAGS} -g -O0"
82 OBJCFLAGS="${OBJCFLAGS} -g -O0"
83 ],
84 [info],[
85 AC_MSG_RESULT(info)
86 CFLAGS="${CFLAGS} -g"
87 CXXFLAGS="${CXXFLAGS} -g"
88 FFLAGS="${FFLAGS} -g"
89 FCFLAGS="${FCFLAGS} -g"
90 OBJCFLAGS="${OBJCFLAGS} -g"
91 ],
92 [profile],[
93 AC_MSG_RESULT(profile)
94 CFLAGS="${CFLAGS} -g -pg"
95 CXXFLAGS="${CXXFLAGS} -g -pg"
96 FFLAGS="${FFLAGS} -g -pg"
97 FCFLAGS="${FCFLAGS} -g -pg"
98 OBJCFLAGS="${OBJCFLAGS} -g -pg"
99 LDFLAGS="${LDFLAGS} -pg"
100 ],
101 [
102 AC_MSG_RESULT(no)
103 dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
104 dnl by setting any unset environment flag variables
105 AS_IF([test "x${CFLAGS+set}" != "xset"],
106 [CFLAGS=""])
107 AS_IF([test "x${CXXFLAGS+set}" != "xset"],
108 [CXXFLAGS=""])
109 AS_IF([test "x${FFLAGS+set}" != "xset"],
110 [FFLAGS=""])
111 AS_IF([test "x${FCFLAGS+set}" != "xset"],
112 [FCFLAGS=""])
113 AS_IF([test "x${OBJCFLAGS+set}" != "xset"],
114 [OBJCFLAGS=""])
115 ])
116
117 dnl Define various variables if debugging is disabled.
118 dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
119 AS_IF([test "x$enable_debug" = "xyes"],
120 [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])],
121 [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])])
122 ax_enable_debug=$enable_debug
123 ])
+0
-84
m4/ax_check_gnu_make.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_CHECK_GNU_MAKE()
7 #
8 # DESCRIPTION
9 #
10 # This macro searches for a GNU version of make. If a match is found:
11 #
12 # * The makefile variable `ifGNUmake' is set to the empty string, otherwise
13 # it is set to "#". This is useful for including a special features in a
14 # Makefile, which cannot be handled by other versions of make.
15 # * The variable `_cv_gnu_make_command` is set to the command to invoke
16 # GNU make if it exists, the empty string otherwise.
17 # * The variable `ax_cv_gnu_make_command` is set to the command to invoke
18 # GNU make by copying `_cv_gnu_make_command`, otherwise it is unset.
19 # * If GNU Make is found, its version is extracted from the output of
20 # `make --version` as the last field of a record of space-separated
21 # columns and saved into the variable `ax_check_gnu_make_version`.
22 #
23 # Here is an example of its use:
24 #
25 # Makefile.in might contain:
26 #
27 # # A failsafe way of putting a dependency rule into a makefile
28 # $(DEPEND):
29 # $(CC) -MM $(srcdir)/*.c > $(DEPEND)
30 #
31 # @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
32 # @ifGNUmake@ include $(DEPEND)
33 # @ifGNUmake@ endif
34 #
35 # Then configure.in would normally contain:
36 #
37 # AX_CHECK_GNU_MAKE()
38 # AC_OUTPUT(Makefile)
39 #
40 # Then perhaps to cause gnu make to override any other make, we could do
41 # something like this (note that GNU make always looks for GNUmakefile
42 # first):
43 #
44 # if ! test x$_cv_gnu_make_command = x ; then
45 # mv Makefile GNUmakefile
46 # echo .DEFAULT: > Makefile ;
47 # echo \ $_cv_gnu_make_command \$@ >> Makefile;
48 # fi
49 #
50 # Then, if any (well almost any) other make is called, and GNU make also
51 # exists, then the other make wraps the GNU make.
52 #
53 # LICENSE
54 #
55 # Copyright (c) 2008 John Darrington <[email protected]>
56 # Copyright (c) 2015 Enrico M. Crisostomo <[email protected]>
57 #
58 # Copying and distribution of this file, with or without modification, are
59 # permitted in any medium without royalty provided the copyright notice
60 # and this notice are preserved. This file is offered as-is, without any
61 # warranty.
62
63 #serial 8
64
65 AC_DEFUN([AX_CHECK_GNU_MAKE],dnl
66 [AC_PROG_AWK
67 AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl
68 _cv_gnu_make_command="" ;
69 dnl Search all the common names for GNU make
70 for a in "$MAKE" make gmake gnumake ; do
71 if test -z "$a" ; then continue ; fi ;
72 if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then
73 _cv_gnu_make_command=$a ;
74 AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make")
75 ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }')
76 break ;
77 fi
78 done ;])
79 dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
80 AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])])
81 AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])])
82 AC_SUBST([ifGNUmake])
83 ])
+0
-74
m4/ax_check_link_flag.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
7 #
8 # DESCRIPTION
9 #
10 # Check whether the given FLAG works with the linker or gives an error.
11 # (Warnings, however, are ignored)
12 #
13 # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
14 # success/failure.
15 #
16 # If EXTRA-FLAGS is defined, it is added to the linker's default flags
17 # when the check is done. The check is thus made with the flags: "LDFLAGS
18 # EXTRA-FLAGS FLAG". This can for example be used to force the linker to
19 # issue an error when a bad flag is given.
20 #
21 # INPUT gives an alternative input source to AC_LINK_IFELSE.
22 #
23 # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
24 # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
25 #
26 # LICENSE
27 #
28 # Copyright (c) 2008 Guido U. Draheim <[email protected]>
29 # Copyright (c) 2011 Maarten Bosmans <[email protected]>
30 #
31 # This program is free software: you can redistribute it and/or modify it
32 # under the terms of the GNU General Public License as published by the
33 # Free Software Foundation, either version 3 of the License, or (at your
34 # option) any later version.
35 #
36 # This program is distributed in the hope that it will be useful, but
37 # WITHOUT ANY WARRANTY; without even the implied warranty of
38 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
39 # Public License for more details.
40 #
41 # You should have received a copy of the GNU General Public License along
42 # with this program. If not, see <http://www.gnu.org/licenses/>.
43 #
44 # As a special exception, the respective Autoconf Macro's copyright owner
45 # gives unlimited permission to copy, distribute and modify the configure
46 # scripts that are the output of Autoconf when processing the Macro. You
47 # need not follow the terms of the GNU General Public License when using
48 # or distributing such scripts, even though portions of the text of the
49 # Macro appear in them. The GNU General Public License (GPL) does govern
50 # all other use of the material that constitutes the Autoconf Macro.
51 #
52 # This special exception to the GPL applies to versions of the Autoconf
53 # Macro released by the Autoconf Archive. When you make and distribute a
54 # modified version of the Autoconf Macro, you may extend this special
55 # exception to the GPL to apply to your modified version as well.
56
57 #serial 4
58
59 AC_DEFUN([AX_CHECK_LINK_FLAG],
60 [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
61 AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
62 AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
63 ax_check_save_flags=$LDFLAGS
64 LDFLAGS="$LDFLAGS $4 $1"
65 AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
66 [AS_VAR_SET(CACHEVAR,[yes])],
67 [AS_VAR_SET(CACHEVAR,[no])])
68 LDFLAGS=$ax_check_save_flags])
69 AS_VAR_IF(CACHEVAR,yes,
70 [m4_default([$2], :)],
71 [m4_default([$3], :)])
72 AS_VAR_POPDEF([CACHEVAR])dnl
73 ])dnl AX_CHECK_LINK_FLAGS
+0
-273
m4/ax_code_coverage.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_CODE_COVERAGE()
7 #
8 # DESCRIPTION
9 #
10 # Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
11 # CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LDFLAGS which should be
12 # included in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LDFLAGS variables of
13 # every build target (program or library) which should be built with code
14 # coverage support. Also defines CODE_COVERAGE_RULES which should be
15 # substituted in your Makefile; and $enable_code_coverage which can be
16 # used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
17 # and substituted, and corresponds to the value of the
18 # --enable-code-coverage option, which defaults to being disabled.
19 #
20 # Test also for gcov program and create GCOV variable that could be
21 # substituted.
22 #
23 # Note that all optimisation flags in CFLAGS must be disabled when code
24 # coverage is enabled.
25 #
26 # Usage example:
27 #
28 # configure.ac:
29 #
30 # AX_CODE_COVERAGE
31 #
32 # Makefile.am:
33 #
34 # @CODE_COVERAGE_RULES@
35 # my_program_LIBS = ... $(CODE_COVERAGE_LDFLAGS) ...
36 # my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
37 # my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
38 # my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
39 #
40 # This results in a "check-code-coverage" rule being added to any
41 # Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
42 # has been configured with --enable-code-coverage). Running `make
43 # check-code-coverage` in that directory will run the module's test suite
44 # (`make check`) and build a code coverage report detailing the code which
45 # was touched, then print the URI for the report.
46 #
47 # This code was derived from Makefile.decl in GLib, originally licenced
48 # under LGPLv2.1+.
49 #
50 # LICENSE
51 #
52 # Copyright (c) 2012, 2016 Philip Withnall
53 # Copyright (c) 2012 Xan Lopez
54 # Copyright (c) 2012 Christian Persch
55 # Copyright (c) 2012 Paolo Borelli
56 # Copyright (c) 2012 Dan Winship
57 # Copyright (c) 2015 Bastien ROUCARIES
58 #
59 # This library is free software; you can redistribute it and/or modify it
60 # under the terms of the GNU Lesser General Public License as published by
61 # the Free Software Foundation; either version 2.1 of the License, or (at
62 # your option) any later version.
63 #
64 # This library is distributed in the hope that it will be useful, but
65 # WITHOUT ANY WARRANTY; without even the implied warranty of
66 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
67 # General Public License for more details.
68 #
69 # You should have received a copy of the GNU Lesser General Public License
70 # along with this program. If not, see <http://www.gnu.org/licenses/>.
71
72 #serial 15
73
74 AC_DEFUN([AX_CODE_COVERAGE],[
75 dnl Check for --enable-code-coverage
76 AC_REQUIRE([AC_PROG_SED])
77
78 # allow to override gcov location
79 AC_ARG_WITH([gcov],
80 [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
81 [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
82 [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
83
84 AC_MSG_CHECKING([whether to build with code coverage support])
85 AC_ARG_ENABLE([code-coverage],
86 AS_HELP_STRING([--enable-code-coverage],
87 [Whether to enable code coverage support]),,
88 enable_code_coverage=no)
89
90 AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
91 AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
92 AC_MSG_RESULT($enable_code_coverage)
93
94 AS_IF([ test "$enable_code_coverage" = "yes" ], [
95 # check for gcov
96 AC_CHECK_TOOL([GCOV],
97 [$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
98 [:])
99 AS_IF([test "X$GCOV" = "X:"],
100 [AC_MSG_ERROR([gcov is needed to do coverage])])
101 AC_SUBST([GCOV])
102
103 dnl Check if gcc is being used
104 AS_IF([ test "$GCC" = "no" ], [
105 AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
106 ])
107
108 # List of supported lcov versions.
109 lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13"
110
111 AC_CHECK_PROG([LCOV], [lcov], [lcov])
112 AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
113
114 AS_IF([ test "$LCOV" ], [
115 AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [
116 ax_cv_lcov_version=invalid
117 lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
118 for lcov_check_version in $lcov_version_list; do
119 if test "$lcov_version" = "$lcov_check_version"; then
120 ax_cv_lcov_version="$lcov_check_version (ok)"
121 fi
122 done
123 ])
124 ], [
125 lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
126 AC_MSG_ERROR([$lcov_msg])
127 ])
128
129 case $ax_cv_lcov_version in
130 ""|invalid[)]
131 lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
132 AC_MSG_ERROR([$lcov_msg])
133 LCOV="exit 0;"
134 ;;
135 esac
136
137 AS_IF([ test -z "$GENHTML" ], [
138 AC_MSG_ERROR([Could not find genhtml from the lcov package])
139 ])
140
141 dnl Build the code coverage flags
142 CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
143 CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
144 CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
145 CODE_COVERAGE_LDFLAGS="-lgcov"
146
147 AC_SUBST([CODE_COVERAGE_CPPFLAGS])
148 AC_SUBST([CODE_COVERAGE_CFLAGS])
149 AC_SUBST([CODE_COVERAGE_CXXFLAGS])
150 AC_SUBST([CODE_COVERAGE_LDFLAGS])
151 ])
152
153 [CODE_COVERAGE_RULES='
154 # Code coverage
155 #
156 # Optional:
157 # - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
158 # Multiple directories may be specified, separated by whitespace.
159 # (Default: $(top_builddir))
160 # - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
161 # by lcov for code coverage. (Default:
162 # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
163 # - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
164 # reports to be created. (Default:
165 # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
166 # - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
167 # set to 0 to disable it and leave empty to stay with the default.
168 # (Default: empty)
169 # - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
170 # instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
171 # - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
172 # instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
173 # - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
174 # - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
175 # collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
176 # - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
177 # instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
178 # - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
179 # lcov instance. (Default: empty)
180 # - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
181 # instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
182 # - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
183 # genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
184 # - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
185 # instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
186 # - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
187 #
188 # The generated report will be titled using the $(PACKAGE_NAME) and
189 # $(PACKAGE_VERSION). In order to add the current git hash to the title,
190 # use the git-version-gen script, available online.
191
192 # Optional variables
193 CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
194 CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
195 CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
196 CODE_COVERAGE_BRANCH_COVERAGE ?=
197 CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
198 --rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
199 CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
200 CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
201 CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
202 CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
203 CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
204 CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
205 CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
206 $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
207 --rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
208 CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS)
209 CODE_COVERAGE_IGNORE_PATTERN ?=
210
211 code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
212 code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
213 code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\
214 $(CODE_COVERAGE_OUTPUT_FILE);
215 code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
216 code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
217 code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\
218 $(CODE_COVERAGE_IGNORE_PATTERN);
219 code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
220 code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
221 code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
222 code_coverage_quiet = $(code_coverage_quiet_$(V))
223 code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
224 code_coverage_quiet_0 = --quiet
225
226 # sanitizes the test-name: replaces with underscores: dashes and dots
227 code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
228
229 # Use recursive makes in order to ignore errors during check
230 check-code-coverage:
231 ifeq ($(CODE_COVERAGE_ENABLED),yes)
232 -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
233 $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
234 else
235 @echo "Need to reconfigure with --enable-code-coverage"
236 endif
237
238 # Capture code coverage data
239 code-coverage-capture: code-coverage-capture-hook
240 ifeq ($(CODE_COVERAGE_ENABLED),yes)
241 $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
242 $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
243 -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
244 $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
245 @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
246 else
247 @echo "Need to reconfigure with --enable-code-coverage"
248 endif
249
250 # Hook rule executed before code-coverage-capture, overridable by the user
251 code-coverage-capture-hook:
252
253 ifeq ($(CODE_COVERAGE_ENABLED),yes)
254 clean: code-coverage-clean
255 code-coverage-clean:
256 -$(LCOV) --directory $(top_builddir) -z
257 -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
258 -find . -name "*.gcda" -o -name "*.gcov" -delete
259 endif
260
261 GITIGNOREFILES ?=
262 GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
263
264 A''M_DISTCHECK_CONFIGURE_FLAGS ?=
265 A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
266
267 .PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
268 ']
269
270 AC_SUBST([CODE_COVERAGE_RULES])
271 m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
272 ])
+0
-70
m4/ax_configure_args.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_configure_args.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_CONFIGURE_ARGS
7 #
8 # DESCRIPTION
9 #
10 # Helper macro for AX_ENABLE_BUILDDIR.
11 #
12 # The traditional way of starting a subdir-configure is running the script
13 # with ${1+"$@"} but since autoconf 2.60 this is broken. Instead we have
14 # to rely on eval'ing $ac_configure_args however some old autoconf
15 # versions do not provide that. To ensure maximum portability of autoconf
16 # extension macros this helper can be AC_REQUIRE'd so that
17 # $ac_configure_args will alsways be present.
18 #
19 # Sadly, the traditional "exec $SHELL" of the enable_builddir macros is
20 # spoiled now and must be replaced by "eval + exit $?".
21 #
22 # Example:
23 #
24 # AC_DEFUN([AX_ENABLE_SUBDIR],[dnl
25 # AC_REQUIRE([AX_CONFIGURE_ARGS])dnl
26 # eval $SHELL $ac_configure_args || exit $?
27 # ...])
28 #
29 # LICENSE
30 #
31 # Copyright (c) 2008 Guido U. Draheim <[email protected]>
32 #
33 # This program is free software; you can redistribute it and/or modify it
34 # under the terms of the GNU General Public License as published by the
35 # Free Software Foundation; either version 3 of the License, or (at your
36 # option) any later version.
37 #
38 # This program is distributed in the hope that it will be useful, but
39 # WITHOUT ANY WARRANTY; without even the implied warranty of
40 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
41 # Public License for more details.
42 #
43 # You should have received a copy of the GNU General Public License along
44 # with this program. If not, see <http://www.gnu.org/licenses/>.
45 #
46 # As a special exception, the respective Autoconf Macro's copyright owner
47 # gives unlimited permission to copy, distribute and modify the configure
48 # scripts that are the output of Autoconf when processing the Macro. You
49 # need not follow the terms of the GNU General Public License when using
50 # or distributing such scripts, even though portions of the text of the
51 # Macro appear in them. The GNU General Public License (GPL) does govern
52 # all other use of the material that constitutes the Autoconf Macro.
53 #
54 # This special exception to the GPL applies to versions of the Autoconf
55 # Macro released by the Autoconf Archive. When you make and distribute a
56 # modified version of the Autoconf Macro, you may extend this special
57 # exception to the GPL to apply to your modified version as well.
58
59 #serial 9
60
61 AC_DEFUN([AX_CONFIGURE_ARGS],[
62 # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args
63 if test "${ac_configure_args+set}" != "set" ; then
64 ac_configure_args=
65 for ac_arg in ${1+"[$]@"}; do
66 ac_configure_args="$ac_configure_args '$ac_arg'"
67 done
68 fi
69 ])
+0
-302
m4/ax_enable_builddir.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])]
7 #
8 # DESCRIPTION
9 #
10 # If the current configure was run within the srcdir then we move all
11 # configure-files into a subdir and let the configure steps continue
12 # there. We provide an option --disable-builddir to suppress the move into
13 # a separate builddir.
14 #
15 # Defaults:
16 #
17 # $1 = $host (overridden with $HOST)
18 # $2 = Makefile.mk
19 # $3 = -all
20 #
21 # This macro must be called before AM_INIT_AUTOMAKE. It creates a default
22 # toplevel srcdir Makefile from the information found in the created
23 # toplevel builddir Makefile. It just copies the variables and
24 # rule-targets, each extended with a default rule-execution that recurses
25 # into the build directory of the current "HOST". You can override the
26 # auto-dection through `config.guess` and build-time of course, as in
27 #
28 # make HOST=i386-mingw-cross
29 #
30 # which can of course set at configure time as well using
31 #
32 # configure --host=i386-mingw-cross
33 #
34 # After the default has been created, additional rules can be appended
35 # that will not just recurse into the subdirectories and only ever exist
36 # in the srcdir toplevel makefile - these parts are read from the $2 =
37 # Makefile.mk file
38 #
39 # The automatic rules are usually scanning the toplevel Makefile for lines
40 # like '#### $host |$builddir' to recognize the place where to recurse
41 # into. Usually, the last one is the only one used. However, almost all
42 # targets have an additional "*-all" rule which makes the script to
43 # recurse into _all_ variants of the current HOST (!!) setting. The "-all"
44 # suffix can be overriden for the macro as well.
45 #
46 # a special rule is only given for things like "dist" that will copy the
47 # tarball from the builddir to the sourcedir (or $(PUB)) for reason of
48 # convenience.
49 #
50 # LICENSE
51 #
52 # Copyright (c) 2009 Guido U. Draheim <[email protected]>
53 # Copyright (c) 2009 Alan Jenkins <[email protected]>
54 #
55 # This program is free software; you can redistribute it and/or modify it
56 # under the terms of the GNU General Public License as published by the
57 # Free Software Foundation; either version 3 of the License, or (at your
58 # option) any later version.
59 #
60 # This program is distributed in the hope that it will be useful, but
61 # WITHOUT ANY WARRANTY; without even the implied warranty of
62 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
63 # Public License for more details.
64 #
65 # You should have received a copy of the GNU General Public License along
66 # with this program. If not, see <http://www.gnu.org/licenses/>.
67 #
68 # As a special exception, the respective Autoconf Macro's copyright owner
69 # gives unlimited permission to copy, distribute and modify the configure
70 # scripts that are the output of Autoconf when processing the Macro. You
71 # need not follow the terms of the GNU General Public License when using
72 # or distributing such scripts, even though portions of the text of the
73 # Macro appear in them. The GNU General Public License (GPL) does govern
74 # all other use of the material that constitutes the Autoconf Macro.
75 #
76 # This special exception to the GPL applies to versions of the Autoconf
77 # Macro released by the Autoconf Archive. When you make and distribute a
78 # modified version of the Autoconf Macro, you may extend this special
79 # exception to the GPL to apply to your modified version as well.
80
81 #serial 25
82
83 AC_DEFUN([AX_ENABLE_BUILDDIR],[
84 AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
85 AC_REQUIRE([AC_CANONICAL_TARGET])[]dnl
86 AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl
87 AC_REQUIRE([AM_AUX_DIR_EXPAND])[]dnl
88 AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
89 AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
90 AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
91 AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
92 SUB="."
93 AC_ARG_ENABLE([builddir], AS_HELP_STRING(
94 [--disable-builddir],[disable automatic build in subdir of sources])
95 ,[SUB="$enableval"], [SUB="auto"])
96 if test ".$ac_srcdir_defaulted" != ".no" ; then
97 if test ".$srcdir" = ".." ; then
98 if test -f config.status ; then
99 AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build)
100 else
101 test ".$SUB" = "." && SUB="."
102 test ".$SUB" = ".no" && SUB="."
103 test ".$TARGET" = "." && TARGET="$target"
104 test ".$SUB" = ".auto" && SUB="m4_ifval([$1], [$1],[$TARGET])"
105 if test ".$SUB" != ".." ; then # we know where to go and
106 AS_MKDIR_P([$SUB])
107 echo __.$SUB.__ > $SUB/conftest.tmp
108 cd $SUB
109 if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then
110 rm conftest.tmp
111 AC_MSG_RESULT([continue configure in default builddir "./$SUB"])
112 else
113 AC_MSG_ERROR([could not change to default builddir "./$SUB"])
114 fi
115 srcdir=`echo "$SUB" |
116 sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'`
117 # going to restart from subdirectory location
118 test -f $srcdir/config.log && mv $srcdir/config.log .
119 test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h .
120 test -f $srcdir/conftest.log && mv $srcdir/conftest.log .
121 test -f $srcdir/$cache_file && mv $srcdir/$cache_file .
122 AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"})
123 case "[$]0" in # restart
124 [[\\/]]* | ?:[[\\/]]*) # Asbolute name
125 eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;;
126 *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;;
127 esac ; exit $?
128 fi
129 fi
130 fi fi
131 test ".$SUB" = ".auto" && SUB="."
132 dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec"
133 AC_PATH_PROG(SED,gsed sed, sed)
134 AUX="$am_aux_dir"
135 AS_VAR_POPDEF([SED])dnl
136 AS_VAR_POPDEF([AUX])dnl
137 AS_VAR_POPDEF([SUB])dnl
138 AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status ..............
139 AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
140 AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl
141 AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl
142 AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
143 AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
144 pushdef([END],[Makefile.mk])dnl
145 pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl
146 SRC="$ax_enable_builddir_srcdir"
147 if test ".$SUB" = ".." ; then
148 if test -f "$TOP/Makefile" ; then
149 AC_MSG_NOTICE([skipping TOP/Makefile - left untouched])
150 else
151 AC_MSG_NOTICE([skipping TOP/Makefile - not created])
152 fi
153 else
154 if test -f "$SRC/Makefile" ; then
155 a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile`
156 test "$a" != "$b" && rm "$SRC/Makefile"
157 fi
158 if test -f "$SRC/Makefile" ; then
159 echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk
160 echo " []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk
161 eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null"
162 if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null
163 then rm $SRC/Makefile ; fi
164 cp $tmp/conftemp.mk $SRC/makefiles.mk~ ## DEBUGGING
165 fi
166 if test ! -f "$SRC/Makefile" ; then
167 AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile])
168 x='`' ; cat >$tmp/conftemp.sed <<_EOF
169 /^\$/n
170 x
171 /^\$/bS
172 x
173 /\\\\\$/{H;d;}
174 {H;s/.*//;x;}
175 bM
176 :S
177 x
178 /\\\\\$/{h;d;}
179 {h;s/.*//;x;}
180 :M
181 s/\\(\\n\\) /\\1 /g
182 /^ /d
183 /^[[ ]]*[[\\#]]/d
184 /^VPATH *=/d
185 s/^srcdir *=.*/srcdir = ./
186 s/^top_srcdir *=.*/top_srcdir = ./
187 /[[:=]]/!d
188 /^\\./d
189 dnl Now handle rules (i.e. lines containing ":" but not " = ").
190 / = /b
191 / .= /b
192 /:/!b
193 s/:.*/:/
194 s/ / /g
195 s/ \\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/ \\1 \\1[]_ALL\\2/g
196 s/^\\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/
197 s/ / /g
198 /^all all[]_ALL[[ :]]/i\\
199 all-configured : all[]_ALL
200 dnl dist-all exists... and would make for dist-all-all
201 s/ [[a-zA-Z0-9-]]*[]_ALL [[a-zA-Z0-9-]]*[]_ALL[]_ALL//g
202 /[]_ALL[]_ALL/d
203 a\\
204 @ HOST="\$(HOST)\" \\\\\\
205 ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
206 ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
207 ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
208 ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" -eq "0" ; then : \\\\\\
209 ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\
210 ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
211 ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\
212 ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
213 ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done
214 dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree)
215 /dist[]_ALL *:/a\\
216 @ HOST="\$(HOST)\" \\\\\\
217 ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
218 ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
219 ; found=$x echo \$\$BUILD | wc -w $x \\\\\\
220 ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\
221 ; if test "\$\$found" -eq "0" ; then : \\\\\\
222 ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\
223 ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
224 ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\
225 ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done
226 dnl special rule add-on: "dist-foo" copies all the archives to $(PUB). (source tree)
227 /dist-[[a-zA-Z0-9]]*[]_ALL *:/a\\
228 @ HOST="\$(HOST)\" \\\\\\
229 ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\
230 ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
231 ; found=$x echo \$\$BUILD | wc -w $x \\\\\\
232 ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\
233 ; if test "\$\$found" -eq "0" ; then : \\\\\\
234 ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\
235 ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
236 ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\
237 ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done
238 dnl special rule add-on: "distclean" removes all local builddirs completely
239 /distclean[]_ALL *:/a\\
240 @ HOST="\$(HOST)\" \\\\\\
241 ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
242 ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\
243 ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
244 ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\
245 ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
246 ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
247 ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\
248 ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
249 ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\
250 ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\
251 ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile
252 _EOF
253 cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING
254 $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile
255 if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then
256 AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])])
257 cat $SRC/END >>$SRC/Makefile
258 fi ; xxxx="####"
259 echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile
260 # sanity check
261 if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then
262 AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts])
263 $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $SRC/Makefile \
264 >$SRC/Makefile~
265 (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null
266 fi
267 else
268 xxxx="\\#\\#\\#\\#"
269 # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed
270 echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed
271 $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp
272 cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~" ## DEBUGGING
273 cp "$tmp/mkfile.tmp" "$SRC/makefiles.out~" ## DEBUGGING
274 if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then
275 AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure])
276 rm "$tmp/mkfile.tmp"
277 else
278 AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure])
279 mv "$tmp/mkfile.tmp" "$SRC/Makefile"
280 fi
281 fi
282 AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)])
283 xxxx="####"
284 echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile
285 fi
286 popdef([END])dnl
287 AS_VAR_POPDEF([SED])dnl
288 AS_VAR_POPDEF([AUX])dnl
289 AS_VAR_POPDEF([SRC])dnl
290 AS_VAR_POPDEF([TOP])dnl
291 AS_VAR_POPDEF([SUB])dnl
292 ],[dnl
293 ax_enable_builddir_srcdir="$srcdir" # $srcdir
294 ax_enable_builddir_host="$HOST" # $HOST / $host
295 ax_enable_builddir_version="$VERSION" # $VERSION
296 ax_enable_builddir_package="$PACKAGE" # $PACKAGE
297 ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX
298 ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED
299 ax_enable_builddir="$ax_enable_builddir" # $SUB
300 ])dnl
301 ])
+0
-86
m4/ax_extend_srcdir.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_extend_srcdir.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_EXTEND_SRCDIR
7 #
8 # DESCRIPTION
9 #
10 # The AX_EXTEND_SRCDIR macro extends $srcdir by one path component.
11 #
12 # As an example, when working in /home/michael/i3-4.12/build and calling
13 # ../configure, your $srcdir is "..". After calling AX_EXTEND_SRCDIR,
14 # $srcdir will be set to "../../i3-4.12".
15 #
16 # The result of extending $srcdir is that filenames (e.g. in the output of
17 # the "backtrace" gdb command) will include one more path component of the
18 # absolute source path. The additional path component makes it easy for
19 # users to recognize which files belong to the PACKAGE, and -- provided a
20 # dist tarball was unpacked -- which version of PACKAGE was used.
21 #
22 # As an example, in "backtrace", you will see:
23 #
24 # #0 main (argc=1, argv=0x7fffffff1fc8) at ../../i3-4.12/src/main.c:187
25 #
26 # instead of:
27 #
28 # #0 main (argc=1, argv=0x7fffffff1fc8) at ../src/main.c:187
29 #
30 # In case your code uses the __FILE__ preprocessor directive to refer to
31 # the filename of the current source file (e.g. in debug messages), using
32 # the extended path might be undesirable. For this purpose,
33 # AX_EXTEND_SRCDIR defines the output variable AX_EXTEND_SRCDIR_CPPFLAGS,
34 # which can be added to AM_CPPFLAGS in Makefile.am in order to define the
35 # preprocessor directive STRIPPED__FILE__. As an example, when compiling
36 # the file "../../i3-4.12/src/main.c", STRIPPED__FILE__ evaluates to
37 # "main.c".
38 #
39 # There are some caveats: When $srcdir is "." (i.e. when ./configure was
40 # called instead of ../configure in a separate build directory),
41 # AX_EXTEND_SRCDIR will still extend $srcdir, but the intended effect will
42 # not be achieved because of the way automake specifies file paths:
43 # automake defines COMPILE to use "`test -f '$source' || echo
44 # '\$(srcdir)/'`$source" in order to prefer files in the current directory
45 # over specifying $srcdir explicitly.
46 #
47 # The AX_EXTEND_SRCDIR author is not aware of any way to influence this
48 # automake behavior. Patches very welcome.
49 #
50 # To work around this issue, you can use AX_ENABLE_BUILDDIR i.e. by adding
51 # the following code to configure.ac:
52 #
53 # AX_ENABLE_BUILDDIR
54 # dnl ...
55 # AX_EXTEND_SRCDIR
56 #
57 # Then also add this bit to Makefile.am (if you wish to use
58 # STRIPPED__FILE__ in your code):
59 #
60 # AM_CPPFLAGS = @AX_EXTEND_SRCDIR_CPPFLAGS@
61 #
62 # LICENSE
63 #
64 # Copyright (c) 2016 Michael Stapelberg <[email protected]>
65 #
66 # Copying and distribution of this file, with or without modification, are
67 # permitted in any medium without royalty provided the copyright notice
68 # and this notice are preserved. This file is offered as-is, without any
69 # warranty.
70
71 #serial 3
72
73 AC_DEFUN([AX_EXTEND_SRCDIR],
74 [dnl
75 AS_CASE([$srcdir],
76 [.|.*|/*],
77 [
78 # pwd -P is specified in IEEE 1003.1 from 2004
79 as_dir=`cd "$srcdir" && pwd -P`
80 as_base=`AS_BASENAME([$as_dir])`
81 srcdir=${srcdir}/../${as_base}
82
83 AC_SUBST([AX_EXTEND_SRCDIR_CPPFLAGS], ["-DSTRIPPED__FILE__=AS_ESCAPE([\"$$(basename $<)\"])"])
84 ])
85 ])dnl AX_EXTEND_SRCDIR
+0
-485
m4/ax_pthread.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_pthread.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
7 #
8 # DESCRIPTION
9 #
10 # This macro figures out how to build C programs using POSIX threads. It
11 # sets the PTHREAD_LIBS output variable to the threads library and linker
12 # flags, and the PTHREAD_CFLAGS output variable to any special C compiler
13 # flags that are needed. (The user can also force certain compiler
14 # flags/libs to be tested by setting these environment variables.)
15 #
16 # Also sets PTHREAD_CC to any special C compiler that is needed for
17 # multi-threaded programs (defaults to the value of CC otherwise). (This
18 # is necessary on AIX to use the special cc_r compiler alias.)
19 #
20 # NOTE: You are assumed to not only compile your program with these flags,
21 # but also to link with them as well. For example, you might link with
22 # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
23 #
24 # If you are only building threaded programs, you may wish to use these
25 # variables in your default LIBS, CFLAGS, and CC:
26 #
27 # LIBS="$PTHREAD_LIBS $LIBS"
28 # CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
29 # CC="$PTHREAD_CC"
30 #
31 # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
32 # has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
33 # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
34 #
35 # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
36 # PTHREAD_PRIO_INHERIT symbol is defined when compiling with
37 # PTHREAD_CFLAGS.
38 #
39 # ACTION-IF-FOUND is a list of shell commands to run if a threads library
40 # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
41 # is not found. If ACTION-IF-FOUND is not specified, the default action
42 # will define HAVE_PTHREAD.
43 #
44 # Please let the authors know if this macro fails on any platform, or if
45 # you have any other suggestions or comments. This macro was based on work
46 # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
47 # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
48 # Alejandro Forero Cuervo to the autoconf macro repository. We are also
49 # grateful for the helpful feedback of numerous users.
50 #
51 # Updated for Autoconf 2.68 by Daniel Richard G.
52 #
53 # LICENSE
54 #
55 # Copyright (c) 2008 Steven G. Johnson <[email protected]>
56 # Copyright (c) 2011 Daniel Richard G. <[email protected]>
57 #
58 # This program is free software: you can redistribute it and/or modify it
59 # under the terms of the GNU General Public License as published by the
60 # Free Software Foundation, either version 3 of the License, or (at your
61 # option) any later version.
62 #
63 # This program is distributed in the hope that it will be useful, but
64 # WITHOUT ANY WARRANTY; without even the implied warranty of
65 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
66 # Public License for more details.
67 #
68 # You should have received a copy of the GNU General Public License along
69 # with this program. If not, see <http://www.gnu.org/licenses/>.
70 #
71 # As a special exception, the respective Autoconf Macro's copyright owner
72 # gives unlimited permission to copy, distribute and modify the configure
73 # scripts that are the output of Autoconf when processing the Macro. You
74 # need not follow the terms of the GNU General Public License when using
75 # or distributing such scripts, even though portions of the text of the
76 # Macro appear in them. The GNU General Public License (GPL) does govern
77 # all other use of the material that constitutes the Autoconf Macro.
78 #
79 # This special exception to the GPL applies to versions of the Autoconf
80 # Macro released by the Autoconf Archive. When you make and distribute a
81 # modified version of the Autoconf Macro, you may extend this special
82 # exception to the GPL to apply to your modified version as well.
83
84 #serial 23
85
86 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
87 AC_DEFUN([AX_PTHREAD], [
88 AC_REQUIRE([AC_CANONICAL_HOST])
89 AC_REQUIRE([AC_PROG_CC])
90 AC_REQUIRE([AC_PROG_SED])
91 AC_LANG_PUSH([C])
92 ax_pthread_ok=no
93
94 # We used to check for pthread.h first, but this fails if pthread.h
95 # requires special compiler flags (e.g. on Tru64 or Sequent).
96 # It gets checked for in the link test anyway.
97
98 # First of all, check if the user has set any of the PTHREAD_LIBS,
99 # etcetera environment variables, and if threads linking works using
100 # them:
101 if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
102 ax_pthread_save_CC="$CC"
103 ax_pthread_save_CFLAGS="$CFLAGS"
104 ax_pthread_save_LIBS="$LIBS"
105 AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
106 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
107 LIBS="$PTHREAD_LIBS $LIBS"
108 AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
109 AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
110 AC_MSG_RESULT([$ax_pthread_ok])
111 if test "x$ax_pthread_ok" = "xno"; then
112 PTHREAD_LIBS=""
113 PTHREAD_CFLAGS=""
114 fi
115 CC="$ax_pthread_save_CC"
116 CFLAGS="$ax_pthread_save_CFLAGS"
117 LIBS="$ax_pthread_save_LIBS"
118 fi
119
120 # We must check for the threads library under a number of different
121 # names; the ordering is very important because some systems
122 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
123 # libraries is broken (non-POSIX).
124
125 # Create a list of thread flags to try. Items starting with a "-" are
126 # C compiler flags, and other items are library names, except for "none"
127 # which indicates that we try without any flags at all, and "pthread-config"
128 # which is a program returning the flags for the Pth emulation library.
129
130 ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
131
132 # The ordering *is* (sometimes) important. Some notes on the
133 # individual items follow:
134
135 # pthreads: AIX (must check this before -lpthread)
136 # none: in case threads are in libc; should be tried before -Kthread and
137 # other compiler flags to prevent continual compiler warnings
138 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
139 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
140 # (Note: HP C rejects this with "bad form for `-t' option")
141 # -pthreads: Solaris/gcc (Note: HP C also rejects)
142 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
143 # doesn't hurt to check since this sometimes defines pthreads and
144 # -D_REENTRANT too), HP C (must be checked before -lpthread, which
145 # is present but should not be used directly; and before -mthreads,
146 # because the compiler interprets this as "-mt" + "-hreads")
147 # -mthreads: Mingw32/gcc, Lynx/gcc
148 # pthread: Linux, etcetera
149 # --thread-safe: KAI C++
150 # pthread-config: use pthread-config program (for GNU Pth library)
151
152 case $host_os in
153
154 freebsd*)
155
156 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
157 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
158
159 ax_pthread_flags="-kthread lthread $ax_pthread_flags"
160 ;;
161
162 hpux*)
163
164 # From the cc(1) man page: "[-mt] Sets various -D flags to enable
165 # multi-threading and also sets -lpthread."
166
167 ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
168 ;;
169
170 openedition*)
171
172 # IBM z/OS requires a feature-test macro to be defined in order to
173 # enable POSIX threads at all, so give the user a hint if this is
174 # not set. (We don't define these ourselves, as they can affect
175 # other portions of the system API in unpredictable ways.)
176
177 AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
178 [
179 # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
180 AX_PTHREAD_ZOS_MISSING
181 # endif
182 ],
183 [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
184 ;;
185
186 solaris*)
187
188 # On Solaris (at least, for some versions), libc contains stubbed
189 # (non-functional) versions of the pthreads routines, so link-based
190 # tests will erroneously succeed. (N.B.: The stubs are missing
191 # pthread_cleanup_push, or rather a function called by this macro,
192 # so we could check for that, but who knows whether they'll stub
193 # that too in a future libc.) So we'll check first for the
194 # standard Solaris way of linking pthreads (-mt -lpthread).
195
196 ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
197 ;;
198 esac
199
200 # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
201
202 AS_IF([test "x$GCC" = "xyes"],
203 [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"])
204
205 # The presence of a feature test macro requesting re-entrant function
206 # definitions is, on some systems, a strong hint that pthreads support is
207 # correctly enabled
208
209 case $host_os in
210 darwin* | hpux* | linux* | osf* | solaris*)
211 ax_pthread_check_macro="_REENTRANT"
212 ;;
213
214 aix*)
215 ax_pthread_check_macro="_THREAD_SAFE"
216 ;;
217
218 *)
219 ax_pthread_check_macro="--"
220 ;;
221 esac
222 AS_IF([test "x$ax_pthread_check_macro" = "x--"],
223 [ax_pthread_check_cond=0],
224 [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
225
226 # Are we compiling with Clang?
227
228 AC_CACHE_CHECK([whether $CC is Clang],
229 [ax_cv_PTHREAD_CLANG],
230 [ax_cv_PTHREAD_CLANG=no
231 # Note that Autoconf sets GCC=yes for Clang as well as GCC
232 if test "x$GCC" = "xyes"; then
233 AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
234 [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
235 # if defined(__clang__) && defined(__llvm__)
236 AX_PTHREAD_CC_IS_CLANG
237 # endif
238 ],
239 [ax_cv_PTHREAD_CLANG=yes])
240 fi
241 ])
242 ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
243
244 ax_pthread_clang_warning=no
245
246 # Clang needs special handling, because older versions handle the -pthread
247 # option in a rather... idiosyncratic way
248
249 if test "x$ax_pthread_clang" = "xyes"; then
250
251 # Clang takes -pthread; it has never supported any other flag
252
253 # (Note 1: This will need to be revisited if a system that Clang
254 # supports has POSIX threads in a separate library. This tends not
255 # to be the way of modern systems, but it's conceivable.)
256
257 # (Note 2: On some systems, notably Darwin, -pthread is not needed
258 # to get POSIX threads support; the API is always present and
259 # active. We could reasonably leave PTHREAD_CFLAGS empty. But
260 # -pthread does define _REENTRANT, and while the Darwin headers
261 # ignore this macro, third-party headers might not.)
262
263 PTHREAD_CFLAGS="-pthread"
264 PTHREAD_LIBS=
265
266 ax_pthread_ok=yes
267
268 # However, older versions of Clang make a point of warning the user
269 # that, in an invocation where only linking and no compilation is
270 # taking place, the -pthread option has no effect ("argument unused
271 # during compilation"). They expect -pthread to be passed in only
272 # when source code is being compiled.
273 #
274 # Problem is, this is at odds with the way Automake and most other
275 # C build frameworks function, which is that the same flags used in
276 # compilation (CFLAGS) are also used in linking. Many systems
277 # supported by AX_PTHREAD require exactly this for POSIX threads
278 # support, and in fact it is often not straightforward to specify a
279 # flag that is used only in the compilation phase and not in
280 # linking. Such a scenario is extremely rare in practice.
281 #
282 # Even though use of the -pthread flag in linking would only print
283 # a warning, this can be a nuisance for well-run software projects
284 # that build with -Werror. So if the active version of Clang has
285 # this misfeature, we search for an option to squash it.
286
287 AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
288 [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
289 [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
290 # Create an alternate version of $ac_link that compiles and
291 # links in two steps (.c -> .o, .o -> exe) instead of one
292 # (.c -> exe), because the warning occurs only in the second
293 # step
294 ax_pthread_save_ac_link="$ac_link"
295 ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
296 ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
297 ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
298 ax_pthread_save_CFLAGS="$CFLAGS"
299 for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
300 AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
301 CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
302 ac_link="$ax_pthread_save_ac_link"
303 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
304 [ac_link="$ax_pthread_2step_ac_link"
305 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
306 [break])
307 ])
308 done
309 ac_link="$ax_pthread_save_ac_link"
310 CFLAGS="$ax_pthread_save_CFLAGS"
311 AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
312 ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
313 ])
314
315 case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
316 no | unknown) ;;
317 *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
318 esac
319
320 fi # $ax_pthread_clang = yes
321
322 if test "x$ax_pthread_ok" = "xno"; then
323 for ax_pthread_try_flag in $ax_pthread_flags; do
324
325 case $ax_pthread_try_flag in
326 none)
327 AC_MSG_CHECKING([whether pthreads work without any flags])
328 ;;
329
330 -mt,pthread)
331 AC_MSG_CHECKING([whether pthreads work with -mt -lpthread])
332 PTHREAD_CFLAGS="-mt"
333 PTHREAD_LIBS="-lpthread"
334 ;;
335
336 -*)
337 AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
338 PTHREAD_CFLAGS="$ax_pthread_try_flag"
339 ;;
340
341 pthread-config)
342 AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
343 AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
344 PTHREAD_CFLAGS="`pthread-config --cflags`"
345 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
346 ;;
347
348 *)
349 AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
350 PTHREAD_LIBS="-l$ax_pthread_try_flag"
351 ;;
352 esac
353
354 ax_pthread_save_CFLAGS="$CFLAGS"
355 ax_pthread_save_LIBS="$LIBS"
356 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
357 LIBS="$PTHREAD_LIBS $LIBS"
358
359 # Check for various functions. We must include pthread.h,
360 # since some functions may be macros. (On the Sequent, we
361 # need a special flag -Kthread to make this header compile.)
362 # We check for pthread_join because it is in -lpthread on IRIX
363 # while pthread_create is in libc. We check for pthread_attr_init
364 # due to DEC craziness with -lpthreads. We check for
365 # pthread_cleanup_push because it is one of the few pthread
366 # functions on Solaris that doesn't have a non-functional libc stub.
367 # We try pthread_create on general principles.
368
369 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
370 # if $ax_pthread_check_cond
371 # error "$ax_pthread_check_macro must be defined"
372 # endif
373 static void routine(void *a) { a = 0; }
374 static void *start_routine(void *a) { return a; }],
375 [pthread_t th; pthread_attr_t attr;
376 pthread_create(&th, 0, start_routine, 0);
377 pthread_join(th, 0);
378 pthread_attr_init(&attr);
379 pthread_cleanup_push(routine, 0);
380 pthread_cleanup_pop(0) /* ; */])],
381 [ax_pthread_ok=yes],
382 [])
383
384 CFLAGS="$ax_pthread_save_CFLAGS"
385 LIBS="$ax_pthread_save_LIBS"
386
387 AC_MSG_RESULT([$ax_pthread_ok])
388 AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
389
390 PTHREAD_LIBS=""
391 PTHREAD_CFLAGS=""
392 done
393 fi
394
395 # Various other checks:
396 if test "x$ax_pthread_ok" = "xyes"; then
397 ax_pthread_save_CFLAGS="$CFLAGS"
398 ax_pthread_save_LIBS="$LIBS"
399 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
400 LIBS="$PTHREAD_LIBS $LIBS"
401
402 # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
403 AC_CACHE_CHECK([for joinable pthread attribute],
404 [ax_cv_PTHREAD_JOINABLE_ATTR],
405 [ax_cv_PTHREAD_JOINABLE_ATTR=unknown
406 for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
407 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
408 [int attr = $ax_pthread_attr; return attr /* ; */])],
409 [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
410 [])
411 done
412 ])
413 AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
414 test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
415 test "x$ax_pthread_joinable_attr_defined" != "xyes"],
416 [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
417 [$ax_cv_PTHREAD_JOINABLE_ATTR],
418 [Define to necessary symbol if this constant
419 uses a non-standard name on your system.])
420 ax_pthread_joinable_attr_defined=yes
421 ])
422
423 AC_CACHE_CHECK([whether more special flags are required for pthreads],
424 [ax_cv_PTHREAD_SPECIAL_FLAGS],
425 [ax_cv_PTHREAD_SPECIAL_FLAGS=no
426 case $host_os in
427 solaris*)
428 ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
429 ;;
430 esac
431 ])
432 AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
433 test "x$ax_pthread_special_flags_added" != "xyes"],
434 [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
435 ax_pthread_special_flags_added=yes])
436
437 AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
438 [ax_cv_PTHREAD_PRIO_INHERIT],
439 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
440 [[int i = PTHREAD_PRIO_INHERIT;]])],
441 [ax_cv_PTHREAD_PRIO_INHERIT=yes],
442 [ax_cv_PTHREAD_PRIO_INHERIT=no])
443 ])
444 AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
445 test "x$ax_pthread_prio_inherit_defined" != "xyes"],
446 [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
447 ax_pthread_prio_inherit_defined=yes
448 ])
449
450 CFLAGS="$ax_pthread_save_CFLAGS"
451 LIBS="$ax_pthread_save_LIBS"
452
453 # More AIX lossage: compile with *_r variant
454 if test "x$GCC" != "xyes"; then
455 case $host_os in
456 aix*)
457 AS_CASE(["x/$CC"],
458 [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
459 [#handle absolute path differently from PATH based program lookup
460 AS_CASE(["x$CC"],
461 [x/*],
462 [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
463 [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
464 ;;
465 esac
466 fi
467 fi
468
469 test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
470
471 AC_SUBST([PTHREAD_LIBS])
472 AC_SUBST([PTHREAD_CFLAGS])
473 AC_SUBST([PTHREAD_CC])
474
475 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
476 if test "x$ax_pthread_ok" = "xyes"; then
477 ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
478 :
479 else
480 ax_pthread_ok=no
481 $2
482 fi
483 AC_LANG_POP
484 ])dnl AX_PTHREAD
+0
-37
m4/ax_require_defined.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_REQUIRE_DEFINED(MACRO)
7 #
8 # DESCRIPTION
9 #
10 # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
11 # been defined and thus are available for use. This avoids random issues
12 # where a macro isn't expanded. Instead the configure script emits a
13 # non-fatal:
14 #
15 # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
16 #
17 # It's like AC_REQUIRE except it doesn't expand the required macro.
18 #
19 # Here's an example:
20 #
21 # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
22 #
23 # LICENSE
24 #
25 # Copyright (c) 2014 Mike Frysinger <[email protected]>
26 #
27 # Copying and distribution of this file, with or without modification, are
28 # permitted in any medium without royalty provided the copyright notice
29 # and this notice are preserved. This file is offered as-is, without any
30 # warranty.
31
32 #serial 1
33
34 AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
35 m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
36 ])dnl AX_REQUIRE_DEFINED
+0
-130
m4/ax_sanitizers.m4 less more
0 # ===========================================================================
1 # http://www.gnu.org/software/autoconf-archive/ax_sanitizers.html
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_SANITIZERS([SANITIZERS], [ENABLED-BY-DEFAULT], [ACTION-SUCCESS])
7 #
8 # DESCRIPTION
9 #
10 # Offers users to enable one or more sanitizers (see
11 # https://github.com/google/sanitizers) with the corresponding
12 # --enable-<sanitizer>-sanitizer option.
13 #
14 # SANITIZERS is a whitespace-separated list of sanitizers to offer via
15 # --enable-<sanitizer>-sanitizer options, e.g. "address memory" for the
16 # address sanitizer and the memory sanitizer. If SANITIZERS is not specified,
17 # all known sanitizers to AX_SANITIZERS will be offered, which at the time of
18 # writing are "address memory undefined".
19 # NOTE that SANITIZERS is expanded at autoconf time, not at configure time,
20 # i.e. you cannot use shell variables in SANITIZERS.
21 #
22 # ENABLED-BY-DEFAULT is a whitespace-separated list of sanitizers which
23 # should be enabled by default, e.g. "memory undefined". Note that not all
24 # sanitizers can be combined, e.g. memory sanitizer cannot be enabled when
25 # address sanitizer is already enabled.
26 # Set ENABLED-BY-DEFAULT to a single whitespace in order to disable all
27 # sanitizers by default.
28 # ENABLED-BY-DEFAULT is expanded at configure time, so you can use shell
29 # variables.
30 #
31 # ACTION-SUCCESS allows to specify shell commands to execute on success, i.e.
32 # when one of the sanitizers was successfully enabled. This is a good place
33 # to call AC_DEFINE for any precompiler constants you might need to make your
34 # code play nice with sanitizers.
35 #
36 # The variable ax_enabled_sanitizers contains a whitespace-separated list of
37 # all enabled sanitizers, so that you can print them at the end of configure,
38 # if you wish.
39 #
40 # The additional --enable-sanitizers option allows users to enable/disable
41 # all sanitizers, effectively overriding ENABLED-BY-DEFAULT.
42 #
43 # EXAMPLES
44 #
45 # AX_SANITIZERS([address])
46 # dnl offer users to enable address sanitizer via --enable-address-sanitizer
47 #
48 # is_debug_build=…
49 # if test "x$is_debug_build" = "xyes"; then
50 # default_sanitizers="address memory"
51 # else
52 # default_sanitizers=
53 # fi
54 # AX_SANITIZERS([address memory], [$default_sanitizers])
55 # dnl enable address sanitizer and memory sanitizer by default for debug
56 # dnl builds, e.g. when building from git instead of a dist tarball.
57 #
58 # AX_SANITIZERS(, , [
59 # AC_DEFINE([SANITIZERS_ENABLED],
60 # [],
61 # [At least one sanitizer was enabled])])
62 # dnl enable all sanitizers known to AX_SANITIZERS by default and set the
63 # dnl SANITIZERS_ENABLED precompiler constant.
64 #
65 # AX_SANITIZERS(, [ ])
66 # dnl provide all sanitizers, but enable none by default.
67 #
68 # LICENSE
69 #
70 # Copyright (c) 2016 Michael Stapelberg <[email protected]>
71 #
72 # Copying and distribution of this file, with or without modification,
73 # are permitted in any medium without royalty provided the copyright
74 # notice and this notice are preserved. This file is offered as-is,
75 # without any warranty.
76
77 AC_DEFUN([AX_SANITIZERS],
78 [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
79 AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
80 AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
81 AC_ARG_ENABLE(sanitizers,
82 AS_HELP_STRING(
83 [--enable-sanitizers],
84 [enable all known sanitizers]),
85 [ax_sanitizers_default=$enableval],
86 [ax_sanitizers_default=])
87 ax_enabled_sanitizers=
88 m4_foreach_w([mysan], m4_default($1, [address memory undefined]), [
89 dnl If ax_sanitizers_default is unset, i.e. the user neither explicitly
90 dnl enabled nor explicitly disabled all sanitizers, we get the default value
91 dnl for this sanitizer based on whether it is listed in ENABLED-BY-DEFAULT.
92 AS_IF([test "x$ax_sanitizers_default" = "x"], [dnl
93 ax_sanitizer_default=
94 for mycheck in m4_default([$2], [address memory undefined]); do
95 AS_IF([test "x$mycheck" = "x[]mysan"], [ax_sanitizer_default=yes])
96 done
97 AS_IF([test "x$ax_sanitizer_default" = "x"], [ax_sanitizer_default=no])
98 ],
99 [ax_sanitizer_default=$ax_sanitizers_default])
100 AC_ARG_ENABLE(mysan[]-sanitizer,
101 AS_HELP_STRING(
102 [--enable-[]mysan[]-sanitizer],
103 [enable -fsanitize=mysan]),
104 [ax_sanitizer_enabled=$enableval],
105 [ax_sanitizer_enabled=$ax_sanitizer_default])
106
107 AS_IF([test "x$ax_sanitizer_enabled" = "xyes"], [
108 dnl Not using AX_APPEND_COMPILE_FLAGS and AX_APPEND_LINK_FLAGS because they
109 dnl lack the ability to specify ACTION-SUCCESS.
110 AX_CHECK_COMPILE_FLAG([-fsanitize=[]mysan], [
111 AX_CHECK_LINK_FLAG([-fsanitize=[]mysan], [
112 AX_APPEND_FLAG([-fsanitize=[]mysan], [])
113 dnl If and only if libtool is being used, LDFLAGS needs to contain -Wc,-fsanitize=….
114 dnl See e.g. https://sources.debian.net/src/systemd/231-7/configure.ac/?hl=128#L135
115 dnl TODO: how can recognize that situation and add -Wc,?
116 AX_APPEND_FLAG([-fsanitize=[]mysan], [LDFLAGS])
117 dnl TODO: add -fPIE -pie for memory
118 # -fno-omit-frame-pointer results in nicer stack traces in error
119 # messages, see http://clang.llvm.org/docs/AddressSanitizer.html#usage
120 AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer], [
121 AX_APPEND_FLAG([-fno-omit-frame-pointer], [])])
122 dnl TODO: at least for clang, we should specify exactly -O1, not -O2 or -O0, so that performance is reasonable but stacktraces are not tampered with (due to inlining), see http://clang.llvm.org/docs/AddressSanitizer.html#usage
123 m4_default([$3], :)
124 ax_enabled_sanitizers="[]mysan $ax_enabled_sanitizers"
125 ])
126 ])
127 ])
128 ])dnl
129 ])dnl AX_SANITIZERS
0 #!/bin/sh
1
2 set -eu
3
4 cd "${MESON_DIST_ROOT}"
5
6 # Delete everything we do not want to have in the release tarballs:
7 rm -rf \
8 contrib/banner.svg \
9 contrib/show-download-count.sh \
10 contrib/sticker-7x5cm-stickma.tif.lzma \
11 contrib/sticker_stickma_black.svg \
12 debian/ \
13 docs/GPN-2009-06-27/ \
14 docs/NoName-2009-03-12/ \
15 docs/slides-2012-01-25/ \
16 docs/slides-2012-03-16/ \
17 testcases/.gitignore \
18 travis/ \
19 .clang-format \
20 .editorconfig \
21 i3bar/.gitignore \
22 .travis.yml \
23 logo.svg \
24 README.md \
25 RELEASE-NOTES-next \
26 release.sh
27
28 mkdir build
29 cd build
30 meson .. -Dprefix=/usr -Ddocs=true -Dmans=true
31 ninja
32 cp *.1 ../man/
33 cp *.html ../docs/
34 cd ..
35 rm -rf build
0 #!/bin/sh
1 ln -sf "i3" "${MESON_INSTALL_DESTDIR_PREFIX}/$1/i3-with-shmlog"
0 # -*- mode: meson -*-
1
2 # Style objective: be consistent with what mesonbuild.com documents/uses, and/or
3 # the meson book: https://meson-manual.com/
4
5 project(
6 'i3',
7 'c',
8 version: '4.19',
9 default_options: [
10 'c_std=c11',
11 'warning_level=1', # enable all warnings (-Wall)
12 # TODO(https://github.com/i3/i3/issues/4087): switch to
13 # 'buildtype=debugoptimized',
14 ],
15 # Ubuntu 18.04 (supported until 2023) has meson 0.45.
16 # We can revisit our minimum supported meson version
17 # if it turns out to be too hard to maintain.
18 meson_version: '>=0.45.0',
19 )
20
21 cc = meson.get_compiler('c')
22 add_project_arguments(cc.get_supported_arguments(['-Wunused-value']), language: 'c')
23
24 if meson.version().version_compare('>=0.48.0')
25 # https://github.com/mesonbuild/meson/issues/2166#issuecomment-629696911
26 meson.add_dist_script('meson/meson-dist-script')
27 else
28 message('meson <0.48.0 detected, dist tarballs will not be filtered')
29 endif
30
31 ################################################################################
32 # Version handling
33 ################################################################################
34
35 cdata = configuration_data()
36
37 version_array = meson.project_version().split('.')
38 cdata.set('MAJOR_VERSION', version_array[0].to_int())
39 cdata.set('MINOR_VERSION', version_array[1].to_int())
40 if version_array.length() > 2
41 cdata.set('PATCH_VERSION', version_array[2].to_int())
42 else
43 cdata.set('PATCH_VERSION', 0)
44 endif
45 cdata.set_quoted('I3_VERSION', '@VCS_TAG@')
46 cdata.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
47
48 if get_option('b_sanitize').split(',').contains('address')
49 cdata.set('I3_ASAN_ENABLED', 1)
50 endif
51
52 cdata.set('HAVE_STRNDUP', cc.has_function('strndup'))
53 cdata.set('HAVE_MKDIRP', cc.has_function('mkdirp'))
54
55 # Instead of generating config.h directly, make vcs_tag generate it so that
56 # @VCS_TAG@ is replaced.
57 config_h_in = configure_file(
58 output: 'config.h.in',
59 configuration: cdata,
60 )
61 config_h = declare_dependency(
62 sources: vcs_tag(
63 input: config_h_in,
64 output: 'config.h',
65 fallback: meson.project_version() + ' (2020-11-15)',
66 )
67 )
68
69 ################################################################################
70 # docs generation
71 ################################################################################
72
73 docdir = get_option('docdir')
74 if docdir == ''
75 docdir = join_paths(get_option('datadir'), 'doc', 'i3')
76 endif
77
78 if get_option('docs')
79 asciidoc = find_program('asciidoc')
80 doc_toc_inputs = [
81 'docs/hacking-howto',
82 'docs/userguide',
83 'docs/ipc',
84 'docs/multi-monitor',
85 'docs/wsbar',
86 'docs/testsuite',
87 'docs/i3bar-protocol',
88 'docs/layout-saving',
89 ]
90 foreach m : doc_toc_inputs
91 custom_target(
92 m.underscorify()+'_asciidoc',
93 input: m,
94 output: '@[email protected]',
95 command: [
96 asciidoc,
97 '-a', 'toc',
98 '-n',
99 '-o', '@OUTPUT@',
100 '@INPUT@',
101 ],
102 install: true,
103 install_dir: docdir,
104 )
105 endforeach
106
107 doc_notoc_inputs = [
108 'docs/debugging',
109 ]
110 foreach m : doc_notoc_inputs
111 custom_target(
112 m.underscorify()+'_asciidoc',
113 input: m,
114 output: '@[email protected]',
115 command: [
116 asciidoc,
117 '-n',
118 '-o', '@OUTPUT@',
119 '@INPUT@',
120 ],
121 install: true,
122 install_dir: docdir,
123 )
124 endforeach
125
126 else
127 if run_command('[', '-f', 'docs/hacking-howto.html', ']').returncode() == 0
128 install_data(
129 [
130 'docs/hacking-howto.html',
131 'docs/userguide.html',
132 'docs/ipc.html',
133 'docs/multi-monitor.html',
134 'docs/wsbar.html',
135 'docs/testsuite.html',
136 'docs/i3bar-protocol.html',
137 'docs/layout-saving.html',
138 'docs/debugging.html',
139 ],
140 install_dir: docdir,
141 )
142 endif
143 endif
144
145 install_data(
146 [
147 'docs/bigpicture.png',
148 'docs/single_terminal.png',
149 'docs/snapping.png',
150 'docs/two_columns.png',
151 'docs/two_terminals.png',
152 'docs/modes.png',
153 'docs/wsbar.png',
154 'docs/keyboard-layer1.png',
155 'docs/keyboard-layer2.png',
156 'docs/i3-sync-working.png',
157 'docs/i3-sync.png',
158 'docs/tree-layout1.png',
159 'docs/tree-layout2.png',
160 'docs/tree-shot1.png',
161 'docs/tree-shot2.png',
162 'docs/tree-shot3.png',
163 'docs/tree-shot4.png',
164 'docs/refcard.html',
165 'docs/refcard_style.css',
166 'docs/logo-30.png',
167 'docs/layout-saving-1.png',
168 ],
169 install_dir: docdir,
170 )
171
172 if meson.version().version_compare('>=0.53')
173 summary('build docs (-Ddocs)', get_option('docs'))
174 endif
175
176 ################################################################################
177 # manpages
178 ################################################################################
179
180 man1 = join_paths(get_option('mandir'), 'man1')
181
182 if get_option('mans')
183 asciidoc = find_program('asciidoc')
184 asciidoc_cdata = configuration_data()
185 asciidoc_cdata.set('PACKAGE_VERSION', meson.project_version())
186 asciidoc_conf = configure_file(
187 input: 'man/asciidoc.conf.in',
188 output: 'asciidoc.conf',
189 configuration: asciidoc_cdata,
190 )
191
192 xmlto = find_program('xmlto')
193
194 pod2man = find_program('pod2man')
195
196 man_inputs = [
197 'man/i3.man',
198 'man/i3bar.man',
199 'man/i3-msg.man',
200 'man/i3-input.man',
201 'man/i3-nagbar.man',
202 'man/i3-config-wizard.man',
203 'man/i3-migrate-config-to-v4.man',
204 'man/i3-sensible-editor.man',
205 'man/i3-sensible-pager.man',
206 'man/i3-sensible-terminal.man',
207 'man/i3-dump-log.man',
208 ]
209
210 foreach m : man_inputs
211 xml = custom_target(
212 m.underscorify()+'_asciidoc',
213 input: m,
214 output: '@[email protected]',
215 command: [
216 asciidoc,
217 '-d', 'manpage',
218 '-b', 'docbook',
219 '-f', asciidoc_conf,
220 '-o', '@OUTPUT@',
221 '@INPUT@',
222 ],
223 )
224
225 custom_target(
226 m.underscorify()+'_xmlto',
227 input: xml,
228 output: '@[email protected]',
229 command: [
230 xmlto,
231 'man',
232 '-o',
233 '@OUTDIR@',
234 '@INPUT@',
235 ],
236 # We should use install and install_dir instead of install_man as per:
237 # https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
238 # https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
239 install: true,
240 install_dir: man1,
241 )
242 endforeach
243
244 pod2man_inputs = [
245 'i3-dmenu-desktop',
246 'i3-save-tree',
247 ]
248 foreach m : pod2man_inputs
249 custom_target(
250 m.underscorify()+'_pod2man',
251 input: m,
252 output: '@[email protected]',
253 command: [
254 pod2man,
255 '--utf8',
256 '@INPUT@',
257 '@OUTPUT@',
258 ],
259 # We should use install and install_dir instead of install_man as per:
260 # https://github.com/mesonbuild/meson/issues/4981#issuecomment-467084867
261 # https://github.com/mesonbuild/meson/issues/1550#issuecomment-370164307
262 install: true,
263 install_dir: man1,
264 )
265 endforeach
266
267 else
268 if run_command('[', '-f', 'man/i3.1', ']').returncode() == 0
269 install_data(
270 [
271 'man/i3.1',
272 'man/i3bar.1',
273 'man/i3-msg.1',
274 'man/i3-input.1',
275 'man/i3-nagbar.1',
276 'man/i3-config-wizard.1',
277 'man/i3-migrate-config-to-v4.1',
278 'man/i3-sensible-editor.1',
279 'man/i3-sensible-pager.1',
280 'man/i3-sensible-terminal.1',
281 'man/i3-dump-log.1',
282 'man/i3-dmenu-desktop.1',
283 'man/i3-save-tree.1',
284 ],
285 install_dir: man1,
286 )
287 endif
288 endif
289
290 if meson.version().version_compare('>=0.53')
291 summary('build manpages (-Dmans)', get_option('mans'))
292 endif
293
294 # Required for e.g. struct ucred to be defined as per unix(7).
295 add_project_arguments('-D_GNU_SOURCE', language: 'c')
296
297 # https://mesonbuild.com/howtox.html#add-math-library-lm-portably
298 m_dep = cc.find_library('m', required: false)
299 rt_dep = cc.find_library('rt', required: false)
300 iconv_dep = cc.find_library('iconv', required: false)
301
302 libsn_dep = dependency('libstartup-notification-1.0', method: 'pkg-config')
303 xcb_dep = dependency('xcb', method: 'pkg-config')
304 xcb_xkb_dep = dependency('xcb-xkb', method: 'pkg-config')
305 xcb_xinerama_dep = dependency('xcb-xinerama', method: 'pkg-config')
306 xcb_randr_dep = dependency('xcb-randr', method: 'pkg-config')
307 xcb_shape_dep = dependency('xcb-shape', method: 'pkg-config')
308 xcb_util_dep = dependency('xcb-util', method: 'pkg-config')
309 xcb_util_cursor_dep = dependency('xcb-cursor', method: 'pkg-config')
310 xcb_util_keysyms_dep = dependency('xcb-keysyms', method: 'pkg-config')
311 xcb_util_wm_dep = dependency('xcb-icccm', method: 'pkg-config')
312 xcb_util_xrm_dep = dependency('xcb-xrm', method: 'pkg-config')
313 xkbcommon_dep = dependency('xkbcommon', method: 'pkg-config')
314 xkbcommon_x11_dep = dependency('xkbcommon-x11', method: 'pkg-config')
315 yajl_dep = dependency('yajl', method: 'pkg-config')
316 libpcre_dep = dependency('libpcre', version: '>=8.10', method: 'pkg-config')
317 cairo_dep = dependency('cairo', version: '>=1.14.4', method: 'pkg-config')
318 pangocairo_dep = dependency('pangocairo', method: 'pkg-config')
319 glib_dep = dependency('glib-2.0', method: 'pkg-config')
320 gobject_dep = dependency('gobject-2.0', method: 'pkg-config')
321
322 ev_dep = cc.find_library('ev')
323
324 inc = include_directories('include')
325
326 libi3srcs = [
327 'libi3/dpi.c',
328 'libi3/draw_util.c',
329 'libi3/fake_configure_notify.c',
330 'libi3/font.c',
331 'libi3/format_placeholders.c',
332 'libi3/get_colorpixel.c',
333 'libi3/get_config_path.c',
334 'libi3/get_exe_path.c',
335 'libi3/get_mod_mask.c',
336 'libi3/get_process_filename.c',
337 'libi3/get_visualtype.c',
338 'libi3/g_utf8_make_valid.c',
339 'libi3/ipc_connect.c',
340 'libi3/ipc_recv_message.c',
341 'libi3/ipc_send_message.c',
342 'libi3/is_debug_build.c',
343 'libi3/resolve_tilde.c',
344 'libi3/root_atom_contents.c',
345 'libi3/safewrappers.c',
346 'libi3/string.c',
347 'libi3/ucs2_conversion.c',
348 ]
349
350 if not cdata.get('HAVE_STRNDUP')
351 libi3srcs += 'libi3/strndup.c'
352 endif
353
354 if not cdata.get('HAVE_MKDIRP')
355 libi3srcs += 'libi3/mkdirp.c'
356 endif
357
358 libi3 = static_library(
359 'i3',
360 libi3srcs,
361 include_directories: inc,
362 dependencies: [
363 pangocairo_dep,
364 config_h,
365 ],
366 )
367
368 i3srcs = [
369 'src/assignments.c',
370 'src/bindings.c',
371 'src/click.c',
372 'src/commands.c',
373 'src/commands_parser.c',
374 'src/con.c',
375 'src/config.c',
376 'src/config_directives.c',
377 'src/config_parser.c',
378 'src/display_version.c',
379 'src/drag.c',
380 'src/ewmh.c',
381 'src/fake_outputs.c',
382 'src/floating.c',
383 'src/handlers.c',
384 'src/ipc.c',
385 'src/key_press.c',
386 'src/load_layout.c',
387 'src/log.c',
388 'src/main.c',
389 'src/manage.c',
390 'src/match.c',
391 'src/move.c',
392 'src/output.c',
393 'src/randr.c',
394 'src/regex.c',
395 'src/render.c',
396 'src/resize.c',
397 'src/restore_layout.c',
398 'src/scratchpad.c',
399 'src/sd-daemon.c',
400 'src/sighandler.c',
401 'src/startup.c',
402 'src/sync.c',
403 'src/tree.c',
404 'src/util.c',
405 'src/version.c',
406 'src/window.c',
407 'src/workspace.c',
408 'src/x.c',
409 'src/xcb.c',
410 'src/xcursor.c',
411 'src/xinerama.c',
412 ]
413
414 # Verify the perl interpreter is present for running parser_gen,
415 # ensuring a good error message when it isn’t:
416 perl = find_program('perl')
417 parser_gen = find_program('generate-command-parser.pl')
418
419 command_parser = custom_target(
420 'command_parser',
421 input: 'parser-specs/commands.spec',
422 output: [
423 'GENERATED_command_enums.h',
424 'GENERATED_command_tokens.h',
425 'GENERATED_command_call.h',
426 ],
427 command: [perl, parser_gen, '--input=@INPUT@', '--prefix=command'],
428 )
429
430 i3srcs += command_parser
431
432 config_parser = custom_target(
433 'config_parser',
434 input: 'parser-specs/config.spec',
435 output: [
436 'GENERATED_config_enums.h',
437 'GENERATED_config_tokens.h',
438 'GENERATED_config_call.h',
439 ],
440 command: [parser_gen, '--input=@INPUT@', '--prefix=config'],
441 )
442
443 i3srcs += config_parser
444
445 # src/log.c uses threading primitives for synchronization
446 thread_dep = dependency('threads')
447
448 common_deps = [
449 thread_dep,
450 m_dep,
451 iconv_dep,
452 rt_dep,
453 libsn_dep,
454 xcb_dep,
455 xcb_xkb_dep,
456 xcb_xinerama_dep,
457 xcb_randr_dep,
458 xcb_shape_dep,
459 xcb_util_dep,
460 xcb_util_cursor_dep,
461 xcb_util_keysyms_dep,
462 xcb_util_wm_dep,
463 xcb_util_xrm_dep,
464 xkbcommon_dep,
465 xkbcommon_x11_dep,
466 yajl_dep,
467 libpcre_dep,
468 cairo_dep,
469 pangocairo_dep,
470 glib_dep,
471 gobject_dep,
472 ev_dep,
473 config_h,
474 ]
475
476 executable(
477 'i3',
478 i3srcs,
479 install: true,
480 include_directories: inc,
481 dependencies: common_deps,
482 link_with: libi3,
483 )
484
485 # This is the only currently working way of installing a symbolic link:
486 meson.add_install_script(
487 'meson/meson-install-i3-with-shmlog',
488 get_option('bindir'),
489 )
490
491 executable(
492 'i3bar',
493 [
494 'i3bar/src/child.c',
495 'i3bar/src/config.c',
496 'i3bar/src/ipc.c',
497 'i3bar/src/main.c',
498 'i3bar/src/mode.c',
499 'i3bar/src/outputs.c',
500 'i3bar/src/parse_json_header.c',
501 'i3bar/src/workspaces.c',
502 'i3bar/src/xcb.c',
503 ],
504 install: true,
505 include_directories: include_directories('include', 'i3bar/include'),
506 dependencies: common_deps,
507 link_with: libi3,
508 )
509
510 executable(
511 'i3-config-wizard',
512 [
513 'i3-config-wizard/i3-config-wizard-atoms.xmacro.h',
514 'i3-config-wizard/main.c',
515 'i3-config-wizard/xcb.h',
516 ],
517 install: true,
518 include_directories: include_directories('include', 'i3-config-wizard'),
519 dependencies: common_deps,
520 link_with: libi3,
521 )
522
523 executable(
524 'i3-dump-log',
525 'i3-dump-log/main.c',
526 install: true,
527 include_directories: inc,
528 dependencies: common_deps,
529 link_with: libi3,
530 )
531
532 executable(
533 'i3-input',
534 [
535 'i3-input/i3-input.h',
536 'i3-input/keysym2ucs.h',
537 'i3-input/keysym2ucs.c',
538 'i3-input/main.c',
539 ],
540 install: true,
541 include_directories: inc,
542 dependencies: common_deps,
543 link_with: libi3,
544 )
545
546 executable(
547 'i3-msg',
548 'i3-msg/main.c',
549 install: true,
550 include_directories: inc,
551 dependencies: common_deps,
552 link_with: libi3,
553 )
554
555 executable(
556 'i3-nagbar',
557 [
558 'i3-nagbar/i3-nagbar-atoms.xmacro.h',
559 'i3-nagbar/main.c',
560 ],
561 install: true,
562 include_directories: include_directories('include', 'i3-nagbar'),
563 dependencies: common_deps,
564 link_with: libi3,
565 )
566
567 install_data(
568 [
569 'i3-dmenu-desktop',
570 'i3-migrate-config-to-v4',
571 'i3-save-tree',
572 'i3-sensible-editor',
573 'i3-sensible-pager',
574 'i3-sensible-terminal',
575 ],
576 install_dir: 'bin',
577 )
578
579 install_subdir(
580 'etc',
581 strip_directory: true,
582 install_dir: join_paths(get_option('sysconfdir'), 'i3'),
583 )
584
585 install_subdir(
586 'share/',
587 strip_directory: true,
588 install_dir: get_option('datadir'),
589 )
590
591 install_headers(
592 'include/i3/ipc.h',
593 subdir: 'i3',
594 )
595
596 # We cannot use configure_file for complete-run.pl.in and i3test.pm.in
597 # because configure_file strips the backslash in e.g. \@display,
598 # resulting in @display, breaking our Perl code:
599 # https://github.com/mesonbuild/meson/issues/7165
600 bash = find_program('bash')
601 replace_dirs = [
602 bash, '-c', # Use bash to capture output and mark as executable
603 'sed -e \'s,@abs_top_builddir@,'
604 + meson.current_build_dir()
605 + ',g;s,@abs_top_srcdir@,'
606 + meson.current_source_dir()+',g\''
607 # Only mark files ending in .pl as executables
608 + ' "$0" > "$1" && { [[ "${1##*.}" == pl ]] && chmod +x "$1" || true; }',
609 '@INPUT0@', # $0
610 '@OUTPUT0@', # $1
611 ]
612 complete_run = custom_target(
613 'complete-run',
614 input: ['testcases/complete-run.pl.in'],
615 output: ['complete-run.pl'],
616 command: replace_dirs,
617 # build this target when running e.g. ninja or ninja test.
618 # This is required for older meson versions (< 0.46.0).
619 build_by_default: true,
620 )
621 i3test_pm = custom_target(
622 'i3test-pm',
623 input: ['testcases/lib/i3test.pm.in'],
624 output: ['i3test.pm'],
625 command: replace_dirs,
626 # build this target when running e.g. ninja or ninja test.
627 # This is required for older meson versions (< 0.46.0).
628 build_by_default: true,
629 )
630
631 if get_option('docs')
632 i3_pod2html = find_program('docs/i3-pod2html')
633
634 custom_target(
635 'lib-i3test.html',
636 input: i3test_pm,
637 output: 'lib-i3test.html',
638 command: [
639 i3_pod2html,
640 '@INPUT@',
641 '@OUTPUT@',
642 ],
643 install: true,
644 install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
645 )
646
647 custom_target(
648 'lib-i3test-test.html',
649 input: 'testcases/lib/i3test/Test.pm',
650 output: 'lib-i3test-test.html',
651 command: [
652 i3_pod2html,
653 '@INPUT@',
654 '@OUTPUT@',
655 ],
656 install: true,
657 install_dir: join_paths(get_option('datadir'), 'doc', 'i3'),
658 )
659 endif
660
661 executable(
662 'test.inject_randr15',
663 'testcases/inject_randr1.5.c',
664 include_directories: inc,
665 dependencies: common_deps,
666 link_with: libi3,
667 )
668
669 executable(
670 'test.commands_parser',
671 'src/commands_parser.c',
672 include_directories: inc,
673 c_args: '-DTEST_PARSER',
674 dependencies: common_deps,
675 link_with: libi3,
676 )
677
678 executable(
679 'test.config_parser',
680 'src/config_parser.c',
681 include_directories: inc,
682 c_args: '-DTEST_PARSER',
683 dependencies: common_deps,
684 link_with: libi3,
685 )
686
687 anyevent_i3 = custom_target(
688 'anyevent-i3',
689 # Should be AnyEvent-I3/blib/lib/AnyEvent/I3.pm,
690 # but see https://github.com/mesonbuild/meson/issues/2320
691 output: 'AnyEvent-I3.stamp',
692 command: [
693 'sh',
694 '-c',
695 'cp -r @0@/AnyEvent-I3 . && cd AnyEvent-I3 && perl Makefile.PL && make && touch ../AnyEvent-I3.stamp'.format(meson.current_source_dir()),
696 ],
697 )
698
699 if meson.version().version_compare('>=0.46.0')
700 test(
701 'complete-run',
702 perl,
703 args: [complete_run],
704 depends: [
705 anyevent_i3,
706 i3test_pm,
707 ],
708 )
709 else
710 # meson < 0.46.0 does not support the depends arg in test targets.
711 # Just hope for the best.
712 test(
713 'complete-run',
714 perl,
715 args: [complete_run],
716 )
717 message('meson < 0.46 detected, you might need to run ninja test twice')
718 endif
0 # -*- mode: meson -*-
1
2 option('docs', type: 'boolean', value: false,
3 description: 'Build documentation from source (release tarballs contain a generated copy)')
4
5 option('mans', type: 'boolean', value: false,
6 description: 'Build manpages from source (release tarballs contain a generated copy)')
7
8 option('docdir', type: 'string', value: '',
9 description: 'documentation directory (default: $datadir/docs/i3)')
148148 -> call cmd_workspace_back_and_forth()
149149 'number'
150150 -> WORKSPACE_NUMBER
151 workspace = string
151 workspace = string
152152 -> call cmd_workspace_name($workspace, $no_auto_back_and_forth)
153153
154154 state WORKSPACE_NUMBER:
338338 new_name = string
339339 -> call cmd_rename_workspace($old_name, $new_name)
340340
341 # move <direction> [<pixels> [px]]
341
342 # move <direction> [<amount> [px|ppt]]
342343 # move [window|container] [to] workspace [<str>|next|prev|next_on_output|prev_on_output|current]
343344 # move [window|container] [to] output <str>
344345 # move [window|container] [to] mark <str>
345346 # move [window|container] [to] scratchpad
346347 # move workspace to [output] <str>
347348 # move scratchpad
348 # move [window|container] [to] [absolute] position [ [<pixels> [px] <pixels> [px]] | center ]
349 # move [window|container] [to] [absolute] position [ [<pos_x> [px|ppt] <pos_y> [px|ppt] ] | center ]
349350 # move [window|container] [to] position mouse|cursor|pointer
350351 state MOVE:
351352 'window'
372373 -> MOVE_TO_ABSOLUTE_POSITION
373374
374375 state MOVE_DIRECTION:
375 pixels = number
376 -> MOVE_DIRECTION_PX
377 end
378 -> call cmd_move_direction($direction, 10)
379
380 state MOVE_DIRECTION_PX:
381 'px'
382 -> call cmd_move_direction($direction, &pixels)
383 end
384 -> call cmd_move_direction($direction, &pixels)
376 amount = number
377 -> MOVE_DIRECTION_NUMBER
378 end
379 -> call cmd_move_direction($direction, 10, "px")
380
381 state MOVE_DIRECTION_NUMBER:
382 mode = 'px', 'ppt'
383 -> call cmd_move_direction($direction, &amount, $mode)
384 end
385 -> call cmd_move_direction($direction, &amount, "px")
385386
386387 state MOVE_WORKSPACE:
387388 'to '
426427 -> MOVE_TO_POSITION_X
427428
428429 state MOVE_TO_POSITION_X:
429 'px'
430 mode_x = 'px', 'ppt'
430431 ->
431432 coord_y = number
432433 -> MOVE_TO_POSITION_Y
433434
434435 state MOVE_TO_POSITION_Y:
435 'px', end
436 -> call cmd_move_window_to_position(&coord_x, &coord_y)
436 mode_y = 'px', 'ppt'
437 -> call cmd_move_window_to_position(&coord_x, $mode_x, &coord_y, $mode_y)
438 end
439 -> call cmd_move_window_to_position(&coord_x, $mode_x, &coord_y, 0)
437440
438441 # mode <string>
439442 state MODE:
471474
472475 # bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]
473476 state BAR:
474 bar_type = 'hidden_state'
477 'hidden_state'
475478 -> BAR_HIDDEN_STATE
476 bar_type = 'mode'
479 'mode'
477480 -> BAR_MODE
478481
479482 state BAR_HIDDEN_STATE:
480483 bar_value = 'hide', 'show', 'toggle'
481 -> BAR_W_ID
484 -> BAR_HIDDEN_STATE_ID
485
486 state BAR_HIDDEN_STATE_ID:
487 bar_id = word
488 ->
489 end
490 -> call cmd_bar_hidden_state($bar_value, $bar_id)
482491
483492 state BAR_MODE:
484493 bar_value = 'dock', 'hide', 'invisible', 'toggle'
485 -> BAR_W_ID
486
487 state BAR_W_ID:
494 -> BAR_MODE_ID
495
496 state BAR_MODE_ID:
488497 bar_id = word
489498 ->
490499 end
491 -> call cmd_bar($bar_type, $bar_value, $bar_id)
500 -> call cmd_bar_mode($bar_value, $bar_id)
00 #!/bin/zsh
11 # This script is used to prepare a new release of i3.
22
3 export RELEASE_VERSION="4.17"
4 export PREVIOUS_VERSION="4.16"
3 export RELEASE_VERSION="4.19"
4 export PREVIOUS_VERSION="4.18"
55 export RELEASE_BRANCH="next"
66
77 if [ ! -e "../i3.github.io" ]
5454 cp "${STARTDIR}/RELEASE-NOTES-${RELEASE_VERSION}" "RELEASE-NOTES-${RELEASE_VERSION}"
5555 git add RELEASE-NOTES-${RELEASE_VERSION}
5656 git rm RELEASE-NOTES-${PREVIOUS_VERSION}
57 sed -i "s,RELEASE-NOTES-${PREVIOUS_VERSION},RELEASE-NOTES-${RELEASE_VERSION},g" Makefile.am
58 sed -i "s/AC_INIT(\[i3\], \[${PREVIOUS_VERSION}\]/AC_INIT([i3], [${RELEASE_VERSION}]/" configure.ac
59 echo "${RELEASE_VERSION} ($(date +%F))" > I3_VERSION
60 git add I3_VERSION
57 sed -i "s/^\s*version: '${PREVIOUS_VERSION}'/ version: '${RELEASE_VERSION}'/" meson.build
6158 git commit -a -m "release i3 ${RELEASE_VERSION}"
6259 git tag "${RELEASE_VERSION}" -m "release i3 ${RELEASE_VERSION}" --sign --local-user=0x4AC8EE1D
6360
64 autoreconf -fi
6561 mkdir build
66 (cd build && ../configure && make dist-bzip2 -j8)
67 cp build/i3-${RELEASE_VERSION}.tar.bz2 .
62 (cd build && meson .. && ninja dist)
63 cp build/meson-build/i3-${RELEASE_VERSION}.tar.xz .
6864
6965 echo "Differences in the release tarball file lists:"
7066
71 diff -u \
72 <(tar tf ../i3-${PREVIOUS_VERSION}.tar.bz2 | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
73 <(tar tf i3-${RELEASE_VERSION}.tar.bz2 | sed "s,i3-${RELEASE_VERSION}/,,g" | sort) \
74 | colordiff
75
76
77 gpg --armor -b i3-${RELEASE_VERSION}.tar.bz2
67 diff --color -u \
68 <(tar tf ../i3-${PREVIOUS_VERSION}.tar.xz | sed "s,i3-${PREVIOUS_VERSION}/,,g" | sort) \
69 <(tar tf i3-${RELEASE_VERSION}.tar.xz | sed "s,i3-${RELEASE_VERSION}/,,g" | sort)
70
71 gpg --armor -b i3-${RELEASE_VERSION}.tar.xz
7872
7973 echo "${RELEASE_VERSION}-non-git" > I3_VERSION
8074 git add I3_VERSION
8175 git commit -a -m "Set non-git version to ${RELEASE_VERSION}-non-git."
8276
83 if [ "${RELEASE_BRANCH}" = "master" ]; then
84 git checkout master
77 if [ "${RELEASE_BRANCH}" = "stable" ]; then
78 git checkout stable
8579 git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'"
8680 git checkout next
87 git merge --no-ff -s recursive -X ours -X no-renames master -m "Merge branch 'master' into next"
81 git merge --no-ff -s recursive -X ours -X no-renames stable -m "Merge branch 'stable' into next"
8882 else
8983 git checkout next
9084 git merge --no-ff release-${RELEASE_VERSION} -m "Merge branch 'release-${RELEASE_VERSION}'"
91 git checkout master
92 git merge --no-ff -s recursive -X theirs -X no-renames next -m "Merge branch 'next' into master"
85 git checkout stable
86 git merge --no-ff -s recursive -X theirs -X no-renames next -m "Merge branch 'next' into stable"
9387 fi
9488
9589 git remote remove origin
9690 git remote add origin [email protected]:i3/i3.git
9791 git config --add remote.origin.push "+refs/tags/*:refs/tags/*"
9892 git config --add remote.origin.push "+refs/heads/next:refs/heads/next"
99 git config --add remote.origin.push "+refs/heads/master:refs/heads/master"
93 git config --add remote.origin.push "+refs/heads/stable:refs/heads/stable"
10094
10195 ################################################################################
10296 # Section 2: Debian packaging
114108 FROM debian:sid
115109 RUN sed -i 's,^deb \(.*\),deb \1\ndeb-src \1,g' /etc/apt/sources.list
116110 RUN apt-get update && apt-get install -y dpkg-dev devscripts
117 COPY i3/i3-${RELEASE_VERSION}.tar.bz2 /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.bz2
111 COPY i3/i3-${RELEASE_VERSION}.tar.xz /usr/src/i3-wm_${RELEASE_VERSION}.orig.tar.xz
118112 WORKDIR /usr/src/
119 RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.bz2
113 RUN tar xf i3-wm_${RELEASE_VERSION}.orig.tar.xz
120114 WORKDIR /usr/src/i3-${RELEASE_VERSION}
121115 COPY i3/debian /usr/src/i3-${RELEASE_VERSION}/debian/
122116 RUN mkdir debian/source
129123 EOT
130124
131125 CONTAINER_NAME=$(echo "i3-${TMPDIR}" | sed 's,/,,g')
132 docker build -t i3 .
126 docker build --no-cache -t i3 .
133127 for file in $(docker run --name "${CONTAINER_NAME}" i3 /bin/sh -c "ls /usr/src/i3*_${RELEASE_VERSION}*")
134128 do
135129 docker cp "${CONTAINER_NAME}:${file}" ${TMPDIR}/debian/
160154 git add docs/${PREVIOUS_VERSION}
161155 git commit -a -m "save docs for ${PREVIOUS_VERSION}"
162156
163 cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.bz2* downloads/
164 git add downloads/i3-${RELEASE_VERSION}.tar.bz2*
157 cp ${TMPDIR}/i3/i3-${RELEASE_VERSION}.tar.xz* downloads/
158 git add downloads/i3-${RELEASE_VERSION}.tar.xz*
165159 cp ${TMPDIR}/i3/RELEASE-NOTES-${RELEASE_VERSION} downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
166160 git add downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt
167161 sed -i "s,<h2>Documentation for i3 v[^<]*</h2>,<h2>Documentation for i3 v${RELEASE_VERSION}</h2>,g" docs/index.html
168162 sed -i "s,<span style=\"margin-left: 2em; color: #c0c0c0\">[^<]*</span>,<span style=\"margin-left: 2em; color: #c0c0c0\">${RELEASE_VERSION}</span>,g" index.html
169163 sed -i "s,The current stable version is .*$,The current stable version is ${RELEASE_VERSION}.,g" downloads/index.html
170 sed -i "s,<tbody>,<tbody>\n <tr>\n <td>${RELEASE_VERSION}</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.bz2\">i3-${RELEASE_VERSION}.tar.bz2</a></td>\n <td>$(LC_ALL=en_US.UTF-8 ls -lh ../i3/i3-${RELEASE_VERSION}.tar.bz2 | awk -F " " {'print $5'} | sed 's/K$/ KiB/g' | sed 's/M$/ MiB/g')</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.bz2.asc\">signature</a></td>\n <td>$(date +'%Y-%m-%d')</td>\n <td><a href=\"/downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt\">release notes</a></td>\n </tr>\n,g" downloads/index.html
164 sed -i "s,<tbody>,<tbody>\n <tr>\n <td>${RELEASE_VERSION}</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.xz\">i3-${RELEASE_VERSION}.tar.xz</a></td>\n <td>$(LC_ALL=en_US.UTF-8 ls -lh ../i3/i3-${RELEASE_VERSION}.tar.xz | awk -F " " {'print $5'} | sed 's/K$/ KiB/g' | sed 's/M$/ MiB/g')</td>\n <td><a href=\"/downloads/i3-${RELEASE_VERSION}.tar.xz.asc\">signature</a></td>\n <td>$(date +'%Y-%m-%d')</td>\n <td><a href=\"/downloads/RELEASE-NOTES-${RELEASE_VERSION}.txt\">release notes</a></td>\n </tr>\n,g" downloads/index.html
171165
172166 git commit -a -m "add ${RELEASE_VERSION} release"
173167
77 */
88 #include "all.h"
99
10 #include <math.h>
11
12 #include <xkbcommon/xkbcommon-x11.h>
1013 #include <xkbcommon/xkbcommon.h>
11 #include <xkbcommon/xkbcommon-x11.h>
1214
1315 static struct xkb_context *xkb_context;
1416 static struct xkb_keymap *xkb_keymap;
625627
626628 ungrab_all_keys(conn);
627629 bindings = mode->bindings;
630 current_binding_mode = mode->name;
628631 translate_keysyms();
629632 grab_all_keys(conn);
630633
99 #include "all.h"
1010
1111 #include <time.h>
12 #include <math.h>
13
14 #include <xcb/xcb_icccm.h>
15
16 #include <X11/XKBlib.h>
1712
1813 typedef enum { CLICK_BORDER = 0,
1914 CLICK_DECORATION = 1,
276271
277272 /* 7: floating modifier pressed, initiate a resize */
278273 if (dest == CLICK_INSIDE && mod_pressed && is_right_click) {
279 floating_mod_on_tiled_client(con, event);
274 if (floating_mod_on_tiled_client(con, event)) {
275 return;
276 }
280277 /* Avoid propagating events to clients, since the user expects
281 * $mod + click to be handled by i3. */
278 * $mod+click to be handled by i3. */
279 xcb_allow_events(conn, XCB_ALLOW_ASYNC_POINTER, event->time);
280 xcb_flush(conn);
282281 return;
283282 }
284283 /* 8: otherwise, check for border/decoration clicks and resize */
285 else if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) &&
286 is_left_or_right_click) {
284 if ((dest == CLICK_BORDER || dest == CLICK_DECORATION) &&
285 is_left_or_right_click) {
287286 DLOG("Trying to resize (tiling)\n");
288287 tiling_resize(con, event, dest, dest == CLICK_DECORATION && !was_focused);
289288 }
77 *
88 */
99 #include "all.h"
10
10 #include "shmlog.h"
11
12 #include <fcntl.h>
1113 #include <stdint.h>
12 #include <float.h>
13 #include <stdarg.h>
1414 #include <unistd.h>
15 #include <fcntl.h>
16
17 #include "shmlog.h"
1815
1916 // Macros to make the YAJL API a bit easier to use.
2017 #define y(x, ...) (cmd_output->json_gen != NULL ? yajl_gen_##x(cmd_output->json_gen, ##__VA_ARGS__) : 0)
131128 */
132129 typedef struct owindow {
133130 Con *con;
134
135 TAILQ_ENTRY(owindow)
136 owindows;
131 TAILQ_ENTRY(owindow) owindows;
137132 } owindow;
138133
139134 typedef TAILQ_HEAD(owindows_head, owindow) owindows_head;
361356
362357 LOG("should move window to workspace %s\n", name);
363358 /* get the workspace */
364 Con *ws = workspace_get(name, NULL);
359 Con *ws = workspace_get(name);
365360
366361 if (no_auto_back_and_forth == NULL) {
367362 ws = maybe_auto_back_and_forth_workspace(ws);
392387
393388 Con *ws = get_existing_workspace_by_num(parsed_num);
394389 if (!ws) {
395 ws = workspace_get(which, NULL);
390 ws = workspace_get(which);
396391 }
397392
398393 if (no_auto_back_and_forth == NULL) {
14011396
14021397 CMD_FOCUS_WARN_CHILDREN;
14031398
1404 Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
1399 Con *__i3_scratch = workspace_get("__i3_scratch");
14051400 owindow *current;
14061401 TAILQ_FOREACH (current, &owindows, owindows) {
14071402 Con *ws = con_get_workspace(current->con);
14941489 }
14951490
14961491 /*
1497 * Implementation of 'move <direction> [<pixels> [px]]'.
1498 *
1499 */
1500 void cmd_move_direction(I3_CMD, const char *direction_str, long move_px) {
1492 * Implementation of 'move <direction> [<amount> [px|ppt]]'.
1493 *
1494 */
1495 void cmd_move_direction(I3_CMD, const char *direction_str, long amount, const char *mode) {
15011496 owindow *current;
15021497 HANDLE_EMPTY_MATCH;
15031498
15041499 Con *initially_focused = focused;
15051500 direction_t direction = parse_direction(direction_str);
15061501
1507 TAILQ_FOREACH (current, &owindows, owindows) {
1508 DLOG("moving in direction %s, px %ld\n", direction_str, move_px);
1502 const bool is_ppt = mode && strcmp(mode, "ppt") == 0;
1503
1504 DLOG("moving in direction %s, %ld %s\n", direction_str, amount, mode);
1505 TAILQ_FOREACH (current, &owindows, owindows) {
15091506 if (con_is_floating(current->con)) {
1510 DLOG("floating move with %ld pixels\n", move_px);
1507 DLOG("floating move with %ld %s\n", amount, mode);
15111508 Rect newrect = current->con->parent->rect;
1509 Con *output = con_get_output(current->con);
15121510
15131511 switch (direction) {
15141512 case D_LEFT:
1515 newrect.x -= move_px;
1513 newrect.x -= is_ppt ? output->rect.width * ((double)amount / 100.0) : amount;
15161514 break;
15171515 case D_RIGHT:
1518 newrect.x += move_px;
1516 newrect.x += is_ppt ? output->rect.width * ((double)amount / 100.0) : amount;
15191517 break;
15201518 case D_UP:
1521 newrect.y -= move_px;
1519 newrect.y -= is_ppt ? output->rect.height * ((double)amount / 100.0) : amount;
15221520 break;
15231521 case D_DOWN:
1524 newrect.y += move_px;
1522 newrect.y += is_ppt ? output->rect.height * ((double)amount / 100.0) : amount;
15251523 break;
15261524 }
15271525
16171615 */
16181616 void cmd_reload(I3_CMD) {
16191617 LOG("reloading\n");
1620 kill_nagbar(&config_error_nagbar_pid, false);
1621 kill_nagbar(&command_error_nagbar_pid, false);
1618
1619 kill_nagbar(config_error_nagbar_pid, false);
1620 kill_nagbar(command_error_nagbar_pid, false);
1621 /* start_nagbar() will refuse to start a new process if the passed pid is
1622 * set. This will happen when our child watcher is triggered by libev when
1623 * the loop re-starts. However, config errors might be detected before
1624 * that since we will read the config right now with load_configuration.
1625 * See #4104. */
1626 config_error_nagbar_pid = command_error_nagbar_pid = -1;
1627
16221628 load_configuration(NULL, C_RELOAD);
16231629 x_set_i3_atoms();
16241630 /* Send an IPC event just in case the ws names have changed */
16251631 ipc_send_workspace_event("reload", NULL, NULL);
1626 /* Send an update event for the barconfig just in case it has changed */
1627 update_barconfig();
1632 /* Send an update event for each barconfig just in case it has changed */
1633 Barconfig *current;
1634 TAILQ_FOREACH (current, &barconfigs, configs) {
1635 ipc_send_barconfig_update_event(current);
1636 }
16281637
16291638 // XXX: default reply for now, make this a better reply
16301639 ysuccess(true);
17141723 }
17151724
17161725 /*
1717 * Implementation of 'move [window|container] [to] [absolute] position <px> [px] <px> [px]
1718 *
1719 */
1720 void cmd_move_window_to_position(I3_CMD, long x, long y) {
1726 * Implementation of 'move [window|container] [to] [absolute] position [<pos_x> [px|ppt] <pos_y> [px|ppt]]
1727 *
1728 */
1729 void cmd_move_window_to_position(I3_CMD, long x, const char *mode_x, long y, const char *mode_y) {
17211730 bool has_error = false;
17221731
17231732 owindow *current;
17361745 }
17371746
17381747 Rect newrect = current->con->parent->rect;
1739
1740 DLOG("moving to position %ld %ld\n", x, y);
1741 newrect.x = x;
1742 newrect.y = y;
1748 Con *output = con_get_output(current->con);
1749
1750 newrect.x = mode_x && strcmp(mode_x, "ppt") == 0 ? output->rect.width * ((double)x / 100.0) : x;
1751 newrect.y = mode_y && strcmp(mode_y, "ppt") == 0 ? output->rect.height * ((double)y / 100.0) : y;
1752 DLOG("moving to position %d %s %d %s\n", newrect.x, mode_x, newrect.y, mode_y);
17431753
17441754 if (!floating_reposition(current->con->parent, newrect)) {
17451755 yerror("Cannot move window/container out of bounds.");
20172027 con_attach(workspace, parent, false);
20182028 ipc_send_workspace_event("rename", workspace, NULL);
20192029
2020 /* Move the workspace to the correct output if it has an assignment */
2021 struct Workspace_Assignment *assignment = NULL;
2022 TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
2023 if (assignment->output == NULL)
2024 continue;
2025 if (strcmp(assignment->name, workspace->name) != 0 && (!name_is_digits(assignment->name) || ws_name_to_number(assignment->name) != workspace->num)) {
2026 continue;
2027 }
2028
2029 Output *target_output = get_output_by_name(assignment->output, true);
2030 if (!target_output) {
2031 LOG("Could not get output named \"%s\"\n", assignment->output);
2032 continue;
2033 }
2034 if (!output_triggers_assignment(target_output, assignment)) {
2035 continue;
2036 }
2037 workspace_move_to_output(workspace, target_output);
2038
2039 break;
2030 Con *assigned = get_assigned_output(workspace->name, workspace->num);
2031 if (assigned) {
2032 workspace_move_to_output(workspace, get_output_for_con(assigned));
20402033 }
20412034
20422035 bool can_restore_focus = previously_focused != NULL;
20772070 * Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]'
20782071 *
20792072 */
2080 static bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
2073 void cmd_bar_mode(I3_CMD, const char *bar_mode, const char *bar_id) {
20812074 int mode = M_DOCK;
20822075 bool toggle = false;
20832076 if (strcmp(bar_mode, "dock") == 0)
20902083 toggle = true;
20912084 else {
20922085 ELOG("Unknown bar mode \"%s\", this is a mismatch between code and parser spec.\n", bar_mode);
2093 return false;
2094 }
2095
2096 bool changed_sth = false;
2086 assert(false);
2087 }
2088
2089 if (TAILQ_EMPTY(&barconfigs)) {
2090 yerror("No bars found\n");
2091 return;
2092 }
2093
20972094 Barconfig *current = NULL;
20982095 TAILQ_FOREACH (current, &barconfigs, configs) {
2099 if (bar_id && strcmp(current->id, bar_id) != 0)
2096 if (bar_id && strcmp(current->id, bar_id) != 0) {
21002097 continue;
2101
2102 if (toggle)
2098 }
2099
2100 if (toggle) {
21032101 mode = (current->mode + 1) % 2;
2104
2105 DLOG("Changing bar mode of bar_id '%s' to '%s (%d)'\n", current->id, bar_mode, mode);
2106 current->mode = mode;
2107 changed_sth = true;
2108
2109 if (bar_id)
2110 break;
2111 }
2112
2113 if (bar_id && !changed_sth) {
2114 DLOG("Changing bar mode of bar_id %s failed, bar_id not found.\n", bar_id);
2115 return false;
2116 }
2117
2118 return true;
2102 }
2103
2104 DLOG("Changing bar mode of bar_id '%s' from '%d' to '%s (%d)'\n",
2105 current->id, current->mode, bar_mode, mode);
2106 if ((int)current->mode != mode) {
2107 current->mode = mode;
2108 ipc_send_barconfig_update_event(current);
2109 }
2110
2111 if (bar_id) {
2112 /* We are looking for a specific bar and we found it */
2113 ysuccess(true);
2114 return;
2115 }
2116 }
2117
2118 if (bar_id) {
2119 /* We are looking for a specific bar and we did not find it */
2120 yerror("Changing bar mode of bar_id %s failed, bar_id not found.\n", bar_id);
2121 } else {
2122 /* We have already handled the case of no bars, so we must have
2123 * updated all active bars now. */
2124 ysuccess(true);
2125 }
21192126 }
21202127
21212128 /*
21222129 * Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]'
21232130 *
21242131 */
2125 static bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_id) {
2132 void cmd_bar_hidden_state(I3_CMD, const char *bar_hidden_state, const char *bar_id) {
21262133 int hidden_state = S_SHOW;
21272134 bool toggle = false;
21282135 if (strcmp(bar_hidden_state, "hide") == 0)
21332140 toggle = true;
21342141 else {
21352142 ELOG("Unknown bar state \"%s\", this is a mismatch between code and parser spec.\n", bar_hidden_state);
2136 return false;
2137 }
2138
2139 bool changed_sth = false;
2143 assert(false);
2144 }
2145
2146 if (TAILQ_EMPTY(&barconfigs)) {
2147 yerror("No bars found\n");
2148 return;
2149 }
2150
21402151 Barconfig *current = NULL;
21412152 TAILQ_FOREACH (current, &barconfigs, configs) {
2142 if (bar_id && strcmp(current->id, bar_id) != 0)
2153 if (bar_id && strcmp(current->id, bar_id) != 0) {
21432154 continue;
2144
2145 if (toggle)
2155 }
2156
2157 if (toggle) {
21462158 hidden_state = (current->hidden_state + 1) % 2;
2147
2148 DLOG("Changing bar hidden_state of bar_id '%s' to '%s (%d)'\n", current->id, bar_hidden_state, hidden_state);
2149 current->hidden_state = hidden_state;
2150 changed_sth = true;
2151
2152 if (bar_id)
2153 break;
2154 }
2155
2156 if (bar_id && !changed_sth) {
2157 DLOG("Changing bar hidden_state of bar_id %s failed, bar_id not found.\n", bar_id);
2158 return false;
2159 }
2160
2161 return true;
2162 }
2163
2164 /*
2165 * Implementation of 'bar (hidden_state hide|show|toggle)|(mode dock|hide|invisible|toggle) [<bar_id>]'
2166 *
2167 */
2168 void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id) {
2169 bool ret;
2170 if (strcmp(bar_type, "mode") == 0)
2171 ret = cmd_bar_mode(bar_value, bar_id);
2172 else if (strcmp(bar_type, "hidden_state") == 0)
2173 ret = cmd_bar_hidden_state(bar_value, bar_id);
2174 else {
2175 ELOG("Unknown bar option type \"%s\", this is a mismatch between code and parser spec.\n", bar_type);
2176 ret = false;
2177 }
2178
2179 ysuccess(ret);
2180 if (!ret)
2181 return;
2182
2183 update_barconfig();
2159 }
2160
2161 DLOG("Changing bar hidden_state of bar_id '%s' from '%d' to '%s (%d)'\n",
2162 current->id, current->hidden_state, bar_hidden_state, hidden_state);
2163 if ((int)current->hidden_state != hidden_state) {
2164 current->hidden_state = hidden_state;
2165 ipc_send_barconfig_update_event(current);
2166 }
2167
2168 if (bar_id) {
2169 /* We are looking for a specific bar and we found it */
2170 ysuccess(true);
2171 return;
2172 }
2173 }
2174
2175 if (bar_id) {
2176 /* We are looking for a specific bar and we did not find it */
2177 yerror("Changing bar hidden_state of bar_id %s failed, bar_id not found.\n", bar_id);
2178 } else {
2179 /* We have already handled the case of no bars, so we must have
2180 * updated all active bars now. */
2181 ysuccess(true);
2182 }
21842183 }
21852184
21862185 /*
22432242 int pixels = logical_px(atoi(value));
22442243 Con *workspace = con_get_workspace(focused);
22452244
2246 #define CMD_GAPS(type) \
2245 #define CMD_SET_GAPS_VALUE(type, value, reset) \
22472246 do { \
2248 int current_value = config.gaps.type; \
2249 if (strcmp(scope, "current") == 0) \
2250 current_value += workspace->gaps.type; \
2251 \
2252 bool reset = false; \
2253 if (!strcmp(mode, "plus")) \
2254 current_value += pixels; \
2255 else if (!strcmp(mode, "minus")) \
2256 current_value -= pixels; \
2257 else if (!strcmp(mode, "set")) { \
2258 current_value = pixels; \
2259 reset = true; \
2260 } else if (!strcmp(mode, "toggle")) { \
2261 current_value = !current_value * pixels; \
2262 reset = true; \
2263 } else { \
2264 ELOG("Invalid mode %s when changing gaps", mode); \
2265 ysuccess(false); \
2266 return; \
2267 } \
2268 \
2269 if (current_value < 0) \
2270 current_value = 0; \
2271 \
22722247 if (!strcmp(scope, "all")) { \
22732248 Con *output, *cur_ws = NULL; \
22742249 TAILQ_FOREACH (output, &(croot->nodes_head), nodes) { \
22762251 TAILQ_FOREACH (cur_ws, &(content->nodes_head), nodes) { \
22772252 if (reset) \
22782253 cur_ws->gaps.type = 0; \
2279 else if (current_value + cur_ws->gaps.type < 0) \
2280 cur_ws->gaps.type = -current_value; \
2254 else if (value + cur_ws->gaps.type < 0) \
2255 cur_ws->gaps.type = -value; \
22812256 } \
22822257 } \
22832258 \
2284 config.gaps.type = current_value; \
2259 config.gaps.type = value; \
22852260 } else { \
2286 workspace->gaps.type = current_value - config.gaps.type; \
2261 workspace->gaps.type = value - config.gaps.type; \
22872262 } \
22882263 } while (0)
22892264
2265 #define CMD_GAPS(type) \
2266 do { \
2267 int current_value = config.gaps.type; \
2268 if (strcmp(scope, "current") == 0) \
2269 current_value += workspace->gaps.type; \
2270 \
2271 bool reset = false; \
2272 if (!strcmp(mode, "plus")) \
2273 current_value += pixels; \
2274 else if (!strcmp(mode, "minus")) \
2275 current_value -= pixels; \
2276 else if (!strcmp(mode, "set")) { \
2277 current_value = pixels; \
2278 reset = true; \
2279 } else if (!strcmp(mode, "toggle")) { \
2280 current_value = !current_value * pixels; \
2281 reset = true; \
2282 } else { \
2283 ELOG("Invalid mode %s when changing gaps", mode); \
2284 ysuccess(false); \
2285 return; \
2286 } \
2287 \
2288 /* see issue 262 */ \
2289 int min_value = 0; \
2290 if (strcmp(#type, "inner") != 0) { \
2291 min_value = strcmp(scope, "all") ? -config.gaps.inner - workspace->gaps.inner : -config.gaps.inner; \
2292 } \
2293 \
2294 if (current_value < min_value) \
2295 current_value = min_value; \
2296 \
2297 CMD_SET_GAPS_VALUE(type, current_value, reset); \
2298 } while (0)
2299
2300 #define CMD_UPDATE_GAPS(type) \
2301 do { \
2302 if (!strcmp(scope, "all")) { \
2303 if (config.gaps.type + config.gaps.inner < 0) \
2304 CMD_SET_GAPS_VALUE(type, -config.gaps.inner, true); \
2305 } else { \
2306 if (config.gaps.type + workspace->gaps.type + config.gaps.inner + workspace->gaps.inner < 0) { \
2307 CMD_SET_GAPS_VALUE(type, -config.gaps.inner - workspace->gaps.inner, true); \
2308 } \
2309 } \
2310 } while (0)
2311
22902312 if (!strcmp(type, "inner")) {
22912313 CMD_GAPS(inner);
2314 // update inconsistent values
2315 CMD_UPDATE_GAPS(top);
2316 CMD_UPDATE_GAPS(bottom);
2317 CMD_UPDATE_GAPS(right);
2318 CMD_UPDATE_GAPS(left);
22922319 } else if (!strcmp(type, "outer")) {
22932320 CMD_GAPS(top);
22942321 CMD_GAPS(bottom);
2323 *
2424 */
2525 #include "all.h"
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <unistd.h>
31 #include <stdbool.h>
32 #include <stdint.h>
3326
3427 // Macros to make the YAJL API a bit easier to use.
3528 #define y(x, ...) (command_output.json_gen != NULL ? yajl_gen_##x(command_output.json_gen, ##__VA_ARGS__) : 0)
99 *
1010 */
1111 #include "all.h"
12
1312 #include "yajl_utils.h"
1413
1514 static void con_on_remove_child(Con *con);
9190 FREE(mark->name);
9291 FREE(mark);
9392 }
93 DLOG("con %p freed\n", con);
9494 free(con);
95 DLOG("con %p freed\n", con);
9695 }
9796
9897 static void _con_attach(Con *con, Con *parent, Con *previous, bool ignore_focus) {
514513 struct bfs_entry {
515514 Con *con;
516515
517 TAILQ_ENTRY(bfs_entry)
518 entries;
516 TAILQ_ENTRY(bfs_entry) entries;
519517 };
520518
521519 /*
527525
528526 /* TODO: is breadth-first-search really appropriate? (check as soon as
529527 * fullscreen levels and fullscreen for containers is implemented) */
530 TAILQ_HEAD(bfs_head, bfs_entry)
531 bfs_head = TAILQ_HEAD_INITIALIZER(bfs_head);
532
528 TAILQ_HEAD(bfs_head, bfs_entry) bfs_head = TAILQ_HEAD_INITIALIZER(bfs_head);
533529 struct bfs_entry *entry = smalloc(sizeof(struct bfs_entry));
534530 entry->con = con;
535531 TAILQ_INSERT_TAIL(&bfs_head, entry, entries);
12611257 }
12621258
12631259 /* If moving a fullscreen container and the destination already has a
1264 * fullscreen window on it, un-fullscreen the target's fullscreen con. */
1260 * fullscreen window on it, un-fullscreen the target's fullscreen con.
1261 * con->fullscreen_mode is not enough in some edge cases:
1262 * 1. con is CT_FLOATING_CON, child is fullscreen.
1263 * 2. con is the parent of a fullscreen container, can be triggered by
1264 * moving the parent with command criteria.
1265 */
12651266 Con *fullscreen = con_get_fullscreen_con(target_ws, CF_OUTPUT);
1266 if (con->fullscreen_mode != CF_NONE && fullscreen != NULL) {
1267 const bool con_has_fullscreen = con->fullscreen_mode != CF_NONE ||
1268 con_get_fullscreen_con(con, CF_GLOBAL) ||
1269 con_get_fullscreen_con(con, CF_OUTPUT);
1270 if (con_has_fullscreen && fullscreen != NULL) {
12671271 con_toggle_fullscreen(fullscreen, CF_OUTPUT);
12681272 fullscreen = NULL;
12691273 }
13621366 }
13631367
13641368 /* For target containers in the scratchpad, we just send the window to the scratchpad. */
1365 if (con_get_workspace(target) == workspace_get("__i3_scratch", NULL)) {
1369 if (con_get_workspace(target) == workspace_get("__i3_scratch")) {
13661370 DLOG("target container is in the scratchpad, moving container to scratchpad.\n");
13671371 scratchpad_move(con);
13681372 return true;
23722376 char *formatted_str = format_placeholders(con->title_format, &placeholders[0], num);
23732377 i3String *formatted = i3string_from_utf8(formatted_str);
23742378 i3string_set_markup(formatted, pango_markup);
2375 FREE(formatted_str);
2376
2377 for (size_t i = 0; i < num; i++) {
2378 FREE(placeholders[i].value);
2379 }
2379
2380 free(formatted_str);
2381 free(title);
2382 free(class);
2383 free(instance);
23802384
23812385 return formatted;
23822386 }
2525 void ungrab_all_keys(xcb_connection_t *conn) {
2626 DLOG("Ungrabbing all keys\n");
2727 xcb_ungrab_key(conn, XCB_GRAB_ANY, root, XCB_BUTTON_MASK_ANY);
28 }
29
30 /*
31 * Sends the current bar configuration as an event to all barconfig_update listeners.
32 *
33 */
34 void update_barconfig(void) {
35 Barconfig *current;
36 TAILQ_FOREACH (current, &barconfigs, configs) {
37 ipc_send_barconfig_update_event(current);
38 }
3928 }
4029
4130 static void free_configuration(void) {
184173 SLIST_INSERT_HEAD(&modes, default_mode, modes);
185174
186175 bindings = default_mode->bindings;
176 current_binding_mode = default_mode->name;
187177
188178 /* Clear the old config or initialize the data structure */
189179 memset(&config, 0, sizeof(config));
77 *
88 */
99 #include "all.h"
10
11 #include <float.h>
12 #include <stdarg.h>
1310
1411 /*******************************************************************************
1512 * Criteria functions.
2424 */
2525 #include "all.h"
2626
27 #include <fcntl.h>
28 #include <stdbool.h>
29 #include <stdint.h>
2730 #include <stdio.h>
2831 #include <stdlib.h>
2932 #include <string.h>
30 #include <unistd.h>
31 #include <stdbool.h>
32 #include <stdint.h>
33 #include <sys/stat.h>
3334 #include <sys/types.h>
3435 #include <sys/wait.h>
35 #include <sys/stat.h>
36 #include <fcntl.h>
36 #include <unistd.h>
37
3738 #include <xcb/xcb_xrm.h>
3839
3940 // Macros to make the YAJL API a bit easier to use.
99 */
1010 #include "all.h"
1111
12 #include <sys/types.h>
13 #include <sys/stat.h>
14 #include <sys/wait.h>
15 #include <sys/socket.h>
16 #include <sys/un.h>
1712 #include <fcntl.h>
1813 #include <time.h>
14 #include <unistd.h>
1915
2016 static bool human_readable_key, loaded_config_file_name_key;
2117 static char *human_readable_version, *loaded_config_file_name;
77 *
88 */
99 #include "all.h"
10
11 #include "i3-atoms_NET_SUPPORTED.xmacro.h"
1012
1113 xcb_window_t ewmh_window;
1214
304306 void ewmh_setup_hints(void) {
305307 xcb_atom_t supported_atoms[] = {
306308 #define xmacro(atom) A_##atom,
307 #include "atoms_NET_SUPPORTED.xmacro"
309 I3_NET_SUPPORTED_ATOMS_XMACRO
308310 #undef xmacro
309311 };
310312
77 *
88 */
99 #include "all.h"
10
11 #include <math.h>
1012
1113 #ifndef MAX
1214 #define MAX(x, y) ((x) > (y) ? (x) : (y))
220222 }
221223 }
222224
223 void floating_enable(Con *con, bool automatic) {
225 bool floating_enable(Con *con, bool automatic) {
224226 bool set_focus = (con == focused);
225227
226228 if (con_is_docked(con)) {
227229 LOG("Container is a dock window, not enabling floating mode.\n");
228 return;
230 return false;
229231 }
230232
231233 if (con_is_floating(con)) {
232234 LOG("Container is already in floating mode, not doing anything.\n");
233 return;
235 return false;
234236 }
235237
236238 if (con->type == CT_WORKSPACE) {
237239 LOG("Container is a workspace, not enabling floating mode.\n");
238 return;
240 return false;
239241 }
240242
241243 Con *focus_head_placeholder = NULL;
418420
419421 floating_set_hint_atom(nc, true);
420422 ipc_send_window_event("floating", con);
423 return true;
421424 }
422425
423426 void floating_disable(Con *con) {
99 */
1010 #include "all.h"
1111
12 #include <sys/time.h>
1213 #include <time.h>
13 #include <float.h>
14 #include <sys/time.h>
14
1515 #include <xcb/randr.h>
1616 #define SN_API_NOT_YET_FROZEN 1
1717 #include <libsn/sn-monitor.h>
726726 return;
727727 }
728728
729 if (con_is_internal(ws) && ws != workspace_get("__i3_scratch", NULL)) {
729 if (con_is_internal(ws) && ws != workspace_get("__i3_scratch")) {
730730 DLOG("Workspace is internal but not scratchpad, ignoring _NET_ACTIVE_WINDOW\n");
731731 return;
732732 }
840840 * let's float it and make it sticky. */
841841 DLOG("The window was requested to be visible on all workspaces, making it sticky and floating.\n");
842842
843 floating_enable(con, false);
844 con->floating = FLOATING_AUTO_ON;
845
846 con->sticky = true;
847 ewmh_update_sticky(con->window->id, true);
848 output_push_sticky_windows(focused);
843 if (floating_enable(con, false)) {
844 con->floating = FLOATING_AUTO_ON;
845
846 con->sticky = true;
847 ewmh_update_sticky(con->window->id, true);
848 output_push_sticky_windows(focused);
849 }
849850 } else {
850851 Con *ws = ewmh_get_workspace_by_index(index);
851852 if (ws == NULL) {
66 * ipc.c: UNIX domain socket IPC (initialization, client handling, protocol).
77 *
88 */
9
910 #include "all.h"
10
1111 #include "yajl_utils.h"
1212
13 #include <ev.h>
14 #include <fcntl.h>
15 #include <libgen.h>
16 #include <locale.h>
1317 #include <stdint.h>
1418 #include <sys/socket.h>
1519 #include <sys/un.h>
16 #include <fcntl.h>
17 #include <libgen.h>
18 #include <ev.h>
20 #include <unistd.h>
21
1922 #include <yajl/yajl_gen.h>
2023 #include <yajl/yajl_parse.h>
2124
2225 char *current_socketpath = NULL;
2326
24 TAILQ_HEAD(ipc_client_head, ipc_client)
25 all_clients = TAILQ_HEAD_INITIALIZER(all_clients);
27 TAILQ_HEAD(ipc_client_head, ipc_client) all_clients = TAILQ_HEAD_INITIALIZER(all_clients);
2628
2729 /*
2830 * Puts the given socket file descriptor into non-blocking mode or dies if
13621364 ipc_send_client_message(client, strlen(reply), I3_IPC_REPLY_TYPE_SYNC, (const uint8_t *)reply);
13631365 }
13641366
1367 IPC_HANDLER(get_binding_state) {
1368 yajl_gen gen = ygenalloc();
1369
1370 y(map_open);
1371
1372 ystr("name");
1373 ystr(current_binding_mode);
1374
1375 y(map_close);
1376
1377 const unsigned char *payload;
1378 ylength length;
1379 y(get_buf, &payload, &length);
1380
1381 ipc_send_client_message(client, length, I3_IPC_REPLY_TYPE_GET_BINDING_STATE, payload);
1382 y(free);
1383 }
1384
13651385 /* The index of each callback function corresponds to the numeric
13661386 * value of the message type (see include/i3/ipc.h) */
1367 handler_t handlers[12] = {
1387 handler_t handlers[13] = {
13681388 handle_run_command,
13691389 handle_get_workspaces,
13701390 handle_subscribe,
13771397 handle_get_config,
13781398 handle_send_tick,
13791399 handle_sync,
1400 handle_get_binding_state,
13801401 };
13811402
13821403 /*
99 */
1010 #include "all.h"
1111
12 #include <yajl/yajl_common.h>
13 #include <yajl/yajl_gen.h>
12 #include <locale.h>
13
1414 #include <yajl/yajl_parse.h>
15 #include <yajl/yajl_version.h>
1615
1716 /* TODO: refactor the whole parsing thing */
1817
4544 * array. */
4645 struct focus_mapping {
4746 int old_id;
48
49 TAILQ_ENTRY(focus_mapping)
50 focus_mappings;
47 TAILQ_ENTRY(focus_mapping) focus_mappings;
5148 };
5249
5350 static TAILQ_HEAD(focus_mappings_head, focus_mapping) focus_mappings =
88 */
99 #include <config.h>
1010
11 #include "all.h"
12 #include "shmlog.h"
13
14 #include <errno.h>
15 #include <fcntl.h>
1116 #include <stdarg.h>
17 #include <stdbool.h>
1218 #include <stdio.h>
19 #include <stdlib.h>
1320 #include <string.h>
14 #include <stdbool.h>
15 #include <stdlib.h>
21 #include <sys/mman.h>
22 #include <sys/stat.h>
1623 #include <sys/time.h>
1724 #include <unistd.h>
18 #include <fcntl.h>
19 #include <sys/mman.h>
20 #include <sys/stat.h>
21 #include <errno.h>
2225 #if !defined(__OpenBSD__)
2326 #include <pthread.h>
2427 #endif
25
26 #include "util.h"
27 #include "log.h"
28 #include "i3.h"
29 #include "libi3.h"
30 #include "shmlog.h"
3128
3229 #if defined(__APPLE__)
3330 #include <sys/sysctl.h>
77 *
88 */
99 #include "all.h"
10 #include "shmlog.h"
1011
1112 #include <ev.h>
1213 #include <fcntl.h>
14 #include <getopt.h>
15 #include <libgen.h>
16 #include <locale.h>
17 #include <signal.h>
18 #include <sys/mman.h>
19 #include <sys/resource.h>
20 #include <sys/socket.h>
21 #include <sys/stat.h>
22 #include <sys/time.h>
1323 #include <sys/types.h>
14 #include <sys/socket.h>
1524 #include <sys/un.h>
16 #include <sys/time.h>
17 #include <sys/resource.h>
18 #include <sys/mman.h>
19 #include <sys/stat.h>
20 #include <libgen.h>
21 #include "shmlog.h"
25 #include <unistd.h>
2226
2327 #ifdef I3_ASAN_ENABLED
2428 #include <sanitizer/lsan_interface.h>
2529 #endif
2630
2731 #include "sd-daemon.h"
32
33 #include "i3-atoms_NET_SUPPORTED.xmacro.h"
34 #include "i3-atoms_rest.xmacro.h"
2835
2936 /* The original value of RLIMIT_CORE when i3 was started. We need to restore
3037 * this before starting any other process, since we set RLIMIT_CORE to
7178
7279 /* The list of key bindings */
7380 struct bindings_head *bindings;
81 const char *current_binding_mode = NULL;
7482
7583 /* The list of exec-lines */
7684 struct autostarts_head autostarts = TAILQ_HEAD_INITIALIZER(autostarts);
93101
94102 /* Define all atoms as global variables */
95103 #define xmacro(atom) xcb_atom_t A_##atom;
96 #include "atoms.xmacro"
104 I3_NET_SUPPORTED_ATOMS_XMACRO
105 I3_REST_ATOMS_XMACRO
97106 #undef xmacro
98107
99108 /*
172181 ipc_shutdown(SHUTDOWN_REASON_EXIT, -1);
173182 unlink(config.ipc_socket_path);
174183 xcb_disconnect(conn);
184
185 /* If a nagbar is active, kill it */
186 kill_nagbar(config_error_nagbar_pid, false);
187 kill_nagbar(command_error_nagbar_pid, false);
175188
176189 /* We need ev >= 4 for the following code. Since it is not *that* important (it
177190 * only makes sure that there are no i3-nagbar instances left behind) we still
371384 char *socket_path = root_atom_contents("I3_SOCKET_PATH", NULL, 0);
372385 if (socket_path) {
373386 printf("%s\n", socket_path);
387 /* With -O2 (i.e. the buildtype=debugoptimized meson
388 * option, which we set by default), gcc 9.2.1 optimizes
389 * away socket_path at this point, resulting in a Leak
390 * Sanitizer report. An explicit free helps: */
391 free(socket_path);
374392 exit(EXIT_SUCCESS);
375393 }
376394
554572 /* Place requests for the atoms we need as soon as possible */
555573 #define xmacro(atom) \
556574 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
557 #include "atoms.xmacro"
575 I3_NET_SUPPORTED_ATOMS_XMACRO
576 I3_REST_ATOMS_XMACRO
558577 #undef xmacro
559578
560579 root_depth = root_screen->root_depth;
600619 A_##name = reply->atom; \
601620 free(reply); \
602621 } while (0);
603 #include "atoms.xmacro"
622 I3_NET_SUPPORTED_ATOMS_XMACRO
623 I3_REST_ATOMS_XMACRO
604624 #undef xmacro
605625
606626 load_configuration(override_configpath, C_LOAD);
77 *
88 */
99 #include "all.h"
10
11 #include "yajl_utils.h"
12
13 #include <yajl/yajl_gen.h>
1410
1511 /*
1612 * Match frame and window depth. This is needed because X will refuse to reparent a
273269 DLOG("Initial geometry: (%d, %d, %d, %d)\n", geom->x, geom->y, geom->width, geom->height);
274270
275271 /* See if any container swallows this new window */
272 cwindow->swallowed = false;
276273 Match *match = NULL;
277274 Con *nc = con_for_window(search_at, cwindow, &match);
278275 const bool match_from_restart_mode = (match && match->restart_mode);
294291 /* A_TO_WORKSPACE type assignment or fallback from A_TO_WORKSPACE_NUMBER
295292 * when the target workspace number does not exist yet. */
296293 if (!assigned_ws) {
297 assigned_ws = workspace_get(assignment->dest.workspace, NULL);
294 assigned_ws = workspace_get(assignment->dest.workspace);
298295 }
299296
300297 nc = con_descend_tiling_focused(assigned_ws);
325322 } else if (startup_ws) {
326323 /* If it was started on a specific workspace, we want to open it there. */
327324 DLOG("Using workspace on which this application was started (%s)\n", startup_ws);
328 nc = con_descend_tiling_focused(workspace_get(startup_ws, NULL));
325 nc = con_descend_tiling_focused(workspace_get(startup_ws));
329326 DLOG("focused on ws %s: %p / %s\n", startup_ws, nc, nc->name);
330327 if (nc->type == CT_WORKSPACE)
331328 nc = tree_open_con(nc, cwindow);
361358 match_free(match);
362359 FREE(match);
363360 }
361
362 cwindow->swallowed = true;
364363 }
365364
366365 DLOG("new container = %p\n", nc);
536535 * was not specified */
537536 bool automatic_border = (motif_border_style == BS_NORMAL);
538537
539 floating_enable(nc, automatic_border);
540 nc->floating = FLOATING_AUTO_ON;
538 if (floating_enable(nc, automatic_border)) {
539 nc->floating = FLOATING_AUTO_ON;
540 }
541541 }
542542
543543 /* explicitly set the border width to the default */
697697 *
698698 */
699699 Con *remanage_window(Con *con) {
700 /* Make sure this windows hasn't already been swallowed. */
701 if (con->window->swallowed) {
702 run_assignments(con->window);
703 return con;
704 }
700705 Match *match;
701706 Con *nc = con_for_window(croot, con->window, &match);
702707 if (nc == NULL || nc->window == NULL || nc->window == con->window) {
742747 ewmh_update_wm_desktop();
743748 }
744749
750 nc->window->swallowed = true;
745751 return nc;
746752 }
1111 #include "all.h"
1212
1313 #include <time.h>
14
1415 #include <xcb/randr.h>
1516
1617 /* Pointer to the result of the query for primary output */
4950 Output *output;
5051 bool get_primary = (strcasecmp("primary", name) == 0);
5152 TAILQ_FOREACH (output, &outputs, outputs) {
53 if (require_active && !output->active) {
54 continue;
55 }
5256 if (output->primary && get_primary) {
5357 return output;
54 }
55 if (require_active && !output->active) {
56 continue;
5758 }
5859 struct output_name *output_name;
5960 SLIST_FOREACH (output_name, &output->names_head, names) {
436437 Con *content = output_get_content(output->con);
437438 Con *previous_focus = con_get_workspace(focused);
438439
439 /* go through all assignments and move the existing workspaces to this output */
440 struct Workspace_Assignment *assignment;
441 TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
442 if (!output_triggers_assignment(output, assignment)) {
443 continue;
444 }
445 Con *workspace = get_existing_workspace_by_name(assignment->name);
446 if (workspace == NULL)
447 continue;
448
449 /* check that this workspace is not already attached (that means the
450 * user configured this assignment twice) */
451 Con *workspace_out = con_get_output(workspace);
452 if (workspace_out == output->con) {
453 LOG("Workspace \"%s\" assigned to output \"%s\", but it is already "
454 "there. Do you have two assignment directives for the same "
455 "workspace in your configuration file?\n",
456 workspace->name, output_primary_name(output));
457 continue;
458 }
459
460 DLOG("Moving workspace \"%s\" from output \"%s\" to \"%s\" due to assignment\n",
461 workspace->name, workspace_out->name, output_primary_name(output));
462 /* Need to copy output's rect since content is not yet rendered. We
463 * can't call render_con here because render_output only proceeds if a
464 * workspace exists. */
465 content->rect = output->con->rect;
466 workspace_move_to_output(workspace, output);
440 /* Iterate over all workspaces and check if any of them should be assigned
441 * to this output. */
442 Con *output_con;
443 TAILQ_FOREACH (output_con, &(croot->nodes_head), nodes) {
444 if (con_is_internal(output_con)) {
445 continue;
446 }
447
448 Con *workspace;
449 TAILQ_FOREACH (workspace, &(output_get_content(output_con)->nodes_head), nodes) {
450 Con *workspace_out = get_assigned_output(workspace->name, workspace->num);
451 if (output->con != workspace_out) {
452 continue;
453 }
454
455 DLOG("Moving workspace \"%s\" from output \"%s\" to \"%s\" due to assignment\n",
456 workspace->name, workspace_out->name, output_primary_name(output));
457 /* Need to copy output's rect since content is not yet rendered. We
458 * can't call render_con here because render_output only proceeds
459 * if a workspace exists. */
460 content->rect = output->con->rect;
461 workspace_move_to_output(workspace, output);
462 }
467463 }
468464
469465 /* Temporarily set the focused container, might not be initialized yet. */
483479 }
484480
485481 /* otherwise, we create the first assigned ws for this output */
482 struct Workspace_Assignment *assignment;
486483 TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
487484 if (!output_triggers_assignment(output, assignment)) {
488485 continue;
10211018 }
10221019
10231020 /* render_layout flushes */
1021 ewmh_update_desktop_properties();
10241022 tree_render();
10251023
10261024 FREE(primary);
88 *
99 */
1010 #include "all.h"
11
12 #include <math.h>
1113
1214 /* Forward declarations */
1315 static int *precalculate_sizes(Con *con, render_params *p);
452454 /* Since the tab width may be something like 31,6 px per tab, we
453455 * let the last tab have all the extra space (0,6 * children). */
454456 if (i == (p->children - 1)) {
455 child->deco_rect.width += (child->rect.width - (child->deco_rect.x + child->deco_rect.width));
457 child->deco_rect.width = child->rect.width - child->deco_rect.x;
456458 }
457459
458460 if (p->children > 1 || (child->border_style != BS_PIXEL && child->border_style != BS_NONE)) {
2828 /** The drawable surface */
2929 surface_t surface;
3030
31 TAILQ_ENTRY(placeholder_state)
32 state;
31 TAILQ_ENTRY(placeholder_state) state;
3332 } placeholder_state;
3433
3534 static TAILQ_HEAD(state_head, placeholder_state) state_head =
3131 }
3232 DLOG("should move con %p to __i3_scratch\n", con);
3333
34 Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
34 Con *__i3_scratch = workspace_get("__i3_scratch");
3535 if (con_get_workspace(con) == __i3_scratch) {
3636 DLOG("This window is already on __i3_scratch.\n");
3737 return;
8383 */
8484 bool scratchpad_show(Con *con) {
8585 DLOG("should show scratchpad window %p\n", con);
86 Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
86 Con *__i3_scratch = workspace_get("__i3_scratch");
8787 Con *floating;
8888
8989 /* If this was 'scratchpad show' without criteria, we check if the
244244 *
245245 */
246246 void scratchpad_fix_resolution(void) {
247 Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
247 Con *__i3_scratch = workspace_get("__i3_scratch");
248248 Con *__i3_output = con_get_output(__i3_scratch);
249249 DLOG("Current resolution: (%d, %d) %d x %d\n",
250250 __i3_output->rect.x, __i3_output->rect.y,
2727 #define _GNU_SOURCE
2828 #endif
2929
30 #include "sd-daemon.h"
31
32 #include <errno.h>
33 #include <netinet/in.h>
34 #include <stdarg.h>
35 #include <stddef.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include <sys/fcntl.h>
40 #include <sys/socket.h>
41 #include <sys/stat.h>
3042 #include <sys/types.h>
31 #include <sys/stat.h>
32 #include <sys/socket.h>
3343 #include <sys/un.h>
34 #include <sys/fcntl.h>
35 #include <netinet/in.h>
36 #include <stdlib.h>
37 #include <errno.h>
3844 #include <unistd.h>
39 #include <string.h>
40 #include <stdarg.h>
41 #include <stdio.h>
42 #include <stddef.h>
43
44 #include "sd-daemon.h"
4545
4646 int sd_listen_fds(int unset_environment) {
4747 int r, fd;
66 */
77 #include "all.h"
88
9 #include <ev.h>
10 #include <iconv.h>
119 #include <signal.h>
1210 #include <sys/wait.h>
13
14 #include <xcb/xcb_event.h>
15
16 #include <X11/keysym.h>
11 #include <unistd.h>
1712
1813 typedef struct dialog_t {
1914 xcb_window_t id;
2015 xcb_colormap_t colormap;
2116 Rect dims;
2217 surface_t surface;
23
24 TAILQ_ENTRY(dialog_t)
25 dialogs;
18 TAILQ_ENTRY(dialog_t) dialogs;
2619 } dialog_t;
2720
2821 static TAILQ_HEAD(dialogs_head, dialog_t) dialogs = TAILQ_HEAD_INITIALIZER(dialogs);
1010 *
1111 */
1212 #include "all.h"
13
1413 #include "sd-daemon.h"
1514
15 #include <paths.h>
1616 #include <sys/types.h>
1717 #include <sys/wait.h>
18 #include <paths.h>
18 #include <unistd.h>
1919
2020 #define SN_API_NOT_YET_FROZEN 1
2121 #include <libsn/sn-launcher.h>
99 */
1010 #include "all.h"
1111
12 #include <ctype.h>
13 #include <fcntl.h>
14 #include <inttypes.h>
15 #include <libgen.h>
16 #include <locale.h>
1217 #include <sys/wait.h>
13 #include <stdarg.h>
18 #include <unistd.h>
1419 #if defined(__OpenBSD__)
1520 #include <sys/cdefs.h>
1621 #endif
17 #include <fcntl.h>
18 #include <pwd.h>
19 #include <yajl/yajl_version.h>
20 #include <libgen.h>
21 #include <ctype.h>
22
23 #define SN_API_NOT_YET_FROZEN 1
24 #include <libsn/sn-launcher.h>
2522
2623 int min(int a, int b) {
2724 return (a < b ? a : b);
289286 void i3_restart(bool forget_layout) {
290287 char *restart_filename = forget_layout ? NULL : store_restart_layout();
291288
292 kill_nagbar(&config_error_nagbar_pid, true);
293 kill_nagbar(&command_error_nagbar_pid, true);
289 kill_nagbar(config_error_nagbar_pid, true);
290 kill_nagbar(command_error_nagbar_pid, true);
294291
295292 restore_geometry();
296293
338335 static void nagbar_exited(EV_P_ ev_child *watcher, int revents) {
339336 ev_child_stop(EV_A_ watcher);
340337
338 int exitcode = WEXITSTATUS(watcher->rstatus);
341339 if (!WIFEXITED(watcher->rstatus)) {
342 ELOG("ERROR: i3-nagbar did not exit normally.\n");
343 return;
344 }
345
346 int exitcode = WEXITSTATUS(watcher->rstatus);
347 DLOG("i3-nagbar process exited with status %d\n", exitcode);
348 if (exitcode == 2) {
349 ELOG("ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n");
350 }
351
352 *((pid_t *)watcher->data) = -1;
353 }
354
355 /*
356 * Cleanup handler. Will be called when i3 exits. Kills i3-nagbar with signal
357 * SIGKILL (9) to make sure there are no left-over i3-nagbar processes.
358 *
359 */
360 static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) {
361 pid_t *nagbar_pid = (pid_t *)watcher->data;
362 if (*nagbar_pid != -1) {
363 LOG("Sending SIGKILL (%d) to i3-nagbar with PID %d\n", SIGKILL, *nagbar_pid);
364 kill(*nagbar_pid, SIGKILL);
340 ELOG("i3-nagbar (%d) did not exit normally. This is not an error if the config was reloaded while a nagbar was active.\n", watcher->pid);
341 } else if (exitcode != 0) {
342 ELOG("i3-nagbar (%d) process exited with status %d\n", watcher->pid, exitcode);
343 } else {
344 DLOG("i3-nagbar (%d) process exited with status %d\n", watcher->pid, exitcode);
345 }
346
347 pid_t *nagbar_pid = watcher->data;
348 if (*nagbar_pid == watcher->pid) {
349 /* Only reset if the watched nagbar is the active nagbar */
350 *nagbar_pid = -1;
365351 }
366352 }
367353
397383 ev_child_init(child, &nagbar_exited, *nagbar_pid, 0);
398384 child->data = nagbar_pid;
399385 ev_child_start(main_loop, child);
400
401 /* install a cleanup watcher (will be called when i3 exits and i3-nagbar is
402 * still running) */
403 ev_cleanup *cleanup = smalloc(sizeof(ev_cleanup));
404 ev_cleanup_init(cleanup, nagbar_cleanup);
405 cleanup->data = nagbar_pid;
406 ev_cleanup_start(main_loop, cleanup);
407 }
408
409 /*
410 * Kills the i3-nagbar process, if *nagbar_pid != -1.
386 }
387
388 /*
389 * Kills the i3-nagbar process, if nagbar_pid != -1.
411390 *
412391 * If wait_for_it is set (restarting i3), this function will waitpid(),
413392 * otherwise, ev is assumed to handle it (reloading).
414393 *
415394 */
416 void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it) {
417 if (*nagbar_pid == -1)
395 void kill_nagbar(pid_t nagbar_pid, bool wait_for_it) {
396 if (nagbar_pid == -1)
418397 return;
419398
420 if (kill(*nagbar_pid, SIGTERM) == -1)
399 if (kill(nagbar_pid, SIGTERM) == -1)
421400 warn("kill(configerror_nagbar) failed");
422401
423402 if (!wait_for_it)
427406 * exec(), our old pid is no longer watched. So, ev won’t handle SIGCHLD
428407 * for us and we would end up with a <defunct> process. Therefore we
429408 * waitpid() here. */
430 waitpid(*nagbar_pid, NULL, 0);
409 waitpid(nagbar_pid, NULL, 0);
431410 }
432411
433412 /*
77 *
88 */
99 #include "all.h"
10
11 #include <math.h>
1012
1113 /*
1214 * Frees an i3Window and all its members.
7171
7272 /*
7373 * Returns the first output that is assigned to a workspace specified by the
74 * given name or number or NULL if no such output exists. If there is a
75 * workspace with a matching name and another workspace with a matching number,
76 * the output assigned to the first one is returned.
77 * The order of the 'ws_assignments' queue is respected: if multiple assignments
78 * match the specified workspace, the first one is returned.
79 * If 'name' is NULL it will be ignored.
80 * If 'parsed_num' is -1 it will be ignored.
81 *
82 */
83 static Con *get_assigned_output(const char *name, long parsed_num) {
74 * given name or number. Returns NULL if no such output exists.
75 *
76 * If an assignment matches by number but there is an assignment later that
77 * matches by name, the second one is preferred.
78 * The order of the 'ws_assignments' queue is respected: if multiple
79 * assignments match the criteria, the first one is returned.
80 * 'name' is ignored when NULL, 'parsed_num' is ignored when it is -1.
81 *
82 */
83 Con *get_assigned_output(const char *name, long parsed_num) {
8484 Con *output = NULL;
8585 struct Workspace_Assignment *assignment;
8686 TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
8989 }
9090
9191 if (name && strcmp(assignment->name, name) == 0) {
92 DLOG("Found workspace name assignment to output \"%s\"\n", assignment->output);
92 DLOG("Found workspace name=\"%s\" assignment to output \"%s\"\n",
93 name, assignment->output);
9394 Output *assigned_by_name = get_output_by_name(assignment->output, true);
9495 if (assigned_by_name) {
9596 /* When the name matches exactly, skip numbered assignments. */
99100 parsed_num != -1 &&
100101 name_is_digits(assignment->name) &&
101102 ws_name_to_number(assignment->name) == parsed_num) {
102 DLOG("Found workspace number assignment to output \"%s\"\n", assignment->output);
103 DLOG("Found workspace number=%ld assignment to output \"%s\"\n",
104 parsed_num, assignment->output);
103105 Output *assigned_by_num = get_output_by_name(assignment->output, true);
104106 if (assigned_by_num) {
105107 output = assigned_by_num->con;
125127 * memory and initializing the data structures correctly).
126128 *
127129 */
128 Con *workspace_get(const char *num, bool *created) {
130 Con *workspace_get(const char *num) {
129131 Con *workspace = get_existing_workspace_by_name(num);
130
131 if (workspace == NULL) {
132 LOG("Creating new workspace \"%s\"\n", num);
133 gaps_t gaps = (gaps_t){0, 0, 0, 0, 0};
134
135 /* We set workspace->num to the number if this workspace’s name begins
136 * with a positive number. Otherwise it’s a named ws and num will be
137 * -1. */
138 long parsed_num = ws_name_to_number(num);
139
140 struct Workspace_Assignment *assignment;
141 TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
142 if (strcmp(assignment->name, num) == 0) {
143 gaps = assignment->gaps;
144 break;
145 } else if (parsed_num != -1 && name_is_digits(assignment->name) && ws_name_to_number(assignment->name) == parsed_num) {
146 gaps = assignment->gaps;
147 }
148 }
149
150 Con *output = get_assigned_output(num, parsed_num);
151 /* if an assignment is not found, we create this workspace on the current output */
152 if (!output) {
153 output = con_get_output(focused);
154 }
155
156 Con *content = output_get_content(output);
157 LOG("got output %p with content %p\n", output, content);
158 /* We need to attach this container after setting its type. con_attach
159 * will handle CT_WORKSPACEs differently */
160 workspace = con_new(NULL, NULL);
161 char *name;
162 sasprintf(&name, "[i3 con] workspace %s", num);
163 x_set_name(workspace, name);
164 free(name);
165 workspace->type = CT_WORKSPACE;
166 FREE(workspace->name);
167 workspace->name = sstrdup(num);
168 workspace->workspace_layout = config.default_layout;
169 workspace->num = parsed_num;
170 LOG("num = %d\n", workspace->num);
171 workspace->gaps = gaps;
172
173 workspace->parent = content;
174 _workspace_apply_default_orientation(workspace);
175
176 con_attach(workspace, content, false);
177
178 ipc_send_workspace_event("init", workspace, NULL);
179 ewmh_update_desktop_properties();
180 if (created != NULL)
181 *created = true;
182 } else if (created != NULL) {
183 *created = false;
184 }
132 if (workspace) {
133 return workspace;
134 }
135
136 LOG("Creating new workspace \"%s\"\n", num);
137 gaps_t gaps = (gaps_t){0, 0, 0, 0, 0};
138
139 /* We set workspace->num to the number if this workspace’s name begins with
140 * a positive number. Otherwise it’s a named ws and num will be 1. */
141 const long parsed_num = ws_name_to_number(num);
142
143 struct Workspace_Assignment *assignment;
144 TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
145 if (strcmp(assignment->name, num) == 0) {
146 gaps = assignment->gaps;
147 break;
148 } else if (parsed_num != -1 && name_is_digits(assignment->name) && ws_name_to_number(assignment->name) == parsed_num) {
149 gaps = assignment->gaps;
150 }
151 }
152
153 Con *output = get_assigned_output(num, parsed_num);
154 /* if an assignment is not found, we create this workspace on the current output */
155 if (!output) {
156 output = con_get_output(focused);
157 }
158
159 /* No parent because we need to attach this container after setting its
160 * type. con_attach will handle CT_WORKSPACEs differently. */
161 workspace = con_new(NULL, NULL);
162
163 char *name;
164 sasprintf(&name, "[i3 con] workspace %s", num);
165 x_set_name(workspace, name);
166 free(name);
167
168 FREE(workspace->name);
169 workspace->name = sstrdup(num);
170 workspace->workspace_layout = config.default_layout;
171 workspace->num = parsed_num;
172 workspace->type = CT_WORKSPACE;
173 workspace->gaps = gaps;
174
175 con_attach(workspace, output_get_content(output), false);
176 _workspace_apply_default_orientation(workspace);
177
178 ipc_send_workspace_event("init", workspace, NULL);
179 ewmh_update_desktop_properties();
185180
186181 return workspace;
187182 }
576571 *
577572 */
578573 void workspace_show_by_name(const char *num) {
579 Con *workspace;
580 workspace = workspace_get(num, NULL);
581 workspace_show(workspace);
574 workspace_show(workspace_get(num));
582575 }
583576
584577 /*
845838 return NULL;
846839 }
847840
848 Con *workspace;
849 workspace = workspace_get(previous_workspace_name, NULL);
850
851 return workspace;
841 return workspace_get(previous_workspace_name);
852842 }
853843
854844 static bool get_urgency_flag(Con *con) {
10351025
10361026 /* so create the workspace referenced to by this assignment */
10371027 DLOG("Creating workspace from assignment %s.\n", assignment->name);
1038 workspace_get(assignment->name, NULL);
1028 workspace_get(assignment->name);
10391029 used_assignment = true;
10401030 break;
10411031 }
88 *
99 */
1010 #include "all.h"
11
12 #include <unistd.h>
1113
1214 #ifndef MAX
1315 #define MAX(x, y) ((x) > (y) ? (x) : (y))
6062
6163 char *name;
6264
63 CIRCLEQ_ENTRY(con_state)
64 state;
65
66 CIRCLEQ_ENTRY(con_state)
67 old_state;
68
69 TAILQ_ENTRY(con_state)
70 initial_mapping_order;
65 CIRCLEQ_ENTRY(con_state) state;
66 CIRCLEQ_ENTRY(con_state) old_state;
67 TAILQ_ENTRY(con_state) initial_mapping_order;
7168 } con_state;
7269
73 CIRCLEQ_HEAD(state_head, con_state)
74 state_head =
70 CIRCLEQ_HEAD(state_head, con_state) state_head =
7571 CIRCLEQ_HEAD_INITIALIZER(state_head);
7672
77 CIRCLEQ_HEAD(old_state_head, con_state)
78 old_state_head =
73 CIRCLEQ_HEAD(old_state_head, con_state) old_state_head =
7974 CIRCLEQ_HEAD_INITIALIZER(old_state_head);
8075
81 TAILQ_HEAD(initial_mapping_head, con_state)
82 initial_mapping_head =
76 TAILQ_HEAD(initial_mapping_head, con_state) initial_mapping_head =
8377 TAILQ_HEAD_INITIALIZER(initial_mapping_head);
8478
8579 /*
589583 }
590584 }
591585
592 /* if this is a borderless/1pixel window, we don’t need to render the
593 * decoration. */
594 if (p->border_style != BS_NORMAL)
595 goto copy_pixmaps;
596
597586 /* If the parent hasn't been set up yet, skip the decoration rendering
598587 * for now. */
599588 if (parent->frame_buffer.id == XCB_NONE)
606595 draw_util_clear_surface(&(con->parent->frame_buffer), COLOR_TRANSPARENT);
607596 FREE(con->parent->deco_render_params);
608597 }
598
599 /* if this is a borderless/1pixel window, we don’t need to render the
600 * decoration. */
601 if (p->border_style != BS_NORMAL)
602 goto copy_pixmaps;
609603
610604 /* 4: paint the bar */
611605 draw_util_rectangle(&(parent->frame_buffer), p->color->background,
88 */
99 #include <config.h>
1010
11 #include "all.h"
12
1113 #include <assert.h>
1214 #include <err.h>
15
1316 #include <xcb/xcb_cursor.h>
14
15 #include "i3.h"
16 #include "xcb.h"
17 #include "xcursor.h"
1817
1918 static xcb_cursor_context_t *ctx;
2019 static xcb_cursor_t cursors[XCURSOR_CURSOR_MAX];
1717 use IO::Handle;
1818
1919 # these are shipped with the testsuite
20 use lib qw(@abs_top_builddir@/testcases/lib @abs_top_srcdir@/testcases/lib @abs_top_srcdir@/AnyEvent-I3/blib/lib);
20 use lib qw(@abs_top_builddir@ @abs_top_builddir@/testcases/lib @abs_top_srcdir@/testcases/lib @abs_top_builddir@/AnyEvent-I3/blib/lib);
2121 use i3test::Util qw(slurp);
2222 use StartXServer;
2323 use StatusLine;
7777 # Check for missing executables
7878 my @binaries = qw(
7979 @abs_top_builddir@/i3
80 @abs_top_builddir@/i3bar/i3bar
81 @abs_top_builddir@/i3-config-wizard/i3-config-wizard
82 @abs_top_builddir@/i3-dump-log/i3-dump-log
83 @abs_top_builddir@/i3-input/i3-input
84 @abs_top_builddir@/i3-msg/i3-msg
85 @abs_top_builddir@/i3-nagbar/i3-nagbar
80 @abs_top_builddir@/i3bar
81 @abs_top_builddir@/i3-config-wizard
82 @abs_top_builddir@/i3-dump-log
83 @abs_top_builddir@/i3-input
84 @abs_top_builddir@/i3-msg
85 @abs_top_builddir@/i3-nagbar
8686 );
8787
8888 foreach my $binary (@binaries) {
102102 }
103103
104104 $ENV{PATH} = join(':',
105 '@abs_top_builddir@/i3-nagbar',
106 '@abs_top_builddir@/i3-msg',
107 '@abs_top_builddir@/i3-input',
108 '@abs_top_builddir@/i3-dump-log',
109 '@abs_top_builddir@/i3-config-wizard',
110 '@abs_top_builddir@/i3bar',
111105 '@abs_top_builddir@',
112106 '@abs_top_srcdir@',
113107 $ENV{PATH});
1515
1616 #include <ev.h>
1717 #include <fcntl.h>
18 #include <getopt.h>
19 #include <libgen.h>
20 #include <sys/mman.h>
21 #include <sys/resource.h>
22 #include <sys/socket.h>
23 #include <sys/stat.h>
24 #include <sys/time.h>
1825 #include <sys/types.h>
19 #include <sys/socket.h>
2026 #include <sys/un.h>
21 #include <sys/time.h>
22 #include <sys/resource.h>
23 #include <sys/mman.h>
24 #include <sys/stat.h>
2527 #include <sys/wait.h>
26 #include <libgen.h>
28 #include <unistd.h>
2729
2830 static void uds_connection_cb(EV_P_ ev_io *w, int revents);
2931 static void read_client_setup_request_cb(EV_P_ ev_io *w, int revents);
66
77 use Test::More;
88 use i3test::Util qw(get_socket_path);
9 use lib qw(@abs_top_srcdir@/AnyEvent-I3/blib/lib);
9 use lib qw(@abs_top_builddir@/AnyEvent-I3/blib/lib);
1010 use AnyEvent::I3;
1111 use ExtUtils::PkgConfig;
1212
66 use X11::XCB::Rect;
77 use X11::XCB::Window;
88 use X11::XCB qw(:all);
9 use lib qw(@abs_top_srcdir@/AnyEvent-I3/blib/lib);
9 use lib qw(@abs_top_builddir@/AnyEvent-I3/blib/lib);
1010 use AnyEvent::I3;
1111 use List::Util qw(first);
1212 use Time::HiRes qw(sleep);
219219 is($absolute->width, $absolute_before->width, 'width not changed');
220220 is($absolute->height, $absolute_before->height, 'height not changed');
221221
222 ######################################################################
223 # 6) test moving floating window to a specified position
222 $absolute_before = $absolute;
223 $top_before = $top;
224
225 ######################################################################
226 # 7) test moving floating containers with a specific amount of ppt
227 ######################################################################
228
229 cmd 'move right 25 ppt';
230
231 sync_with_i3;
232
233 ($absolute, $top) = $floatwin->rect;
234
235 is($absolute->x, int($x->root->rect->width * 0.25) + $absolute_before->x, 'moved 25 ppt to the right');
236 is($absolute->y, $absolute_before->y, 'y not changed');
237 is($absolute->width, $absolute_before->width, 'width not changed');
238 is($absolute->height, $absolute_before->height, 'height not changed');
239
240 ######################################################################
241 # 8) test moving floating window to a specified position
224242 # and to absolute center
225243 ######################################################################
226244
227245 $tmp = fresh_workspace;
228246 open_floating_window; my @floatcon;
229247
248 # Move to specified position with px
230249 cmd 'move position 5 px 15 px';
231250
232251 @floatcon = @{get_ws($tmp)->{floating_nodes}};
233252
234 is($floatcon[0]->{rect}->{x}, 5, 'moved to position 5 x');
235 is($floatcon[0]->{rect}->{y}, 15, 'moved to position 15 y');
236
253 is($floatcon[0]->{rect}->{x}, 5, 'moved to position 5 (px) x');
254 is($floatcon[0]->{rect}->{y}, 15, 'moved to position 15 (px) y');
255
256 # Move to specified position with ppt
257 cmd 'move position 20 ppt 20 ppt';
258
259 @floatcon = @{get_ws($tmp)->{floating_nodes}};
260
261 is($floatcon[0]->{rect}->{x}, int($x->root->rect->width * 0.20), "moved to position 20 (ppt) x");
262 is($floatcon[0]->{rect}->{y}, int($x->root->rect->height * 0.20), "moved to position 20 (ppt) y");
263
264 # Move to absolute center
237265 cmd 'move absolute position center';
238266
239267 @floatcon = @{get_ws($tmp)->{floating_nodes}};
339339 is(@{$ws->{floating_nodes}}, 1, 'one floating node on second workspace');
340340
341341 ###################################################################
342 # Test that when moving a fullscreen floating window to a workspace
343 # that already has an other fullscreen container, the second
344 # container gets un-fullscreened.
345 # See #4124
346 ###################################################################
347 $tmp2 = fresh_workspace;
348 $second = open_window;
349 cmd 'fullscreen enable';
350 $ws = get_ws($tmp2);
351 is($ws->{nodes}->[0]->{fullscreen_mode}, 1, 'sanity check: fullscreen enabled');
352
353 $tmp = fresh_workspace;
354 $first = open_window;
355 cmd 'floating enable, fullscreen enable';
356 cmd "move workspace $tmp2";
357
358 $ws = get_ws($tmp2);
359 is_num_children($tmp2, 1, 'one regular node on second workspace');
360 is_num_fullscreen($tmp2, 1, 'one fullscreen node on second workspace');
361 is(@{$ws->{floating_nodes}}, 1, 'one floating node on second workspace');
362 is($ws->{nodes}->[0]->{fullscreen_mode}, 0, 'previous fullscreen disabled');
363
364 ###################################################################
365 # Same as above, but trigger the bug with the parent of a
366 # fullscreen container, instead of a CT_FLOATING_CON.
367 ###################################################################
368 $tmp2 = fresh_workspace;
369 $second = open_window;
370 cmd 'fullscreen enable';
371 $ws = get_ws($tmp2);
372 is($ws->{nodes}->[0]->{fullscreen_mode}, 1, 'sanity check: fullscreen enabled');
373
374 $tmp = fresh_workspace;
375 open_window;
376 $first = open_window;
377 cmd 'layout tabbed';
378 cmd 'focus parent, mark a, focus child';
379 cmd 'fullscreen enable';
380 cmd "[con_mark=a] move workspace $tmp2";
381
382 $ws = get_ws($tmp2);
383 is(sum_nodes(get_ws_content($tmp2)), 4, '3 leafs & 1 split node in second workspace');
384 # is_num_fullscreen does not catch this nested fullscreen container
385 is($ws->{nodes}->[0]->{fullscreen_mode}, 0, 'previous fullscreen disabled');
386 is($ws->{nodes}->[1]->{nodes}->[1]->{fullscreen_mode}, 1, 'nested fullscreen from moved container preserved');
387
388 ###################################################################
342389 # Check that moving an empty workspace using criteria doesn't
343390 # create unfocused empty workspace.
344391 ###################################################################
3131
3232 is(int($version->{minor}), $version->{minor}, 'minor version is an integer');
3333 is(int($version->{patch}), $version->{patch}, 'patch version is an integer');
34 like($version->{human_readable}, qr/branch/, 'human readable version contains branch name');
3534
3635 done_testing;
4040
4141 sub check_output {
4242 my ($workspace, $output, $msg) = @_;
43 is(get_output_for_workspace($workspace), $output, $msg);
43 is(get_output_for_workspace($workspace), $output, "[$workspace->$output] " . $msg);
4444 }
4545
4646 check_output('9', '', 'Numbered workspace with a big number that is assigned to output that does not exist is not used');
8181 workspace foo output doesnotexist1 doesnotexist2 doesnotexist3
8282 workspace bar output doesnotexist
8383 workspace bar output fake-0
84 workspace 5 output fake-0
85 workspace 5:xxx output fake-1
86 workspace 6:xxx output fake-0
87 workspace 6 output fake-1
8488 EOT
8589
8690 $pid = launch_with_config($config);
8993 do_test('2', 'fake-3', 'First output out of multiple assignments is used');
9094 do_test('3', 'fake-0', 'First existing output is used');
9195 do_test('4', 'fake-0', 'Excessive whitespace is ok');
92 do_test('5', 'fake-1', 'Numbered initialization for fake-1');
93 do_test('6', 'fake-2', 'Numbered initialization for fake-2');
96 do_test('5', 'fake-0', 'Numbered assignment ok');
97 do_test('5:xxx', 'fake-1', 'Named assignment overrides number');
98 do_test('6', 'fake-1', 'Numbered assignment ok');
99 do_test('6:xxx', 'fake-0', 'Named assignment overrides number');
100 do_test('7', 'fake-2', 'Numbered initialization for fake-2');
94101
95102 cmd 'focus output fake-0, workspace foo';
96103 check_output('foo', 'fake-0', 'Workspace with only non-existing assigned outputs opened in current output');
102109 cmd 'workspace 2, move workspace to output left';
103110 check_output('2', 'fake-2', 'Moved assigned workspace up');
104111
112 # Specific name overrides assignment by number after renaming
113 # See #4021
114 cmd 'workspace 5, rename workspace to 5:xxx';
115 check_output('5:xxx', 'fake-1', 'workspace triggered correct, specific assignment after renaming');
116
117 # Same but opposite order
118 cmd 'workspace 6, rename workspace to 6:xxx';
119 check_output('6:xxx', 'fake-0', 'workspace triggered correct, specific assignment after renaming');
120
105121 exit_gracefully($pid);
106122 done_testing;
0 #!perl
1 # vim:ts=4:sw=4:expandtab
2 #
3 # Please read the following documents before working on tests:
4 # • https://build.i3wm.org/docs/testsuite.html
5 # (or docs/testsuite)
6 #
7 # • https://build.i3wm.org/docs/lib-i3test.html
8 # (alternatively: perldoc ./testcases/lib/i3test.pm)
9 #
10 # • https://build.i3wm.org/docs/ipc.html
11 # (or docs/ipc)
12 #
13 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
14 # (unless you are already familiar with Perl)
15 #
16 # Verify that _NET_WM_DESKTOP sticky requests do not conflict with dock
17 # clients, resulting in a crash
18 # Ticket: #4039
19 # Bug still in: 4.18-238-g4d55bba7f
20 use i3test;
21
22 sub send_sticky_request {
23 my ($win) = @_;
24
25 my $msg = pack "CCSLLLLLL",
26 X11::XCB::CLIENT_MESSAGE, # response_type
27 32, # format
28 0, # sequence
29 $win->id, # window
30 $x->atom(name => '_NET_WM_DESKTOP')->id, # message type
31 hex '0xFFFFFFFF', # data32[0] = NET_WM_DESKTOP_ALL
32 0, # data32[1]
33 0, # data32[2]
34 0, # data32[3]
35 0; # data32[4]
36
37 $x->send_event(0, $x->get_root_window(), X11::XCB::EVENT_MASK_SUBSTRUCTURE_REDIRECT, $msg);
38 }
39
40 # Test the normal functionality first
41 my $ws = fresh_workspace;
42 my $win = open_window;
43
44 is(@{get_ws($ws)->{floating_nodes}}, 0, 'No floating windows yet');
45 send_sticky_request($win);
46 sync_with_i3;
47
48 is(@{get_ws($ws)->{floating_nodes}}, 1, 'One floating (sticky) window');
49 $ws = fresh_workspace;
50 is(@{get_ws($ws)->{floating_nodes}}, 1, 'Sticky window in new workspace');
51
52 # See #4039
53 kill_all_windows;
54 $win = open_window({
55 window_type => $x->atom(name => '_NET_WM_WINDOW_TYPE_DOCK')
56 });
57
58 send_sticky_request($win);
59 sync_with_i3;
60 is(@{get_ws($ws)->{floating_nodes}}, 0, 'Dock client did not get sticky/floating');
61
62 # Cause a ConfigureRequest by setting the window’s position/size.
63 my ($a, $t) = $win->rect;
64 $win->rect(X11::XCB::Rect->new(x => 0, y => 0, width => $a->width, height => $a->height));
65
66 does_i3_live;
67 is(@{get_ws($ws)->{floating_nodes}}, 0, 'Dock client still not sticky/floating');
68
69 done_testing;
0 #!perl
1 # vim:ts=4:sw=4:expandtab
2 #
3 # Please read the following documents before working on tests:
4 # • https://build.i3wm.org/docs/testsuite.html
5 # (or docs/testsuite)
6 #
7 # • https://build.i3wm.org/docs/lib-i3test.html
8 # (alternatively: perldoc ./testcases/lib/i3test.pm)
9 #
10 # • https://build.i3wm.org/docs/ipc.html
11 # (or docs/ipc)
12 #
13 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
14 # (unless you are already familiar with Perl)
15 #
16 # Verifies the GET_BINDING_MODE IPC command
17 # Ticket: #3892
18 # Bug still in: 4.18-318-g50160eb1
19 use i3test i3_config => <<EOT;
20 # i3 config file (v4)
21 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
22
23 mode "extra" {
24 bindsym Mod1+x nop foo
25 }
26 EOT
27
28 my $i3 = i3(get_socket_path());
29 $i3->connect->recv;
30 # TODO: use the symbolic name for the command/reply type instead of the
31 # numerical 12:
32 my $binding_state = $i3->message(12, "")->recv;
33 is($binding_state->{name}, 'default', 'at startup, binding mode is default');
34
35 cmd 'mode extra';
36
37 $binding_state = $i3->message(12, "")->recv;
38 is($binding_state->{name}, 'extra', 'after switching, binding mode is extra');
39
40 done_testing;
8282
8383 close($fh);
8484
85 ############################################################
86 # Make sure window only gets swallowed once
87 ############################################################
88 # Regression, issue #3888
89 $ws = fresh_workspace;
90
91 ($fh, $filename) = tempfile(UNLINK => 1);
92 print $fh <<'EOT';
93 // vim:ts=4:sw=4:et
94 {
95 // splith split container with 2 children
96 "layout": "splith",
97 "type": "con",
98 "nodes": [
99 {
100 "type": "con",
101 "swallows": [
102 {
103 "class": "^foo$"
104 }
105 ]
106 },
107 {
108 // splitv split container with 2 children
109 "layout": "splitv",
110 "type": "con",
111 "nodes": [
112 {
113 "type": "con",
114 "swallows": [
115 {
116 "class": "^foo$"
117 }
118 ]
119 },
120 {
121 "type": "con",
122 "swallows": [
123 {
124 "class": "^foo$"
125 }
126 ]
127 }
128 ]
129 }
130 ]
131 }
132 EOT
133 $fh->flush;
134 cmd "append_layout $filename";
135
136 $window = open_window wm_class => 'foo';
137
138 # Changing an unrelated window property originally resulted in the window
139 # getting remanaged and swallowd by a different placeholder, even though the
140 # matching property (class for the layout above) didn't change.
141 change_window_title($window, "different_title");
142
143 @content = @{get_ws_content($ws)};
144
145 subtest 'regression test that window gets only swallowed once', sub {
146 is($content[0]->{nodes}[0]->{window}, $window->id, 'first placeholder swallowed window');
147 isnt($content[0]->{nodes}[1]->{nodes}[0]->{window}, $window->id, 'second placeholder did not swallow window');
148 isnt($content[0]->{nodes}[1]->{nodes}[1]->{window}, $window->id, 'thid placeholder did not swallow window');
149 };
150
85151 done_testing;
1212
1313 "files": [
1414 {
15 "includePattern": "build/deb/debian-amd64/(.*\\.deb)$",
15 "includePattern": "distbuild/deb/debian-amd64/(.*\\.deb)$",
1616 "matrixParams": {
1717 "deb_distribution": "sid",
1818 "deb_component": "main",
2121 "uploadPattern": "$1"
2222 },
2323 {
24 "includePattern": "build/deb/debian-i386/(.*\\.deb)$",
24 "includePattern": "distbuild/deb/debian-i386/(.*\\.deb)$",
2525 "matrixParams": {
2626 "deb_distribution": "sid",
2727 "deb_component": "main",
1212
1313 "files": [
1414 {
15 "includePattern": "build/deb/ubuntu-amd64/(.*\\.deb)$",
15 "includePattern": "distbuild/deb/ubuntu-amd64/(.*\\.deb)$",
1616 "matrixParams": {
1717 "deb_distribution": "bionic",
1818 "deb_component": "main",
2121 "uploadPattern": "$1"
2222 },
2323 {
24 "includePattern": "build/deb/ubuntu-i386/(.*\\.deb)$",
24 "includePattern": "distbuild/deb/ubuntu-i386/(.*\\.deb)$",
2525 "matrixParams": {
2626 "deb_distribution": "bionic",
2727 "deb_component": "main",
22 set -e
33 set -x
44
5 clang-format-6.0 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
5 clang-format-9 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
3232 };
3333 my @binaries = qw(
3434 build/i3
35 build/i3-config-wizard/i3-config-wizard
36 build/i3-dump-log/i3-dump-log
37 build/i3-input/i3-input
38 build/i3-msg/i3-msg
39 build/i3-nagbar/i3-nagbar
40 build/i3bar/i3bar
35 build/i3-config-wizard
36 build/i3-dump-log
37 build/i3-input
38 build/i3-msg
39 build/i3-nagbar
40 build/i3bar
4141 );
4242 for my $binary (@binaries) {
4343 check_spelling(slurp($binary), $binary_spelling_exceptions, sub {
44
55 DEST=$1
66
7 mkdir -p build
8 cd build
9 ../configure
10 make echo-version > ../I3_VERSION
11 make dist-bzip2
7 cd distbuild
128 # unpack dist tarball
139 mkdir -p "${DEST}"
14 tar xf *.tar.bz2 -C "${DEST}" --strip-components=1
10 tar xf meson-dist/*.tar.xz -C "${DEST}" --strip-components=1
1511 cp -r ../debian "${DEST}"
1612 sed -i '/^\s*libxcb-xrm-dev/d' deb/ubuntu-*/DIST/debian/control || true
1713 cd "${DEST}"
33
44 BASENAME=$1
55 DOCKERFILE=$2
6
7 # .dockerignore is created on demand so that release.sh and other scripts are
8 # not influenced by our travis setup.
9 echo .git > .dockerignore
106
117 docker build --pull --no-cache --rm -t=${BASENAME} -f ${DOCKERFILE} .
128 # For pull requests, travis does not add secure environment variables to the
22 set -e
33 set -x
44
5 for f in $(grep '\.html$' debian/i3-wm.docs | grep -v 'docs/refcard.html' | grep -v 'docs/lib-i3test')
5 # TODO: install the docs via meson, inject styles with an option
6
7 for f in $(sed -n "s/^\s*'\(docs\/.*\)',$/\1/gp" meson.build | grep -vF .)
68 do
79 asciidoc -a linkcss -a stylesdir=https://i3wm.org/css -a scriptsdir=https://i3wm.org/js --backend=xhtml11 -f docs/asciidoc-git.conf $(dirname $f)/$(basename $f .html)
810 done
11
912 ./docs/i3-pod2html --stylesurl=https://i3wm.org/css i3-dmenu-desktop man/i3-dmenu-desktop.html
1013 ./docs/i3-pod2html --stylesurl=https://i3wm.org/css i3-save-tree man/i3-save-tree.html
11 ./docs/i3-pod2html --stylesurl=https://i3wm.org/css build/testcases/lib/i3test.pm docs/lib-i3test.html
14 ./docs/i3-pod2html --stylesurl=https://i3wm.org/css build/i3test.pm docs/lib-i3test.html
1215 ./docs/i3-pod2html --stylesurl=https://i3wm.org/css testcases/lib/i3test/Test.pm docs/lib-i3test-test.html
13 for file in $(sed 's/\.1$/.man/g' debian/i3-wm.manpages)
16
17 for file in $(sed -n "s/^\s*'\(man\/.*\).man',$/\1.man/gp" meson.build)
1418 do
1519 [ -f "$file" ] && asciidoc -a linkcss -a stylesdir=https://i3wm.org/css -a scriptsdir=https://i3wm.org/js --backend=xhtml11 -f docs/asciidoc-git.conf "$file"
1620 done
1721
1822 mkdir -p deb/COPY-DOCS
1923
20 cp $(tr "\n" ' ' < debian/i3-wm.docs) deb/COPY-DOCS/
21 cp $(sed 's/\.1$/.html/g' debian/i3-wm.manpages | tr "\n" ' ') deb/COPY-DOCS/
24 cp $(sed -n "s/^\s*'\(docs\/.*\)',$/\1/gp" meson.build | grep -F .) deb/COPY-DOCS/
25 cp $(sed -n "s/^\s*'\(man\/.*\).man',$/\1.html/gp" meson.build) deb/COPY-DOCS/
2525
2626 # Try running the tests in parallel so that the common case (tests pass) is
2727 # quick, but fall back to running them in sequence to make debugging easier.
28 if ! make check
28 if ! ninja test
2929 then
30 ./testcases/complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)
30 ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)
3131 fi
1212 # (3608 kB/s)). Hence, let’s stick with httpredir.debian.org (default) for now.
1313
1414 # Install mk-build-deps (for installing the i3 build dependencies),
15 # clang and clang-format-6.0 (for checking formatting and building with clang),
15 # clang and clang-format-9 (for checking formatting and building with clang),
1616 # lintian (for checking spelling errors),
1717 RUN linux32 apt-get update && \
1818 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
1919 dpkg-dev devscripts git equivs \
20 clang clang-format-6.0 \
20 build-essential clang clang-format-9 \
2121 lintian && \
2222 rm -rf /var/lib/apt/lists/*
2323
1212 # (3608 kB/s)). Hence, let’s stick with httpredir.debian.org (default) for now.
1313
1414 # Install mk-build-deps (for installing the i3 build dependencies),
15 # clang and clang-format-6.0 (for checking formatting and building with clang),
15 # clang and clang-format-9 (for checking formatting and building with clang),
1616 # lintian (for checking spelling errors),
1717 RUN linux32 apt-get update && \
1818 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
1919 dpkg-dev devscripts git equivs \
20 clang clang-format-6.0 \
20 build-essential clang clang-format-9 \
2121 lintian && \
2222 rm -rf /var/lib/apt/lists/*
2323
1212 # (3608 kB/s)). Hence, let’s stick with httpredir.debian.org (default) for now.
1313
1414 # Install mk-build-deps (for installing the i3 build dependencies),
15 # clang and clang-format-6.0 (for checking formatting and building with clang),
15 # clang and clang-format-9 (for checking formatting and building with clang),
1616 # lintian (for checking spelling errors),
1717 # test suite dependencies (for running tests)
1818 RUN apt-get update && \
1919 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
2020 dpkg-dev devscripts git equivs \
21 clang clang-format-6.0 \
21 build-essential clang clang-format-9 \
2222 lintian && \
2323 rm -rf /var/lib/apt/lists/*
2424
1010 # (3608 kB/s)). Hence, let’s stick with httpredir.debian.org (default) for now.
1111
1212 # Install mk-build-deps (for installing the i3 build dependencies),
13 # clang and clang-format-6.0 (for checking formatting and building with clang),
13 # clang and clang-format-9 (for checking formatting and building with clang),
1414 # lintian (for checking spelling errors),
1515 # test suite dependencies (for running tests)
1616 RUN apt-get update && \
1717 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
1818 dpkg-dev devscripts git equivs \
19 clang clang-format-6.0 \
19 build-essential clang clang-format-9 \
2020 lintian \
2121 libmodule-install-perl libanyevent-perl libextutils-pkgconfig-perl xcb-proto cpanminus xvfb xserver-xephyr xauth libinline-perl libinline-c-perl libxml-simple-perl libmouse-perl libmousex-nativetraits-perl libextutils-depends-perl perl libtest-deep-perl libtest-exception-perl libxml-parser-perl libtest-simple-perl libtest-fatal-perl libdata-dump-perl libtest-differences-perl libxml-tokeparser-perl libipc-run-perl libxcb-xtest0-dev libx11-xcb-perl libjson-xs-perl x11-xserver-utils && \
2222 rm -rf /var/lib/apt/lists/*