105 Commits

Author SHA1 Message Date
Kovid Goyal
392f576d07
Instrument safe_close() to make it easy to see where an fd is closed from 2020-07-14 20:18:04 +05:30
Kovid Goyal
e678c41f56
More code scanning warning fixes 2020-07-07 10:24:57 +05:30
Kovid Goyal
521f921424
Fix a bunch of code scanning warnings 2020-07-07 09:52:59 +05:30
James McCoy
a94e208db3 Use T_PYSSIZET for GraphicsManager.image_count
GraphicsManager.image_count is declared as a size_t, so the Python type
needs to be the same width.  On 64-bit big-endian architectures, this
mismatch was showing up as test failures:

    ======================================================================
    FAIL: test_gr_delete (kitty_tests.graphics.TestGraphics)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/<<PKGBUILDDIR>>/kitty_tests/graphics.py", line 319, in test_gr_delete
        self.ae(len(layers(s)), 0), self.ae(s.grman.image_count, 1)
        ch = 20
        cw = 10
        delete = <function TestGraphics.test_gr_delete.<locals>.delete at 0x3ffb7fc38b0>
        dx = 0.2
        dy = 0.4
        layers = <function put_helpers.<locals>.layers at 0x3ffb77709d0>
        put_image = <function put_helpers.<locals>.put_image at 0x3ffb77708b0>
        put_ref = <function put_helpers.<locals>.put_ref at 0x3ffb7770940>
        rect_eq = <function put_helpers.<locals>.rect_eq at 0x3ffb7770a60>
        s = <fast_data_types.Screen object at 0x1b60df0>
        self = <kitty_tests.graphics.TestGraphics testMethod=test_gr_delete>
    AssertionError: 0 != 1
2020-04-25 23:25:18 -04:00
Kovid Goyal
e2339697b9
Fix #2449 2020-03-19 17:22:58 +05:30
Luflosi
5c83f45bc6
Fix memory leak when realloc() fails 2020-02-20 10:54:10 +01:00
Kovid Goyal
9bf24bdff5
Cleanup png_path_to_bitmap() 2020-01-31 09:46:16 +05:30
Fredrick Brennan
8a6b8b415c More stylistic fixes 2020-01-31 09:48:28 +08:00
Fredrick Brennan
aaaa34e119 Move a bunch of unneeded stuff 2020-01-30 18:08:25 +08:00
Fredrick Brennan
6627586d6e Fix pedantic compiler test 2020-01-30 17:31:37 +08:00
Fredrick Brennan
9f364209af Add background_image 2020-01-30 17:23:42 +08:00
Fredrick Brennan
8020657d8c
Allow drawing images below cells w/background 2020-01-11 16:56:59 +05:30
Luflosi
f3b9ff5f9f
Use datatype monotonic_t instead of double to keep track of time
The time is stored in a signed 64 bit integer with nanosecond accuracy. This eliminates the possibility of floating-point inaccuracies.
`monotonic_t` can currently hold values large enough to work correctly for more than 200 years into the future.
Using a typedef instead of directly using `int64_t` everywhere will also allow easily changing the datatype in the future should the need arise for more precise or bigger time values.
2019-09-25 17:43:11 +02:00
Kovid Goyal
49429b5f49
When zeroing memory, use type independent code
Reduces the potential for bugs
2019-07-23 10:54:10 +05:30
Kovid Goyal
d9f90ef077
Make qsort invocations type independent 2019-07-23 10:20:41 +05:30
Kovid Goyal
6a126fa18e
Fix a crash when displaying very large number of images
Fixes #1825
2019-07-23 10:18:09 +05:30
Kovid Goyal
14d703f5cc
Cleanup 2019-07-23 09:44:58 +05:30
Kovid Goyal
9850025f3a
Use image ids instead of pointers when removing images since pointer values are changed by the remove operation 2019-07-23 09:40:41 +05:30
Kovid Goyal
8daab0ba41
Change image internal_id type to id_type 2019-07-23 09:34:04 +05:30
Kovid Goyal
c848c3ee0d
Use an interrupt-safe close() 2019-07-05 14:39:07 +05:30
Kovid Goyal
6a31909557
Make the MIN and MAX macros typesafe 2019-07-01 17:03:47 +05:30
Kovid Goyal
656916e0fa
Use remove_i_from_array in a few more places
Also simplify the REMOVER macro
2019-06-07 14:25:33 +05:30
Kovid Goyal
8b5f02bb0b
Fix shader invocation for cells output during resize 2019-03-04 19:54:10 +05:30
Kovid Goyal
11522ccc92
Initial code to show window size in cells while resizing 2019-03-04 19:54:10 +05:30
Kovid Goyal
f6b5e54890
Fix failing test 2018-12-11 10:08:52 +05:30
Kovid Goyal
d20c65ef80
Graphics protocol: Only delete temporary image-data files if they are in a known temporary file location 2018-12-11 10:00:43 +05:30
Kovid Goyal
2b035739f8
Make the PNG reader code re-useable 2018-07-07 07:46:15 +05:30
Kovid Goyal
df9eab279a
Implement changing the font size for individual top level (OS) windows 2018-05-27 12:37:49 +05:30
Kovid Goyal
523aadaa3b
Refactor font group handling
Allow kitty to manage multiple groups of fonts with different cell
sizes. Will eventually allow kitty to have different font sizes/dpi per
OSWindow
2018-05-27 12:37:05 +05:30
James McCoy
215a7689d9
Correct types for various PyArg_ParseTuple/Py_BuildValue calls
Debian's [mips] build failed one of the font tests:

    FAIL: test_sprite_map (kitty_tests.fonts.Rendering)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/<<PKGBUILDDIR>>/kitty_tests/fonts.py", line 48, in test_sprite_map
        self.ae(test_sprite_position_for(0, 1), (0, 1, 1))
        self = <kitty_tests.fonts.Rendering testMethod=test_sprite_map>
    AssertionError: Tuples differ: (0, 0, 0) != (0, 1, 1)

    First differing element 1:
    0
    1

    - (0, 0, 0)
    ?     ^  ^

    + (0, 1, 1)
    ?     ^  ^

This was due to test_sprite_position_for() using the "I" code to parse
into an unsigned short.  Since mips is big endian, the "wrong" byte was
stored into extra_glyphs.data.

This commit changes all similar data type mismatches that were found
from auditing calls to PyArg_ParseTuple/Py_BuildValue.

[mips]: https://buildd.debian.org/status/fetch.php?pkg=kitty&arch=mips&ver=0.9.0-1&stamp=1524126606&raw=0
2018-04-20 08:28:26 -04:00
Kovid Goyal
527255e3a1
Fix compilation with gcc 8
Apparently some nitwit Linux distros have made an unreleased compiler
their default compiler. Fixes #376

Fixes various new warnings that GCC 8 issues
2018-03-12 10:38:12 +05:30
Kovid Goyal
c7506496da
Unify error logging between python and C 2018-03-04 11:55:47 +05:30
Kovid Goyal
1ef010689d
Add support for clearing the scrollback buffer
kitty now supports using \E3J to clear the screen and scrollback buffer.
See #268
2018-01-06 23:55:49 +05:30
Kovid Goyal
0fcce6ec58
Remove trailing whitespace from native code files 2017-12-20 08:44:47 +05:30
Kovid Goyal
c17c6cae4c
Support S8C1T mode
That is, eight bit control codes. When in S8C1T mode, kitty will send
only eight bit control codes to the client.
2017-12-05 20:21:12 +05:30
Kovid Goyal
aef8b4ae67
Allow re-use of ensure_space_for macro 2017-11-13 15:29:52 +05:30
Kovid Goyal
8431eef970
Get rid of no longer needed GPU function indirection 2017-11-09 16:45:02 +05:30
Kovid Goyal
c1a1b06fe7
Use -Og when building in debug mode 2017-11-08 17:12:35 +05:30
Kovid Goyal
88df0890ae
Fix crash when displaying more than 64 images in a single session
Also DRYer
2017-11-07 13:34:31 +05:30
Kovid Goyal
21ed07d7ce
Ensure python type objects are declared in onlya single unit 2017-11-01 13:14:50 +05:30
Kovid Goyal
48b98c583e
Fix incorrect scrolling of images with specified number of rows 2017-10-16 22:02:55 +05:30
Kovid Goyal
94eaaae4a6
Handle font size changes, rescaling images 2017-10-09 15:15:13 +05:30
Kovid Goyal
3cce238b2b
Relayout images on screen resizes
The strategy is very simple, images are not rescaled or re-positioned in
any way.
2017-10-09 12:43:37 +05:30
Kovid Goyal
f9b52249d1
Remove unused code 2017-10-09 11:58:25 +05:30
Kovid Goyal
f396fe59ca
Implement a quota for image data 2017-10-09 11:31:57 +05:30
Kovid Goyal
747f7b076d
Implement control code for deleting images 2017-10-08 22:51:00 +05:30
Kovid Goyal
d5088a3e5b
Do image clipping using OpenGL rather than on the CPU 2017-10-07 10:08:26 +05:30
Kovid Goyal
6a65f23f98
Add a a=q mode for querying without storing image data 2017-10-06 23:43:42 +05:30
Kovid Goyal
31173245f8
Send ACKs to client when displaying images by id 2017-10-06 22:39:17 +05:30
Kovid Goyal
d4e493727e
Clip all rendered images to screen boundaries 2017-10-06 21:22:52 +05:30