mouse not dragging a float window.

58 views
Skip to first unread message

Colin Baxter

unread,
Aug 29, 2022, 11:46:21 AM8/29/22
to stumpw...@nongnu.org

I have pulled today's stumpwm git and built stumpwm using sbcl-2.2.7. It
appears to work except the mouse will now not drag a floating window. I
have tried click and sloppy focus policies without effect. I have looked
through the recent commits but don't see anything relevant. I would
appreciate some suggestions on how to resolve this.

Best wishes,

Colin Baxter.


Eric S Fraga

unread,
Aug 30, 2022, 4:55:24 AM8/30/22
to stumpw...@nongnu.org
Hi Colin,
Just to add a +1. I noticed this a few weeks ago but thought it was
something I did. I don't use floating groups much so didn't raise the
issue earlier.

Looking at the code for floating groups (which does not appear to have
changed since June), it seems that one should use "super" plus the mouse
to move windows. My keyboard doesn't have a super key (none of the
windows keys) so I thought I would change the behaviour to using the Alt
key by

(setf *float-window-modifier* :alt)

but to no avail.

--
Eric S Fraga via gnus (Emacs 29.0.50 2022-08-16) on Debian 11.4


Colin Baxter

unread,
Aug 30, 2022, 9:56:20 AM8/30/22
to Eric S Fraga, stumpw...@nongnu.org
Dear Eric,

Thanks very much for your reply.

>>>>> Eric S Fraga <e.f...@ucl.ac.uk> writes:

> Hi Colin,
> On Monday, 29 Aug 2022 at 16:34, Colin Baxter wrote:
>> I have pulled today's stumpwm git and built stumpwm using
>> sbcl-2.2.7. It appears to work except the mouse will now not drag
>> a floating window. I have tried click and sloppy focus policies
>> without effect. I have looked through the recent commits but
>> don't see anything relevant. I would appreciate some suggestions
>> on how to resolve this.

> Just to add a +1. I noticed this a few weeks ago but thought it
> was something I did. I don't use floating groups much so didn't
> raise the issue earlier.

> Looking at the code for floating groups (which does not appear to
> have changed since June), it seems that one should use "super"
> plus the mouse to move windows. My keyboard doesn't have a super
> key (none of the windows keys) so I thought I would change the
> behaviour to using the Alt key by

I have the super key and yes I can re-size a window using the mouse
while depressing super, as in previous versions of stumpwm, but it will
not allowing dragging, i.e. moving the whole window. I have also tried
other combinations of keys with the mouse, but all to no avail. Using my
old stumpwm binary (which fortunately I haven't deleted) I can drag
windows with just the mouse and no keys. So I'm guessing that something
has changed, but like you, there seemed to be nothing immediately
obvious in the recent commits.

> (setf *float-window-modifier* :alt)

This now seems to be rejected no matter what follows the colon.

Best wishes,

Colin.

Michael Raskin

unread,
Aug 30, 2022, 4:32:21 PM8/30/22
to m43...@yandex.com, e.f...@ucl.ac.uk, stumpw...@nongnu.org
> > (setf *float-window-modifier* :alt)
>
>This now seems to be rejected no matter what follows the colon.

Source code looks like Alt could be :alt :meta :altgr (and it's of course black magic which one)



Colin Baxter

unread,
Aug 31, 2022, 2:57:30 AM8/31/22
to Michael Raskin, e.f...@ucl.ac.uk, stumpw...@nongnu.org
Indeed!

Best wishes,

Eric S Fraga

unread,
Aug 31, 2022, 11:19:12 AM8/31/22
to stumpw...@nongnu.org
Hi all,

So, I gave up trying to figure out the reason for :alt etc. not working
and simply implemented a move keymap for floating groups, akin to what
ratpoison has (IIRC). Works for me and means I don't have to use the
mouse which is a real bonus!

I'll need to do a resize as well in due course but it was moving that
was frustrating me (as all windows sat on top of each other) and I have
a very large monitor...

Thank you,
eric

David

unread,
Aug 31, 2022, 11:40:36 AM8/31/22
to Eric S Fraga, stumpw...@nongnu.org
Is it worth a PR on the main repo? I’d welcome merging it if so.

David

> On Aug 31, 2022, at 11:19 AM, Eric S Fraga <e.f...@ucl.ac.uk> wrote:
>
> Hi all,

Eric S Fraga

unread,
Aug 31, 2022, 12:01:28 PM8/31/22
to stumpw...@nongnu.org
On Wednesday, 31 Aug 2022 at 11:39, David wrote:
> Is it worth a PR on the main repo? I’d welcome merging it if so.

I don't know but I'm happy to share the code and let others decide
and/or incorporate it as I'm sure it could be improved and brought in
line with the main StumpWM code. I'm still very much a n00b when it
comes to the variant of Lisp for StumpWM (having only Emacs Lisp
experience these days although I did learn Lisp in the 70s... ;-)).

Anyway, the code:

--8<---------------cut here---------------start------------->8---
;; function to move windows around using the keyboard as the above did
;; not (does not?) work. The esf-move-window function moves the
;; current window by the number of pixels given, for both x and y
;; directions. The function is invoked by the keystrokes in the
;; interactive keymap, esf-move, which is called up by invoking it as
;; a command. Finally, I map C-t M to esf-move. The function &
;; keymap could be improved by giving some visual feedback to indicate
;; that we are still in a move operation but I don't know how to do
;; that (yet).

(defcommand (esf-move-window float-group) (dx dy)
((:number "dX = ") (:number "dY = "))
(let* ((window (current-window))
(parent (window-parent window))
;; (width (xlib:drawable-width parent))
;; (height (xlib:drawable-height parent))
(x (xlib:drawable-x parent))
(y (xlib:drawable-y parent)))
(float-window-move-resize window :x (+ x dx) :y (+ y dy))))
;; the interactive keymap allows specifying setup, exit, and abort
;; functions. I don't have anything to do at the moment in those
;; cases and maybe do not have to specify any but I specify one just
;; in case and to remember how to specify these
(defun esf-move-setup ())
;; the actual interactive keymap for moving the window. Default is 10
;; pixels in either direction or 100 with Shift on the same keys. I
;; use arrow and vi movement keys.
(define-interactive-keymap (esf-move float-group)
(:on-enter #'esf-move-setup)
((kbd "Up") "esf-move-window 0 -10")
((kbd "S-Up") "esf-move-window 0 -100")
((kbd "k") "esf-move-window 0 -10")
((kbd "K") "esf-move-window 0 -100")
((kbd "Down") "esf-move-window 0 10")
((kbd "S-Down") "esf-move-window 0 100")
((kbd "j") "esf-move-window 0 10")
((kbd "J") "esf-move-window 0 100")
((kbd "Left") "esf-move-window -10 0")
((kbd "S-Left") "esf-move-window -100 0")
((kbd "h") "esf-move-window -10 0")
((kbd "H") "esf-move-window -100 0")
((kbd "Right") "esf-move-window 10 0")
((kbd "S-Right") "esf-move-window 100 0")
((kbd "l") "esf-move-window 10 0")
((kbd "L") "esf-move-window 100 0"))

;; bind the interactive keymap to a key in the float group
(define-key stumpwm::*float-group-root-map* (kbd "M") "esf-move")
--8<---------------cut here---------------end--------------->8---

Eric S Fraga

unread,
Sep 1, 2022, 10:26:59 AM9/1/22
to stumpw...@nongnu.org
Hello all,

Just in case anybody is interested, for completeness, below is the
equivalent code for resizing floating windows using the keyboard. I now
no longer care about mouse support whether with :super or whatever! ;-)

eric

--8<---------------cut here---------------start------------->8---
;; function to resize windows around using the keyboard, similar to
;; the moving of windows defined just above. The esf-resize-window
;; function adjusts the width and height of the current window by the
;; number of pixels given. The function is invoked by the keystrokes
;; in the interactive keymap, esf-resize, which is called up by
;; invoking it as a command. Finally, I map C-t R to esf-resize. The
;; function & keymap could be improved by giving some visual feedback
;; to indicate that we are still in a move operation but I don't know
;; how to do that (yet).

(defcommand (esf-resize-window float-group) (dw dh)
((:number "dW = ") (:number "dH = "))
(let* ((window (current-window))
(parent (window-parent window))
(w (xlib:drawable-width parent))
(h (xlib:drawable-height parent)))
(float-window-move-resize window
:width (+ w dw)
:height (- (+ h dh) ;desired height
;; but correct height to
;; ignore title bar height
*float-window-title-height*))))

(defun esf-resize-setup ())
;; the actual interactive keymap for resizing the window. )Default is
;; 10 pixels in either direction or 100 with Shift on the same keys.
;; I use arrow and vi resizement keys.
(define-interactive-keymap (esf-resize float-group)
(:on-enter #'esf-resize-setup)
((kbd "Up") "esf-resize-window 0 -10")
((kbd "S-Up") "esf-resize-window 0 -100")
((kbd "k") "esf-resize-window 0 -10")
((kbd "K") "esf-resize-window 0 -100")
((kbd "Down") "esf-resize-window 0 10")
((kbd "S-Down") "esf-resize-window 0 100")
((kbd "j") "esf-resize-window 0 10")
((kbd "J") "esf-resize-window 0 100")
((kbd "Left") "esf-resize-window -10 0")
((kbd "S-Left") "esf-resize-window -100 0")
((kbd "h") "esf-resize-window -10 0")
((kbd "H") "esf-resize-window -100 0")
((kbd "Right") "esf-resize-window 10 0")
((kbd "S-Right") "esf-resize-window 100 0")
((kbd "l") "esf-resize-window 10 0")
((kbd "L") "esf-resize-window 100 0"))

;; bind the interactive keymap to a key in the float group
(define-key stumpwm::*float-group-root-map* (kbd "R") "esf-resize")
--8<---------------cut here---------------end--------------->8---

Eric S Fraga

unread,
Sep 1, 2022, 10:56:47 AM9/1/22
to stumpw...@nongnu.org
with a minor refactoring of the actual resize function:

--8<---------------cut here---------------start------------->8---
(defcommand (esf-resize-window float-group) (dw dh)
((:number "dW = ") (:number "dH = "))
(let* ((window (current-window))
(parent (window-parent window))
(w (xlib:drawable-width parent))
;; get actual height: ignore title bar
(h (- (xlib:drawable-height parent) *float-window-title-height*)))
(float-window-move-resize window
:width (+ w dw)
:height (+ h dh))))

Colin Baxter

unread,
Sep 12, 2022, 2:09:49 AM9/12/22
to Michael Raskin, e.f...@ucl.ac.uk, stumpw...@nongnu.org

A re-compile and re-install of stumpwm was enough to remove my
problem. I suppose the initial installation was corrupted in some way.

Thanks for all the replies.

Best wishes,

Colin.

Reply all
Reply to author
Forward
0 new messages