diff --git a/doc/handbook/handbook.facts b/doc/handbook/handbook.facts index 16b371a1f4..fd23744a78 100644 --- a/doc/handbook/handbook.facts +++ b/doc/handbook/handbook.facts @@ -49,4 +49,4 @@ ARTICLE: "type-index" "Type index" { $outliner [ builtins get [ ] subset ] } ; ARTICLE: "class-index" "Class index" -{ $outliner [ classes get [ ] subset ] } ; +{ $outliner [ classes ] } ; diff --git a/library/ui/backend.factor b/library/ui/backend.factor index 75790843ce..eb5431844d 100644 --- a/library/ui/backend.factor +++ b/library/ui/backend.factor @@ -7,6 +7,8 @@ DEFER: draw-world ! defined in world.factor DEFER: open-window* ( world title -- ) +DEFER: raise-window ( world -- ) + DEFER: select-gl-context ( handle -- ) DEFER: flush-gl-context ( handle -- ) diff --git a/library/ui/cocoa/ui.factor b/library/ui/cocoa/ui.factor index 0cb0f977d9..ed14e3c5c2 100644 --- a/library/ui/cocoa/ui.factor +++ b/library/ui/cocoa/ui.factor @@ -51,6 +51,9 @@ IN: gadgets dup start-world world-handle second f -> makeKeyAndOrderFront: ; +: raise-window ( world -- ) + world-handle second -> makeMainWindow ; + : select-gl-context ( handle -- ) first -> openGLContext -> makeCurrentContext ; diff --git a/library/ui/tools/search.factor b/library/ui/tools/search.factor index a2e45601b9..2e9c0a8d3c 100644 --- a/library/ui/tools/search.factor +++ b/library/ui/tools/search.factor @@ -35,10 +35,8 @@ M: search-gadget pref-dim* drop { 400 500 } ; : apropos-window [ apropos ] - "Apropos" - open-window ; + "Apropos" open-titled-window ; : search-help-window [ search-help. ] - "Search help" - open-window ; + "Search help" open-titled-window ; diff --git a/library/ui/ui.factor b/library/ui/ui.factor index 87f318af33..a66f135bea 100644 --- a/library/ui/ui.factor +++ b/library/ui/ui.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: gadgets -USING: arrays gadgets gadgets-labels gadgets-theme -gadgets-viewports hashtables kernel math namespaces queues -sequences threads ; +USING: arrays gadgets gadgets-frames gadgets-labels +gadgets-theme gadgets-viewports hashtables kernel math +namespaces queues sequences threads ; ! Assoc mapping aliens to gadgets SYMBOL: windows @@ -66,17 +66,11 @@ TUPLE: titled-gadget title ; M: titled-gadget gadget-title titled-gadget-title ; -M: titled-gadget pref-dim* viewport-dim ; - -M: titled-gadget layout* - dup rect-dim swap gadget-child set-layout-dim ; - M: titled-gadget focusable-child* gadget-child ; C: titled-gadget ( gadget title -- ) - dup delegate>gadget [ set-titled-gadget-title ] keep - [ add-gadget ] keep ; + { { [ ] f @center } } make-frame* ; : update-title ( gadget -- ) dup gadget-parent dup world? @@ -88,15 +82,21 @@ C: titled-gadget ( gadget title -- ) : open-titled-window ( gadget title -- ) open-window ; +: find-window ( quot -- world ) + windows get [ second ] map + [ world-gadget swap call ] find-last-with nip ; inline + : open-tool ( arg cons setter -- ) >r call tuck r> call open-window ; inline : call-tool ( arg pred cons setter -- ) - >r >r frontmost-window world-gadget swap call [ - frontmost-window world-gadget r> drop r> call + rot find-window [ + rot drop + dup raise-window + world-gadget swap call ] [ - r> r> open-tool - ] if ; inline + open-tool + ] if* ; inline : start-world ( world -- ) dup add-notify diff --git a/library/ui/x11/ui.factor b/library/ui/x11/ui.factor index 2d0cd290e9..6279851469 100644 --- a/library/ui/x11/ui.factor +++ b/library/ui/x11/ui.factor @@ -135,6 +135,9 @@ IN: gadgets dup gadget-window dup start-world world-handle first map-window* ; +: raise-window ( world -- ) + dpy get swap second XRaiseWindow drop ; + : select-gl-context ( handle -- ) dpy get swap first2 glXMakeCurrent [ "Failed to set current GLX context" throw ] unless ;