Skip to content

Commit

Permalink
Give fixed windows a property so that tinywm doesn't drag them but wi…
Browse files Browse the repository at this point in the history
…ll drag other non-reparented windows; don't focus windows with tinywm; that's not tiny enough
  • Loading branch information
mwitmer committed Feb 3, 2014
1 parent 308f40b commit 4f9d22a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 12 additions & 0 deletions module/guile-wm/draw.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#:use-module (xcb xml)
#:use-module (guile-wm color)
#:use-module (guile-wm focus)
#:use-module (guile-wm icccm)
#:use-module (guile-wm shared)
#:export (with-gc with-font with-pixmap basic-window-create
fixed-window-create))
Expand Down Expand Up @@ -64,6 +65,9 @@ consists of key-press, structure-notify, and exposure."
#:bit-gravity 'north-west #:event-mask events #:override-redirect #t)
window)

(define (fixed-window-atom)
(xref (reply-for intern-atom #f "_GUILE_WM_FIXED") 'atom))

(define* (fixed-window-create x y width height border
#:optional (events basic-events)
#:key (focused? #t))
Expand All @@ -85,4 +89,12 @@ the window will also keep the focus."
((visibility-notify-event visibility #:window window)
(when (not (eq? (xref visibility 'state) 'unobscured))
(configure-window (xref visibility 'window) #:stack-mode 'above))))
(let ((fixed-atom (fixed-window-atom)))
(change-property 'replace window fixed-atom
(pre-defined-atom 'integer) 8 #(1 0 0 0)))
window)

(define-public (fixed-window? window)
(xid=
(xref (get-window-property window (fixed-window-atom)) 'type)
(pre-defined-atom 'integer)))
7 changes: 3 additions & 4 deletions module/guile-wm/module/tinywm.scm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#:use-module (guile-wm shared)
#:use-module (guile-wm log)
#:use-module (guile-wm focus)
#:use-module (guile-wm draw)
#:use-module (guile-wm module randr)
#:use-module (xcb xml xproto)
#:use-module (xcb event-loop)
Expand Down Expand Up @@ -75,10 +76,8 @@
(win (xref button-press 'child))

;; Don't try to move/resize the root window.
(unless (= (xid->integer (win)) 0)
(when (assv-ref (reverse-reparents) (xid->integer (win)))
(set-focus (assv-ref (reverse-reparents) (xid->integer (win))))
(on-window-click (win) button-press))))
(unless (or (= (xid->integer (win)) 0) (fixed-window? (win)))
(on-window-click (win) button-press)))

(wm-init
(lambda ()
Expand Down

0 comments on commit 4f9d22a

Please sign in to comment.