Skip to content

Commit

Permalink
Fix race condition when initializing Tiling WM
Browse files Browse the repository at this point in the history
Only start listening for changes to randr displays
after the tiling wm is all set up.
  • Loading branch information
mwitmer committed May 28, 2017
1 parent 4271248 commit f3c7b3b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions module/guile-wm/module/tiling.scm
Original file line number Diff line number Diff line change
Expand Up @@ -419,21 +419,21 @@
(define-command (start-tiling!)
(set! frame-list (detect-frames))
(set! blank-x-window (basic-window-create 0 0 200 20 2))
(change-window-attributes blank-x-window #:back-pixmap 'parent-relative)
(place-windows!)
(set! selected-tile (frame-content (car frame-list)))
(add-wm-hook! screen-change-hook reset-frames)
(add-wm-hook! menu-select-window-hook tiling-menu-select-window)
(add-wm-hook! unmap-notify-hook tiling-unmap)
(add-wm-hook! after-reparent-hook tiling-reparent)
(run-wm-hook start-tiling-hook)
(with-replies ((attributes get-window-attributes (current-root)))
(change-window-attributes (current-root)
#:event-mask (cons 'button-press (xref attributes 'your-event-mask)))
(change-window-attributes (current-root)
#:event-mask (cons 'button-press (xref attributes 'your-event-mask)))
(unlisten! button-press-event 'click-to-focus)
(listen! button-press-event 'click-to-focus tiling-click-to-focus)))
(listen! button-press-event 'click-to-focus tiling-click-to-focus)
(change-window-attributes blank-x-window #:back-pixmap 'parent-relative)
(place-windows!)
(add-wm-hook! screen-change-hook reset-frames)
(add-wm-hook! menu-select-window-hook tiling-menu-select-window)
(add-wm-hook! unmap-notify-hook tiling-unmap)
(add-wm-hook! after-reparent-hook tiling-reparent)
(run-wm-hook start-tiling-hook)))

(define-command (stop-tiling!)
(remove-wm-hook! after-reparent-hook tiling-reparent)
Expand All @@ -449,8 +449,8 @@
(change-window-attributes (current-root)
#:event-mask (delq 'button-press (xref attributes 'your-event-mask)))
(unlisten! button-press-event 'click-to-focus)
(listen! button-press-event 'click-to-focus non-tiling-click-to-focus))
(run-wm-hook stop-tiling-hook))
(listen! button-press-event 'click-to-focus non-tiling-click-to-focus)
(run-wm-hook stop-tiling-hook)))

(wm-init
(lambda ()
Expand Down

1 comment on commit f3c7b3b

@watkinsr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, I will try this fix, thanks for the resume of the project!

Please sign in to comment.