diff options
Diffstat (limited to 'exwm-workspace.el')
-rw-r--r-- | exwm-workspace.el | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/exwm-workspace.el b/exwm-workspace.el index d58758fc1f01..783287366aff 100644 --- a/exwm-workspace.el +++ b/exwm-workspace.el @@ -1,6 +1,6 @@ ;;; exwm-workspace.el --- Workspace Module for EXWM -*- lexical-binding: t -*- -;; Copyright (C) 2015-2018 Free Software Foundation, Inc. +;; Copyright (C) 2015-2019 Free Software Foundation, Inc. ;; Author: Chris Feng <chris.w.feng@gmail.com> @@ -308,7 +308,8 @@ NIL if FRAME is not a workspace" ;; Make left/top processed first. (push struts* exwm-workspace--struts) (setq exwm-workspace--struts - (append exwm-workspace--struts (list struts*)))))))))) + (append exwm-workspace--struts (list struts*)))))))) + (exwm--log "%s" exwm-workspace--struts))) (defun exwm-workspace--update-workareas () "Update `exwm-workspace--workareas'." @@ -372,10 +373,11 @@ NIL if FRAME is not a workspace" ;; Save the result. (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) + (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook)) (defun exwm-workspace--set-active (frame active) - "Make frame FRAME active on its output." + "Make frame FRAME active on its monitor." (exwm--log "active=%s; frame=%s" frame active) (set-frame-parameter frame 'exwm-active active) (if active @@ -452,7 +454,8 @@ NIL if FRAME is not a workspace" :window (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id) :value-mask xcb:ConfigWindow:Width - :width width)))) + :width width)) + (exwm--log "y: %s, width: %s" y width))) (defun exwm-workspace--switch-map-nth-prefix (&optional prefix-digits) "Allow selecting a workspace by number. @@ -544,15 +547,15 @@ for internal use only." (set-frame-parameter (buffer-local-value 'exwm--frame (window-buffer)) 'exwm-selected-window (selected-window))) ;; Show/Hide X windows. - (let ((output-old (frame-parameter old-frame 'exwm-randr-output)) - (output-new (frame-parameter frame 'exwm-randr-output)) + (let ((monitor-old (frame-parameter old-frame 'exwm-randr-monitor)) + (monitor-new (frame-parameter frame 'exwm-randr-monitor)) (active-old (exwm-workspace--active-p old-frame)) (active-new (exwm-workspace--active-p frame)) workspaces-to-hide) (cond ((not active-old) (exwm-workspace--set-active frame t)) - ((equal output-old output-new) + ((equal monitor-old monitor-new) (exwm-workspace--set-active frame t) (unless (eq frame old-frame) (exwm-workspace--set-active old-frame nil) @@ -561,8 +564,8 @@ for internal use only." (t (dolist (w exwm-workspace--list) (when (and (exwm-workspace--active-p w) - (equal output-new - (frame-parameter w 'exwm-randr-output))) + (equal monitor-new + (frame-parameter w 'exwm-randr-monitor))) (exwm-workspace--set-active w nil) (setq workspaces-to-hide (append workspaces-to-hide (list w))))) (exwm-workspace--set-active frame t))) @@ -648,6 +651,7 @@ Passing a workspace frame as the first option is for internal use only." (t 0)))) (unless frame-or-index (setq frame-or-index 0)) + (exwm--log "%s" frame-or-index) (if (or (framep frame-or-index) (< frame-or-index (exwm-workspace--count))) (exwm-workspace-switch frame-or-index) @@ -748,6 +752,7 @@ before it." INDEX must not exceed the current number of workspaces." (interactive) + (exwm--log "%s" index) (if (and index ;; No need to move if it's the last one. (< index (exwm-workspace--count))) @@ -758,6 +763,7 @@ INDEX must not exceed the current number of workspaces." (defun exwm-workspace-delete (&optional frame-or-index) "Delete the workspace FRAME-OR-INDEX." (interactive) + (exwm--log "%s" frame-or-index) (when (< 1 (exwm-workspace--count)) (delete-frame (if frame-or-index @@ -766,6 +772,7 @@ INDEX must not exceed the current number of workspaces." (defun exwm-workspace--set-desktop (id) "Set _NET_WM_DESKTOP for X window ID." + (exwm--log "#x%x" id) (with-current-buffer (exwm--id->buffer id) (let ((desktop (exwm-workspace--position exwm--frame))) (setq exwm--desktop desktop) @@ -790,6 +797,7 @@ INDEX must not exceed the current number of workspaces." (let ((frame (exwm-workspace--workspace-from-frame-or-index frame-or-index)) old-frame container) (unless id (setq id (exwm--buffer->id (window-buffer)))) + (exwm--log "Moving #x%x to %s" id frame-or-index) (with-current-buffer (exwm--id->buffer id) (unless (eq exwm--frame frame) (unless exwm-workspace-show-all-buffers @@ -819,8 +827,8 @@ INDEX must not exceed the current number of workspaces." ;; Floating. (setq container (frame-parameter exwm--floating-frame 'exwm-container)) - (unless (equal (frame-parameter old-frame 'exwm-randr-output) - (frame-parameter frame 'exwm-randr-output)) + (unless (equal (frame-parameter old-frame 'exwm-randr-monitor) + (frame-parameter frame 'exwm-randr-monitor)) (with-slots (x y) (xcb:+request-unchecked+reply exwm--connection (make-instance 'xcb:GetGeometry @@ -985,6 +993,7 @@ INDEX must not exceed the current number of workspaces." (defun exwm-workspace--x-create-frame (orig-fun params) "Set override-redirect on the frame created by `x-create-frame'." + (exwm--log) (let ((frame (funcall orig-fun params))) (xcb:+request exwm--connection (make-instance 'xcb:ChangeWindowAttributes @@ -1006,6 +1015,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace-attach-minibuffer () "Attach the minibuffer so that it always shows." (interactive) + (exwm--log) (when (and (exwm-workspace--minibuffer-own-frame-p) (not (exwm-workspace--minibuffer-attached-p))) ;; Reset the frame size. @@ -1030,6 +1040,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace-detach-minibuffer () "Detach the minibuffer so that it automatically hides." (interactive) + (exwm--log) (when (and (exwm-workspace--minibuffer-own-frame-p) (exwm-workspace--minibuffer-attached-p)) (setq exwm-workspace--attached-minibuffer-height 0) @@ -1047,6 +1058,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace-toggle-minibuffer () "Attach the minibuffer if it's detached, or detach it if it's attached." (interactive) + (exwm--log) (when (exwm-workspace--minibuffer-own-frame-p) (if (exwm-workspace--minibuffer-attached-p) (exwm-workspace-detach-minibuffer) @@ -1072,6 +1084,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (when (and (integerp max-mini-window-height) (> height max-mini-window-height)) (setq height max-mini-window-height)) + (exwm--log "%s" height) (set-frame-height exwm-workspace--minibuffer height)))) (defun exwm-workspace--on-ConfigureNotify (data _synthetic) @@ -1082,6 +1095,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (with-slots (window height) obj (when (eq (frame-parameter exwm-workspace--minibuffer 'exwm-outer-id) window) + (exwm--log) (when (and (floatp max-mini-window-height) (> height (* max-mini-window-height (exwm-workspace--current-height)))) @@ -1123,6 +1137,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace--show-minibuffer () "Show the minibuffer frame." + (exwm--log) ;; Cancel pending timer. (when exwm-workspace--display-echo-area-timer (cancel-timer exwm-workspace--display-echo-area-timer) @@ -1144,6 +1159,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace--hide-minibuffer () "Hide the minibuffer frame." + (exwm--log) ;; Hide the minibuffer frame. (if (exwm-workspace--minibuffer-attached-p) (xcb:+request exwm--connection @@ -1165,6 +1181,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace--on-minibuffer-setup () "Run in minibuffer-setup-hook to show the minibuffer and its container." + (exwm--log) (when (and (= 1 (minibuffer-depth)) (not (exwm-workspace--client-p))) (add-hook 'post-command-hook #'exwm-workspace--update-minibuffer-height) @@ -1186,6 +1203,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace--on-minibuffer-exit () "Run in minibuffer-exit-hook to hide the minibuffer container." + (exwm--log) (when (and (= 1 (minibuffer-depth)) (not (exwm-workspace--client-p))) (remove-hook 'post-command-hook #'exwm-workspace--update-minibuffer-height) @@ -1228,6 +1246,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace--set-desktop-geometry () "Set _NET_DESKTOP_GEOMETRY." + (exwm--log) ;; We don't support large desktop so it's the same with screen size. (xcb:+request exwm--connection (make-instance 'xcb:ewmh:set-_NET_DESKTOP_GEOMETRY @@ -1237,6 +1256,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace--add-frame-as-workspace (frame) "Configure frame FRAME to be treated as a workspace." + (exwm--log "%s" frame) (setq exwm-workspace--list (nconc exwm-workspace--list (list frame))) (let ((outer-id (string-to-number (frame-parameter frame 'outer-window-id))) @@ -1252,7 +1272,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." ;; prevent potential problems. The values do not matter here as ;; they'll be updated by the RandR module later. (let ((w (car exwm-workspace--list))) - (dolist (param '(exwm-randr-output + (dolist (param '(exwm-randr-monitor exwm-geometry)) (set-frame-parameter frame param (frame-parameter w param)))) (xcb:+request exwm--connection @@ -1401,6 +1421,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." (defun exwm-workspace--update-ewmh-props () "Update EWMH properties to match the workspace list." + (exwm--log) (let ((num-workspaces (exwm-workspace--count))) ;; Avoid setting 0 desktops. (when (= 0 num-workspaces) @@ -1420,6 +1441,7 @@ Please check `exwm-workspace--minibuffer-own-frame-p' first." NEW-X-PARAMETERS is an alist of frame parameters, merged into current `window-system-default-frame-alist' for the X Window System. The parameters are applied to all subsequently created X frames." + (exwm--log) ;; The parameters are modified in place; take current ;; ones or insert a new X-specific list. (let ((x-parameters (or (assq 'x window-system-default-frame-alist) @@ -1439,6 +1461,7 @@ applied to all subsequently created X frames." (interactive "e")) (defun exwm-workspace--init-minibuffer-frame () + (exwm--log) ;; Initialize workspaces without minibuffers. (setq exwm-workspace--minibuffer (make-frame '((window-system . x) (minibuffer . only) @@ -1509,6 +1532,7 @@ applied to all subsequently created X frames." :test #'equal)) (defun exwm-workspace--exit-minibuffer-frame () + (exwm--log) ;; Only on minibuffer-frame. (remove-hook 'minibuffer-setup-hook #'exwm-workspace--on-minibuffer-setup) (remove-hook 'minibuffer-exit-hook #'exwm-workspace--on-minibuffer-exit) @@ -1532,6 +1556,7 @@ applied to all subsequently created X frames." (defun exwm-workspace--init () "Initialize workspace module." + (exwm--log) ;; Prevent unexpected exit (setq exwm-workspace--fullscreen-frame-count 0) (exwm-workspace--modify-all-x-frames-parameters @@ -1599,6 +1624,7 @@ applied to all subsequently created X frames." (defun exwm-workspace--exit () "Exit the workspace module." + (exwm--log) (when (exwm-workspace--minibuffer-own-frame-p) (exwm-workspace--exit-minibuffer-frame)) (advice-remove 'x-create-frame #'exwm-workspace--x-create-frame) @@ -1636,6 +1662,7 @@ applied to all subsequently created X frames." (defun exwm-workspace--post-init () "The second stage in the initialization of the workspace module." + (exwm--log) (when exwm-workspace--client ;; Reset the 'fullscreen' frame parameter to make emacsclinet frames ;; fullscreen (even without the RandR module enabled). |