racket/gui: add Mac OS X fullscreen options to frame%
original commit: 887a906bd2dffce800da84aa4788268db96b1b3b
This commit is contained in:
parent
e621a273f3
commit
990bb9c938
|
@ -15,7 +15,9 @@ A frame is a top-level container window. It has a title bar (which
|
||||||
[y (or/c position-integer? #f) #f]
|
[y (or/c position-integer? #f) #f]
|
||||||
[style (listof (or/c 'no-resize-border 'no-caption
|
[style (listof (or/c 'no-resize-border 'no-caption
|
||||||
'no-system-menu 'hide-menu-bar
|
'no-system-menu 'hide-menu-bar
|
||||||
'toolbar-button 'float 'metal)) null]
|
'toolbar-button 'float 'metal
|
||||||
|
'fullscreen-button 'fullscreen-aux))
|
||||||
|
null]
|
||||||
[enabled any/c #t]
|
[enabled any/c #t]
|
||||||
[border spacing-integer? 0]
|
[border spacing-integer? 0]
|
||||||
[spacing spacing-integer? 0]
|
[spacing spacing-integer? 0]
|
||||||
|
@ -84,6 +86,12 @@ some platforms:
|
||||||
|
|
||||||
@item{@racket['metal] --- ignored (formerly supported for Mac OS X)}
|
@item{@racket['metal] --- ignored (formerly supported for Mac OS X)}
|
||||||
|
|
||||||
|
@item{@racket['fullscreen-button] --- includes a button on the
|
||||||
|
frame's title bar to put the frame in fullscreen mode (Mac OS X)}
|
||||||
|
|
||||||
|
@item{@racket['fullscreen-aux] --- allows the frame to accompany
|
||||||
|
another that is in fullscreen mode (Mac OS X)}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
Even if the frame is not shown, a few notification events may be
|
Even if the frame is not shown, a few notification events may be
|
||||||
|
@ -93,6 +101,10 @@ Even if the frame is not shown, a few notification events may be
|
||||||
|
|
||||||
@WindowKWs[@racket[enabled]] @AreaContKWs[] @AreaKWs[]
|
@WindowKWs[@racket[enabled]] @AreaContKWs[] @AreaKWs[]
|
||||||
|
|
||||||
|
@history[#:changed "6.0.0.6" @elem{Added @racket['fullscreen-button]
|
||||||
|
and @racket['fullscreen-aux] options
|
||||||
|
for @racket[style].}]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,6 +119,19 @@ See also @method[frame% set-status-text].
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@defmethod[(fullscreen [fullscreen? any/c])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Puts the frame in fullscreen mode or restores the frame to
|
||||||
|
non-fullscreen mode (Mac OS X).
|
||||||
|
|
||||||
|
@Unmonitored[@elem{A frame's mode} @elem{the user} @elem{a
|
||||||
|
frame has been put in fullscreen mode} @elem{@method[frame% is-fullscreened?]}]
|
||||||
|
|
||||||
|
@history[#:added "6.0.0.6"]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@defmethod[(get-menu-bar)
|
@defmethod[(get-menu-bar)
|
||||||
(or/c (is-a?/c menu-bar%) #f)]{
|
(or/c (is-a?/c menu-bar%) #f)]{
|
||||||
|
|
||||||
|
@ -134,6 +159,15 @@ frame has been iconized} @elem{@method[frame% is-iconized?]}]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@defmethod[(is-fullscreened?)
|
||||||
|
boolean?]{
|
||||||
|
|
||||||
|
Returns @racket[#t] if the frame is in fullscreen mode (Mac OS X), @racket[#f]
|
||||||
|
otherwise.
|
||||||
|
|
||||||
|
@history[#:added "6.0.0.6"]
|
||||||
|
}
|
||||||
|
|
||||||
@defmethod[(is-iconized?)
|
@defmethod[(is-iconized?)
|
||||||
boolean?]{
|
boolean?]{
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,8 @@
|
||||||
(check-init-position cwho x)
|
(check-init-position cwho x)
|
||||||
(check-init-position cwho y)
|
(check-init-position cwho y)
|
||||||
(check-style cwho #f '(no-resize-border no-caption no-system-menu
|
(check-style cwho #f '(no-resize-border no-caption no-system-menu
|
||||||
toolbar-button hide-menu-bar float metal)
|
toolbar-button hide-menu-bar float metal
|
||||||
|
fullscreen-button fullscreen-aux)
|
||||||
style))
|
style))
|
||||||
(rename-super [super-on-subwindow-char on-subwindow-char])
|
(rename-super [super-on-subwindow-char on-subwindow-char])
|
||||||
(define wx #f)
|
(define wx #f)
|
||||||
|
@ -196,6 +197,8 @@
|
||||||
[is-iconized? (entry-point (lambda () (send wx iconized?)))]
|
[is-iconized? (entry-point (lambda () (send wx iconized?)))]
|
||||||
[maximize (entry-point (lambda (on?) (send wx position-for-initial-show) (send wx maximize on?)))]
|
[maximize (entry-point (lambda (on?) (send wx position-for-initial-show) (send wx maximize on?)))]
|
||||||
[is-maximized? (entry-point (lambda () (send wx is-maximized?)))]
|
[is-maximized? (entry-point (lambda () (send wx is-maximized?)))]
|
||||||
|
[fullscreen (entry-point (lambda (on?) (send wx fullscreen on?)))]
|
||||||
|
[is-fullscreened? (entry-point (lambda () (send wx fullscreened?)))]
|
||||||
[get-menu-bar (entry-point (lambda () (let ([mb (send wx get-the-menu-bar)])
|
[get-menu-bar (entry-point (lambda () (let ([mb (send wx get-the-menu-bar)])
|
||||||
(and mb (wx->mred mb)))))]
|
(and mb (wx->mred mb)))))]
|
||||||
[modified (entry-point
|
[modified (entry-point
|
||||||
|
|
|
@ -121,4 +121,6 @@
|
||||||
(define kCGImageAlphaNoneSkipLast 5)
|
(define kCGImageAlphaNoneSkipLast 5)
|
||||||
(define kCGImageAlphaNoneSkipFirst 6)
|
(define kCGImageAlphaNoneSkipFirst 6)
|
||||||
|
|
||||||
|
(define NSWindowCollectionBehaviorFullScreenPrimary 128)
|
||||||
|
(define NSWindowCollectionBehaviorFullScreenAuxiliary 256)
|
||||||
|
(define NSFullScreenWindowMask (1 . << . 14))
|
||||||
|
|
|
@ -253,6 +253,14 @@
|
||||||
defer: #:type _BOOL NO))])
|
defer: #:type _BOOL NO))])
|
||||||
;; use init rect as frame size, not content size
|
;; use init rect as frame size, not content size
|
||||||
(tellv c setFrame: #:type _NSRect init-rect display: #:type _BOOL #f)
|
(tellv c setFrame: #:type _NSRect init-rect display: #:type _BOOL #f)
|
||||||
|
;; fullscreen variants:
|
||||||
|
(when (version-10.7-or-later?)
|
||||||
|
(cond
|
||||||
|
[(memq 'fullscreen-button style)
|
||||||
|
(tellv c setCollectionBehavior: #:type _int NSWindowCollectionBehaviorFullScreenPrimary)]
|
||||||
|
[(memq 'fullscreen-aux style)
|
||||||
|
(tellv c setCollectionBehavior: #:type _int NSWindowCollectionBehaviorFullScreenAuxiliary)]
|
||||||
|
[else (void)]))
|
||||||
c))]
|
c))]
|
||||||
[no-show? #t])
|
[no-show? #t])
|
||||||
(define cocoa (get-cocoa))
|
(define cocoa (get-cocoa))
|
||||||
|
@ -660,10 +668,15 @@
|
||||||
(tellv cocoa miniaturize: cocoa)
|
(tellv cocoa miniaturize: cocoa)
|
||||||
(tellv cocoa deminiaturize: cocoa)))
|
(tellv cocoa deminiaturize: cocoa)))
|
||||||
|
|
||||||
|
(define/public (fullscreened?)
|
||||||
|
(positive? (bitwise-and (tell #:type _NSUInteger cocoa styleMask) NSFullScreenWindowMask)))
|
||||||
|
(define/public (fullscreen on?)
|
||||||
|
(unless (eq? (and on? #t) (fullscreened?))
|
||||||
|
(tellv cocoa toggleFullScreen: #f)))
|
||||||
|
|
||||||
(define/public (set-title s)
|
(define/public (set-title s)
|
||||||
(tellv cocoa setTitle: #:type _NSString s))
|
(tellv cocoa setTitle: #:type _NSString s))
|
||||||
|
|
||||||
|
|
||||||
(define color-callback void)
|
(define color-callback void)
|
||||||
(define/public (set-color-callback cb)
|
(define/public (set-color-callback cb)
|
||||||
(set! color-callback cb))
|
(set! color-callback cb))
|
||||||
|
|
|
@ -524,6 +524,9 @@
|
||||||
(gtk_window_iconify gtk)
|
(gtk_window_iconify gtk)
|
||||||
(gtk_window_deiconify gtk)))
|
(gtk_window_deiconify gtk)))
|
||||||
|
|
||||||
|
(define/public (fullscreened?) #f)
|
||||||
|
(define/public (fullscreen on?) (void))
|
||||||
|
|
||||||
(def/public-unimplemented get-menu-bar)
|
(def/public-unimplemented get-menu-bar)
|
||||||
|
|
||||||
(define/public (set-title s)
|
(define/public (set-title s)
|
||||||
|
|
|
@ -575,6 +575,9 @@
|
||||||
(unless (eq? (and on? #t) (iconized?))
|
(unless (eq? (and on? #t) (iconized?))
|
||||||
(ShowWindow hwnd (if on? SW_MINIMIZE SW_RESTORE)))))
|
(ShowWindow hwnd (if on? SW_MINIMIZE SW_RESTORE)))))
|
||||||
|
|
||||||
|
(define/public (fullscreened?) #f)
|
||||||
|
(define/public (fullscreen on?) (void))
|
||||||
|
|
||||||
(define/private (get-placement)
|
(define/private (get-placement)
|
||||||
(let ([wp (make-WINDOWPLACEMENT
|
(let ([wp (make-WINDOWPLACEMENT
|
||||||
(ctype-sizeof _WINDOWPLACEMENT)
|
(ctype-sizeof _WINDOWPLACEMENT)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user