Adjust default prefix keys; advice x-create-frame

* exwm-input.el (exwm-input--on-KeyPress-line-mode, exwm-input-prefix-keys):
  Allow users to disable 'C-c' prefixed keys; Add 'C-c' to / remove 'M-!'
  from the default prefix keys.

* exwm-workspace.el (exwm-workspace--x-create-frame, exwm-workspace--init):
  Advice `x-create-frame' to prevent it from hanging EXWM, making e.g.
  speedbar working.
* exwm-floating.el (exwm-floating--set-floating): Remove the now unnecessary
  request that sets override-redirect on floating frames.
This commit is contained in:
Chris Feng 2015-09-23 12:53:08 +08:00
parent 623db8b378
commit 22ee3e6c5f
3 changed files with 15 additions and 7 deletions

View file

@ -141,11 +141,6 @@
(setq x (/ (- display-width width) 2) (setq x (/ (- display-width width) 2)
y (/ (- display-height height) 2)))))) y (/ (- display-height height) 2))))))
(exwm--log "Floating geometry (corrected): %dx%d%+d%+d" width height x y) (exwm--log "Floating geometry (corrected): %dx%d%+d%+d" width height x y)
;; Set OverrideRedirect on this frame
(xcb:+request exwm--connection
(make-instance 'xcb:ChangeWindowAttributes
:window outer-id :value-mask xcb:CW:OverrideRedirect
:override-redirect 1))
;; Set event mask ;; Set event mask
(xcb:+request exwm--connection (xcb:+request exwm--connection
(make-instance 'xcb:ChangeWindowAttributes (make-instance 'xcb:ChangeWindowAttributes

View file

@ -209,7 +209,7 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(defvar exwm-input--global-prefix-keys nil (defvar exwm-input--global-prefix-keys nil
"List of prefix keys of global key bindings.") "List of prefix keys of global key bindings.")
(defvar exwm-input-prefix-keys (defvar exwm-input-prefix-keys
'(?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-! ?\M-& ?\M-:) '(?\C-c ?\C-x ?\C-u ?\C-h ?\M-x ?\M-` ?\M-& ?\M-:)
"List of prefix keys EXWM should forward to Emacs when in line-mode.") "List of prefix keys EXWM should forward to Emacs when in line-mode.")
(defvar exwm-input--simulation-keys nil "Simulation keys in line-mode.") (defvar exwm-input--simulation-keys nil "Simulation keys in line-mode.")
(defvar exwm-input--simulation-prefix-keys nil (defvar exwm-input--simulation-prefix-keys nil
@ -259,7 +259,6 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
(setq event (xcb:keysyms:keysym->event keysym state)) (setq event (xcb:keysyms:keysym->event keysym state))
(or exwm-input--during-key-sequence (or exwm-input--during-key-sequence
(setq minibuffer-window (active-minibuffer-window)) (setq minibuffer-window (active-minibuffer-window))
(eq event ?\C-c) ;mode-specific key
(memq event exwm-input--global-prefix-keys) (memq event exwm-input--global-prefix-keys)
(memq event exwm-input-prefix-keys) (memq event exwm-input-prefix-keys)
(memq event exwm-input--simulation-prefix-keys))) (memq event exwm-input--simulation-prefix-keys)))

View file

@ -263,6 +263,18 @@ The optional FORCE option is for internal use only."
(setq newname (format "%s<%d>" basename (cl-incf counter)))) (setq newname (format "%s<%d>" basename (cl-incf counter))))
(rename-buffer (concat (and hidden " ") newname)))) (rename-buffer (concat (and hidden " ") newname))))
(defun exwm-workspace--x-create-frame (orig-fun params)
"Set override-redirect on the frame created by `x-create-frame'."
(let ((frame (funcall orig-fun params)))
(xcb:+request exwm--connection
(make-instance 'xcb:ChangeWindowAttributes
:window (string-to-number
(frame-parameter frame 'outer-window-id))
:value-mask xcb:CW:OverrideRedirect
:override-redirect 1))
(xcb:flush exwm--connection)
frame))
(defun exwm-workspace--init () (defun exwm-workspace--init ()
"Initialize workspace module." "Initialize workspace module."
(cl-assert (and (< 0 exwm-workspace-number) (>= 10 exwm-workspace-number))) (cl-assert (and (< 0 exwm-workspace-number) (>= 10 exwm-workspace-number)))
@ -306,6 +318,8 @@ The optional FORCE option is for internal use only."
:window window-id :value-mask xcb:CW:EventMask :window window-id :value-mask xcb:CW:EventMask
:event-mask xcb:EventMask:SubstructureRedirect)))) :event-mask xcb:EventMask:SubstructureRedirect))))
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
;; We have to advice `x-create-frame' or every call to it would hang EXWM
(advice-add 'x-create-frame :around #'exwm-workspace--x-create-frame)
;; We have to delay making the frame visible until the ;; We have to delay making the frame visible until the
;; override-redirect flag has been set. ;; override-redirect flag has been set.
(select-frame-set-input-focus (car exwm-workspace--list)) (select-frame-set-input-focus (car exwm-workspace--list))