kitty/kitty
Johannes Altmanninger 9ab0c8575e Fix Python.h being included after system headers
My "./dev.sh build" failed with

    Compiling kitty/screen.c ...
    gcc -MMD -DNDEBUG -DPRIMARY_VERSION=4000 -DSECONDARY_VERSION=37 -DXT_VERSION="0.37.0" -I/home/johannes/git/kitty/dependencies/linux-amd64/include -Wextra -Wfloat-conversion -Wno-missing-field-initializers -Wall -Wstrict-prototypes -std=c11 -pedantic-errors -Werror -O3 -fwrapv -fstack-protector-strong -pipe -fvisibility=hidden -fno-plt -fPIC -D_FORTIFY_SOURCE=2 -flto -fcf-protection=full -march=native -mtune=native -pthread -I/home/johannes/git/kitty/dependencies/linux-amd64/include/libpng16 -I/home/johannes/git/kitty/dependencies/linux-amd64/include -I/home/johannes/git/kitty/dependencies/linux-amd64/include -I/home/johannes/git/kitty/dependencies/linux-amd64/include -I/home/johannes/git/kitty/dependencies/linux-amd64/include/freetype2 -I/home/johannes/git/kitty/dependencies/linux-amd64/include/libpng16 -I/usr/include/uuid -I/home/johannes/git/kitty/dependencies/linux-amd64/include/harfbuzz -I/home/johannes/git/kitty/dependencies/linux-amd64/include/freetype2 -I/home/johannes/git/kitty/dependencies/linux-amd64/include/libpng16 -I/home/johannes/git/kitty/dependencies/linux-amd64/include -I/home/johannes/git/kitty/dependencies/linux-amd64/include/python3.12 -c kitty/screen.c -o build/fast_data_types-kitty-screen.c.o
    In file included from /home/johannes/git/kitty/dependencies/linux-amd64/include/python3.12/Python.h:12,
                     from kitty/data-types.h:11,
                     from kitty/text-cache.h:10,
                     from kitty/line.h:10,
                     from kitty/history.h:10,
                     from kitty/lineops.h:9,
                     from kitty/fonts.h:9,
                     from kitty/screen.c:19:
    /home/johannes/git/kitty/dependencies/linux-amd64/include/python3.12/pyconfig.h:1875:9: error: "_POSIX_C_SOURCE" redefined
     1875 | #define _POSIX_C_SOURCE 200809L
          |         ^~~~~~~~~~~~~~~
    In file included from /usr/include/bits/libc-header-start.h:33,
                     from /usr/include/stdint.h:26,
                     from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/include/stdint.h:9,
                     from kitty/charsets.h:9,
                     from kitty/screen.c:17:
    /usr/include/features.h:329:10: note: this is the location of the previous definition
      329 | # define _POSIX_C_SOURCE 199506L
          |          ^~~~~~~~~~~~~~~
    The following build command failed: /home/johannes/git/kitty/dependencies/linux-amd64/bin/python setup.py develop
    exit status 1

[Python docs](https://docs.python.org/3/c-api/intro.html) say:

> Since Python may define some pre-processor definitions which affect
> the standard headers on some systems, you must include Python.h
> before any standard headers are included.

Make it so. Since data-types.h is already included first in a lot of
*.c and *.h files, let's use that one.
Also fix the includes in launcher.

This is similar to commit 8e84b2145 (Re-order includes for
"_POSIX_C_SOURCE", 2018-06-02).

Also add an explicit error for this case, to make the resolution more
obvious? Here's the error when I try to include <stdlib.h> in screen.c:

    In file included from kitty/screen.c:14:
    kitty/data-types.h:11:2: error: #error "Must include \"data-types.h\" before any system headers"
       11 | #error "Must include \"data-types.h\" before any system headers"
          |  ^~~~~
    In file included from /home/johannes/git/kitty/dependencies/linux-amd64/include/python3.12/Python.h:12,
                     from kitty/data-types.h:14:
    /home/johannes/git/kitty/dependencies/linux-amd64/include/python3.12/pyconfig.h:1875:9: error: "_POSIX_C_SOURCE" redefined
     1875 | #define _POSIX_C_SOURCE 200809L
          |         ^~~~~~~~~~~~~~~
    In file included from /usr/include/bits/libc-header-start.h:33,
                     from /usr/include/stdlib.h:26,
                     from kitty/screen.c:13:
    /usr/include/features.h:329:10: note: this is the location of the previous definition
      329 | # define _POSIX_C_SOURCE 199506L
          |          ^~~~~~~~~~~~~~~
    The following build command failed: /home/johannes/git/kitty/dependencies/linux-amd64/bin/python setup.py develop
    exit status 1
2024-11-24 16:52:49 +01:00
..
conf A new option second_transparent_bg 2024-07-21 20:22:31 +05:30
fonts Use box drawing for filled circle and fish eye so that they line up with empty circle 2024-09-09 21:34:46 +05:30
launcher Fix Python.h being included after system headers 2024-11-24 16:52:49 +01:00
layout ... 2024-09-24 14:38:11 +05:30
options Fix config spelling errors 2024-11-10 19:49:33 -08:00
rc Get automatic theme switching working 2024-11-07 17:31:44 +05:30
__init__.py
actions.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
alpha_blend.glsl
animation.c use a named magic constant 2024-09-20 09:11:18 +05:30
animation.h DRYer 2024-07-19 11:47:24 +05:30
arches.h
backtrace.h
banned.h
base64.h
bash.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
bgimage_fragment.glsl
bgimage_vertex.glsl
binary.h
border_fragment.glsl
border_vertex.glsl Bell color should also not be rendered translucent 2024-09-26 00:29:20 +05:30
borders.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
boss.py Get automatic theme switching working 2024-11-07 17:31:44 +05:30
cell_defines.glsl
cell_fragment.glsl Prepare for allowing upto seven additional semi-transparent background colors 2024-09-24 19:02:13 +05:30
cell_vertex.glsl Replace the second_transparent_bg option 2024-09-24 19:02:13 +05:30
charsets.c Make kitty --single-instance fast 2024-06-23 15:45:41 +05:30
charsets.h Restore support for alternate character sets 2024-02-25 09:57:44 +05:30
child-monitor.c add a comment documenting previous PR 2024-11-23 19:40:13 +05:30
child.c macOS has no execvpe 2024-09-29 11:59:42 +05:30
child.py Add comments document realpath behavior for cwd_of_process 2024-10-07 21:13:54 +05:30
choose_entry.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
cleanup.c
cleanup.h Remove the 4KB mac chars limit in unicode_in_range 2024-11-04 09:10:07 +05:30
cli.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
cli_stub.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
client.py Fix report_device_attributes 2024-04-10 08:24:39 +05:30
clipboard.py Fix a regression that broke writing to the clipboard using the OSC 5522 protocol 2024-09-15 08:42:50 +05:30
cocoa_window.h Implement a polling mode for close events 2024-07-28 15:35:22 +05:30
cocoa_window.m Update sound support in desktop notifications spec 2024-08-04 20:20:41 +05:30
colors.c Implement changing transparent background colors via remote control 2024-09-24 19:02:13 +05:30
colors.h
colors.py Get automatic theme switching working 2024-11-07 17:31:44 +05:30
config.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
constants.py version 0.37.0 2024-10-30 21:34:51 +05:30
control-codes.h Parse and ignore SOS codes 2024-03-03 08:58:47 +05:30
core_text.m Fix bug pointed out by ASAN 2024-11-04 09:10:08 +05:30
cross-platform-random.h
crypto.c Fix #7904 2024-09-26 21:53:37 +05:30
cursor.c Move more declarations out of data-types.h 2024-11-04 09:10:07 +05:30
cursor_trail.c Cleanup cursor_trail threshold option name and documentation 2024-10-27 13:44:33 +05:30
data-types.c Move more declarations out of data-types.h 2024-11-04 09:10:07 +05:30
data-types.h Fix Python.h being included after system headers 2024-11-24 16:52:49 +01:00
debug_config.py Document how to setup kitty for automatic OS color following 2024-11-07 19:09:18 +05:30
desktop.c Rename method and change default theme to __custom 2024-08-03 13:06:48 +05:30
disk-cache.c DRYer 2024-07-16 10:45:46 +05:30
disk-cache.h
emoji.h bump unicode version to 16 2024-11-10 09:03:52 +05:30
entry_points.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
fast-file-copy.c
fast-file-copy.h
fast_data_types.pyi Function to get the current system color theme 2024-11-07 12:47:06 +05:30
file_transmission.py Another fix for mypy 1.12 2024-10-15 08:16:31 +05:30
font-names.c MacOS Intel: Fix a crash in the choose-fonts kitten when displaying previews of variable fonts 2024-08-18 17:22:12 +05:30
fontconfig.c Initial port of code to use TextCache 2024-11-04 09:10:07 +05:30
fonts.c ... 2024-11-09 07:54:55 +05:30
fonts.h Initial port of code to use TextCache 2024-11-04 09:10:07 +05:30
freetype.c Fix segfault when font descriptor point to invalid font file 2024-10-18 02:31:54 +02:00
freetype_render_ui_text.c Implement rendering of window control buttons in CSD 2024-04-06 08:32:07 +05:30
freetype_render_ui_text.h Implement rendering of window control buttons in CSD 2024-04-06 08:32:07 +05:30
gl-wrapper.c
gl-wrapper.h
gl.c Fix minimum OpenGL version reported in some error messages 2024-05-20 20:13:35 +05:30
gl.h Output OpenGL version in debug config 2024-04-24 08:55:56 +05:30
glfw-wrapper.c Report compositor missing capabilities in debug output 2024-04-04 16:56:13 +05:30
glfw-wrapper.h Function to get the current system color theme 2024-11-07 12:47:06 +05:30
glfw.c Add tests for strip_csi with multibyte 2024-11-24 09:28:21 +05:30
glyph-cache.c ... 2024-07-13 14:04:21 +05:30
glyph-cache.h Migrate glyph properties hash table to verstable 2024-07-12 09:11:00 +05:30
graphics.c Graphics protocol: Fix delete by number not deleting newest image with the specified number 2024-11-24 10:11:34 +05:30
graphics.h Speed up loading of background image 2024-07-23 15:10:54 +05:30
graphics_fragment.glsl
graphics_vertex.glsl
guess_mime_type.py
history.c Fix #8044 2024-11-12 09:04:08 +05:30
history.h Move more declarations out of data-types.h 2024-11-04 09:10:07 +05:30
hyperlink.c DRYer 2024-07-16 10:57:00 +05:30
hyperlink.h Move hyperlink hashmap to verstable 2024-07-12 09:11:00 +05:30
iqsort.h
key_encoding.c
key_encoding.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
key_names.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
keys.c Dispatch any clicks waiting for click_interval on key events 2024-07-07 20:17:22 +05:30
keys.h Make the debug logging functions consistent 2024-04-08 12:53:55 +05:30
keys.py macOS: Fix shortcuts that become entries in the global menubar being reported as removed shortcuts in the debug output 2024-09-08 09:48:14 +05:30
kittens.c
kitty-verstable.h DRYer 2024-07-16 10:45:46 +05:30
launch.py Make code to parse color specs and patch options objects re-useable 2024-11-07 13:14:33 +05:30
line-buf.c Couple more places where we initialized Line without TextCache 2024-11-12 09:08:42 +05:30
line-buf.h Make the TextCache object available in the Screen, LineBuf and Line objects 2024-11-04 09:10:07 +05:30
line.c ... 2024-11-09 07:54:55 +05:30
line.h Reduce size of LineAttrs from 4 bytes to 1 byte 2024-11-04 09:10:08 +05:30
linear2srgb.glsl
lineops.h Port the CoreText backend to use ListOfChars 2024-11-04 09:10:07 +05:30
logging.c macOS: Fix a regression in the previous release that caused --single-instance to not work when using macos-launch-services-cmdline 2024-08-23 15:27:26 +05:30
loop-utils.c
loop-utils.h
macos_process_info.c
main.py Get automatic theme switching working 2024-11-07 17:31:44 +05:30
marks.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
modes.h Add support for in-band window resize notifications 2024-07-18 20:32:33 +05:30
monotonic.c
monotonic.h Make the debug logging functions consistent 2024-04-08 12:53:55 +05:30
mouse.c Add special flag to shell integration protocol to request real click events 2024-09-06 00:08:55 -06:00
multiprocessing.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
notifications.py Make mypy happy, I hope 2024-10-15 07:35:15 +05:30
open_actions.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
os_window_size.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
parse-graphics-command.h Graphics protocol: Add a new delete mode for deleting images whose ids fall within a range 2024-02-25 09:57:44 +05:30
png-reader.c
png-reader.h
remote_control.py Add a framework for easily and securely using remote control from the main function of a custom kitten 2024-09-29 20:36:12 +05:30
render_cache.py Ensure output rgba data file is unlinked on error 2024-10-11 19:01:02 +05:30
rewrap.h Initial port of code to use TextCache 2024-11-04 09:10:07 +05:30
rgb.py Document the new color control protocol 2024-07-22 13:24:25 +05:30
rowcolumn-diacritics.c bump unicode version to 16 2024-11-10 09:03:52 +05:30
safe-wrappers.h Preserve fd numbers in pass_fds 2024-09-29 10:42:20 +05:30
screen.c Fix Python.h being included after system headers 2024-11-24 16:52:49 +01:00
screen.h Initial port of code to use TextCache 2024-11-04 09:10:07 +05:30
search_query_parser.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
session.py Fix a regression in the previous release that broke use of the cd command in session files 2024-09-06 14:50:15 +05:30
shaders.c Fix background image flashing when closing a tab 2024-10-28 12:30:03 +05:30
shaders.py add cursor trail 2024-10-12 19:55:48 +09:00
shell_integration.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
shlex.c DRYer 2024-08-24 06:21:27 +05:30
shm.py
short_uuid.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
simd-string-128.c
simd-string-256.c
simd-string-impl.h Bump Go to 1.23 2024-08-24 08:06:02 +05:30
simd-string.c Fix #7245 2024-03-21 20:50:05 +05:30
simd-string.h Use a fast SIMD implementation to XOR data going into the disk cache 2024-02-25 09:57:43 +05:30
srgb_gamma.h
state.c Make github code scanner happy 2024-07-24 06:52:41 +05:30
state.h Cleanup cursor_trail threshold option name and documentation 2024-10-27 13:44:33 +05:30
systemd.c Fix building on apple 2024-05-16 21:24:36 +05:30
tab_bar.py Add wcswidth to safe_builtins 2024-10-19 09:00:01 +05:30
tabs.py Add a framework for easily and securely using remote control from the main function of a custom kitten 2024-09-29 20:36:12 +05:30
terminfo.h Fix #7321 2024-04-08 07:39:50 +05:30
terminfo.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
text-cache.c Fix bug pointed out by ASAN 2024-11-04 09:10:08 +05:30
text-cache.h ... 2024-11-04 09:10:08 +05:30
threading.h
tint_fragment.glsl
tint_vertex.glsl
trail_fragment.glsl fade out cursor trail where cursor is hidden 2024-10-27 13:55:53 +09:00
trail_vertex.glsl don't draw cursor trail over the real cursor 2024-10-13 16:37:52 +09:00
types.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
typing.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
typing.pyi Add *_into API for streaming encode/decode 2024-07-30 07:18:33 +05:30
unicode-data.c bump unicode version to 16 2024-11-10 09:03:52 +05:30
unicode-data.h Initial port of code to use TextCache 2024-11-04 09:10:07 +05:30
update_check.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
utils.py Remove unused code 2024-09-12 20:33:41 +05:30
utmp.c
vt-parser.c New OSC 21 protocol for color control 2024-07-22 10:57:13 +05:30
vt-parser.h Ensure event loop ticks ASAP when there is pending input 2024-02-25 09:57:45 +05:30
wcswidth.c
wcswidth.h
wcwidth-std.h bump unicode version to 16 2024-11-10 09:03:52 +05:30
window.py Discard OSC 9 notifications that start with 4; 2024-11-01 20:21:55 +05:30
window_list.py Run pyupgrade to update the codebase to python 3.9 2024-07-31 07:55:27 +05:30
window_logo.c Make github code scanner happy 2024-07-24 06:52:41 +05:30
window_logo.h Also allow using other image formats for window_logo_path 2024-07-23 15:29:19 +05:30
xdg.py Search $XDG_DATA_HOME/icons before ~/.icons 2024-08-03 12:32:23 +05:30