Commit Graph

215 Commits

Author SHA1 Message Date
Jan 6e113cb15e Attach command buffer to Renderer Window (#1472) 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
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
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 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 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
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
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
Jan aa503665e0
defer lua error until after cleanup (#1310) 2023-01-06 14:31:44 -04:00
Julien Voisin b3937b0380
Don't set a value twice (#1306) 2023-01-05 15:48:49 -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
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
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
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
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 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
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
Jefferson González ba0a454c97
system: added raise_window() (#1131) 2022-09-29 11:31:55 -04: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