2015-07-17 13:16:08 +02:00
|
|
|
|
;;; exwm-floating.el --- Floating Module for EXWM -*- lexical-binding: t -*-
|
|
|
|
|
|
2019-02-01 01:00:00 +01:00
|
|
|
|
;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
|
|
|
|
;; Author: Chris Feng <chris.w.feng@gmail.com>
|
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; This file is part of GNU Emacs.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This module deals with the conversion between floating and non-floating
|
|
|
|
|
;; states and implements moving/resizing operations on floating windows.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'xcb-cursor)
|
2015-09-04 03:09:59 +02:00
|
|
|
|
(require 'exwm-core)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(defgroup exwm-floating nil
|
|
|
|
|
"Floating."
|
|
|
|
|
:version "25.3"
|
|
|
|
|
:group 'exwm)
|
|
|
|
|
|
|
|
|
|
(defcustom exwm-floating-setup-hook nil
|
|
|
|
|
"Normal hook run when an X window has been made floating, in the
|
|
|
|
|
context of the corresponding buffer."
|
|
|
|
|
:type 'hook)
|
|
|
|
|
|
|
|
|
|
(defcustom exwm-floating-exit-hook nil
|
|
|
|
|
"Normal hook run when an X window has exited floating state, in the
|
|
|
|
|
context of the corresponding buffer."
|
|
|
|
|
:type 'hook)
|
|
|
|
|
|
2019-09-13 02:00:00 +02:00
|
|
|
|
(defvar exwm-floating--border-pixel nil
|
|
|
|
|
"Border pixel drawn around floating X windows.")
|
|
|
|
|
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(defcustom exwm-floating-border-color "navy"
|
|
|
|
|
"Border color of floating windows."
|
2019-09-13 02:00:00 +02:00
|
|
|
|
:type 'color
|
|
|
|
|
:initialize #'custom-initialize-default
|
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
;; Change border color for all floating X windows.
|
|
|
|
|
(exwm-floating--init-border)
|
|
|
|
|
(dolist (pair exwm--id-buffer-alist)
|
|
|
|
|
(with-current-buffer (cdr pair)
|
|
|
|
|
(when exwm--floating-frame
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ChangeWindowAttributes
|
|
|
|
|
:window
|
|
|
|
|
(frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container)
|
|
|
|
|
:value-mask xcb:CW:BorderPixel
|
|
|
|
|
:border-pixel
|
|
|
|
|
exwm-floating--border-pixel)))))
|
|
|
|
|
(when exwm--connection
|
|
|
|
|
(xcb:flush exwm--connection))))
|
2018-02-18 17:04:27 +01:00
|
|
|
|
|
|
|
|
|
(defcustom exwm-floating-border-width 1
|
|
|
|
|
"Border width of floating windows."
|
2019-09-13 02:00:00 +02:00
|
|
|
|
:type '(integer
|
|
|
|
|
:validate (lambda (widget)
|
|
|
|
|
(when (< (widget-value widget) 0)
|
|
|
|
|
(widget-put widget :error "Border width is at least 0")
|
|
|
|
|
widget)))
|
|
|
|
|
:initialize #'custom-initialize-default
|
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
(let ((delta (- value exwm-floating-border-width))
|
|
|
|
|
container)
|
|
|
|
|
(set-default symbol value)
|
|
|
|
|
;; Change border width for all floating X windows.
|
|
|
|
|
(dolist (pair exwm--id-buffer-alist)
|
|
|
|
|
(with-current-buffer (cdr pair)
|
|
|
|
|
(when exwm--floating-frame
|
|
|
|
|
(setq container (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container))
|
|
|
|
|
(with-slots (x y)
|
|
|
|
|
(xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:GetGeometry
|
|
|
|
|
:drawable container))
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window container
|
|
|
|
|
:value-mask
|
|
|
|
|
(logior xcb:ConfigWindow:X
|
|
|
|
|
xcb:ConfigWindow:Y
|
|
|
|
|
xcb:ConfigWindow:BorderWidth)
|
|
|
|
|
:border-width value
|
|
|
|
|
:x (- x delta)
|
|
|
|
|
:y (- y delta)))))))
|
|
|
|
|
(when exwm--connection
|
|
|
|
|
(xcb:flush exwm--connection)))))
|
2018-02-18 17:04:27 +01:00
|
|
|
|
|
2016-09-23 12:41:43 +02:00
|
|
|
|
(defvar exwm-floating--border-colormap nil
|
|
|
|
|
"Colormap used by the border pixel.
|
|
|
|
|
|
|
|
|
|
This is also used by X window containers.")
|
2015-08-16 13:00:42 +02:00
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;; Cursors for moving/resizing a window
|
|
|
|
|
(defvar exwm-floating--cursor-move nil)
|
|
|
|
|
(defvar exwm-floating--cursor-top-left nil)
|
|
|
|
|
(defvar exwm-floating--cursor-top nil)
|
|
|
|
|
(defvar exwm-floating--cursor-top-right nil)
|
|
|
|
|
(defvar exwm-floating--cursor-right nil)
|
|
|
|
|
(defvar exwm-floating--cursor-bottom-right nil)
|
|
|
|
|
(defvar exwm-floating--cursor-bottom nil)
|
|
|
|
|
(defvar exwm-floating--cursor-bottom-left nil)
|
|
|
|
|
(defvar exwm-floating--cursor-left nil)
|
|
|
|
|
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(defvar exwm-floating--moveresize-calculate nil
|
|
|
|
|
"Calculate move/resize parameters [buffer event-mask x y width height].")
|
|
|
|
|
|
|
|
|
|
(defvar exwm-workspace--current)
|
2019-09-14 02:00:00 +02:00
|
|
|
|
(defvar exwm-workspace--frame-y-offset)
|
|
|
|
|
(defvar exwm-workspace--window-y-offset)
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(defvar exwm-workspace--workareas)
|
|
|
|
|
(declare-function exwm-layout--hide "exwm-layout.el" (id))
|
|
|
|
|
(declare-function exwm-layout--iconic-state-p "exwm-layout.el" (&optional id))
|
|
|
|
|
(declare-function exwm-layout--refresh "exwm-layout.el" ())
|
|
|
|
|
(declare-function exwm-layout--show "exwm-layout.el" (id &optional window))
|
|
|
|
|
(declare-function exwm-workspace--position "exwm-workspace.el" (frame))
|
2019-09-14 02:00:00 +02:00
|
|
|
|
(declare-function exwm-workspace--update-offsets "exwm-workspace.el" ())
|
2018-02-18 17:04:27 +01:00
|
|
|
|
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(defun exwm-floating--set-allowed-actions (id tilling)
|
|
|
|
|
"Set _NET_WM_ALLOWED_ACTIONS."
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log "#x%x" id)
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ewmh:set-_NET_WM_ALLOWED_ACTIONS
|
|
|
|
|
:window id
|
|
|
|
|
:data (if tilling
|
|
|
|
|
(vector xcb:Atom:_NET_WM_ACTION_MINIMIZE
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_FULLSCREEN
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_CHANGE_DESKTOP
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_CLOSE)
|
|
|
|
|
(vector xcb:Atom:_NET_WM_ACTION_MOVE
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_RESIZE
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_MINIMIZE
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_FULLSCREEN
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_CHANGE_DESKTOP
|
|
|
|
|
xcb:Atom:_NET_WM_ACTION_CLOSE)))))
|
|
|
|
|
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(defun exwm-floating--set-floating (id)
|
|
|
|
|
"Make window ID floating."
|
2015-08-13 06:02:44 +02:00
|
|
|
|
(let ((window (get-buffer-window (exwm--id->buffer id))))
|
2016-08-31 13:18:42 +02:00
|
|
|
|
(when window
|
|
|
|
|
;; Hide the non-floating X window first.
|
|
|
|
|
(set-window-buffer window (other-buffer nil t))))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(let* ((original-frame (buffer-local-value 'exwm--frame
|
|
|
|
|
(exwm--id->buffer id)))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; Create new frame
|
2015-09-16 15:32:38 +02:00
|
|
|
|
(frame (with-current-buffer
|
|
|
|
|
(or (get-buffer "*scratch*")
|
2015-10-26 05:38:20 +01:00
|
|
|
|
(progn
|
|
|
|
|
(set-buffer-major-mode
|
|
|
|
|
(get-buffer-create "*scratch*"))
|
|
|
|
|
(get-buffer "*scratch*")))
|
2016-02-03 05:12:24 +01:00
|
|
|
|
(make-frame
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
`((minibuffer . ,(minibuffer-window exwm--frame))
|
2019-09-14 02:00:00 +02:00
|
|
|
|
(left . ,(* window-min-width -10000))
|
|
|
|
|
(top . ,(* window-min-height -10000))
|
2016-02-18 12:56:01 +01:00
|
|
|
|
(width . ,window-min-width)
|
|
|
|
|
(height . ,window-min-height)
|
2016-02-03 05:12:24 +01:00
|
|
|
|
(unsplittable . t))))) ;and fix the size later
|
2015-09-04 03:09:59 +02:00
|
|
|
|
(outer-id (string-to-number (frame-parameter frame 'outer-window-id)))
|
2016-08-09 07:34:29 +02:00
|
|
|
|
(window-id (string-to-number (frame-parameter frame 'window-id)))
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(frame-container (xcb:generate-id exwm--connection))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(window (frame-first-window frame)) ;and it's the only window
|
|
|
|
|
(x (slot-value exwm--geometry 'x))
|
|
|
|
|
(y (slot-value exwm--geometry 'y))
|
|
|
|
|
(width (slot-value exwm--geometry 'width))
|
2016-08-09 07:26:15 +02:00
|
|
|
|
(height (slot-value exwm--geometry 'height)))
|
2019-09-14 02:00:00 +02:00
|
|
|
|
;; Force drawing menu-bar & tool-bar.
|
|
|
|
|
(redisplay t)
|
|
|
|
|
(exwm-workspace--update-offsets)
|
2018-02-19 15:40:27 +01:00
|
|
|
|
(exwm--log "Floating geometry (original): %dx%d%+d%+d" width height x y)
|
2016-02-20 14:52:07 +01:00
|
|
|
|
;; Save frame parameters.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(set-frame-parameter frame 'exwm-outer-id outer-id)
|
2016-08-09 07:34:29 +02:00
|
|
|
|
(set-frame-parameter frame 'exwm-id window-id)
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(set-frame-parameter frame 'exwm-container frame-container)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; Fix illegal parameters
|
|
|
|
|
;; FIXME: check normal hints restrictions
|
2018-02-19 15:40:27 +01:00
|
|
|
|
(let* ((workarea (elt exwm-workspace--workareas
|
|
|
|
|
(exwm-workspace--position original-frame)))
|
|
|
|
|
(x* (aref workarea 0))
|
|
|
|
|
(y* (aref workarea 1))
|
|
|
|
|
(width* (aref workarea 2))
|
|
|
|
|
(height* (aref workarea 3)))
|
2015-08-11 09:06:11 +02:00
|
|
|
|
;; Center floating windows
|
2018-02-19 15:40:27 +01:00
|
|
|
|
(when (and (or (= x 0) (= x x*))
|
|
|
|
|
(or (= y 0) (= y y*)))
|
2015-08-11 09:06:11 +02:00
|
|
|
|
(let ((buffer (exwm--id->buffer exwm-transient-for))
|
|
|
|
|
window edges)
|
|
|
|
|
(when (and buffer (setq window (get-buffer-window buffer)))
|
|
|
|
|
(setq edges (window-inside-absolute-pixel-edges window))
|
|
|
|
|
(unless (and (<= width (- (elt edges 2) (elt edges 0)))
|
|
|
|
|
(<= height (- (elt edges 3) (elt edges 1))))
|
|
|
|
|
(setq edges nil)))
|
|
|
|
|
(if edges
|
|
|
|
|
;; Put at the center of leading window
|
2018-02-19 15:40:27 +01:00
|
|
|
|
(setq x (+ x* (/ (- (elt edges 2) (elt edges 0) width) 2))
|
|
|
|
|
y (+ y* (/ (- (elt edges 3) (elt edges 1) height) 2)))
|
2015-08-11 09:06:11 +02:00
|
|
|
|
;; Put at the center of screen
|
2018-02-19 15:40:27 +01:00
|
|
|
|
(setq x (/ (- width* width) 2)
|
|
|
|
|
y (/ (- height* height) 2)))))
|
|
|
|
|
(if (> width width*)
|
|
|
|
|
;; Too wide
|
|
|
|
|
(progn (setq x x*
|
|
|
|
|
width width*))
|
|
|
|
|
;; Invalid width
|
|
|
|
|
(when (= 0 width) (setq width (/ width* 2)))
|
|
|
|
|
;; Make sure at least half of the window is visible
|
|
|
|
|
(unless (< x* (+ x (/ width 2)) (+ x* width*))
|
|
|
|
|
(setq x (+ x* (/ (- width* width) 2)))))
|
|
|
|
|
(if (> height height*)
|
|
|
|
|
;; Too tall
|
|
|
|
|
(setq y y*
|
|
|
|
|
height height*)
|
|
|
|
|
;; Invalid height
|
|
|
|
|
(when (= 0 height) (setq height (/ height* 2)))
|
|
|
|
|
;; Make sure at least half of the window is visible
|
|
|
|
|
(unless (< y* (+ y (/ height 2)) (+ y* height*))
|
2018-03-02 18:00:28 +01:00
|
|
|
|
(setq y (+ y* (/ (- height* height) 2)))))
|
|
|
|
|
;; The geometry can be overridden by user options.
|
|
|
|
|
(let ((x** (plist-get exwm--configurations 'x))
|
|
|
|
|
(y** (plist-get exwm--configurations 'y))
|
|
|
|
|
(width** (plist-get exwm--configurations 'width))
|
|
|
|
|
(height** (plist-get exwm--configurations 'height)))
|
|
|
|
|
(if (integerp x**)
|
|
|
|
|
(setq x (+ x* x**))
|
|
|
|
|
(when (and (floatp x**)
|
|
|
|
|
(>= 1 x** 0))
|
|
|
|
|
(setq x (+ x* (round (* x** width*))))))
|
|
|
|
|
(if (integerp y**)
|
|
|
|
|
(setq y (+ y* y**))
|
|
|
|
|
(when (and (floatp y**)
|
|
|
|
|
(>= 1 y** 0))
|
|
|
|
|
(setq y (+ y* (round (* y** height*))))))
|
|
|
|
|
(if (integerp width**)
|
|
|
|
|
(setq width width**)
|
|
|
|
|
(when (and (floatp width**)
|
|
|
|
|
(> 1 width** 0))
|
|
|
|
|
(setq width (max 1 (round (* width** width*))))))
|
|
|
|
|
(if (integerp height**)
|
|
|
|
|
(setq height height**)
|
|
|
|
|
(when (and (floatp height**)
|
|
|
|
|
(> 1 height** 0))
|
|
|
|
|
(setq height (max 1 (round (* height** height*))))))))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(exwm--set-geometry id x y nil nil)
|
|
|
|
|
(xcb:flush exwm--connection)
|
2015-08-11 09:06:11 +02:00
|
|
|
|
(exwm--log "Floating geometry (corrected): %dx%d%+d%+d" width height x y)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; Fit frame to client
|
2016-02-18 12:56:01 +01:00
|
|
|
|
;; It seems we have to make the frame invisible in order to resize it
|
|
|
|
|
;; timely.
|
|
|
|
|
;; The frame will be made visible by `select-frame-set-input-focus'.
|
|
|
|
|
(make-frame-invisible frame)
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(let* ((edges (window-inside-pixel-edges window))
|
|
|
|
|
(frame-width (+ width (- (frame-pixel-width frame)
|
|
|
|
|
(- (elt edges 2) (elt edges 0)))))
|
|
|
|
|
(frame-height (+ height (- (frame-pixel-height frame)
|
2019-09-08 02:00:00 +02:00
|
|
|
|
(- (elt edges 3) (elt edges 1)))
|
|
|
|
|
;; Use `frame-outer-height' in the future.
|
2019-09-14 02:00:00 +02:00
|
|
|
|
exwm-workspace--frame-y-offset))
|
2018-03-02 18:00:28 +01:00
|
|
|
|
(floating-mode-line (plist-get exwm--configurations
|
2018-03-03 18:39:12 +01:00
|
|
|
|
'floating-mode-line))
|
|
|
|
|
(floating-header-line (plist-get exwm--configurations
|
|
|
|
|
'floating-header-line)))
|
2018-03-02 18:00:28 +01:00
|
|
|
|
(if floating-mode-line
|
|
|
|
|
(setq exwm--mode-line-format (or exwm--mode-line-format
|
|
|
|
|
mode-line-format)
|
|
|
|
|
mode-line-format floating-mode-line)
|
|
|
|
|
(if (and (not (plist-member exwm--configurations 'floating-mode-line))
|
|
|
|
|
exwm--mwm-hints-decorations)
|
|
|
|
|
(when exwm--mode-line-format
|
|
|
|
|
(setq mode-line-format exwm--mode-line-format))
|
|
|
|
|
;; The mode-line need to be hidden in floating mode.
|
|
|
|
|
(setq frame-height (- frame-height (window-mode-line-height
|
|
|
|
|
(frame-root-window frame)))
|
|
|
|
|
exwm--mode-line-format (or exwm--mode-line-format
|
|
|
|
|
mode-line-format)
|
|
|
|
|
mode-line-format nil)))
|
2018-03-03 18:39:12 +01:00
|
|
|
|
(if floating-header-line
|
|
|
|
|
(setq header-line-format floating-header-line)
|
|
|
|
|
(if (and (not (plist-member exwm--configurations
|
|
|
|
|
'floating-header-line))
|
|
|
|
|
exwm--mwm-hints-decorations)
|
|
|
|
|
(setq header-line-format nil)
|
2019-09-14 02:00:00 +02:00
|
|
|
|
;; The header-line need to be hidden in floating mode.
|
2018-03-03 18:39:12 +01:00
|
|
|
|
(setq frame-height (- frame-height (window-header-line-height
|
|
|
|
|
(frame-root-window frame)))
|
|
|
|
|
header-line-format nil)))
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(set-frame-size frame frame-width frame-height t)
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
;; Create the frame container as the parent of the frame.
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:CreateWindow
|
2016-08-12 13:18:32 +02:00
|
|
|
|
:depth 0
|
|
|
|
|
:wid frame-container
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:parent exwm--root
|
2019-09-14 02:00:00 +02:00
|
|
|
|
:x x
|
|
|
|
|
:y (- y exwm-workspace--window-y-offset)
|
2016-08-12 13:18:32 +02:00
|
|
|
|
:width width
|
|
|
|
|
:height height
|
2018-03-02 18:00:28 +01:00
|
|
|
|
:border-width
|
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
|
|
|
|
(let ((border-witdh (plist-get exwm--configurations
|
|
|
|
|
'border-width)))
|
|
|
|
|
(if (and (integerp border-witdh)
|
|
|
|
|
(>= border-witdh 0))
|
|
|
|
|
border-witdh
|
|
|
|
|
exwm-floating-border-width)))
|
2016-08-12 13:18:32 +02:00
|
|
|
|
:class xcb:WindowClass:InputOutput
|
|
|
|
|
:visual 0
|
|
|
|
|
:value-mask (logior xcb:CW:BackPixmap
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(if exwm-floating--border-pixel
|
|
|
|
|
xcb:CW:BorderPixel 0)
|
|
|
|
|
xcb:CW:OverrideRedirect
|
|
|
|
|
(if exwm-floating--border-colormap
|
|
|
|
|
xcb:CW:Colormap 0))
|
2016-08-12 13:18:32 +02:00
|
|
|
|
:background-pixmap xcb:BackPixmap:ParentRelative
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:border-pixel exwm-floating--border-pixel
|
|
|
|
|
:override-redirect 1
|
|
|
|
|
:colormap exwm-floating--border-colormap))
|
2018-03-06 01:00:00 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ewmh:set-_NET_WM_NAME
|
|
|
|
|
:window frame-container
|
|
|
|
|
:data
|
|
|
|
|
(format "EXWM floating frame container for 0x%x" id)))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
;; Map it.
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:MapWindow :window frame-container))
|
|
|
|
|
;; Put the X window right above this frame container.
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window id
|
|
|
|
|
:value-mask (logior xcb:ConfigWindow:Sibling
|
|
|
|
|
xcb:ConfigWindow:StackMode)
|
|
|
|
|
:sibling frame-container
|
|
|
|
|
:stack-mode xcb:StackMode:Above)))
|
2016-02-20 14:52:07 +01:00
|
|
|
|
;; Reparent this frame to its container.
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ReparentWindow
|
2016-02-20 14:52:07 +01:00
|
|
|
|
:window outer-id :parent frame-container :x 0 :y 0))
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(exwm-floating--set-allowed-actions id nil)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:flush exwm--connection)
|
|
|
|
|
;; Set window/buffer
|
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(setq window-size-fixed exwm--fixed-size
|
2015-07-17 13:16:08 +02:00
|
|
|
|
exwm--floating-frame frame)
|
2016-02-18 12:56:01 +01:00
|
|
|
|
;; Do the refresh manually.
|
|
|
|
|
(remove-hook 'window-configuration-change-hook #'exwm-layout--refresh)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(set-window-buffer window (current-buffer)) ;this changes current buffer
|
2016-02-18 12:56:01 +01:00
|
|
|
|
(add-hook 'window-configuration-change-hook #'exwm-layout--refresh)
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(set-window-dedicated-p window t)
|
|
|
|
|
(exwm-layout--show id window))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
|
|
|
|
(if (exwm-layout--iconic-state-p id)
|
|
|
|
|
;; Hide iconic floating X windows.
|
|
|
|
|
(exwm-floating-hide)
|
|
|
|
|
(with-selected-frame exwm--frame
|
|
|
|
|
(exwm-layout--refresh)))
|
2016-07-18 06:55:27 +02:00
|
|
|
|
(select-frame-set-input-focus frame))
|
|
|
|
|
;; FIXME: Strangely, the Emacs frame can move itself at this point
|
|
|
|
|
;; when there are left/top struts set. Force resetting its
|
|
|
|
|
;; position seems working, but it'd better to figure out why.
|
2017-05-07 12:40:08 +02:00
|
|
|
|
;; FIXME: This also happens in another case (#220) where the cause is
|
|
|
|
|
;; still unclear.
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(exwm--set-geometry outer-id 0 0 nil nil)
|
2017-05-07 12:40:08 +02:00
|
|
|
|
(xcb:flush exwm--connection))
|
2016-08-09 07:20:36 +02:00
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
|
|
|
|
(run-hooks 'exwm-floating-setup-hook))
|
2016-02-20 07:52:53 +01:00
|
|
|
|
;; Redraw the frame.
|
2019-09-14 02:00:00 +02:00
|
|
|
|
(redisplay t))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
|
|
|
|
(defun exwm-floating--unset-floating (id)
|
|
|
|
|
"Make window ID non-floating."
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log "#x%x" id)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(let ((buffer (exwm--id->buffer id)))
|
2016-02-03 05:12:24 +01:00
|
|
|
|
(with-current-buffer buffer
|
2016-02-18 12:56:01 +01:00
|
|
|
|
(when exwm--floating-frame
|
2016-02-20 07:52:53 +01:00
|
|
|
|
;; The X window is already mapped.
|
|
|
|
|
;; Unmap the X window.
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ChangeWindowAttributes
|
|
|
|
|
:window id :value-mask xcb:CW:EventMask
|
|
|
|
|
:event-mask xcb:EventMask:NoEvent))
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:UnmapWindow :window id))
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ChangeWindowAttributes
|
|
|
|
|
:window id :value-mask xcb:CW:EventMask
|
2019-03-17 01:00:00 +01:00
|
|
|
|
:event-mask (exwm--get-client-event-mask)))
|
2016-02-20 07:52:53 +01:00
|
|
|
|
;; Reparent the floating frame back to the root window.
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(let ((frame-id (frame-parameter exwm--floating-frame 'exwm-outer-id))
|
|
|
|
|
(frame-container (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container)))
|
2016-02-18 12:56:01 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:UnmapWindow :window frame-id))
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ReparentWindow
|
|
|
|
|
:window frame-id
|
|
|
|
|
:parent exwm--root
|
2016-02-20 14:52:07 +01:00
|
|
|
|
:x 0 :y 0))
|
|
|
|
|
;; Also destroy its container.
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:DestroyWindow :window frame-container))))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
;; Place the X window just above the reference X window.
|
2016-02-20 14:52:07 +01:00
|
|
|
|
;; (the stacking order won't change from now on).
|
2016-09-23 12:41:43 +02:00
|
|
|
|
;; Also hide the possible floating border.
|
2016-02-06 05:59:33 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:window id
|
2016-09-23 12:41:43 +02:00
|
|
|
|
:value-mask (logior xcb:ConfigWindow:BorderWidth
|
|
|
|
|
xcb:ConfigWindow:Sibling
|
2016-02-06 05:59:33 +01:00
|
|
|
|
xcb:ConfigWindow:StackMode)
|
2016-09-23 12:41:43 +02:00
|
|
|
|
:border-width 0
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:sibling exwm--guide-window
|
2016-02-06 05:59:33 +01:00
|
|
|
|
:stack-mode xcb:StackMode:Above)))
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(exwm-floating--set-allowed-actions id t)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:flush exwm--connection)
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(when exwm--floating-frame ;from floating to non-floating
|
|
|
|
|
(set-window-dedicated-p (frame-first-window exwm--floating-frame) nil)
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
;; Select a tiling window and delete the old frame.
|
|
|
|
|
(select-window (frame-selected-window exwm-workspace--current))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(delete-frame exwm--floating-frame))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(with-current-buffer buffer
|
2015-08-12 12:09:35 +02:00
|
|
|
|
(setq window-size-fixed nil
|
2018-03-02 18:00:28 +01:00
|
|
|
|
exwm--floating-frame nil)
|
|
|
|
|
(if (not (plist-member exwm--configurations 'tiling-mode-line))
|
|
|
|
|
(when exwm--mode-line-format
|
|
|
|
|
(setq mode-line-format exwm--mode-line-format))
|
|
|
|
|
(setq exwm--mode-line-format (or exwm--mode-line-format
|
|
|
|
|
mode-line-format)
|
|
|
|
|
mode-line-format (plist-get exwm--configurations
|
2018-03-03 18:39:12 +01:00
|
|
|
|
'tiling-mode-line)))
|
|
|
|
|
(if (not (plist-member exwm--configurations 'tiling-header-line))
|
|
|
|
|
(setq header-line-format nil)
|
|
|
|
|
(setq header-line-format (plist-get exwm--configurations
|
|
|
|
|
'tiling-header-line))))
|
2016-10-06 06:47:56 +02:00
|
|
|
|
;; Only show X windows in normal state.
|
2016-07-13 12:51:32 +02:00
|
|
|
|
(unless (exwm-layout--iconic-state-p)
|
2017-08-30 18:58:39 +02:00
|
|
|
|
(pop-to-buffer-same-window buffer)))
|
2016-08-09 07:20:36 +02:00
|
|
|
|
(with-current-buffer (exwm--id->buffer id)
|
|
|
|
|
(run-hooks 'exwm-floating-exit-hook)))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
;;;###autoload
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(cl-defun exwm-floating-toggle-floating ()
|
2015-07-17 13:16:08 +02:00
|
|
|
|
"Toggle the current window between floating and non-floating states."
|
|
|
|
|
(interactive)
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log)
|
2018-02-18 17:04:27 +01:00
|
|
|
|
(unless (derived-mode-p 'exwm-mode)
|
2018-03-10 10:28:43 +01:00
|
|
|
|
(cl-return-from exwm-floating-toggle-floating))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(with-current-buffer (window-buffer)
|
|
|
|
|
(if exwm--floating-frame
|
|
|
|
|
(exwm-floating--unset-floating exwm--id)
|
|
|
|
|
(exwm-floating--set-floating exwm--id))))
|
|
|
|
|
|
2016-02-25 05:41:35 +01:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun exwm-floating-hide ()
|
|
|
|
|
"Hide the current floating X window (which would show again when selected)."
|
|
|
|
|
(interactive)
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log)
|
2018-07-14 18:00:00 +02:00
|
|
|
|
(when (and (derived-mode-p 'exwm-mode)
|
2016-02-25 05:41:35 +01:00
|
|
|
|
exwm--floating-frame)
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(exwm-layout--hide exwm--id)
|
2016-02-25 05:41:35 +01:00
|
|
|
|
(select-frame-set-input-focus exwm-workspace--current)))
|
|
|
|
|
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(defun exwm-floating--start-moveresize (id &optional type)
|
|
|
|
|
"Start move/resize."
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log "#x%x" id)
|
2016-03-04 12:11:10 +01:00
|
|
|
|
(let ((buffer-or-id (or (exwm--id->buffer id) id))
|
|
|
|
|
frame container-or-id x y width height cursor)
|
|
|
|
|
(if (bufferp buffer-or-id)
|
2016-03-06 06:45:13 +01:00
|
|
|
|
;; Managed.
|
|
|
|
|
(with-current-buffer buffer-or-id
|
|
|
|
|
(setq frame exwm--floating-frame
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
container-or-id (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container)))
|
2016-03-04 12:11:10 +01:00
|
|
|
|
;; Unmanaged.
|
|
|
|
|
(setq container-or-id id))
|
|
|
|
|
(when (and container-or-id
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; Test if the pointer can be grabbed
|
|
|
|
|
(= xcb:GrabStatus:Success
|
|
|
|
|
(slot-value
|
|
|
|
|
(xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:GrabPointer
|
2016-03-04 12:11:10 +01:00
|
|
|
|
:owner-events 0
|
2016-03-06 06:45:13 +01:00
|
|
|
|
:grab-window container-or-id
|
2015-07-17 13:16:08 +02:00
|
|
|
|
:event-mask xcb:EventMask:NoEvent
|
|
|
|
|
:pointer-mode xcb:GrabMode:Async
|
|
|
|
|
:keyboard-mode xcb:GrabMode:Async
|
|
|
|
|
:confine-to xcb:Window:None
|
|
|
|
|
:cursor xcb:Cursor:None
|
|
|
|
|
:time xcb:Time:CurrentTime))
|
|
|
|
|
'status)))
|
|
|
|
|
(with-slots (root-x root-y win-x win-y)
|
|
|
|
|
(xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:QueryPointer :window id))
|
2016-03-06 06:45:13 +01:00
|
|
|
|
(if (not (bufferp buffer-or-id))
|
|
|
|
|
;; Unmanaged.
|
|
|
|
|
(unless (eq type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE)
|
|
|
|
|
(with-slots ((width* width)
|
|
|
|
|
(height* height))
|
|
|
|
|
(xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:GetGeometry :drawable id))
|
|
|
|
|
(setq width width*
|
|
|
|
|
height height*)))
|
|
|
|
|
;; Managed.
|
|
|
|
|
(select-window (frame-first-window frame)) ;transfer input focus
|
|
|
|
|
(setq width (frame-pixel-width frame)
|
|
|
|
|
height (frame-pixel-height frame))
|
|
|
|
|
(unless type
|
|
|
|
|
;; Determine the resize type according to the pointer position
|
2019-09-08 02:00:00 +02:00
|
|
|
|
;; Clicking the center 1/3 part to resize has no effect
|
2016-03-06 06:45:13 +01:00
|
|
|
|
(setq x (/ (* 3 win-x) (float width))
|
|
|
|
|
y (/ (* 3 win-y) (float height))
|
|
|
|
|
type (cond ((and (< x 1) (< y 1))
|
|
|
|
|
xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT)
|
|
|
|
|
((and (> x 2) (< y 1))
|
|
|
|
|
xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT)
|
|
|
|
|
((and (> x 2) (> y 2))
|
|
|
|
|
xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT)
|
|
|
|
|
((and (< x 1) (> y 2))
|
|
|
|
|
xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT)
|
|
|
|
|
((> x 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_RIGHT)
|
|
|
|
|
((> y 2) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOM)
|
|
|
|
|
((< x 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_LEFT)
|
|
|
|
|
((< y 1) xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOP)))))
|
2015-09-03 12:56:36 +02:00
|
|
|
|
(if (not type)
|
|
|
|
|
(exwm-floating--stop-moveresize)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(cond ((= type xcb:ewmh:_NET_WM_MOVERESIZE_MOVE)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-move
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (x y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(logior xcb:ConfigWindow:X
|
|
|
|
|
xcb:ConfigWindow:Y))
|
|
|
|
|
(- x win-x) (- y win-y) 0 0))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPLEFT)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-top-left
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (x y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(logior xcb:ConfigWindow:X
|
|
|
|
|
xcb:ConfigWindow:Y
|
|
|
|
|
xcb:ConfigWindow:Width
|
|
|
|
|
xcb:ConfigWindow:Height))
|
|
|
|
|
(- x win-x) (- y win-y)
|
|
|
|
|
(- (+ root-x width) x)
|
|
|
|
|
(- (+ root-y height) y)))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOP)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-top
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (_x y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(logior xcb:ConfigWindow:Y
|
|
|
|
|
xcb:ConfigWindow:Height))
|
|
|
|
|
0 (- y win-y) 0 (- (+ root-y height) y)))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_TOPRIGHT)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-top-right
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (x y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(logior xcb:ConfigWindow:Y
|
|
|
|
|
xcb:ConfigWindow:Width
|
|
|
|
|
xcb:ConfigWindow:Height))
|
|
|
|
|
0 (- y win-y) (- x (- root-x width))
|
|
|
|
|
(- (+ root-y height) y)))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_RIGHT)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-right
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (x _y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
xcb:ConfigWindow:Width
|
|
|
|
|
0 0 (- x (- root-x width)) 0))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-bottom-right
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (x y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(logior xcb:ConfigWindow:Width
|
|
|
|
|
xcb:ConfigWindow:Height))
|
|
|
|
|
0 0 (- x (- root-x width))
|
|
|
|
|
(- y (- root-y height))))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOM)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-bottom
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (_x y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
xcb:ConfigWindow:Height
|
|
|
|
|
0 0 0 (- y (- root-y height))))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-bottom-left
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (x y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(logior xcb:ConfigWindow:X
|
|
|
|
|
xcb:ConfigWindow:Width
|
|
|
|
|
xcb:ConfigWindow:Height))
|
|
|
|
|
(- x win-x)
|
|
|
|
|
0
|
|
|
|
|
(- (+ root-x width) x)
|
|
|
|
|
(- y (- root-y height))))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
((= type xcb:ewmh:_NET_WM_MOVERESIZE_SIZE_LEFT)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq cursor exwm-floating--cursor-left
|
|
|
|
|
exwm-floating--moveresize-calculate
|
2019-03-24 01:00:00 +01:00
|
|
|
|
(lambda (x _y)
|
|
|
|
|
(vector buffer-or-id
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(logior xcb:ConfigWindow:X
|
|
|
|
|
xcb:ConfigWindow:Width))
|
|
|
|
|
(- x win-x) 0 (- (+ root-x width) x) 0)))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; Select events and change cursor (should always succeed)
|
|
|
|
|
(xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:GrabPointer
|
2016-03-04 12:11:10 +01:00
|
|
|
|
:owner-events 0 :grab-window container-or-id
|
2015-09-27 13:31:00 +02:00
|
|
|
|
:event-mask (eval-when-compile
|
|
|
|
|
(logior xcb:EventMask:ButtonRelease
|
|
|
|
|
xcb:EventMask:ButtonMotion))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
:pointer-mode xcb:GrabMode:Async
|
|
|
|
|
:keyboard-mode xcb:GrabMode:Async
|
|
|
|
|
:confine-to xcb:Window:None
|
|
|
|
|
:cursor cursor
|
2015-07-18 04:23:24 +02:00
|
|
|
|
:time xcb:Time:CurrentTime)))))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
(defun exwm-floating--stop-moveresize (&rest _args)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
"Stop move/resize."
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:UngrabPointer :time xcb:Time:CurrentTime))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(when exwm-floating--moveresize-calculate
|
2019-09-14 02:00:00 +02:00
|
|
|
|
(let (result buffer-or-id outer-id container-id)
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(setq result (funcall exwm-floating--moveresize-calculate 0 0)
|
|
|
|
|
buffer-or-id (aref result 0))
|
|
|
|
|
(when (bufferp buffer-or-id)
|
|
|
|
|
(with-current-buffer buffer-or-id
|
2019-09-14 02:00:00 +02:00
|
|
|
|
(setq outer-id (frame-parameter exwm--floating-frame 'exwm-outer-id)
|
|
|
|
|
container-id (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container))
|
|
|
|
|
(with-slots (x y width height border-width)
|
|
|
|
|
(xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:GetGeometry
|
|
|
|
|
:drawable container-id))
|
|
|
|
|
;; Notify Emacs frame about this the position change.
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:SendEvent
|
|
|
|
|
:propagate 0
|
|
|
|
|
:destination outer-id
|
|
|
|
|
:event-mask xcb:EventMask:StructureNotify
|
|
|
|
|
:event
|
|
|
|
|
(xcb:marshal
|
|
|
|
|
(make-instance 'xcb:ConfigureNotify
|
|
|
|
|
:event outer-id
|
|
|
|
|
:window outer-id
|
|
|
|
|
:above-sibling xcb:Window:None
|
|
|
|
|
:x (+ x border-width)
|
|
|
|
|
:y (+ y border-width)
|
|
|
|
|
:width width
|
|
|
|
|
:height height
|
|
|
|
|
:border-width 0
|
|
|
|
|
:override-redirect 0)
|
|
|
|
|
exwm--connection)))
|
|
|
|
|
(xcb:flush exwm--connection))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(exwm-layout--show exwm--id
|
|
|
|
|
(frame-root-window exwm--floating-frame)))))
|
|
|
|
|
(setq exwm-floating--moveresize-calculate nil)))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
2015-09-04 03:09:59 +02:00
|
|
|
|
(defun exwm-floating--do-moveresize (data _synthetic)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
"Perform move/resize."
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(when exwm-floating--moveresize-calculate
|
2016-08-09 07:26:15 +02:00
|
|
|
|
(let* ((obj (make-instance 'xcb:MotionNotify))
|
2019-09-14 02:00:00 +02:00
|
|
|
|
result value-mask x y width height buffer-or-id container-or-id)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:unmarshal obj data)
|
2015-07-18 04:23:24 +02:00
|
|
|
|
(setq result (funcall exwm-floating--moveresize-calculate
|
2016-02-20 14:52:07 +01:00
|
|
|
|
(slot-value obj 'root-x) (slot-value obj 'root-y))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
buffer-or-id (aref result 0)
|
|
|
|
|
value-mask (aref result 1)
|
|
|
|
|
x (aref result 2)
|
|
|
|
|
y (aref result 3)
|
2018-02-04 15:38:02 +01:00
|
|
|
|
width (max 1 (aref result 4))
|
|
|
|
|
height (max 1 (aref result 5)))
|
2019-09-08 02:00:00 +02:00
|
|
|
|
(if (not (bufferp buffer-or-id))
|
|
|
|
|
;; Unmanaged.
|
|
|
|
|
(setq container-or-id buffer-or-id)
|
|
|
|
|
;; Managed.
|
|
|
|
|
(setq container-or-id
|
|
|
|
|
(with-current-buffer buffer-or-id
|
|
|
|
|
(frame-parameter exwm--floating-frame 'exwm-container))
|
2019-09-14 02:00:00 +02:00
|
|
|
|
x (- x exwm-floating-border-width)
|
2019-09-08 02:00:00 +02:00
|
|
|
|
;; Use `frame-outer-height' in the future.
|
2019-09-14 02:00:00 +02:00
|
|
|
|
y (- y exwm-floating-border-width
|
|
|
|
|
exwm-workspace--window-y-offset)
|
|
|
|
|
height (+ height exwm-workspace--window-y-offset)))
|
2016-03-04 12:11:10 +01:00
|
|
|
|
(xcb:+request exwm--connection
|
2016-03-06 06:45:13 +01:00
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window container-or-id
|
|
|
|
|
:value-mask (aref result 1)
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:x x
|
|
|
|
|
:y y
|
2016-03-06 06:45:13 +01:00
|
|
|
|
:width width
|
|
|
|
|
:height height))
|
2016-03-04 12:11:10 +01:00
|
|
|
|
(when (bufferp buffer-or-id)
|
2016-03-06 06:45:13 +01:00
|
|
|
|
;; Managed.
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(setq value-mask (logand value-mask (logior xcb:ConfigWindow:Width
|
|
|
|
|
xcb:ConfigWindow:Height)))
|
|
|
|
|
(when (/= 0 value-mask)
|
|
|
|
|
(with-current-buffer buffer-or-id
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:ConfigureWindow
|
|
|
|
|
:window (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-outer-id)
|
|
|
|
|
:value-mask value-mask
|
|
|
|
|
:width width
|
|
|
|
|
:height height)))))
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(xcb:flush exwm--connection))))
|
|
|
|
|
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(defun exwm-floating-move (&optional delta-x delta-y)
|
|
|
|
|
"Move a floating window right by DELTA-X pixels and down by DELTA-Y pixels.
|
|
|
|
|
|
|
|
|
|
Both DELTA-X and DELTA-Y default to 1. This command should be bound locally."
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log "delta-x: %s, delta-y: %s" delta-x delta-y)
|
2018-07-14 18:00:00 +02:00
|
|
|
|
(unless (and (derived-mode-p 'exwm-mode) exwm--floating-frame)
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(user-error "[EXWM] `exwm-floating-move' is only for floating X windows"))
|
|
|
|
|
(unless delta-x (setq delta-x 1))
|
|
|
|
|
(unless delta-y (setq delta-y 1))
|
|
|
|
|
(unless (and (= 0 delta-x) (= 0 delta-y))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(let* ((floating-container (frame-parameter exwm--floating-frame
|
|
|
|
|
'exwm-container))
|
|
|
|
|
(geometry (xcb:+request-unchecked+reply exwm--connection
|
2016-02-03 05:12:24 +01:00
|
|
|
|
(make-instance 'xcb:GetGeometry
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
:drawable floating-container)))
|
2015-09-18 08:17:52 +02:00
|
|
|
|
(edges (window-inside-absolute-pixel-edges)))
|
Make X windows container-less
; This is an attempt to make (managed) X windows container-less, i.e. direct children of the root window. This is mainly to make EXWM compatible with third-party compositors. Other issues like wrong absolute position should also get resolved by the way. The workspace containers ("virtual roots") are also removed. However Emacs frames are still wrapped in containers to avoid unexpected stack reordering.
* exwm-cm.el: Make this module obsolete as EXWM supports third-party compositors now.
* exwm-core.el (exwm--container):
* exwm-floating.el (exwm-floating--set-floating)
(exwm-floating--unset-floating, exwm-floating-hide)
(exwm-floating--start-moveresize, exwm-floating--stop-moveresize)
(exwm-floating--do-moveresize, exwm-floating-move):
* exwm-input.el (exwm-input--update-focus):
* exwm-layout.el (exwm-layout--show, exwm-layout--hide)
(exwm-layout-set-fullscreen, exwm-layout-unset-fullscreen):
* exwm-manage.el (exwm-manage--manage-window, exwm-manage--unmanage-window)
(exwm-manage--kill-buffer-query-function, exwm-manage--kill-client):
* exwm-workspace.el (exwm-workspace--set-fullscreen, exwm-workspace-switch)
(exwm-workspace-move-window, exwm-workspace--add-frame-as-workspace)
(exwm-workspace--remove-frame-as-workspace): Make adaptions for container-less X windows.
* exwm-workspace.el (exwm-workspace--update-ewmh-props):
* exwm.el (exwm--init-icccm-ewmh, exwm--exit-icccm-ewmh): No longer use virtual roots.
* exwm-input.el (exwm-input--on-workspace-list-change)
(exwm-input--update-global-prefix-keys, exwm-input--init, exwm-input--exit): From now on global key bindings are grabbed on the root window so it's no long required to re-grab them each time the workspace list changes. As a result `exwm-input--on-workspace-list-change' and its corresponding references are discarded. It remains to be seen if this change will raise input focus issues.
* exwm-manage.el (exwm-manage--manage-window): Explicitly set the workspace for newly managed X windows.
* exwm-floating.el (exwm-floating--set-floating): Avoid implicit reference to the current workspace.
* exwm-core.el (exwm--set-geometry): New function for setting the geometry of an X window.
* exwm-layout.el (exwm-layout--resize-container): Replaced by `exwm-layout--resize-container'.
* exwm-core.el (exwm--guide-window): New global variable recording the guide X window.
* exwm.el (exwm--init-icccm-ewmh): Set it.
* exwm-input.el (exwm-input--post-init): New function containing staffs for initialization but should better get called after the event loop starts.
* exwm.el (exwm-init): Use it.
2018-02-17 18:04:04 +01:00
|
|
|
|
(with-slots (x y) geometry
|
|
|
|
|
(exwm--set-geometry floating-container
|
|
|
|
|
(+ x delta-x) (+ y delta-y) nil nil))
|
|
|
|
|
(exwm--set-geometry exwm--id
|
|
|
|
|
(+ (pop edges) delta-x)
|
|
|
|
|
(+ (pop edges) delta-y)
|
|
|
|
|
nil nil))
|
2015-09-11 11:13:43 +02:00
|
|
|
|
(xcb:flush exwm--connection)))
|
|
|
|
|
|
2019-09-13 02:00:00 +02:00
|
|
|
|
(defun exwm-floating--init-border ()
|
|
|
|
|
"Initialize border colormap and pixel."
|
|
|
|
|
(exwm--log)
|
|
|
|
|
;; Use the default colormap.
|
|
|
|
|
(unless exwm-floating--border-colormap
|
|
|
|
|
(with-slots (roots) (xcb:get-setup exwm--connection)
|
|
|
|
|
(with-slots (default-colormap) (car roots)
|
|
|
|
|
(setq exwm-floating--border-colormap default-colormap))))
|
|
|
|
|
;; Free any previously allocated pixel.
|
|
|
|
|
(when exwm-floating--border-pixel
|
|
|
|
|
(xcb:+request exwm--connection
|
|
|
|
|
(make-instance 'xcb:FreeColors
|
|
|
|
|
:cmap exwm-floating--border-colormap
|
|
|
|
|
:plane-mask 0
|
|
|
|
|
:pixels (vector exwm-floating--border-pixel)))
|
|
|
|
|
(setq exwm-floating--border-pixel nil))
|
|
|
|
|
;; Allocate new pixel.
|
|
|
|
|
(let ((color (x-color-values (or exwm-floating-border-color "")))
|
|
|
|
|
reply)
|
|
|
|
|
(when color
|
|
|
|
|
(setq reply (xcb:+request-unchecked+reply exwm--connection
|
|
|
|
|
(make-instance 'xcb:AllocColor
|
|
|
|
|
:cmap exwm-floating--border-colormap
|
|
|
|
|
:red (pop color)
|
|
|
|
|
:green (pop color)
|
|
|
|
|
:blue (pop color))))
|
|
|
|
|
(when reply
|
|
|
|
|
(setq exwm-floating--border-pixel (slot-value reply 'pixel))))))
|
|
|
|
|
|
2015-07-17 13:16:08 +02:00
|
|
|
|
(defun exwm-floating--init ()
|
|
|
|
|
"Initialize floating module."
|
2018-12-02 01:00:00 +01:00
|
|
|
|
(exwm--log)
|
2019-09-13 02:00:00 +02:00
|
|
|
|
(exwm-floating--init-border)
|
2015-07-17 13:16:08 +02:00
|
|
|
|
;; Initialize cursors for moving/resizing a window
|
|
|
|
|
(xcb:cursor:init exwm--connection)
|
|
|
|
|
(setq exwm-floating--cursor-move
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "fleur")
|
|
|
|
|
exwm-floating--cursor-top-left
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "top_left_corner")
|
|
|
|
|
exwm-floating--cursor-top
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "top_side")
|
|
|
|
|
exwm-floating--cursor-top-right
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "top_right_corner")
|
|
|
|
|
exwm-floating--cursor-right
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "right_side")
|
|
|
|
|
exwm-floating--cursor-bottom-right
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "bottom_right_corner")
|
|
|
|
|
exwm-floating--cursor-bottom
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "bottom_side")
|
|
|
|
|
exwm-floating--cursor-bottom-left
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "bottom_left_corner")
|
|
|
|
|
exwm-floating--cursor-left
|
|
|
|
|
(xcb:cursor:load-cursor exwm--connection "left_side")))
|
|
|
|
|
|
2016-05-23 13:13:42 +02:00
|
|
|
|
(defun exwm-floating--exit ()
|
2018-12-02 01:00:00 +01:00
|
|
|
|
"Exit the floating module."
|
|
|
|
|
(exwm--log))
|
2016-05-23 13:13:42 +02:00
|
|
|
|
|
2015-07-17 13:16:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(provide 'exwm-floating)
|
|
|
|
|
|
|
|
|
|
;;; exwm-floating.el ends here
|