]> gitweb.factorcode.org Git - factor.git/commitdiff
Added set-fullscreen? and fullscreen? hooks along with their cocoa implementations.
authorMatthew Willis <yuuki@kotatsu.local>
Sat, 9 Feb 2008 08:17:24 +0000 (00:17 -0800)
committerMatthew Willis <yuuki@kotatsu.local>
Sat, 9 Feb 2008 08:17:24 +0000 (00:17 -0800)
extra/cocoa/cocoa.factor
extra/ui/backend/backend.factor
extra/ui/cocoa/cocoa.factor
extra/ui/gadgets/worlds/worlds-docs.factor

index cbc6c9d762c04ec06fce85f529cb648455bfdfba..c94984f00b2b4cd276c8ed36c010244ac3730dda 100755 (executable)
@@ -58,6 +58,7 @@ SYMBOL: super-sent-messages
         "NSPasteboard"
         "NSResponder"
         "NSSavePanel"
         "NSPasteboard"
         "NSResponder"
         "NSSavePanel"
+        "NSScreen"
         "NSView"
         "NSWindow"
         "NSWorkspace"
         "NSView"
         "NSWindow"
         "NSWorkspace"
index a0646f35b0d618a455b96b4ac6ca95831efa5cb1..cc1f5f7d0585d82ec0ae55de7f31b61654ed69d3 100755 (executable)
@@ -7,6 +7,10 @@ SYMBOL: ui-backend
 
 HOOK: set-title ui-backend ( string world -- )
 
 
 HOOK: set-title ui-backend ( string world -- )
 
+HOOK: set-fullscreen? ui-backend ( ? world -- )
+
+HOOK: fullscreen? ui-backend ( world -- ? )
+
 HOOK: (open-window) ui-backend ( world -- )
 
 HOOK: (close-window) ui-backend ( handle -- )
 HOOK: (open-window) ui-backend ( world -- )
 
 HOOK: (close-window) ui-backend ( handle -- )
index 1e46544180ce99498821225f695733d9d5acb344..184e6fd856aa3d49503f5855b698eabea547da9d 100755 (executable)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2006, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 ! Copyright (C) 2006, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays cocoa cocoa.application command-line
+USING: math arrays cocoa cocoa.application command-line
 kernel memory namespaces cocoa.messages cocoa.runtime
 cocoa.subclassing cocoa.pasteboard cocoa.types cocoa.windows
 cocoa.classes cocoa.application sequences system ui ui.backend
 kernel memory namespaces cocoa.messages cocoa.runtime
 cocoa.subclassing cocoa.pasteboard cocoa.types cocoa.windows
 cocoa.classes cocoa.application sequences system ui ui.backend
@@ -53,6 +53,18 @@ M: pasteboard set-clipboard-contents
 M: cocoa-ui-backend set-title ( string world -- )
     world-handle second swap <NSString> -> setTitle: ;
 
 M: cocoa-ui-backend set-title ( string world -- )
     world-handle second swap <NSString> -> setTitle: ;
 
+: enter-fullscreen ( world -- )
+    world-handle first NSScreen -> mainScreen f -> enterFullScreenMode:withOptions: drop ;
+
+: exit-fullscreen ( world -- )
+    world-handle first f -> exitFullScreenModeWithOptions: ;
+
+M: cocoa-ui-backend set-fullscreen? ( ? world -- )
+    swap [ enter-fullscreen ] [ exit-fullscreen ] if ;
+
+M: cocoa-ui-backend fullscreen? ( world -- ? )
+    world-handle first -> isInFullScreenMode zero? not ;
+
 : auto-position ( world -- )
     dup world-loc { 0 0 } = [
         world-handle second -> center
 : auto-position ( world -- )
     dup world-loc { 0 0 } = [
         world-handle second -> center
index a47717329d4f3a1b9a2497c85263378c6ed13d3e..8a647507511108e14f36156aafa290832d47c608 100755 (executable)
@@ -13,6 +13,15 @@ HELP: set-title
 { $description "Sets the title bar of the native window containing the world." }
 { $notes "This word should not be called directly by user code. Instead, change the " { $link world-title } " model; see " { $link "models" } "." } ;
 
 { $description "Sets the title bar of the native window containing the world." }
 { $notes "This word should not be called directly by user code. Instead, change the " { $link world-title } " model; see " { $link "models" } "." } ;
 
+HELP: set-fullscreen?
+{ $values { "?" "a boolean" } { "world" world } }
+{ $description "Sets and unsets fullscreen mode for the world." }
+{ $notes "Find a world using " { $link find-world } "." } ;
+
+HELP: fullscreen?
+{ $values { "world" world } { "?" "a boolean" } }
+{ $description "Queries the world to see if it is running in fullscreen mode." } ;
+
 HELP: raise-window
 { $values { "world" world } }
 { $description "Makes the native window containing the given world the front-most window." }
 HELP: raise-window
 { $values { "world" world } }
 { $description "Makes the native window containing the given world the front-most window." }