Commit Graph

538 Commits

Author SHA1 Message Date
Takase 74d9c15736 style(src/renderer): use FreeType header names (#1554) 2023-08-07 14:51:14 +01:00
Guldoman 3775032c78 Allow setting custom glyphset size (#1542)
* Properly set glyphset size

* Rename `MAX_GLYPHSET` to `GLYPHSET_SIZE`

* Use more appropriate types for font metrics
2023-08-07 14:51:14 +01:00
Jan 6e113cb15e Attach command buffer to Renderer Window (#1472) 2023-08-07 14:50:59 +01:00
Guldoman 9bb6589790 Increase number of loadable glyphsets (#1524)
This should be enough to load every unicode codepoint.
2023-08-07 14:50:59 +01:00
Jefferson González 35647067d8 Close lua state when exiting on a runtime error (#1487)
* Close lua state when exiting on a runtime error

* This change allows calling the garbage collector before exiting the
  application for a cleaner shutdown.
* Components like the shared memory object on #1486 will have a better
  chance at destroying no longer needed resources.

* Overriden os.exit to always close the state

* Allow setting close param on os.exit override

* Simplified the os.exit override a bit more

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-07 14:50:59 +01:00
takase1121 363b102abc fix(renderer): fix memory leak when freeing glyphsets 2023-08-07 14:50:59 +01:00
takase1121 a007a190ef fix(rencache): fix compiler warning for printing size_t 2023-08-07 14:50:59 +01:00
Takase 46260b8073 fix(process): check for HANDLE_INVALID (#1475) 2023-08-07 14:50:59 +01:00
Jan 0fae012c68 Make `system.path_compare` more digit-aware (#1474)
This allows a human friendly sorting filenames with numbers in them
So
- asd1
- asd10
- asd2
becomes
- asd1
- asd2
- asd10
2023-08-07 14:50:59 +01:00
Takase e2a582d5fd Process API improvements (again) (#1370)
* feat(process): add push_error
* refactor(process): use push_error for better errors
* style(process): consistent error messages
* refactor(process): reimplement process.strerror() with push_error
* refactor(process): implement close_fd only once
* refactor(process): rename process_handle to process_handle_t
* fix(process): prevent errors from a NULL error message
* refactor(process): refactor push_error into 2 functions
* fix(process): fix wrong error message
* fix(process): check if push_error_string actually pushed something
* refactor(process): make error messages descriptive
* fix(process): check for empty table instead of aborting
* refactor(process): make error messages descriptive on Windows
* refactor(process): rename process_stream_handle to process_stream_t
* refactor(process): fix wrong usage of process_handle_t
* fix(process): fix wrong type name
* refactor(process): incoporate kill_list_thread into process_kill_list_t
* refactor(process): make kill_list per-state data
2023-08-07 14:50:59 +01:00
Guldoman 0be18493a9 Show error message in crash message box (#1461)
* Save to `error.txt` the same traceback shown on stdout
* Show error message in crash message box
2023-08-07 14:50:58 +01:00
Jefferson González baa8f528f1 Fix for api_require wrong macro && conditions (#1465)
This mistake escaped my eyes when reviewing #1437 and causes
some symbols to not be exported, because the preprocessor macros
are expecting multiple LUA versions to evaluate as true at once.
The fix is to replace `&&` with `||`.
2023-08-07 14:50:58 +01:00
Guldoman 0ee346014e Make `system.path_compare` more case-aware (#1457)
* Use Lua-provided string lengths for `system.path_compare`
* Make `system.path_compare` more case-aware
   Before, strings like `README.md` would be sorted before `changelog.md`, 
   because we only looked at the raw ascii values.
   Now the character case is considered as a secondary sorting key.
2023-08-07 14:50:58 +01:00
Takase 4e626bc320 Update api_require to expose more symbols (#1437)
* feat(system): update api_require for more symbols
* fix(system): fix missing 5.1 symbols
* fix(system): add more missing symbols
* fix(system): add all symbols
   We got'em this time. I swear.
* fix(system): fix undefined symbols due to conditional compilation
   There is only pain and suffering.
   Turns out some of the symbols are only exported when the options are enabled.
   We need to preprocess the header.
2023-08-07 14:50:58 +01:00
Takase 26ff5e28a6 fix: fix differing stacktrace on stdout and file (#1404)
* fix(c-bootstrap): produce identical stack traces
2023-08-07 14:50:58 +01:00
Takase e935454992 Fix invalid EXEFILE and EXEDIR on Windows (#1396)
* fix(main): fix get_exe_filename returning invalid result on Windows
* fix(main): fix bootstrap not intepreting UTF-8 properly
2023-08-07 14:50:58 +01:00
Adam 7ca0ec18ca Added in support for foreground and background events. (#1395) 2023-08-07 14:50:58 +01:00
Adam ee80b451c6 Added in explicit touchscreen keyboard support. (#1389) 2023-08-07 14:50:58 +01:00
Takase 350131dabc Asynchronous process reaping (#1412)
* refactor(process): introduce process_stream_handle separate from process_handle

* feat(process): introduce process_handle helper functions

* feat(process): add asynchronous process reaping

* feat(process): wait for shorter period if possible

* style(process): remove unecessary brackets

* style(process): fix parentheses

* refactor(process): remove useless setvbuf call

* style(process): remove unecessary value

* refactor(process): add size field into kill_list

* refactor(process): use SDL_Delay for sleeping

* style(process): remove trailing whitespace

* fix(main): destroy window before closing lua

* fix(process): check for timeout correctly

* refactor(process): remove unecessary if check

* refactor(process): remove size from the list

* fix(process): fix invalid delay calculation

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-07 14:50:58 +01:00
Guldoman 1d86665b6d Aggregate `SDL_Surface`s and their scale in `RenSurface` (#1429) 2023-08-07 14:50:58 +01:00
Guldoman 4f1360a6c5 Use clipping functions provided by SDL (#1426) 2023-08-07 14:50:58 +01:00
Guldoman 7907fa785c Improve text width calculation precision (#1408)
In some extreme cases (~30000 chars) text width precision takes a hit.
Using double instead of float fixes that.
2023-08-07 14:50:58 +01:00
Takase 193871869d refactor(main): move SetProcessDPIAware to manifests (#1413) 2023-08-07 14:50:58 +01:00
Guldoman dbb9f30c81 Split `Command` struct into different structs for each command type (#1407)
This reduces the space needed for each command.
2023-08-07 14:50:58 +01:00
Takase 2d2d715fd9 Add manifest on Windows (#1405)
* fix(gitignore): add exclusion for manifest files

* feat(windows): add application manifest

* feat(build): use application manifest on windows

* refactor(build): use genrate_file to generate the manifest

* style(manifest): remove trailing whitespace
2023-08-07 14:50:58 +01:00
Adam 83c27cf9f4 Added in ability to specify prefix via env variable. (#1388) 2023-08-07 14:50:58 +01:00
Takase ab3d6004a1 fix: exec() error not returned to parent (#1363)
* fix: exec() error not returned to parent

* chore: remove accidental lua.h inclusion
2023-08-07 14:50:58 +01:00
Jan 16182d01d8 pass RenWindow by argument (#1321)
* pass RenWindow to all renderer functions that need it

* pass RenWindow to all rencache functions that need it
2023-08-07 14:50:58 +01:00
Guldoman 12bae1ec95 Avoid drawing hidden text in `DocView:draw_line_text` (#1298)
* Stop drawing text past the `DocView` edge in `DocView:draw_line_text`

* Don't add draw commands if they fall outside the latest clip

The check was previously done with the window rect, so this will reduce 
a bit more the number of commands sent.
2023-08-07 14:50:43 +01:00
Adam Harrison bdd87298d6 Updated dummy method signature to match prototypes. 2023-08-07 14:50:43 +01:00
Guldoman b58ba3fede Make empty groups in `regex.gmatch` return their offset (#1325)
This makes `regex.gmatch` behave like `string.gmatch`.
2023-08-07 14:50:43 +01:00
adityaraj 8c4f093c41 Create Renderer Only When It Doesn't Exist (#1315) 2023-08-07 14:50:43 +01:00
Jan c44a3cd291 replace uses of SDL_Window with RenWindow (#1319)
Since Renwindow contains our instance of SDL_Window we can use this
to simplify future logic to create separate window instances
2023-08-07 14:50:43 +01:00
George Sokianos e4f3f1b744 Prepare 2.1.1r1 release 2023-01-29 12:58:56 +00:00
George Sokianos 62adafb59d Updates to make latest code compile and work under OS4 2023-01-09 00:45:37 +00:00
George Sokianos 65d95c7f40 Merge branch 'master' into amiga2.1 2023-01-08 21:04:04 +00:00
George Sokianos f6784d2530 innosetup changes 2023-01-08 20:52:15 +00:00
Jan aa503665e0
defer lua error until after cleanup (#1310) 2023-01-06 14:31:44 -04:00
Julien Voisin 6c6e5e9b99
Handle readlink errors (#1292) 2023-01-05 15:59:45 -05:00
Julien Voisin b3937b0380
Don't set a value twice (#1306) 2023-01-05 15:48:49 -05:00
Julien Voisin 7133ea5419
Fix a memory leak (#1305)
`font` was not freed upon error.
2023-01-05 15:48:01 -05:00
Julien Voisin 81b8747d80
Make api_require's nodes const (#1296) 2023-01-05 15:46:26 -05:00
Takase b7e9ca6585
do not allow users to create an empty font group (#1303) 2023-01-04 16:46:08 +01:00
Guldoman 2638e9636b
Allow command buffer to be expanded (#1297) 2023-01-01 21:12:14 -05:00
jgmdev 79908baed6 regex: properly call pcre2_jit_compile 2022-12-28 19:40:20 -04:00
Quinten Kock 3fda8c0a09
Fix userdata APIs for Lua 5.4 in native plugin interface (#1188)
* Reintroduce some missing Lua API's from native plugin API

* Add new upvalue functions to header

* Fix things that are actually macros in current lua

* Introduce lua_insert,replace,remove macros from lua5.4
2022-12-27 23:39:28 -05:00
Jefferson González 141d00795c
dirmonitor: use pipes on fsevents (#1274)
As suggested by Guldoman this change introduces the usage
of pipes to allow blocking the get changes call until any
file system changes are received, which now properly reduces
the cpu usage on idle to 0%.

This change better fixes #1237
2022-12-27 23:07:12 -04:00
Jefferson González 5fa7dabd34
dirmonitor: fix high cpu usage, fixes #1237 (#1271) 2022-12-27 18:23:39 -05:00
Guldoman c29b1c2cb9
Use Lua string length instead of relying on `strlen` (#1262)
This allows us to render `NULL` byte sequences and not truncate strings 
that contain them.
2022-12-26 13:49:07 -04:00
jgmdev 0ab7fe9311 core regex: use backward compatible lua_newuserdata 2022-12-21 00:54:12 -04:00
Guldoman 24179bbb23
Merge pull request #1245 from Jan200101/PR/touch-event
add touch events
2022-12-21 00:13:52 +01:00
Jan b584f1fe35
Simplify SDL message boxes (#1249)
It has what we needs and needs less abstraction, overall simplifying the code
2022-12-20 18:36:18 -04:00
Takase 6d0e7f3046
Fix some syntax errors (#1243)
* move signal.h inclusion outside of if-else block
not sure if this change is appropriate, we need to make sure SIG_IGN
is only set on POSIX targets. To verify this we might need to include
unistd.h,

* fix syntax error
this is often overlooked when compiling for normal platforms
2022-12-20 18:11:05 -04:00
Jefferson González 3c64c32379
core: ported regex.gsub to faster native version (#1233)
* added regex.gmatch iterator and other fixes
* fixed issues reported by Guldoman
* push strings with fixed len just in case for binary safety
* added limit to regex.gsub and use pushinteger
* added description to regex.gsub limits param
* replaced substitutions regex description for correctness
* ignore negative limits on regex.gsub
2022-12-20 17:46:37 -04:00
Jan200101 b137d77183
add touch events 2022-12-20 09:30:58 +01:00
Adam Harrison 5ab8dc0275 Converted from bytes to characters, as this is what windows is expecting. 2022-12-18 14:49:59 -05:00
Delta-official 5db5512663
Fix native plugins not reloading upon core:restart (#1219)
* Fix native plugins not reloading upon core:restart

* Move the metatable name definition to api.h

* Replace metatable name with const
2022-12-02 17:06:35 -05:00
Takase 2e186a746d
better error messages for checkcolor (#1211) 2022-11-30 01:38:35 -04:00
Guldoman 9f917052ad
Add initialization to variable in `ren_draw_text` 2022-11-27 00:45:57 +01:00
Takase 7fa51bb7ab
Windows font loading hotfix (#1205)
* add missing windows header
* hold the handle until GC so that the file can't be modified in use,
   this is a regression when we switched to CreateFile.
* set wpath to NULL to avoid double free
2022-11-17 01:09:38 -04:00
Jefferson González c8e525c126
Merge pull request #1201 from takase1121/PR/font-load-utf8
Load fonts with UTF-8 filenames
2022-11-15 23:27:03 -04:00
Takase 4107b0c3fe
MSVC Support (#1199)
* fix stdalign and min/max for MSVC
* add missing ISREG and ISDIR for MSVC
* use MAX_PATH instead of PATH_MAX
* remove unecessary headers inclusion
* add MSVC CI
* add appropriate macros to platform detection
* re-add msvc CI artifacts
* upload the generated artifacts
* patch lua for MSVC CI builds
* update patch for MSVC compatibility
2022-11-15 23:23:45 -04:00
Guldoman 38a8549e71
Replace deprecated meson feature `gui_app` with `win_subsystem` 2022-11-15 16:57:50 +01:00
takase1121 69938c619c
add support for loading fonts with UTF-8 filenames 2022-11-14 22:01:24 +08:00
takase1121 4457f26502
use flexible structure member from C99 2022-11-14 22:00:40 +08:00
takase1121 5cabc68ccb
fix utfconv.h duplicate functions 2022-11-14 21:59:32 +08:00
Guldoman 66198eb327 Use a better fallback in case `get_exe_filename` fails 2022-11-13 19:47:32 +01:00
Alexey Dokuchaev 1b1c13e3de Add missing `get_exe_filename()` implementation for FreeBSD 2022-11-13 19:47:32 +01:00
Jan 56e465c351
dirmonitor: give kevent a timeout so it doesn't lock forever (#1180) 2022-11-05 20:00:32 -04:00
Adam 9951e785b6
Getting ready for 2.1. (#1181)
* Getting ready for 2.1.

* Fixed version.

* Year.

* Manually added line as takase said to.

* Fixed minor issue at takase's behest.

* Dunno where that went.

* Updated to use a function pointer.

* OK, as discussed, adding this manually for now.

* Updated SDL.
2022-11-02 03:38:58 +01:00
jgmdev 3c752f86f3 core renderer: increased max font fallbacks to 10 2022-10-19 21:12:04 -04:00
jgmdev 1708462f4c core renderer: fixed small issue introduced on #1145 2022-10-19 21:11:29 -04:00
Guldoman 6b754eb628
Refactor scrollbar into its own file (#1124)
* Move scrollbar to its own file
* Don't call `Scrollbar` functions if `View` is not scrollable
* Allow horizontal scrolling in `Scrollbar`
* Add horizontal scrollbar to `View`
* Add `root:horizontal-scroll` command with `shift+wheel` keymap
* Prioritize vertical scrollbar hover
* Don't send mouse movement to vertical scrollbar when dragging horizontal one
* Fix clicking on horizontal scrollbar track
* Implement `start` scrollbar alignment
* Add documentation to `Scrollbar`
* Make `DocView` infinitely scrollable horizontally
* Handle horizontal scroll SDL event
2022-10-15 20:12:15 -04:00
Guldoman 5c2c95765e
Add IME support (#991) 2022-10-15 19:58:51 -04:00
Takase 7107f88f9f
save a reference to the font when calling renderer.draw_text. (#1156)
This prevents the GC from killing it.
2022-10-13 22:52:38 -04:00
jgmdev 42ac231f01 core utf8: fix license text 2022-10-13 11:29:37 -04:00
Jefferson González 48c800cde7
dirmonitor: added missing mutex initialization (#1150) 2022-10-12 10:31:26 -04:00
Jefferson González a7888e96ea
Add fsevents backend to dirmonitor (#1141)
* dirmonitor: added backend reporting of watch mode

* dirmonitor: added fsevents backend for macos
2022-10-10 20:40:41 -04:00
George Sokianos 789004ea2c Updates and fixes for the latest available code, for 2.1 release 2022-10-10 19:06:19 +01:00
Takase 34c4ac3cd5
add parameter validation to checkcolor and f_font_group (#1145) 2022-10-10 11:44:19 -04:00
Adam dad0f79708
Fixed process layer argument quoting; allows for strings with spaces. And added ability to specify a literal, in the style of python. (#1132) 2022-10-09 19:53:48 -07:00
Guldoman e7a575b4c4
Use relative mouse position directly for drop event (#1140)
Previously the relative position was calculated using the window 
position and the global mouse coordinates. In some systems like wayland, 
this operation returns incorrect values.
2022-10-09 20:13:51 -04:00
Adam e34a3ca78f Stealthy fix of list_dir on windows with single letter directories. 2022-10-04 21:06:23 -04:00
Adam 293110feaa
Fix process api detach bug (#1137)
* Added in conditional, as detaching will fail with "Operation not permitted" on linux; setsid sets a new process group anyway.

* Added in variable to check detached state on cleanup, so we don't send TERM.
2022-10-04 20:02:22 -04:00
Jan 630ab0ab92
Add i386 architecture detection, add FreeBSD to platform detection (#1135)
defining anything that isn't a specific set of architectures x86 is just wrong.
It should at least be called something non identifying like "native"

Lite-XL already builds for FreeBSD so add it to the platform detection
2022-10-04 11:13:21 -04:00
Jefferson González ba0a454c97
system: added raise_window() (#1131) 2022-09-29 11:31:55 -04:00
George Sokianos 2bdfd5a694 Merge branch 'master' into amiga-2.0 2022-09-26 17:27:35 +01:00
George Sokianos 1ecb66c807 innosetup changes 2022-09-26 17:06:05 +01:00
George Sokianos a5f073d23b Prepare 2.0.3r3 release 2022-09-26 15:44:38 +01:00
George Sokianos da2ba3aac2 Further makefile cleanup, added profyler 2022-09-26 15:30:42 +01:00
George Sokianos 5d39b4ae68 Fixed locale bug with MorphOS 2022-09-26 14:17:55 +01:00
Jefferson González a640360d0d
api: expose api_load_libs to native plugins (#1125)
This function is currently needed for the threading plugin.
2022-09-22 20:30:24 -04:00
Dmitry Atamanov 4546ce13e4
Update unidata to version 15.0 (#1122) 2022-09-19 21:27:54 -04:00
Adam 5ada80b9df
Added in native modules suffixes. (#1111)
* Added in native modules with suffixes, giving priority to those with matching architectures and platforms.

* PowerPC isn't x86, and it's x86_64.

* Changed things over to allow compiler to set a tuple, makes more sense from a build perspective.

* Spelling mistake.

* Added in arm target tuples.
2022-09-18 18:27:50 -04:00
Adam 4f17667d42 Changed setpgrp to a more portable form. 2022-09-02 20:26:13 -04:00
Guldoman cbe0fd63bf
Reduce double click radius
SDL uses 32 pixels by default, which is a bit too much and causes 
problems with, for example, adding multiple close selections too 
quickly.
2022-08-21 19:08:32 +02:00
Aqil Contractor 9b1bfeacac
Added a smoothing and strikethrough option to font loading. (#1087)
* Added a smoothing option to font loading.
* Added a font strikethrough option to font loading.
* Fixed underline applying incorrectly in cases of non-underlined fallback fonts being used.

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2022-08-20 16:15:08 -04:00
George Sokianos 32eeb07c54 Fixed non existing path crashes on OS4 2022-08-01 18:08:23 +01:00
Guldoman 86024586fd
Start dirmonitor check thread only after a watch is added (#1072) 2022-07-11 17:14:50 -04:00
Adam e784513222 Missing header. 2022-06-24 20:21:15 -04:00