about summary refs log tree commit diff
path: root/exwm-input.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2016-07-17T04·46+0800
committerChris Feng <chris.w.feng@gmail.com>2016-07-17T04·46+0800
commit2195316821c7d54cb6858e00d810e7089491a24d (patch)
treeaef5c81e18de5b860978c3566b25022a4ec0cc6a /exwm-input.el
parent4ac71a7ddc78d1485a7fca7a8dbf4c4f6b4016f2 (diff)
Add major mode menu
* exwm-core.el (exwm--keyboard-grabbed): New buffer-local variable for
recoding grabbing state.
(exwm-mode-menu, exwm-mode-map): Add major mode menu.
* exwm-input.el (exwm-input-set-key): Update prefix keys when a global
binding is interactively set.
(exwm-input-grab-keyboard, exwm-input-release-keyboard): Update grabbing
state.
Diffstat (limited to 'exwm-input.el')
-rw-r--r--exwm-input.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/exwm-input.el b/exwm-input.el
index 57c0cc801a..6f18fbf132 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -285,7 +285,9 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
   "Set a global key binding."
   (interactive "KSet key globally: \nCSet key %s to command: ")
   (global-set-key key command)
-  (cl-pushnew key exwm-input--global-keys))
+  (cl-pushnew key exwm-input--global-keys)
+  (when (called-interactively-p 'any)
+    (exwm-input--update-global-prefix-keys)))
 
 ;; FIXME: Putting (t . EVENT) into `unread-command-events' does not really work
 ;;        as documented in Emacs 24.  Since inserting a conventional EVENT does
@@ -421,6 +423,7 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
   (when id
     (with-current-buffer (exwm--id->buffer id)
       (exwm-input--grab-keyboard id)
+      (setq exwm--keyboard-grabbed t)
       (exwm-input--update-mode-line id)
       (force-mode-line-update))))
 
@@ -431,6 +434,7 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
   (when id
     (with-current-buffer (exwm--id->buffer id)
       (exwm-input--release-keyboard id)
+      (setq exwm--keyboard-grabbed nil)
       (exwm-input--update-mode-line id)
       (force-mode-line-update))))