Manage a certain type of undecorated X windows

* exwm-core.el (exwm--mwm-hints): Removed.
(exwm--mwm-hints-decorations): New buffer-local variable for
indicating whether the X window should have decorations.
* exwm-floating.el (exwm-floating--set-floating): Hide the mode-line
of undecorated floating X windows by default.
* exwm-manage.el (exwm-manage--update-mwm-hints):
Set exwm--mwm-hints-decorations;
(exwm-manage--manage-window): Manage an undecorated X window if its
input model is not 'No Input' or 'Globally Active'.
This commit is contained in:
Chris Feng 2016-05-24 12:30:53 +08:00
parent 1b2ae3749e
commit 3dba5f156f
3 changed files with 22 additions and 9 deletions

View file

@ -116,7 +116,7 @@
(defvar-local exwm--hints-input nil) (defvar-local exwm--hints-input nil)
(defvar-local exwm--hints-urgency nil) (defvar-local exwm--hints-urgency nil)
;; _MOTIF_WM_HINTS ;; _MOTIF_WM_HINTS
(defvar-local exwm--mwm-hints nil) (defvar-local exwm--mwm-hints-decorations t)
(defvar exwm-mode-map (defvar exwm-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))

View file

@ -159,6 +159,12 @@
(- (elt edges 2) (elt edges 0))))) (- (elt edges 2) (elt edges 0)))))
(frame-height (+ height (- (frame-pixel-height frame) (frame-height (+ height (- (frame-pixel-height frame)
(- (elt edges 3) (elt edges 1)))))) (- (elt edges 3) (elt edges 1))))))
;; Check `exwm--mwm-hints-decorations'.
(unless exwm--mwm-hints-decorations
(setq frame-height (- frame-height (window-mode-line-height
(frame-root-window frame)))
exwm--mode-line-format mode-line-format
mode-line-format nil))
(set-frame-size frame frame-width frame-height t) (set-frame-size frame frame-width frame-height t)
;; Create the frame container as the parent of the frame and ;; Create the frame container as the parent of the frame and
;; a child of the X window container. ;; a child of the X window container.

View file

@ -48,7 +48,7 @@ corresponding buffer.")
(defun exwm-manage--update-mwm-hints (id &optional force) (defun exwm-manage--update-mwm-hints (id &optional force)
"Update _MOTIF_WM_HINTS." "Update _MOTIF_WM_HINTS."
(with-current-buffer (exwm--id->buffer id) (with-current-buffer (exwm--id->buffer id)
(unless (and exwm--mwm-hints (not force)) (unless (and (not exwm--mwm-hints-decorations) (not force))
(let ((reply (xcb:+request-unchecked+reply exwm--connection (let ((reply (xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:icccm:-GetProperty (make-instance 'xcb:icccm:-GetProperty
:window id :window id
@ -56,7 +56,17 @@ corresponding buffer.")
:type exwm-manage--_MOTIF_WM_HINTS :type exwm-manage--_MOTIF_WM_HINTS
:long-length 5)))) :long-length 5))))
(when reply (when reply
(setq exwm--mwm-hints (append (slot-value reply 'value) nil))))))) ;; Check MotifWmHints.decorations.
(with-slots (value) reply
(setq value (append value nil))
(when (and value
;; See <Xm/MwmUtil.h> for fields definitions.
(/= 0 (logand
(elt value 0) ;MotifWmHints.flags
2)) ;MWM_HINTS_DECORATIONS
(= 0
(elt value 2))) ;MotifWmHints.decorations
(setq exwm--mwm-hints-decorations nil))))))))
(defvar exwm-workspace--current) (defvar exwm-workspace--current)
(defvar exwm-workspace--switch-history-outdated) (defvar exwm-workspace--switch-history-outdated)
@ -90,6 +100,7 @@ corresponding buffer.")
(exwm--update-class id) (exwm--update-class id)
(exwm--update-transient-for id) (exwm--update-transient-for id)
(exwm--update-normal-hints id) (exwm--update-normal-hints id)
(exwm--update-hints id)
(exwm-manage--update-geometry id) (exwm-manage--update-geometry id)
(exwm-manage--update-mwm-hints id) (exwm-manage--update-mwm-hints id)
;; No need to manage (please check OverrideRedirect outside) ;; No need to manage (please check OverrideRedirect outside)
@ -100,11 +111,8 @@ corresponding buffer.")
(memq xcb:Atom:_NET_WM_WINDOW_TYPE_DIALOG exwm-window-type) (memq xcb:Atom:_NET_WM_WINDOW_TYPE_DIALOG exwm-window-type)
(memq xcb:Atom:_NET_WM_WINDOW_TYPE_NORMAL exwm-window-type))) (memq xcb:Atom:_NET_WM_WINDOW_TYPE_NORMAL exwm-window-type)))
;; Check the _MOTIF_WM_HINTS property. ;; Check the _MOTIF_WM_HINTS property.
(and exwm--mwm-hints (and (not exwm--mwm-hints-decorations)
;; See <Xm/MwmUtil.h> for fields definitions. (not exwm--hints-input)
(/= 0 (logand (elt exwm--mwm-hints 0) ;MotifWmHints.flags
2)) ;MWM_HINTS_DECORATIONS
(= 0 (elt exwm--mwm-hints 2)) ;MotifWmHints.decorations
;; Floating windows only ;; Floating windows only
(or exwm-transient-for exwm--fixed-size (or exwm-transient-for exwm--fixed-size
(memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY (memq xcb:Atom:_NET_WM_WINDOW_TYPE_UTILITY
@ -202,7 +210,6 @@ corresponding buffer.")
:data (vconcat (mapcar #'car exwm--id-buffer-alist)))) :data (vconcat (mapcar #'car exwm--id-buffer-alist))))
(xcb:flush exwm--connection) (xcb:flush exwm--connection)
(exwm--update-title id) (exwm--update-title id)
(exwm--update-hints id)
(exwm--update-protocols id) (exwm--update-protocols id)
(exwm--update-state id) (exwm--update-state id)
(if (or exwm-transient-for exwm--fixed-size (if (or exwm-transient-for exwm--fixed-size