From 31e3fe5a2f4bba28d243d0664dd48823bec660ba Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 13 May 2009 20:05:22 -0500 Subject: [PATCH] rename set-fullscreen? to set-fullscreen, add a toggle-fullscreen word, fix windows backend for fullscreen* --- basis/ui/backend/windows/windows.factor | 5 +++++ basis/ui/ui-docs.factor | 4 ++-- basis/ui/ui.factor | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/basis/ui/backend/windows/windows.factor b/basis/ui/backend/windows/windows.factor index afed121fb6..3fc9e66769 100755 --- a/basis/ui/backend/windows/windows.factor +++ b/basis/ui/backend/windows/windows.factor @@ -761,6 +761,11 @@ M: windows-ui-backend (ungrab-input) ( handle -- ) M: windows-ui-backend set-fullscreen* ( ? world -- ) swap [ enter-fullscreen ] [ exit-fullscreen ] if ; +M: windows-ui-backend fullscreen* ( world -- ? ) + [ handle>> hWnd>> hwnd>RECT ] + [ handle>> hWnd>> fullscreen-RECT ] bi + [ get-RECT-dimensions 2array 2nip ] bi@ = ; + windows-ui-backend ui-backend set-global [ "ui.tools" ] main-vocab-hook set-global diff --git a/basis/ui/ui-docs.factor b/basis/ui/ui-docs.factor index e206c7d408..a4bcb8bcdf 100644 --- a/basis/ui/ui-docs.factor +++ b/basis/ui/ui-docs.factor @@ -25,7 +25,7 @@ HELP: world-attributes { { $snippet "pixel-format-attributes" } " is a sequence of " { $link "ui.pixel-formats-attributes" } " that the window will request for its OpenGL pixel format." } } ; -HELP: set-fullscreen? +HELP: set-fullscreen { $values { "?" "a boolean" } { "gadget" gadget } } { $description "Sets and unsets fullscreen mode for the gadget's world." } ; @@ -33,7 +33,7 @@ HELP: fullscreen? { $values { "gadget" gadget } { "?" "a boolean" } } { $description "Queries the gadget's world to see if it is running in fullscreen mode." } ; -{ fullscreen? set-fullscreen? } related-words +{ fullscreen? set-fullscreen } related-words HELP: find-window { $values { "quot" { $quotation "( world -- ? )" } } { "world" { $maybe world } } } diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor index 0a6f26fd5b..e4cf725add 100644 --- a/basis/ui/ui.factor +++ b/basis/ui/ui.factor @@ -209,12 +209,15 @@ PRIVATE> : open-window ( gadget title/attributes -- ) ?attributes open-world-window ; -: set-fullscreen? ( ? gadget -- ) +: set-fullscreen ( ? gadget -- ) find-world set-fullscreen* ; : fullscreen? ( gadget -- ? ) find-world fullscreen* ; +: toggle-fullscreen ( gadget -- ) + [ fullscreen? not ] keep set-fullscreen ; + : raise-window ( gadget -- ) find-world raise-window* ;