1
0
Fork 0

- [GUI] fixed 'global' keybindings

the software responds to global keychord pressed even if the gemtext
  window has not the focus.
This commit is contained in:
cage 2023-06-10 16:02:21 +02:00
parent 8f9b4d0cf5
commit f124028730
1 changed files with 107 additions and 103 deletions

View File

@ -1416,50 +1416,49 @@
1.0)))
(render-ir-lines (get-address-bar-text main-window) main-window))
(defun initialize-keybindings (main-window)
(let ((inner-gemtext-widget (gui:inner-text (gemtext-widget main-window))))
(gui:bind inner-gemtext-widget
(defun initialize-keybindings (main-window target)
(gui:bind target
(client-configuration:get-keybinding :quit)
(lambda (e)
(declare (ignore e))
(menu:quit)))
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :search)
(lambda (e)
(declare (ignore e))
(funcall (menu:show-search-frame-clsr main-window)))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :stream)
(lambda (e)
(declare (ignore e))
(menu:show-streams))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :certificates)
(lambda (e)
(declare (ignore e))
(menu:show-certificates))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:config-keybinding-tour-manage)
(lambda (e)
(declare (ignore e))
(menu:show-tour))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :gemlog)
(lambda (e)
(declare (ignore e))
(menu:manage-gemlogs))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :about)
(lambda (e)
(declare (ignore e))
(menu:help-about))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :type-address)
(lambda (e)
(declare (ignore e))
@ -1468,56 +1467,60 @@
(gui:focus entry)
(gui:set-selection entry 0 :end)))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:config-keybinding-tour-shuffle)
(lambda (e)
(declare (ignore e))
(client-tour-window:enqueue-shuffle-tour))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:config-keybinding-tour-next)
(lambda (e)
(declare (ignore e))
(funcall (tour-visit-next-iri-clsr main-window)))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :back)
(lambda (e)
(declare (ignore e))
(funcall (back-iri-clsr main-window)))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:get-keybinding :up)
(lambda (e)
(declare (ignore e))
(funcall (up-iri-clsr main-window)))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:config-keybinding-bookmark-toggle)
(lambda (e)
(declare (ignore e))
(funcall (toggle-bookmark-iri-clsr main-window)))
:exclusive t)
(gui:bind inner-gemtext-widget
(gui:bind target
(client-configuration:config-keybinding-bookmark-show)
(lambda (e)
(declare (ignore e))
(funcall (menu:show-bookmarks-clsr main-window))))
(gui:bind inner-gemtext-widget
(funcall (menu:show-bookmarks-clsr main-window)))
:exclusive t)
(gui:bind target
(client-configuration:config-keybinding-gemtext-scaling-increase)
(lambda (e)
(declare (ignore e))
(scale-gemtext main-window 0.1)))
(gui:bind inner-gemtext-widget
(scale-gemtext main-window 0.1))
:exclusive t)
(gui:bind target
(client-configuration:config-keybinding-gemtext-scaling-decrease)
(lambda (e)
(declare (ignore e))
(scale-gemtext main-window -0.1)))
(gui:bind inner-gemtext-widget
(scale-gemtext main-window -0.1))
:exclusive t)
(gui:bind target
(client-configuration:config-keybinding-gemtext-scaling-reset)
(lambda (e)
(declare (ignore e))
(scale-gemtext main-window nil)))))
(scale-gemtext main-window nil))
:exclusive t))
(defun init-main-window (starting-iri)
(setf gui:*debug-tk* nil)
@ -1530,7 +1533,8 @@
(setf gui-goodies:*main-frame* main-frame)
(initialize-menu gui:*tk* main-frame)
(gui:grid main-frame 0 0 :sticky :nswe)
(initialize-keybindings main-frame)
(initialize-keybindings main-frame (gui:root-toplevel))
(initialize-keybindings main-frame (gui:inner-text (gemtext-widget main-frame)))
(gui-goodies:gui-resize-grid-all gui-goodies:*toplevel*)
(gui:wait-complete-redraw)
(when (string-not-empty-p starting-iri)