display size and menu fixes

This commit is contained in:
Matthew Flatt 2010-09-18 08:00:23 -06:00
parent 97a52a58bc
commit b3613e999f
5 changed files with 18 additions and 7 deletions

View File

@ -402,7 +402,8 @@
(define/override (move x y)
(let ([x (if (= x -11111) (get-x) x)]
[y (if (= y -11111) (get-y) y)])
(tellv cocoa setFrameTopLeftPoint: #:type _NSPoint (make-NSPoint x (flip-screen y)))))
(tellv cocoa setFrameTopLeftPoint: #:type _NSPoint (make-NSPoint x (- (flip-screen y)
(get-menu-bar-height))))))
(define/override (center dir wrt)
(let ([f (tell #:type _NSRect cocoa frame)]

View File

@ -10,7 +10,8 @@
"const.rkt"
"queue.rkt")
(provide menu-bar%)
(provide menu-bar%
get-menu-bar-height)
(import-class NSApplication NSMenu NSMenuItem NSProcessInfo NSScreen)
@ -59,6 +60,9 @@
(and (<= x (NSPoint-x p) (+ x w))
(<= (- y h) (NSPoint-y p) y)))))))
(define (get-menu-bar-height)
(inexact->exact (floor (tell #:type _CGFloat cocoa-mb menuBarHeight))))
(set-menu-bar-hooks! in-menu-bar-range)
;; Init menu bar

View File

@ -11,6 +11,7 @@
"finfo.rkt" ; file-creator-and-type
"filedialog.rkt"
"dc.rkt"
"menu-bar.rkt"
"../../lock.rkt"
"../common/handlers.rkt")
@ -101,12 +102,16 @@
(define (display-origin xb yb all?)
(set-box! xb 0)
(set-box! yb 0))
(define (display-size xb yb v)
(if all?
(set-box! yb 0)
(set-box! yb (get-menu-bar-height))))
(define (display-size xb yb all?)
(atomically
(with-autorelease
(let* ([screen (tell (tell NSScreen screens) objectAtIndex: #:type _NSUInteger 0)]
[f (tell #:type _NSRect screen frame)])
[f (if all?
(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))))))))

View File

@ -182,7 +182,8 @@
(public [append-item append])
(define (append-item i label help-str-or-submenu chckable?)
(atomically
(let ([item-gtk ((if chckable?
(let ([item-gtk ((if (and chckable?
(not (help-str-or-submenu . is-a? . menu%)))
gtk_check_menu_item_new_with_mnemonic
gtk_menu_item_new_with_mnemonic)
(fixup-mneumonic label))])

View File

@ -35,7 +35,7 @@
(opt-lambda ([full-screen? #f])
(let ([xb (box 0)]
[yb (box 0)])
(wx:display-size xb yb (if full-screen? 1 0))
(wx:display-size xb yb full-screen?)
(values (unbox xb) (unbox yb)))))
(define get-display-left-top-inset