fix default dialog% position (centered)
Closes PR 11637
This commit is contained in:
parent
2043b4ad6f
commit
0bc987e66b
|
@ -469,20 +469,24 @@
|
||||||
|
|
||||||
(define/override (center dir wrt)
|
(define/override (center dir wrt)
|
||||||
(let ([f (tell #:type _NSRect cocoa frame)]
|
(let ([f (tell #:type _NSRect cocoa frame)]
|
||||||
[s (tell #:type _NSRect (tell cocoa screen) frame)])
|
[w (if wrt
|
||||||
|
(tell #:type _NSRect (send wrt get-cocoa) frame)
|
||||||
|
(tell #:type _NSRect (tell cocoa screen) frame))])
|
||||||
(tellv cocoa setFrame:
|
(tellv cocoa setFrame:
|
||||||
#:type _NSRect (make-NSRect (make-NSPoint
|
#:type _NSRect (make-NSRect (make-NSPoint
|
||||||
(if (or (eq? dir 'both)
|
(if (or (eq? dir 'both)
|
||||||
(eq? dir 'horizontal))
|
(eq? dir 'horizontal))
|
||||||
(quotient (- (NSSize-width (NSRect-size s))
|
(+ (quotient (- (NSSize-width (NSRect-size w))
|
||||||
(NSSize-width (NSRect-size f)))
|
(NSSize-width (NSRect-size f)))
|
||||||
2)
|
2)
|
||||||
|
(NSPoint-x (NSRect-origin w)))
|
||||||
(NSPoint-x (NSRect-origin f)))
|
(NSPoint-x (NSRect-origin f)))
|
||||||
(if (or (eq? dir 'both)
|
(if (or (eq? dir 'both)
|
||||||
(eq? dir 'vertical))
|
(eq? dir 'vertical))
|
||||||
(quotient (- (NSSize-height (NSRect-size s))
|
(+ (quotient (- (NSSize-height (NSRect-size w))
|
||||||
(NSSize-height (NSRect-size f)))
|
(NSSize-height (NSRect-size f)))
|
||||||
2)
|
2)
|
||||||
|
(NSPoint-y (NSRect-origin w)))
|
||||||
(NSPoint-x (NSRect-origin f))))
|
(NSPoint-x (NSRect-origin f))))
|
||||||
(NSRect-size f))
|
(NSRect-size f))
|
||||||
display: #:type _BOOL #t)))
|
display: #:type _BOOL #t)))
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
[panel #f]
|
[panel #f]
|
||||||
|
|
||||||
[use-default-position? (and (= -11111 (list-ref args 2))
|
[use-default-position? (and (= -11111 (list-ref args 2))
|
||||||
(= -11111 (list-ref args (if dlg? 3 1))))]
|
(= -11111 (list-ref args 1)))]
|
||||||
|
|
||||||
[enabled? #t]
|
[enabled? #t]
|
||||||
[focus #f]
|
[focus #f]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user