Commit Graph

207 Commits (625f5aed51d76c9113aefbaef5ed92b611e27dc6)

Author SHA1 Message Date
nixo 625f5aed51 organize code in modules 2020-05-12 15:47:51 +02:00
nixo abe82f31a6 add move to workspace 2020-05-12 14:56:06 +02:00
nixo fb813d3ba3 wip keypress handling 2020-05-12 14:21:16 +02:00
nixo 56c30d5e3e Manage keybindings directly in guile! 2020-05-11 17:44:53 +02:00
nixo f2e7aee743 add some hook, add example config 2020-05-10 19:35:15 +02:00
nixo 03cbf0a766 more progresses 2020-05-10 18:31:26 +02:00
nixo c8f383329d many progresses 2020-05-10 17:20:32 +02:00
nixo 0270a9c565 [ipc] remove complex managing of message types. guile will do better easily 2020-05-10 01:33:55 +02:00
nixo 3fe8e00356 [meson]: add more programs, [i3]: add bindsym 2020-05-10 00:40:57 +02:00
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 0b62129224
Remove unused headers
With help from
https://github.com/include-what-you-use/include-what-you-use/
2020-04-20 04:25:06 +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
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
xzfc 1f0c628cde
clang-format: bring back ForeachMacros (#3948)
* clang-format: bring back ForeachMacros

ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.

* Add curly braces

Co-authored-by: Orestis Floros <orestisflo@gmail.com>
2020-02-19 11:31:09 +01:00
Ingo Bürk e3f120c0b6
Merge pull request #3946 from phy1729/i3bar_command-exec
Prepend "exec " to default i3bar_command
2020-02-18 09:16:27 +01:00
Orestis Floros 2eac53fada
atoms: Properly declare as global variables
See #3914
2020-02-01 17:34:01 +01:00
Matthew Martin a2cba79f9c Prepend "exec " to default i3bar_command
Avoids leaving around a useless shell process.
2020-01-30 21:02:50 -06:00
Orestis Floros 0ed94fc788
Use EXIT_SUCCESS/FAILURE instead of 0/1 2020-01-16 09:27:05 +01:00
Orestis Floros f7aee6b908
Exit with success on -h 2020-01-16 09:21:16 +01:00
David Shen efe84764b0 Unset _I3_RESTART_FD after restart (#3775)
Closes #3764
Closes #3765
2019-08-28 08:54:10 +02:00
Orestis Floros 14d2a4c7f6
Correctly select output when pointer query fails 2019-08-13 16:54:55 +03:00
Michael Stapelberg e4ecc6e4a1
Make `restart` IPC command send a reply once restart completed (!) (#3743)
This is achieved by retaining the IPC connection which is sending the restart
command across the restart.

This is the cleaner fix for https://github.com/i3/go-i3/issues/3

fixes #3565
2019-07-21 14:52:12 +02:00
Orestis Floros c9efa6dffe
Call all ewmh_update_* functions together when necessary
The testcase is changed because it was actually incorrect. Easy to
verify because:
> _NET_CURRENT_DESKTOP
> …
> The index of the current desktop. This is always an integer between 0
> and _NET_NUMBER_OF_DESKTOPS - 1.

Fixes #3696.
Also updates the viewports.

Finally, fixes an issue with _NET_CURRENT_DESKTOP not being updated
after a workspace rename. Example:
- workspaces 1, 2, 3
- rename workspace 1 to 5
- All workspaces changed their index but _NET_CURRENT_DESKTOP was not
updated
2019-05-03 16:19:11 +03:00
Orestis Floros 08cdc3a6ae
Allow checking for duplicate bindings with -C
- Having both parse_configuration and parse_file is excessive now
- We detect if we are parsing only by checking if conn is NULL, not with
use_nagbar
- font.pattern needs to be set to NULL because it is freed in
free_font()

Fixes #3660
2019-03-29 12:30:04 +02:00
Orestis Floros 4a2cacebf6
load_configuration: Remove conn argument 2019-03-29 02:49:10 +02:00
Orestis 02bb2693f9 cmd_exit: Let i3_exit handle shutdown (#3600)
- __lsan_do_leak_check() will terminate the process, so move it to the
end of the function.
- ev_loop_destroy() must be called after ipc_shutdown() because the
latter calls ev_ functions.

Fixes #3599
2019-01-22 21:35:44 +01: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
Albert Safin 27030c8566 Code style: fix misaligned and misindented comments 2018-12-09 08:04:55 +07:00
Albert Safin 1a85619498 Add input and bounding shapes support (#2742)
Basic idea: if the window has a shape, set the parent container shape as
the union of the window shape and the shape of the frame borders.

Co-authored-by: Uli Schlachter <psychon@znc.in>
2018-12-01 11:52:41 +07:00
Orestis Floros e4d2b38552
Make comment style more consistent 2018-10-13 21:10:10 +03:00
Orestis Floros b87bc70cd6
Enable detectable autorepeat
https://www.x.org/releases/current/doc/kbproto/xkbproto.html#Detectable_Autorepeat

Detectable autorepeat should only affect --release bindings. Currently,
when a user keeps a key pressed, we get multiple KeyPress and KeyRelease
events. With this change, we still get multiple KeyPress events, which
means that you can still keep a key pressed to repeatedly execute a
normal binding, but only one KeyRelease event when the key is physically
released.

Unfortunately, this change is not currently testable because detectable
autorepeat doesn't seem to work under Xephyr. AwesomeWM experienced the
same problem:
6f2424e901

Fixes #3306
2018-06-15 13:56:31 +03:00
Orestis Floros 5ab8c766c4
Fix link
Equivalent from the same version:
https://cgit.freedesktop.org/xorg/xserver/tree/xkb/xkbEvents.c?h=xorg-server-1.17.2#n927
2018-06-07 23:07:16 +03:00
Orestis Floros 16f8fe28d9
main.c: remove redundant 'focused' declaration
Previously declared in tree.h:17.
2018-04-27 01:16:42 +03:00
hwangcc23 e26fd91cf8 Add an i3bar flag: --verbose
Fix the issue #3220. (https://github.com/i3/i3/issues/3220)
2018-04-13 23:09:44 +08:00
Orestis Floros 0c2fbeedc2 Don't raise floating windows when focused because of focus_follows_mouse
Fixes #2990.
2018-01-14 15:45:33 +02:00
Daniel Mueller 3e34122de4 Perform proper cleanup for signals with 'Term' action (#3057)
Issue #3049 describes a case where terminating i3 by means of SIGTERM
causes it to leak the runtime directory and all its contents. There are
multiple issues at play: first, any cleanup handlers registered via
atexit are never invoked when a signal terminates the program (see
atexit(3)). Hence, the log SHM log cleanup performed in i3_exit is not
invoked in that case. Second, compared to the shutdown path for the
'exit' command, we do not unlink the UNIX domain socket we create,
causing it to be leaked as well. Third, a handler for SIGTERM is not
registered at all despite handle_signal claiming to be the handler for
all 'Term' signals.
This change addresses all three problems and results in a graceful exit
including cleanup to happen when we receive a signal with the default
action 'Term'. It addresses issue #3049.
2017-11-28 23:29:47 -08:00
Daniel Mueller 2481301dfc
fix typo in src/main.c 2017-11-18 09:49:41 -08:00
Michael Stapelberg 0d8b6714e3 Move XCB event handling into xcb_prepare_cb.
Previously, we used ev_check watchers, which are executed at the beginning of an
event loop iteration.

This was problematic if one of the handlers happened to fill the XCB event
queue, e.g. by reading a reply from X11 and an event happened in the meantime.

In that situation, we would hand control to the event loop, entirely ignoring
the pending event. This would manifest itself as a 1-minute hang,
reproducible (sometimes) in the i3 testsuite.

issue #2790 describes an instance of this issue in i3bar, and we fixed that by
changing the watcher priority to run last. Handling events in xcb_prepare_cb has
the same effect, as ev_prepare watchers are run just before the event loop goes
to sleep.
2017-10-23 21:06:13 +02:00
Michael Stapelberg 8e528d2de8 skip ConfigureNotify events with --force_xinerama
This prevents an i3 crash under certain conditions when running the tests.
2017-10-23 21:04:20 +02:00
Michael Stapelberg d968d39b27 Replace http:// with https:// where applicable
The testcases will be updated automatically in a separate commit.
2017-09-24 10:19:07 +02:00
Michael Stapelberg 607e97e651 ipc: rename COMMAND to RUN_COMMAND for consistency (#2956)
All other message types are verbs, only our first-ever message COMMAND wasn’t.

While we’re here, also change the message type dictionary into a table with
clickable links to the corresponding reply type.

Authors of downstream IPC libraries are encouraged to keep the old name around
so as to not break existing code, but mark it as deprecated.
2017-09-17 15:25:00 +02:00
Vladimir Panteleev 30b1ab38b3
Introduce output_primary_name function
Currently simply returns output->name, but this will make it easier to
change how output names are stored in the following commits.

Also replace reading output->name with invocations of
output_primary_name. Code which writes output->name is unchanged. Done
using a mostly mechanical replacement of output->name to
output_primary_name(output).
2017-09-13 08:22:57 +00:00
Michael Stapelberg d7e6cba17e do leak check before exiting
related to #2541
2017-08-28 09:23:42 +02:00
Michael Stapelberg 633a9f7b14 Implement RandR 1.5 support (#2580)
This comes with the intentionally undocumented --disable-randr15 command
line flag and disable-randr15 configuration directive. We will add
documentation before the release if and only if it turns out that users
actually need to use this flag in their setups. Ideally, nobody would
need to use the flag and everything would just keep working, but it’s
better to be safe than sorry.

fixes #1799
2016-11-28 18:20:46 +01:00
Ingo Bürk fea0bc1a45 Fix memory leaks. (#2530)
fixes #2529
2016-11-03 00:18:18 -07: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 3cba06f7b9 Fix _i3_version debugging symbol (#2492)
The idea was to ensure the symbol would always be present. For that, we need
__attribute__((used)), not __attribute__((unused)). Further, ensure the
variable has static storage, as the used attribute only applies to variables
with static storage. See also http://stackoverflow.com/a/29545417/712014
2016-10-05 09:46:33 -07:00
Michael Stapelberg 3a359a0243 Remove extraneous newline when printing core_pattern (#2490)
This was accidentally changed in commit 94a09b3cac
2016-10-03 23:53:49 -07:00
Ingo Bürk cb1fcfed6a Use Xft.dpi for DPI if available.
fixes #2465
2016-09-26 20:29:53 +02:00
Michael Stapelberg b850cfba4d Fix memleaks by avoiding _checked variants when discarding the result
Thanks psychon for pointing this out in
https://github.com/i3/i3/pull/2450#discussion_r78560433!
2016-09-14 09:22:45 +02:00