Commit Graph

98 Commits (next)

Author SHA1 Message Date
Orestis Floros 38f28186ec
Remove some includes from all.h
Also removes duplicates from other headers

All used std* imports are included once in all.h for easy use

- getopt: Only used in main.c and inject_randr1.5.c
- glob: Not used in i3, only in i3bar & libi3
- inttypes: Only used in util.c
- locale: A bit specific for all.h
- math: Slow according to #4022
- unistd: I feel it's good to explicitly include per file that needs it
- yajl: Specific to yajl_utils.h and ipc.h

Related to #4022

Timing before:

```
Analyzing build trace from ...
**** Time summary:
Compilation (81 times):
  Parsing (frontend):           51.3 s
  Codegen & opts (backend):      7.7 s

**** Files that took longest to parse (compiler frontend):
  1254 ms: build/src/i3-commands.o
   972 ms: build/src/i3-resize.o
   945 ms: build/src/i3-con.o
   921 ms: build/src/i3-scratchpad.o
   907 ms: build/src/i3-main.o
   904 ms: build/src/i3-handlers.o
   904 ms: build/src/i3-config_directives.o
   893 ms: build/src/i3-restore_layout.o
   875 ms: build/src/i3-x.o
   854 ms: build/src/i3-ipc.o

**** Files that took longest to codegen (compiler backend):
   863 ms: build/src/i3-commands.o
   471 ms: build/i3bar/src/i3bar-xcb.o
   377 ms: build/src/i3-con.o
   360 ms: build/src/i3-ipc.o
   306 ms: build/src/i3-x.o
   290 ms: build/src/i3-main.o
   238 ms: build/src/i3-config_parser.o
   237 ms: build/src/i3-handlers.o
   220 ms: build/i3-config-wizard/i3_config_wizard-main.o
   214 ms: build/src/i3-bindings.o

**** Functions that took longest to compile:
   209 ms: main (../../i3/src/main.c)
    95 ms: manage_window (../../i3/src/manage.c)
    57 ms: reconfig_windows (../../i3/i3bar/src/xcb.c)
    55 ms: x_draw_decoration (../../i3/src/x.c)
    49 ms: x_push_node (../../i3/src/x.c)
    48 ms: handle_client_message (../../i3/src/handlers.c)
    48 ms: dump_node (../../i3/src/ipc.c)
    47 ms: GENERATED_call (../../i3/src/config_parser.c)
    45 ms: config_string_cb (../../i3/i3bar/src/config.c)
    44 ms: GENERATED_call (../../i3/src/commands_parser.c)
    42 ms: floating_check_size (../../i3/src/floating.c)
    40 ms: con_swap (../../i3/src/con.c)
    40 ms: parse_config (../../i3/src/config_parser.c)
    39 ms: main (../../i3/i3-nagbar/main.c)
    39 ms: cmd_rename_workspace (../../i3/src/commands.c)
    38 ms: window_update_normal_hints (../../i3/src/window.c)
    38 ms: cmd_swap (../../i3/src/commands.c)
    37 ms: dump_bar_config (../../i3/src/ipc.c)
    36 ms: translate_keysyms (../../i3/src/bindings.c)
    35 ms: tree_close_internal (../../i3/src/tree.c)
    34 ms: match_matches_window (../../i3/src/match.c)
    34 ms: floating_enable (../../i3/src/floating.c)
    34 ms: json_string (../../i3/src/load_layout.c)
    33 ms: x_push_changes (../../i3/src/x.c)
    33 ms: main (../../i3/i3-config-wizard/main.c)
    31 ms: free_configuration (../../i3/src/config.c)
    30 ms: parse_file (../../i3/src/config_parser.c)
    28 ms: load_font (../../i3/libi3/font.c)
    28 ms: handle_configure_request (../../i3/src/handlers.c)
    28 ms: parse_command (../../i3/src/commands_parser.c)

**** Function sets that took longest to compile / optimize:

*** Expensive headers:
29287 ms: ../../i3/include/libi3.h (included 78 times, avg 375 ms), included via:
  i3-resize.o all.h data.h  (576 ms)
  a-g_utf8_make_valid.o  (491 ms)
  a-dpi.o  (491 ms)
  a-get_colorpixel.o  (483 ms)
  a-is_debug_build.o  (478 ms)
  a-strndup.o  (478 ms)
  ...

29221 ms: ../../i3/include/all.h (included 39 times, avg 749 ms), included via:
  i3-resize.o  (946 ms)
  i3-scratchpad.o  (895 ms)
  i3-restore_layout.o  (865 ms)
  i3-handlers.o  (839 ms)
  i3-drag.o  (830 ms)
  i3-config_directives.o  (793 ms)
  ...

5195 ms: /usr/include/xcb/xcb.h (included 79 times, avg 65 ms), included via:
  i3-handlers.o all.h  (113 ms)
  i3-restore_layout.o all.h  (108 ms)
  a-g_utf8_make_valid.o libi3.h  (108 ms)
  i3bar-xcb.o common.h  (105 ms)
  i3-scratchpad.o all.h  (95 ms)
  a-get_colorpixel.o libi3.h  (89 ms)
  ...

4100 ms: /usr/include/math.h (included 41 times, avg 100 ms), included via:
  i3-scratchpad.o all.h  (180 ms)
  i3-fake_outputs.o all.h  (138 ms)
  i3-regex.o all.h  (130 ms)
  i3-restore_layout.o all.h  (128 ms)
  i3-xcb.o all.h  (121 ms)
  i3-move.o all.h  (119 ms)
  ...

4046 ms: ../../i3/i3bar/include/common.h (included 9 times, avg 449 ms), included via:
  i3bar-main.o  (503 ms)
  i3bar-xcb.o  (501 ms)
  i3bar-workspaces.o  (472 ms)
  i3bar-parse_json_header.o  (446 ms)
  i3bar-child.o  (438 ms)
  i3bar-ipc.o  (434 ms)
  ...

2713 ms: ../../i3/include/i3.h (included 41 times, avg 66 ms), included via:
  i3-xcursor.o  (450 ms)
  i3-config_directives.o all.h ipc.h configuration.h  (87 ms)
  i3-config.o all.h ipc.h configuration.h  (71 ms)
  i3-manage.o all.h ipc.h configuration.h  (70 ms)
  i3-window.o all.h ipc.h configuration.h  (68 ms)
  i3-x.o all.h ipc.h configuration.h  (61 ms)
  ...

1492 ms: /usr/include/xcb/xkb.h (included 42 times, avg 35 ms), included via:
  i3-config_directives.o all.h ipc.h configuration.h i3.h  (50 ms)
  i3-config.o all.h ipc.h configuration.h i3.h  (45 ms)
  i3-window.o all.h ipc.h configuration.h i3.h  (43 ms)
  i3-x.o all.h ipc.h configuration.h i3.h  (42 ms)
  i3-manage.o all.h ipc.h configuration.h i3.h  (41 ms)
  i3-config_parser.o all.h ipc.h configuration.h i3.h  (38 ms)
  ...

1432 ms: /usr/include/stdlib.h (included 79 times, avg 18 ms), included via:
  i3-scratchpad.o all.h  (48 ms)
  i3-restore_layout.o all.h  (36 ms)
  i3-regex.o all.h  (32 ms)
  i3-key_press.o all.h  (28 ms)
  i3-commands.o all.h  (28 ms)
  i3-bindings.o all.h  (24 ms)
  ...

1349 ms: /usr/include/pthread.h (included 79 times, avg 17 ms), included via:
  i3bar-xcb.o common.h xcb.h  (33 ms)
  a-ucs2_conversion.o libi3.h xcb.h  (32 ms)
  i3-match.o all.h xcb.h  (27 ms)
  i3-scratchpad.o all.h xcb.h  (25 ms)
  a-g_utf8_make_valid.o libi3.h xcb.h  (25 ms)
  i3_config_wizard-main.o xcb.h  (24 ms)
  ...

1151 ms: /usr/include/X11/Xlib.h (included 45 times, avg 25 ms), included via:
  i3-output.o all.h data.h sn-launcher.h sn-common.h  (50 ms)
  i3-config_parser.o all.h data.h sn-launcher.h sn-common.h  (43 ms)
  i3-x.o all.h data.h sn-launcher.h sn-common.h  (34 ms)
  i3-config_directives.o all.h data.h sn-launcher.h sn-common.h  (32 ms)
  i3_config_wizard-main.o sn-launchee.h sn-common.h  (30 ms)
  i3-drag.o all.h data.h sn-launcher.h sn-common.h  (29 ms)
  ...
```

Timing after:

```
Analyzing build trace from ...
**** Time summary:
Compilation (81 times):
  Parsing (frontend):           47.6 s
  Codegen & opts (backend):      7.6 s

**** Files that took longest to parse (compiler frontend):
  1154 ms: build/src/i3-commands.o
   929 ms: build/src/i3-display_version.o
   852 ms: build/src/i3-bindings.o
   847 ms: build/src/i3-con.o
   806 ms: build/src/i3-ipc.o
   801 ms: build/src/i3-floating.o
   792 ms: build/src/i3-main.o
   792 ms: build/src/i3-drag.o
   792 ms: build/src/i3-window.o
   776 ms: build/src/i3-config_directives.o

**** Files that took longest to codegen (compiler backend):
   885 ms: build/src/i3-commands.o
   422 ms: build/i3bar/src/i3bar-xcb.o
   382 ms: build/src/i3-con.o
   348 ms: build/src/i3-x.o
   288 ms: build/src/i3-ipc.o
   268 ms: build/src/i3-handlers.o
   254 ms: build/src/i3-main.o
   251 ms: build/src/i3-floating.o
   249 ms: build/src/i3-config_parser.o
   194 ms: build/src/i3-randr.o

**** Functions that took longest to compile:
   186 ms: main (../../i3/src/main.c)
    95 ms: manage_window (../../i3/src/manage.c)
    65 ms: floating_check_size (../../i3/src/floating.c)
    63 ms: x_draw_decoration (../../i3/src/x.c)
    58 ms: handle_client_message (../../i3/src/handlers.c)
    55 ms: x_push_node (../../i3/src/x.c)
    54 ms: match_matches_window (../../i3/src/match.c)
    51 ms: parse_config (../../i3/src/config_parser.c)
    49 ms: dump_node (../../i3/src/ipc.c)
    47 ms: reconfig_windows (../../i3/i3bar/src/xcb.c)
    47 ms: config_string_cb (../../i3/i3bar/src/config.c)
    45 ms: GENERATED_call (../../i3/src/config_parser.c)
    45 ms: GENERATED_call (../../i3/src/commands_parser.c)
    43 ms: floating_enable (../../i3/src/floating.c)
    42 ms: handle_configure_request (../../i3/src/handlers.c)
    40 ms: con_swap (../../i3/src/con.c)
    36 ms: main (../../i3/i3-input/main.c)
    36 ms: main (../../i3/i3-msg/main.c)
    36 ms: main (../../i3/i3-nagbar/main.c)
    36 ms: cmd_move_con_to_workspace_number (../../i3/src/commands.c)
    35 ms: json_string (../../i3/src/load_layout.c)
    35 ms: tree_restore (../../i3/src/tree.c)
    35 ms: cmd_swap (../../i3/src/commands.c)
    34 ms: x_push_changes (../../i3/src/x.c)
    32 ms: main (../../i3/i3-config-wizard/main.c)
    32 ms: ewmh_setup_hints (../../i3/src/ewmh.c)
    31 ms: match_parse_property (../../i3/src/match.c)
    30 ms: cmd_mark (../../i3/src/commands.c)
    30 ms: translate_keysyms (../../i3/src/bindings.c)
    30 ms: window_update_normal_hints (../../i3/src/window.c)

**** Function sets that took longest to compile / optimize:

*** Expensive headers:
29596 ms: ../../i3/include/libi3.h (included 78 times, avg 379 ms), included via:
  a-get_config_path.o  (539 ms)
  i3_dump_log-main.o  (522 ms)
  i3_config_wizard-main.o  (501 ms)
  a-fake_configure_notify.o  (500 ms)
  a-root_atom_contents.o  (488 ms)
  i3-display_version.o all.h  (466 ms)
  ...

26054 ms: ../../i3/include/all.h (included 41 times, avg 635 ms), included via:
  i3-display_version.o  (901 ms)
  i3-drag.o  (775 ms)
  i3-ewmh.o  (703 ms)
  i3-startup.o  (693 ms)
  i3-commands.o  (687 ms)
  i3-xcb.o  (680 ms)
  ...

5345 ms: /usr/include/xcb/xcb.h (included 79 times, avg 67 ms), included via:
  i3-display_version.o all.h  (173 ms)
  i3_input-keysym2ucs.o keysym2ucs.h  (106 ms)
  i3-ewmh.o all.h  (106 ms)
  a-fake_configure_notify.o libi3.h  (103 ms)
  a-get_config_path.o libi3.h  (95 ms)
  i3bar-parse_json_header.o common.h  (93 ms)
  ...

4127 ms: ../../i3/i3bar/include/common.h (included 9 times, avg 458 ms), included via:
  i3bar-child.o  (524 ms)
  i3bar-mode.o  (486 ms)
  i3bar-outputs.o  (464 ms)
  i3bar-parse_json_header.o  (463 ms)
  i3bar-config.o  (457 ms)
  i3bar-ipc.o  (448 ms)
  ...

1542 ms: /usr/include/xcb/xkb.h (included 42 times, avg 36 ms), included via:
  i3-con.o all.h ipc.h configuration.h i3.h  (60 ms)
  i3-render.o all.h ipc.h configuration.h i3.h  (56 ms)
  i3-bindings.o all.h ipc.h configuration.h i3.h  (56 ms)
  i3-sighandler.o all.h ipc.h configuration.h i3.h  (48 ms)
  i3-xcb.o all.h ipc.h configuration.h i3.h  (47 ms)
  i3-resize.o all.h ipc.h configuration.h i3.h  (39 ms)
  ...

1456 ms: /usr/include/stdlib.h (included 79 times, avg 18 ms), included via:
  i3-drag.o all.h  (60 ms)
  i3-display_version.o all.h  (55 ms)
  i3-fake_outputs.o all.h  (39 ms)
  i3-config_directives.o all.h  (33 ms)
  i3-xcursor.o all.h  (30 ms)
  i3bar-mode.o common.h libi3.h pango.h pango-attributes.h pango-font.h pango-coverage.h glib-object.h gbinding.h glib.h gasyncqueue.h gthread.h gutils.h  (29 ms)
  ...

1136 ms: /usr/include/X11/Xlib.h (included 44 times, avg 25 ms), included via:
  i3-con.o all.h data.h sn-launcher.h sn-common.h  (35 ms)
  i3-resize.o all.h data.h sn-launcher.h sn-common.h  (34 ms)
  i3-util.o all.h data.h sn-launcher.h sn-common.h  (33 ms)
  i3-assignments.o all.h data.h sn-launcher.h sn-common.h  (33 ms)
  i3-sighandler.o all.h data.h sn-launcher.h sn-common.h  (31 ms)
  i3-xcb.o all.h data.h sn-launcher.h sn-common.h  (31 ms)
  ...

808 ms: /usr/include/stdio.h (included 79 times, avg 10 ms), included via:
  i3-drag.o all.h  (19 ms)
  i3-fake_outputs.o all.h  (18 ms)
  a-font.o libi3.h  (16 ms)
  i3bar-child.o common.h libi3.h  (15 ms)
  a-safewrappers.o libi3.h  (15 ms)
  a-ipc_send_message.o libi3.h  (13 ms)
  ...

770 ms: /usr/include/xcb/randr.h (included 42 times, avg 18 ms), included via:
  i3-click.o all.h data.h  (29 ms)
  i3-commands.o all.h data.h  (27 ms)
  i3-assignments.o all.h data.h  (25 ms)
  i3-xcb.o all.h data.h  (21 ms)
  i3-resize.o all.h data.h  (21 ms)
  i3-sighandler.o all.h data.h  (20 ms)
  ...

688 ms: /usr/include/math.h (included 6 times, avg 114 ms), included via:
  a-dpi.o  (145 ms)
  i3-render.o  (127 ms)
  i3-floating.o  (106 ms)
  a-root_atom_contents.o  (106 ms)
  i3-window.o  (102 ms)
  i3-bindings.o  (99 ms)
  ...
```
2020-04-20 05:54:17 +02:00
Orestis Floros 2954125324
nagbar: Remove i3-nagbar.h 2020-04-20 04:25:45 +02:00
Orestis Floros 3c522d9f2f
Sort includes in *.c files
Not enabling in .clang-format because it breaks headers files.

Used:
    IncludeCategories:
      - Regex:           '^<config'
        Priority:        0
      - Regex:           '^".*"'
        Priority:        1
      - Regex:           '^<(xcb|xkb|yajl|X11)'
        Priority:        3
      - Regex:           '.*'
        Priority:        2
2020-04-19 09:58:25 +02:00
Jason Nader 9a3318b622
Fix error message 2020-03-01 13:25:42 +09:00
Jason Nader 191c394db8
Use _PATH_BSHELL in nagbar script as well 2020-03-01 12:46:30 +09:00
Ingo Bürk d2acdcc69f
Merge pull request #3960 from ammgws/patch-2
Remove comment referencing old source code
2020-03-01 01:29:30 +01:00
Jason 5024a13b8b
Remove comment referencing old source code
Behaviour was changed in f691a55923
2020-03-01 05:03:41 +09:00
Jason a516bdbb92
Use _PATH_BSHELL
Possibly overlooked in f691a55923850a4d315450925fc98733d07b69c9?
2020-03-01 04:53:35 +09:00
xzfc 47be36410c
Assume xcb_cursor_context_new never fails (#3955)
According to libxcb-cursor code, the only condition in which
xcb_cursor_context_new() returns a non-zero result is a memory
allocation failure[1].  Thus, it is safe to assume that
xcursor_supported is always true, and remove dead code.

[1]: https://gitlab.freedesktop.org/xorg/lib/libxcb-cursor/blob/0.1.3/cursor/cursor.c#L131-132
2020-02-24 08:48:58 +01:00
Orestis Floros e9f011397a
libi3: Make visual_type extern
See #3914
2020-02-01 17:32:54 +01:00
Orestis Floros ffde51e50f
i3-nagbar: Fix small leak 2019-10-14 12:26:10 +03:00
Orestis Floros a3f94783e5
i3-nagbar: get_window_position: Improve logging 2019-10-14 12:26:04 +03:00
Orestis Floros b1723f0549
i3-nagbar: Don't use DLOG
debuglog() is empty and no option to enable it exists
2019-10-14 12:24:30 +03:00
Nguyễn Thái Ngọc Duy 6462cf1ca3
Remove \n from errx and die messages
errx() already appends \n internally. "\n" in the error message will
result in a blank line after the message. die() is just a wrapper around
errx() so it receives the same treatment.
2019-01-02 14:23:56 +02:00
Orestis Floros 07dfb8450b
Fix typo: childs -> children 2018-10-13 21:10:11 +03:00
Orestis dfe89cc4f1 i3-nagbar: add option for button that runs commands without a terminal (#3258)
Fixes #2199.
2018-10-07 22:43:24 +02:00
Orestis Floros d080f58299
i3-nagbar & i3-config-wizard: check sncontext != NULL
From
07237ff25d/libsn/sn-common.c (L87-L171)
it appears that SnDisplay can't be NULL, so I skipped the check.

Fixes #3419
2018-09-23 17:06:29 +03:00
Orestis Floros bf1cb39b4b
Support startup-notification in i3-nagbar & i3-config-wizard
The default i3 config uses the `exec` command without `--no-startup-id`
to launch:
1. i3-nagbar
4cba9fcbda/etc/config (L150)
2. i3-config-wizard
4cba9fcbda/etc/config (L194)

A user that opens i3 for the first time will be greeted with a "loading"
cursor because of i3-config-wizard.
2018-08-25 14:54:16 +03:00
Orestis Floros 0b5a2092a0
Fix redundant casts to the same type
Found using clang-tidy's google-readability-casting.
2018-04-27 00:09:42 +03:00
Michael Stapelberg 021d40f666 Bugfix: ignore ConfigureNotify with width == 0 || height == 0
fixes #3132
2018-03-09 08:25:07 +01:00
Daniel Mueller 865bd462b4
do not check for NULL in FREE macro
free(3) is safe to invoke on a NULL pointer, in which case no action is
taken. This change adjusts the FREE macros to omit this unnecessary
check.
2017-11-23 15:41:33 -08:00
Michael Stapelberg 38b777c5fc Revert "i3-nagbar: add button flag to execute action with /bin/sh directly" (#2893) 2017-08-31 22:50:00 +02:00
Max Fisher 2fe9d7bbd2 i3-nagbar: add button flag to execute action with /bin/sh directly.
Fixes #2765.
2017-05-12 21:50:41 +10:00
mihaicmn 8edb4a1f0c migrate i3-nagbar to draw_util (#2644) 2017-01-21 07:25:21 -08:00
Ingo Bürk d58dbc3a77 Only react on the last Expose event in a series of events. (#2636)
Thanks to @psychon for pointing this out during the review of PR #2624.
This commit extends this change to all other occurences of Expose events
within i3.
2017-01-13 09:34:58 -08:00
mihaicmn f25c3d5e77 Use the DPI setting within the i3-config-wizard and i3-nagbar (#2585) 2016-11-28 22:07:45 +01:00
Michael Stapelberg f354f53435 Ensure all *.[ch] files include config.h
Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
2016-10-23 21:09:24 +02:00
Michael Stapelberg 4a52a7e9fb Switch to autotools (GNU build system)
This commit probably comes as a surprise to some, given that one of i3’s
explicitly stated goals used to be “Do not use programs such as
autoconf/automake for configuration and creating unreadable/broken makefiles”.

I phrased this goal over 7 years ago, based largely on a grudge that I
inherited, which — as I’ve realized in the meantime — was largely held against
FOSS in general, and not actually nuanced criticism of autotools.

In the meantime, I have come to realize that the knee-jerk reaction of “I could
do this better!” (i.e. writing our own build system in this particular case) is
usually misguided, and nowadays I strongly suggest trying hard to fix the
existing system for the benefit of all existing and future users.

Further, I recently got to experience the other side of the coin, as I packaged
a new version of FreeRADIUS for Debian, which at the time of writing used
autoconf in combination with boilermake, a custom make-based build system that
only FreeRADIUS uses. Understanding the build system enough to fix issues and
enable parallel compilation took me an entire day. That time is time which
potentially every downstream maintainer needs to invest, and the resulting
knowledge cannot be applied to any other project.

Hence, I believe it’s a good idea switch i3 to autotools. Yes, it might be that
particular features were easier to implement/understand in our custom
Makefiles, and there might be individuals who have an easier time reading
through our custom Makefiles than learning autotools. All of these
considerations are outweighed by the benefits we get from using the same build
system as literally thousands of other FOSS software packages.

Aside from these somewhat philosophical considerations, there’s also practical
improvements which this change brings us. See the “changes” section below.

┌──────────────────────────────────────────────────────────────────────────────┐
│ new workflow                                                                 │
└──────────────────────────────────────────────────────────────────────────────┘

You can now build i3 like you build any other software package which uses
autotools. Here’s a memory refresher:

    autoreconf -fi
    mkdir -p build && cd build
    ../configure
    make -j8

(The autoreconf -fi step is unnecessary if you are building from a release
 tarball, but shouldn’t hurt either.)

┌──────────────────────────────────────────────────────────────────────────────┐
│ recommended reading                                                          │
└──────────────────────────────────────────────────────────────────────────────┘

I very much recommend reading “A Practitioner's Guide to GNU Autoconf,
Automake, and Libtool” by John Calcote (https://www.nostarch.com/autotools.htm).
That book is from 2010 and, AFAICT, is the most up to date comprehensive
description of autotools. Do not read older documentation. In particular, if a
document you’re reading mentions configure.in (deprecated filename) or
recursive make (now considered harmful), it’s likely outdated.

┌──────────────────────────────────────────────────────────────────────────────┐
│ changes                                                                      │
└──────────────────────────────────────────────────────────────────────────────┘

This commit implements the following new functionality/changes in behavior:

• We use the AX_ENABLE_BUILDDIR macro to enforce builds happening in a separate
  directory. This is a prerequisite for the AX_EXTEND_SRCDIR macro and building
  in a separate directory is common practice anyway. In case this causes any
  trouble when packaging i3 for your distribution, please let me know.

• “make check” runs the i3 testsuite.
  You can still use ./testcases/complete-run.pl to get the interactive progress
  output.

• “make distcheck” (runs testsuite on “make dist” result, tiny bit quicker
  feedback cycle than waiting for the travis build to catch the issue).

• “make uninstall” (occasionally requested by users who compile from source)

• “make” will build manpages/docs by default if the tools are installed.
  Conversely, manpages/docs are not tried to be built for users who don’t want
  to install all these dependencies to get started hacking on i3.

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

• Support for pre-compiled headers (PCH) has been dropped for now in the
  interest of simplicitly. Maybe we can re-add it later.

• coverage reports are now generated using “make check-code-coverage”, which
  requires specifying --enable-code-coverage when calling configure.

┌──────────────────────────────────────────────────────────────────────────────┐
│ build system feature parity/testing                                          │
└──────────────────────────────────────────────────────────────────────────────┘

In addition to what’s described above, I tested the following features:

• “make install” installs the same files (plus documentation and manpages)
  cd i3-old && make install PREFIX=/tmp/inst/old
  cd i3-new && ./configure --prefix=/tmp/inst/new
  cd /tmp/inst
  (cd old && for f in $(find); do [ -e "../new/$f" ] || echo "$f missing"; done)

• make dist generates a tarball which includes the same files
  cd i3-old && make dist
  cd i3-new/x86_64-pc-linux-gnu && make dist
  colordiff -u <(tar tf i3-old/i3-4.12.tar.bz2 | sort) \
               <(tar tf i3-new/x86_64-pc-linux-gnu/i3-4.12.tar.gz | sort)
  There are some expected differences:
  • Some files have been renamed (e.g. the new etc/ and share/ subdirectories)
  • Some files will now be generated at build-time, so only their corresponding
    .in file is shipped (e.g. testcases/complete-run.pl)
  • The generated parser files are shipped in the dist tarball (they only
    depend on the parser-specs/* files, not on the target system)
  • autotools infrastructure is shipped (e.g. “configure”, “missing”, etc.)

• DLOG and ELOG statements still produce the same file name in logfiles

• Listing source code in gdb still works.

• gdb backtraces contain the i3-<version> path component

• release.sh still works

• version embedding
  1. git checkout shows “4.12-136-gf720023 (2016-10-10, branch "autotools")”
  2. tarball of a git version shows “4.12-non-git”
  3. release tarball shows 4.13

• debug mode is enabled by default for non-release builds

• enabling verbose builds via V=1

┌──────────────────────────────────────────────────────────────────────────────┐
│ speed                                                                        │
└──────────────────────────────────────────────────────────────────────────────┘

There is no noticeable difference in compilation speed itself (of binaries,
documentation and manpages):

i3-old $ time make all docs mans -j8
make all docs mans -j8  28.92s user 2.15s system 640% cpu 4.852 total

i3-new $ time make -j8
make -j8  27.08s user 1.92s system 620% cpu 4.669 total

In terms of one-time costs:
configuring the build system (../configure) takes about 2.7s on my machine,
generating the build system (autoreconf -fi) takes about 3.1s on my machine.

┌──────────────────────────────────────────────────────────────────────────────┐
│ m4 macros                                                                    │
└──────────────────────────────────────────────────────────────────────────────┘

All files in m4/ have been copied from the autoconf-archive package in version
b6aeb1988f4b6c78bf39d97b6c4f6e1d594d59b9 and should be updated whenever they
change.

This commit has been tested with autoconf 2.69 and automake 1.15.
2016-10-23 21:09:21 +02:00
Ingo Bürk cb1fcfed6a Use Xft.dpi for DPI if available.
fixes #2465
2016-09-26 20:29:53 +02:00
Michael Stapelberg 9bf346c7a0 Remove compatibility definitions for xcb-util < 0.3.8 (#2473)
Even Debian oldstable has xcb-util 0.3.8.
2016-09-24 09:48:32 -07:00
Theo Buehler a1d1f456a1 Add pledge(2) support for OpenBSD
pledges for i3:
"stdio rpath unix" for talking to the i3 socket usually in /tmp
"proc exec" for executing programs
"wpath cpath" are needed for the restart-in-place functionality

To make this work, @semarie pointed out that it is sufficient to ensure
that we get physical_mem_bytes only once, namely in init_logging().

pledges for i3-msg:
"stdio rpath unix" are needed for talking to the i3-socket

pledges for i3-nagbar
"rpath getpw" to find the home directory
"wpath cpath" to write the script
"proc exec" to execute the script
2016-01-17 18:49:00 +01:00
Michael Stapelberg a9f31b9dc9 i3-nagbar: explicitly set cursor using libxcursor if available
See commit b1f1da432 for context.

fixes #2114
2016-01-04 09:26:45 +01:00
Alex Auvolat c6a4e4519f Correct color management for pango fonts
Corrects the cases where the colorpixel is not 0xRRGGBB : we have to
use the full color_t struct to describe font colors, as Pango expects
RGB values and not an XCB colorpixel value.
2015-12-29 14:26:21 +01:00
Ingo Bürk 1c4100ce5d Use 32-bit visuals for i3bar when possible and allow RGBA colors.
This patch creates all necessary windows for i3bar with 32-bit visuals if available.
It also introduces the possibility to define RGBA colors (next to RGB colors), which
allows the user to set the opacity of any color. This requires running a compositor.

With this patch we also start supporting _NET_SYSTEM_TRAY_VISUAL, which is necessary
for the tray icons so they create the tray window with the correct depth and visual.
2015-10-06 23:01:57 +02:00
shdown c85d16faa4 Use safe wrappers wherever possible 2015-08-03 12:50:50 +03:00
Ingo Bürk 94a09b3cac Added missing newlines in log statements. 2015-06-30 20:48:35 +02:00
Deiz 884214f14f Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-20 17:50:21 -04:00
Thomas Anderson 196e1d0971 Respect EXEC_PREFIX and a users' choice of PKG_CONFIG.
The Makefiles should put binaries in $(EXEC_PREFIX) and
architecture-independent files in $(PREFIX). Also a user may have a
prefixed- pkg-config, as in the case of cross compiling on Exherbo
Linux, so respect the well-accepted $(PKG_CONFIG) variable for this
purpose.
2015-04-12 17:59:30 -07:00
Michael Stapelberg dfefb10d36 initialize variables to NULL to avoid invalid free() on error 2015-03-29 20:57:20 +02:00
Michael Stapelberg 6cba530946 Merge pull request #1593 from Airblader/feature-nagbar-primary-output
Display i3-nagbar on primary output
2015-03-29 19:54:32 +02:00
Michael Stapelberg 93adcf8bdc Merge pull request #1575 from hwangcc23/next
Fix warnings
2015-03-29 16:53:14 +02:00
hwangcc 42515308e7 Add a safe wrapper for write and fix some warnings
1. Add a function writeall and make swrite wrap that function. Use either writeall or swrite, depending on whether we want to exit on errors or not.
2. Fix warnings when compiling with a higher optimisation level.
(CFLAGS ?= -pipe -O3 -march=native -mtune=native -freorder-blocks-and-partition)

Signed-off-by: hwangcc <hwangcc@csie.nctu.edu.tw>
2015-03-29 10:22:34 +08:00
Ingo Bürk 0ad9268253 Open i3-nagbar on the primary screen
If a primary screen is set and the CRTC information can be retrieved,
i3-nagbar will now open on the primary screen. Otherwise, the old (fixed)
position will be used as a fallback.

fixes #1405
2015-03-28 19:35:59 +01:00
Ingo Bürk 43f65e1d2b Compile xcb-randr support into i3-nagbar 2015-03-27 08:44:00 +01:00
Michael Stapelberg ad31b13cb6 update default fonts for i3-{input,config-wizard,nagbar}
We’ve done this a while ago in i3.config itself, but the tools in
question aren’t hooked up to that setting, so we need to do it here as
well.
2015-03-26 10:03:30 +01:00
Michael Stapelberg d91bf5d491 make i3-nagbar work properly on hi-dpi displays 2015-03-26 09:44:46 +01:00
Diana Thayer 94b1e76af4 degendered terms 2015-03-11 21:41:43 -07:00
Michael Stapelberg 091f1db39a run clang-format (3.5.0)
Not quite sure why there are so many differences. Perhaps we’ve gotten
out of the habit of running clang-format after every change.

I guess it’d be best to have a travis hook that runs clang-format for us
and reports any problems on pull requests.
2015-03-01 17:16:03 +01:00
Michael Stapelberg 4c06e7a573 clang-format-3.5 **/*.h **/*.c
This should be the last commit that formats a big bunch of files. From
here on, whenever I merge patches, I’ll run clang-format like described
in the title.
2014-06-19 11:20:32 +02:00
Michael Stapelberg 9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

1) The i3 codebase is now consistently formatted. clang-format uncovered
   plenty of places where inconsistent code made it into our code base.

2) When writing code, you don’t need to think or worry about our coding
   style. Write it in yours, then run clang-format-3.5

3) When submitting patches, we don’t need to argue about coding style.

The basic idea is that we don’t want to care about _how_ we write the
code, but _what_ it does :). The coding style that we use is defined in
the .clang-format config file and is based on the google style, but
adapted in such a way that the number of modifications to the i3 code
base is minimal.
2014-06-15 19:07:02 +02:00