diff --git a/src/switch-wm.scm b/src/switch-wm.scm index 8a68018..0f92033 100644 --- a/src/switch-wm.scm +++ b/src/switch-wm.scm @@ -1,9 +1,9 @@ (define-options-spec switch-wm-options-spec (titlebar-colors colors '("#aaaaaa" "#eeeeee" "#777777" "black")) - (titlebar-colors-active colors '("#666699" "#aaaacc" "#333366" "#eeeeee")) - (titlebar-colors-focused colors '("#9999aa" "#eeeeff" "#777788" "black")) + (titlebar-colors-focused colors '("#666699" "#aaaacc" "#333366" "#eeeeee")) + (titlebar-colors-active colors '("#9999aa" "#eeeeff" "#777788" "black")) (titlebar-height int 18) - (titlebar-style symbol 'flat) + (titlebar-style symbol 'raised) (font font "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*") (select-next keys "M-k n") (select-previous keys "M-k p") @@ -66,7 +66,11 @@ ;; client changed it's size ?? (fit-client-window wm (second msg))) - ;; TODO: need focus-in of manager to update empty-titlebar + ((update-manager-state) + (let ((state (if (window-contains-focus? dpy (wm:window wm)) + 'focused + 'active))) + (set-titlebar-state! empty-titlebar state))) ((update-client-state) (let* ((client (second msg)) @@ -124,8 +128,8 @@ (set-window-border-width! dpy (client:window client) 0) (let* ((channel (make-channel)) (titlebar (create-client-titlebar channel wm client))) - (set-data:titlebars! data (cons (cons client titlebar) - (data:titlebars data))) + (set-data:titlebars! data (append (data:titlebars data) + (list (cons client titlebar)))) (fit-titlebars wm data) (update-titlebars wm data) (fit-client-window wm client) @@ -133,7 +137,7 @@ (install-dragging-control channel dpy (titlebar:window titlebar) - (client:client-window client)) + (titlebar:window titlebar)) (grab-shortcut dpy (client:client-window client) (get-option-value options 'kill-client) 'kill-client channel #f) @@ -143,11 +147,14 @@ (let ((msg (receive channel))) (case (car msg) ((drop) - ;; TODO: check if outside... - ;;(move-window dpy (client:client-window client) - ;; (second msg) (third msg)) - #t - ) + ;; check if outside... + (let ((root-x (fourth msg)) + (root-y (fifth msg))) + (let ((r (root-rectangle dpy (wm:window wm)))) + (if (not (point-in-rectangle? r root-x root-y)) + (send (wm:out-channel wm) + (list 'root-drop (client:window client) + root-x root-y)))))) ((click) (wm-select-client wm client (fourth msg))) ((kill-client)