Compare commits

...

3 Commits

Author SHA1 Message Date
0c3091632f add importable trace macro 2024-09-10 17:53:15 +01:00
2743c3ece0 make lsqlite build 2024-09-10 14:18:14 +01:00
3dd0d3f11c ignore num lock state when recognising keys 2024-09-10 14:17:55 +01:00
4 changed files with 18 additions and 2 deletions

View File

@ -1,5 +1,6 @@
(local { : Gtk : Gdk : WebKit2 : cairo } (require :lgi))
(local { : view } (require :fennel))
(import-macros {: trace} :macros)
(fn new-buffer [name]
(var property-change-listener nil)

View File

@ -1,6 +1,7 @@
(local { : Gdk } (require :lgi))
(local { : view } (require :fennel))
(local lume (require :lume))
(import-macros {: trace} :macros)
(local modifier-keyvals
;; we need to detect and discard modifier-only key events when
@ -19,6 +20,7 @@
:Super_R ; menu key? not on my keyboard
:Alt_L
:Alt_R
:Num_Lock
:ISO_Level3_Shift ; AltGr
]]
(collect [_ n (ipairs names)]
@ -27,6 +29,10 @@
(fn modifier? [keyval]
(. modifier-keyvals keyval))
(fn ignored-modifier? [mod]
(= mod :MOD2_MASK) ; numlock
)
(fn keychord->spec [keychord]
(let [Mod Gdk.ModifierType
symbol (keychord:match "(%w+)$")
@ -49,7 +55,9 @@
(let [modmask
(accumulate [m 0
k _ (pairs event.state)]
(bor m (. Gdk.ModifierType k)))]
(if (ignored-modifier? k)
m
(bor m (. Gdk.ModifierType (trace k)))))]
(spec->index {:keyval event.keyval : modmask})))
(fn compact [xs]

View File

@ -8,7 +8,7 @@ let
in lua.pkgs.buildLuarocksPackage {
pname = "lsqlite3";
version = "0.9.5-1";
buildInputs = [ sqlite ] ;
buildInputs = [ sqlite sqlite.dev ] ;
src = fetchurl {
url = "https://luarocks.org/manifests/dougcurrie/lsqlite3-0.9.5-1.src.rock";
sha256 = "sha256-/a48AzkKtOS32zoT0Jt5/+GTGHObdS0XkUrc2z0u+f8=";

7
macros.fnl Normal file
View File

@ -0,0 +1,7 @@
(fn trace [x]
`(do
(print :trace ,(view x) (view ,x))
,x))
{ : trace }