summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid <171410+dmb2@users.noreply.github.com>2024-07-25 20:16:04 -0400
committerGitHub <noreply@github.com>2024-07-25 20:16:04 -0400
commitbfa43b7ec9658d3bf13304f0c04df88ce356acac (patch)
tree58c894484bc311a38ee14d9eb8810f9d1765d814
parent11be454df8f01f2ed7aa20cffe23f16f1d7b7bd6 (diff)
parent623472e4e155aca67ad8c73f9e37b6c1453e2397 (diff)
Merge pull request #1195 from MIvanchev/message-window-margin
Adding support for message window margins.
-rw-r--r--message-window.lisp12
-rw-r--r--primitives.lisp12
-rw-r--r--stumpwm.texi.in2
3 files changed, 23 insertions, 3 deletions
diff --git a/message-window.lisp b/message-window.lisp
index 2a46dc5..2bc1b37 100644
--- a/message-window.lisp
+++ b/message-window.lisp
@@ -82,10 +82,16 @@ function expects to be wrapped in a with-state for win."
(* (xlib:drawable-border-width win) 2)))
(head-x (head-x (current-head)))
(head-y (head-y (current-head)))
- (head-maxx (+ head-x (head-width (current-head))))
- (head-maxy (+ head-y (head-height (current-head)))))
+ (head-width (head-width (current-head)))
+ (head-height (head-height (current-head)))
+ (margin-x (if (> (* *message-window-margin* 2) head-width) 0 *message-window-margin*))
+ (margin-y (if (> (* *message-window-y-margin* 2) head-height) 0 *message-window-y-margin*))
+ (minx (+ head-x margin-x))
+ (miny (+ head-y margin-y))
+ (maxx (- (+ head-x head-width) margin-x))
+ (maxy (- (+ head-y head-height) margin-y)))
(multiple-value-bind (x y)
- (gravity-coords gravity w h head-x head-y head-maxx head-maxy)
+ (gravity-coords gravity w h minx miny maxx maxy)
(setf (xlib:drawable-y win) (max head-y y)
(xlib:drawable-x win) (max head-x x))))))
diff --git a/primitives.lisp b/primitives.lisp
index ce1012a..135e6a7 100644
--- a/primitives.lisp
+++ b/primitives.lisp
@@ -75,6 +75,8 @@
*window-parent-events*
*message-window-padding*
*message-window-y-padding*
+ *message-window-margin*
+ *message-window-y-margin*
*message-window-gravity*
*message-window-real-gravity*
*message-window-input-gravity*
@@ -470,6 +472,16 @@ Include only those we are ready to support.")
(defvar *message-window-y-padding* 0
"The number of pixels that pad the text in the message window vertically.")
+(defvar *message-window-margin* 0
+ "The number of pixels (i.e. the gap) between the message window and the
+ horizontal edges of the head. The margin is disregarded if it takes more
+ space than is available.")
+
+(defvar *message-window-y-margin* 0
+ "The number of pixels (i.e. the gap) between the message window and the
+ vertical edges of the head. The margin is disregarded if it takes more
+ space than is available.")
+
(defvar *message-window-gravity* :top-right
"This variable controls where the message window appears. The following
are valid values.
diff --git a/stumpwm.texi.in b/stumpwm.texi.in
index 91bea6f..2b75202 100644
--- a/stumpwm.texi.in
+++ b/stumpwm.texi.in
@@ -1655,6 +1655,8 @@ set these color variables.
### *message-window-padding*
### *message-window-y-padding*
+### *message-window-margin*
+### *message-window-y-margin*
### *message-window-gravity*
### *message-window-input-gravity*
### *message-window-timer*