[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/exwm eafd031 56/64: Allow hide/show mode-line on floati
From: |
Chris Feng |
Subject: |
[elpa] externals/exwm eafd031 56/64: Allow hide/show mode-line on floating frames |
Date: |
Thu, 17 Sep 2015 23:18:11 +0000 |
branch: externals/exwm
commit eafd031c556ecfe986c656ca72fcde7e06ac819a
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>
Allow hide/show mode-line on floating frames
* exwm-core.el: new buffer-local variable exwm--floating-mode-line-format
for
saving mode-line-format when mode-line is hidden
* exwm-floating.el (exwm-floating--fit-frame-to-window)
(exwm-floating-hide-mode-line, exwm-floating-show-mode-line): new
functions
for resizing frames, hiding/showing mode-line respectively;
(exwm-floating--set-floating): use exwm-floating--fit-frame-to-window to
resize frames
---
exwm-core.el | 15 ++++++-----
exwm-floating.el | 65 ++++++++++++++++++++++++++++++++++++++++++++---------
2 files changed, 62 insertions(+), 18 deletions(-)
diff --git a/exwm-core.el b/exwm-core.el
index 9810de4..74eb94f 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -78,13 +78,14 @@
"Event mask set on all managed windows.")
;; Internal variables
-(defvar-local exwm--id nil) ;window ID
-(defvar-local exwm--frame nil) ;workspace frame
-(defvar-local exwm--floating-frame nil) ;floating frame
-(defvar-local exwm--floating-edges nil) ;four edges
-(defvar-local exwm--fullscreen nil) ;used in fullscreen
-(defvar-local exwm--floating-frame-geometry nil) ;in fullscreen
-(defvar-local exwm--fixed-size nil) ;fixed size
+(defvar-local exwm--id nil) ;window ID
+(defvar-local exwm--frame nil) ;workspace frame
+(defvar-local exwm--floating-frame nil) ;floating frame
+(defvar-local exwm--floating-edges nil) ;four edges
+(defvar-local exwm--floating-mode-line-format nil) ;save mode-line-format
+(defvar-local exwm--fullscreen nil) ;used in fullscreen
+(defvar-local exwm--floating-frame-geometry nil) ;in fullscreen
+(defvar-local exwm--fixed-size nil) ;fixed size
(defvar-local exwm--on-KeyPress ;KeyPress event handler
#'exwm-input--on-KeyPress-line-mode)
;; Properties
diff --git a/exwm-floating.el b/exwm-floating.el
index 6bb635a..4ea495d 100644
--- a/exwm-floating.el
+++ b/exwm-floating.el
@@ -166,17 +166,7 @@
(+ width exwm-floating-border-width)
(+ height exwm-floating-border-width))))
;; Fit frame to client
- (xcb:+request exwm--connection
- (make-instance 'xcb:ConfigureWindow
- :window outer-id
- :value-mask (logior xcb:ConfigWindow:Width
- xcb:ConfigWindow:Height
- xcb:ConfigWindow:StackMode)
- :width (+ width (* 2 exwm-floating-border-width))
- :height (+ height (* 2 exwm-floating-border-width)
- (window-mode-line-height)
- (window-header-line-height))
- :stack-mode xcb:StackMode:Above)) ;top-most
+ (exwm-floating--fit-frame-to-window outer-id width height)
;; Reparent window to this frame
(xcb:+request exwm--connection
(make-instance 'xcb:ChangeWindowAttributes
@@ -246,6 +236,59 @@
(exwm-floating--unset-floating exwm--id)
(exwm-floating--set-floating exwm--id))))
+(defun exwm-floating--fit-frame-to-window (&optional frame-outer-id
+ width height)
+ "Resize a floating frame to make it fit the size of the window.
+
+Default to resize `exwm--floating-frame' unless FRAME-OUTER-ID is non-nil.
+This function will issue an `xcb:GetGeometry' request unless WIDTH and HEIGHT
+are provided. You should call `xcb:flush' and assign `window-size-fixed' a
+non-nil value afterwards."
+ (setq window-size-fixed nil)
+ (unless (and width height)
+ (let ((geometry (xcb:+request-unchecked+reply exwm--connection
+ (make-instance 'xcb:GetGeometry :drawable exwm--id))))
+ (setq width (slot-value geometry 'width)
+ height (slot-value geometry 'height))))
+ (xcb:+request exwm--connection
+ (make-instance 'xcb:ConfigureWindow
+ :window (or frame-outer-id
+ (frame-parameter exwm--floating-frame
+ 'exwm-outer-id))
+ :value-mask (logior xcb:ConfigWindow:Width
+ xcb:ConfigWindow:Height
+ xcb:ConfigWindow:StackMode)
+ :width (+ width (* 2 exwm-floating-border-width))
+ :height (+ height (* 2 exwm-floating-border-width)
+ (window-mode-line-height)
+ (window-header-line-height))
+ :stack-mode xcb:StackMode:Above))) ;top-most
+
+(defun exwm-floating-hide-mode-line ()
+ "Hide mode-line of a floating frame."
+ (interactive)
+ (unless (eq major-mode 'exwm-mode)
+ (user-error "[EXWM] Please use this command with EXWM buffers"))
+ (when (and exwm--floating-frame mode-line-format)
+ (setq exwm--floating-mode-line-format mode-line-format
+ mode-line-format nil)
+ (exwm-floating--fit-frame-to-window)
+ (xcb:flush exwm--connection)
+ (setq window-size-fixed t)))
+
+(defun exwm-floating-show-mode-line ()
+ "Show mode-line of a floating frame."
+ (interactive)
+ (unless (eq major-mode 'exwm-mode)
+ (user-error "[EXWM] Please use this command with EXWM buffers"))
+ (when (and exwm--floating-frame (not mode-line-format))
+ (setq mode-line-format exwm--floating-mode-line-format
+ exwm--floating-mode-line-format nil)
+ (exwm-floating--fit-frame-to-window)
+ (exwm-input-grab-keyboard) ;mode-line-format may be outdated
+ (xcb:flush exwm--connection)
+ (setq window-size-fixed t)))
+
(defvar exwm-floating--moveresize-calculate nil
"Calculate move/resize parameters [frame-id event-mask x y width height].")
- [elpa] externals/exwm 7032ee7 48/64: Re-enable complete refresh of keyboard mapping, (continued)
- [elpa] externals/exwm 7032ee7 48/64: Re-enable complete refresh of keyboard mapping, Chris Feng, 2015/09/17
- [elpa] externals/exwm 981293f 44/64: Replay KeyPress events instead of fake them in line-mode, Chris Feng, 2015/09/17
- [elpa] externals/exwm f7bec7a 51/64: Minor fix, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5222dc1 49/64: Avoid deleting the frame created by Emacs client by accident, Chris Feng, 2015/09/17
- [elpa] externals/exwm f1d37b9 53/64: Ungrab pointer timely when resizing is aborted, Chris Feng, 2015/09/17
- [elpa] externals/exwm 76f4849 50/64: Drop intro to xelb-util, Chris Feng, 2015/09/17
- [elpa] externals/exwm 9eee94e 52/64: Merge pull request #52 from pipcet/minor-fix, Chris Feng, 2015/09/17
- [elpa] externals/exwm 637ac15 55/64: Code cleanups, Chris Feng, 2015/09/17
- [elpa] externals/exwm b50a6e6 45/64: Correct several EWMH properties, Chris Feng, 2015/09/17
- [elpa] externals/exwm 5373c1d 57/64: Add support for xcb:Atom:_NET_CLIENT_LIST_STACKING etc, Chris Feng, 2015/09/17
- [elpa] externals/exwm eafd031 56/64: Allow hide/show mode-line on floating frames,
Chris Feng <=
- [elpa] externals/exwm 1d43515 59/64: Allow switch to normal buffers in exwm-workspace-switch-to-window, Chris Feng, 2015/09/17
- [elpa] externals/exwm 3f2f844 58/64: Add a command to interactively move X window to the current workspace, Chris Feng, 2015/09/17
- [elpa] externals/exwm cfbd9a5 61/64: Minor fix for window move, Chris Feng, 2015/09/17
- [elpa] externals/exwm 576a676 62/64: Fix with-slots, Chris Feng, 2015/09/17
- [elpa] externals/exwm dbcabe7 60/64: Implement move/resize with keyboard, Chris Feng, 2015/09/17
- [elpa] externals/exwm 10a7fe8 01/64: First commit, Chris Feng, 2015/09/17
- [elpa] externals/exwm 4255f07 64/64: On-demand update exwm-workspace--switch-history, Chris Feng, 2015/09/17
- [elpa] externals/exwm 6d63c71 54/64: Prepare for GNU ELPA release, Chris Feng, 2015/09/17
- [elpa] externals/exwm b458d5a 63/64: Allow showing buffers on other workspaces and moving an X window by switching, Chris Feng, 2015/09/17