better support for avoiding window overlap with the Mac dock

svn: r3070

original commit: 67b5c30218c3428f6b57575a99fa85ad68eb08d6
This commit is contained in:
Matthew Flatt 2006-05-26 11:15:39 +00:00
parent b5529b001e
commit aa1e17c346

View File

@ -31,14 +31,21 @@
(wx:display-size xb yb (if full-screen? 1 0)) (wx:display-size xb yb (if full-screen? 1 0))
(values (unbox xb) (unbox yb))))) (values (unbox xb) (unbox yb)))))
(define (get-display-left-top-inset) (define get-display-left-top-inset
(let ([xb (box 0)] (opt-lambda ([advisory? #f])
[yb (box 0)]) (let ([xb (box 0)]
(wx:display-origin xb yb) [yb (box 0)])
(values (unbox xb) (unbox yb)))) (wx:display-origin xb yb advisory?)
(values (unbox xb) (unbox yb)))))
(define top-x 1) (define-values (init-top-x init-top-y)
(define top-y 1) (let-values ([(x y) (get-display-left-top-inset #f)]
[(x2 y2) (get-display-left-top-inset #t)])
(values (+ 1 (- x2 x))
(+ 1 (- y2 y)))))
(define top-x init-top-x)
(define top-y init-top-y)
(define top-level-windows (make-hash-table 'weak)) (define top-level-windows (make-hash-table 'weak))
;; make-top-container%: adds the necessary functionality to wx:frame% and ;; make-top-container%: adds the necessary functionality to wx:frame% and
@ -340,8 +347,8 @@
(values top-y #f) (values top-y #f)
(values (max 0 (- sh h 20)) #t))]) (values (max 0 (- sh h 20)) #t))])
(move x y) (move x y)
(set! top-x (if x-reset? 0 (+ top-x 10))) (set! top-x (if x-reset? init-top-x (+ top-x 10)))
(set! top-y (if y-reset? 0 (+ top-y 20))))) (set! top-y (if y-reset? init-top-y (+ top-y 20)))))
(if on? (if on?
(hash-table-put! top-level-windows this #t) (hash-table-put! top-level-windows this #t)
(hash-table-remove! top-level-windows this)) (hash-table-remove! top-level-windows this))