Commit Graph

443 Commits

Author SHA1 Message Date
Jan a951c3cd39
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-19 12:30:41 +08:00
Guldoman bddb5e274d
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-19 12:28:48 +08:00
Adam Harrison 4c18cf6744
Updated dummy method signature to match prototypes. 2023-08-19 12:28:48 +08:00
Guldoman a9d8f12cb7
Make empty groups in `regex.gmatch` return their offset (#1325)
This makes `regex.gmatch` behave like `string.gmatch`.
2023-08-19 12:28:47 +08:00
adityaraj ae218bc005
Create Renderer Only When It Doesn't Exist (#1315) 2023-08-19 12:28:21 +08:00
Jan c8afe3d1bf
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-19 12:28:21 +08:00
Jan f5a224999a
defer lua error until after cleanup (#1310) 2023-08-19 12:28:20 +08:00
Julien Voisin 1ab320bb9b
Handle readlink errors (#1292) 2023-08-19 12:28:19 +08:00
Julien Voisin d86413cc30
Don't set a value twice (#1306) 2023-08-19 12:28:19 +08:00
Julien Voisin d06c9f401c
Fix a memory leak (#1305)
`font` was not freed upon error.
2023-08-19 12:28:19 +08:00
Julien Voisin d755fa6fba
Make api_require's nodes const (#1296) 2023-08-19 12:28:18 +08:00
Takase 69ce580970
do not allow users to create an empty font group (#1303) 2023-08-19 12:28:18 +08:00
Guldoman bd4e64cc7e
Allow command buffer to be expanded (#1297) 2023-08-19 12:28:18 +08: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
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