352 Commits

Author SHA1 Message Date
Kovid Goyal
27df509206 Nicer fix for enter event mouse tracking
Send an explicit mouse event to child when pointer enters window instead
of relying on GLFW to send a cursor position update event.
2025-03-04 11:29:29 +05:30
Kovid Goyal
756240f68d Remove unused code 2025-02-03 10:56:50 +05:30
Kovid Goyal
39dc31e021 Render the octant characters using box drawing 2025-02-03 10:56:48 +05:30
Kovid Goyal
88f796a94c Read decorations indices from a separate texture 2025-02-03 10:56:45 +05:30
Kovid Goyal
0fb49f4139 Switch to using an index for sprite tracking
Frees up two bytes in GPUCell. Doesn't require a minimum texture row
size. Makes a bunch of code faster. Index uses 31 bits which gives us
2,147,483,647 aka ~ 2 billion sprites.
2025-02-03 10:56:45 +05:30
Kovid Goyal
06f2e64cff Remove duplicated data 2025-02-03 10:56:45 +05:30
Kovid Goyal
8993386399 Store font related cell metrics in a single struct 2025-02-03 10:56:44 +05:30
Kovid Goyal
9d48fa9126 hints/unicode_input kittens: Do not lose keypresses that are sent very rapidly via an automation tool immediately after the kitten is launched
We now buffer the key events until the kitten tells us it is ready.
Without this the key presses are delivered to the underlying window
as the kitten's overlay window was not being focused until the kitten
set the ready message.

Fixes #7089
2024-12-12 13:11:12 +05:30
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
Kovid Goyal
7ff7947ab3 Fix cell_as_unicode 2024-11-04 09:10:07 +05:30
Kovid Goyal
cabd6c0589 Initial port of code to use TextCache 2024-11-04 09:10:07 +05:30
Kovid Goyal
f6347ee1e2 Move more declarations out of data-types.h 2024-11-04 09:10:07 +05:30
Kovid Goyal
05120061cc Move various data types into their own headers 2024-11-04 09:10:07 +05:30
Kovid Goyal
c572adf677 Start work on allowing unlimited codepoints per cell
This is needed to properly support zero-width joiner based emoji
sequences.
2024-11-04 09:10:07 +05:30
Kovid Goyal
811dc814a0 Rename variable with better name
This is the time at which the cursor was moved by the client not the
time at which it was updated.
2024-10-18 11:09:29 +05:30
Rick Choi
c3eb48fc8a add cursor trail 2024-10-12 19:55:48 +09:00
Kovid Goyal
dbfeb8d6a4 Store transparent colors on ColorProfile
This will eventually allow them to be changed using remote control and
escape codes.
2024-09-24 19:02:13 +05:30
Kovid Goyal
9843b5c210 Remove unused code 2024-08-26 19:13:09 +05:30
Kovid Goyal
eedf01fbe3 Make getpeerid re-useable 2024-08-26 18:55:10 +05:30
Kovid Goyal
554a2b1811 Allow unfocused cursor shape to remain unchanged
Fixes #7728
2024-08-17 15:49:55 +05:30
Kovid Goyal
ba3de858df Mark temp vars used in min/max macros as const 2024-08-08 20:36:36 +05:30
Kovid Goyal
3d0747e713 Switch to SIMD accelerated base64 decoding for clipboard and notification requests 2024-07-26 23:57:33 +05:30
Kovid Goyal
0cf9a79760 A new option second_transparent_bg
Makes a second background color semi-transparent via background_opacity.
Useful for things like cursor line highlight in editors.

Fixes #7646
2024-07-21 20:22:31 +05:30
Kovid Goyal
0a707b5c33 Move work on animation implementation 2024-07-18 22:25:02 +05:30
Kovid Goyal
eb7487d7a2 Prepare of alpha blending of cursor
Will allow for cursor blink animation eventually.
2024-07-18 22:25:02 +05:30
Kovid Goyal
8fc96c5bd7 Make the debug logging functions consistent
They now all output the same format of:
[time since program start] msg
2024-04-08 12:53:55 +05:30
Kovid Goyal
06da31019c Micro-optimize clearing of lines
Use a doubling strategy to memset arrays to a fixed value. Makes the
memset O(log(N)) from O(N) in number of calls to memcpy.
2024-02-25 09:57:37 +05:30
Kovid Goyal
89c431a624 Optimize implementation of clear screen escape code 2024-02-25 09:57:36 +05:30
Kovid Goyal
6c2ef90033 Add some const for functions taking ColorProfile 2024-02-25 09:57:32 +05:30
Kovid Goyal
1f835b27c4 start work on implementing pending mode as paused rendering 2024-02-25 09:57:32 +05:30
Kovid Goyal
391a43d967 Store last cursor render pos in the rendered info struct 2024-02-25 09:57:32 +05:30
Kovid Goyal
be37a283d5 Move unfocused ender bool into cursor render info 2024-02-25 09:57:32 +05:30
Kovid Goyal
c2d81d67c2 Nicer macros to ignore diagnostics 2024-02-25 09:57:30 +05:30
Kovid Goyal
6205fb32fd Refactor VT parser for more speed
No longer copy bytes into a separate buffer, instead parse them in place
in the read buffer
2024-02-25 09:57:23 +05:30
Kovid Goyal
a4ca143fc5 Limit amount of pending data we will store 2024-02-25 09:57:23 +05:30
Kovid Goyal
b083ad9038 Start work on bytes based VT parser 2024-02-25 09:57:22 +05:30
Kovid Goyal
187fa996f8 Add the cell pointer shape 2023-10-16 20:33:12 +05:30
Kovid Goyal
4f1971c480 Rationalize mouse cursor shape handling
Now can use the full range of standard mouse cursor shapes similar to
those supported by browsers via the CSS cursor property.

Still needs to be fully implemented for cocoa backend.
2023-10-15 09:17:31 +05:30
Kovid Goyal
eb14714f1e ... 2023-08-07 12:30:30 +05:30
Kovid Goyal
6c7a8f8fa9 Ensure usage of __attribute__(cleanup) never frees un-initialized memory
Use macros that take an initializer parameter to, thereby ensuring the
variable to be cleaned up is always initialized.
2023-08-07 12:24:18 +05:30
Kovid Goyal
9af4d5e0fc Fix error from asan when built with clang 2023-08-07 11:46:18 +05:30
Kovid Goyal
b83e4d88f4 Implement fast padding-less base64 encode/decode for python 2023-07-30 19:49:38 +05:30
Konstantin Borisov
ee4a9c6ed8 fixed CENTER_CLAMPED to center images bigger than view, added CENTER_SCALED background image layout option 2023-07-13 21:26:25 +05:30
Campbell Jones
55fd885491 Add option to set XDG sound theme on Linux 2023-03-18 16:38:29 -04:00
Sergei Grechanik
d63eeada73 Image placement using Unicode placeholders
This commit introduces the Unicode placeholder image placement method.
In particular:
- Virtual placements can be created by passing `U=1` in a put command.
- Images with virtual placements can be displayed using the placeholder
  character `U+10EEEE` with diacritics indicating rows and columns.
- The image ID is indicated by the foreground color of the placeholder.
  Additionally, the most significant byte of the ID can be specified via
  the third diacritic.
- Underline color can be optionally used to specify the placement ID.
- A bug was fixed, which caused incomplete image removal when it was
  overwritten by another image with the same ID.
2023-02-21 18:23:16 -08:00
Kovid Goyal
2307892b50 Cleanup previous PR getting kitty working on macOS
Do not reduce the required OpenGL version on macOS. There is no point
anyway.

Fixes #2790
2023-02-10 11:03:25 +05:30
Kovid Goyal
a09dda27dc Merge branch 'master' of https://github.com/marcan/kitty 2023-02-10 10:55:41 +05:30
Kovid Goyal
68cf9f7514 Switch to tracking linewrap on the last cell in a line
This allows us to have newline not affect the wrap status of a line.

Now a lines wrapping status is changed only when the last cell
in the line is changed. This actually matches the behavior of many other
terminal emulators so is probably a good thing from a ecosystem
compatibility perspective.

The fish shell expects this weird behavior of newline not changing
wrapping status, for unknown reasons, which is the actual motivation for
doing all this work.

Fixes #5766
2022-12-26 20:26:21 +05:30
Hector Martin
84aebae6a8 Downgrade OpenGL version requirement to 3.1
There are only a few features required from newer versions, and they
can be achieved via extensions. This significantly improves compatibility.
2022-12-20 16:22:05 +09:00
Kovid Goyal
ae8f3de070 Allow centering the background image
Fixes #5525
2022-10-04 08:26:28 +05:30