pass keymap into the frame

This commit is contained in:
Daniel Barlow 2022-12-23 15:21:06 +00:00
parent 0befc24bc0
commit cde0b8cd56
2 changed files with 21 additions and 18 deletions

View File

@ -2,10 +2,28 @@
(local lfs (require :lfs)) (local lfs (require :lfs))
(local { : Gtk : Gdk : WebKit2 : cairo } lgi) (local { : Gtk : Gdk : WebKit2 : cairo } lgi)
(local Command (require :command))
(local Frame (require :frame)) (local Frame (require :frame))
(local Buffer (require :buffer)) (local Buffer (require :buffer))
(let [f (Frame.new) ;;; when we decide how to do an init file/rc file, this will go in it
(local my-keymap {
"g" #(Command.invoke-interactively
"visit-location"
{:buffer "main"})
"M-q" #(Command.invoke-interactively
"quit-browser"
{})
"C-x" {
"C-c"
#(Command.invoke-interactively
"quit-browser"
{})
}
})
(let [f (Frame.new my-keymap)
b (Buffer.new "main")] b (Buffer.new "main")]
(f:show-buffer b) (f:show-buffer b)
(b:visit (.. "file://" (lfs.currentdir) "/doc/index.html"))) (b:visit (.. "file://" (lfs.currentdir) "/doc/index.html")))

View File

@ -5,25 +5,10 @@
(var frames []) (var frames [])
(fn new-frame [] (fn new-frame [global-keymap]
(let [hpad 2 (let [hpad 2
vpad 2 vpad 2
recogniser (keymap.recogniser recogniser (keymap.recogniser global-keymap)
{
"g" #(Command.invoke-interactively
"visit-location"
{:buffer "main"})
"M-q" #(Command.invoke-interactively
"quit-browser"
{})
"c" {
"x"
#(Command.invoke-interactively
"quit-browser"
{})
}
})
window (Gtk.Window { window (Gtk.Window {
:title "Dunlin" :title "Dunlin"
:default_width 800 :default_width 800