cocoa: fix problems using menu-bar height

This commit is contained in:
Matthew Flatt 2011-05-10 19:24:57 -06:00
parent b45b111960
commit 515a4f7991
3 changed files with 15 additions and 9 deletions

View File

@ -467,7 +467,7 @@
(define/override (flip y h) (flip-screen (+ y h)))
(define/override (get-y)
(- (super get-y) (if caption? 22 0)))
(- (- (super get-y) (if caption? 22 0)) (get-menu-bar-height)))
(define/override (set-size x y w h)
(unless (and (= x -1) (= y -1))

View File

@ -83,12 +83,6 @@
(and (<= x (NSPoint-x p) (+ x w))
(<= (- y h) (NSPoint-y p) y)))))))
(define initial-menubar-height
(inexact->exact (floor (tell #:type _CGFloat cocoa-mb menuBarHeight))))
(define (get-menu-bar-height)
initial-menubar-height)
(set-menu-bar-hooks! in-menu-bar-range)
;; Init menu bar
@ -205,3 +199,9 @@
(send top-wx on-menu-click))))))
(super-new))
(define initial-menubar-height
(inexact->exact (floor (tell #:type _CGFloat cocoa-mb menuBarHeight))))
(define (get-menu-bar-height)
initial-menubar-height)

View File

@ -63,7 +63,7 @@
file-selector
key-symbol-to-menu-key)
(import-class NSScreen NSCursor)
(import-class NSScreen NSCursor NSMenu)
(define (find-graphical-system-path what)
#f)
@ -106,7 +106,13 @@
(tell #:type _NSRect screen frame)
(tell #:type _NSRect screen visibleFrame))])
(set-box! xb (->long (NSSize-width (NSRect-size f))))
(set-box! yb (->long (NSSize-height (NSRect-size f))))))))
(set-box! yb (->long (- (NSSize-height (NSRect-size f))
(cond
[all? 0]
[(tell #:type _BOOL NSMenu menuBarVisible) 0]
;; Make result consistent when menu bar is hidden:
[else
(get-menu-bar-height)]))))))))
(define-appkit NSBeep (_fun -> _void))
(define (bell) (NSBeep))