From 3b1f3c08a4a60498c834e5476603170ebe25ddd9 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 13 Apr 2009 03:16:57 -0500 Subject: [PATCH] Fix window positioning on OS X --- basis/ui/backend/cocoa/cocoa.factor | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/basis/ui/backend/cocoa/cocoa.factor b/basis/ui/backend/cocoa/cocoa.factor index 1bbf46c69e..362305c8f7 100755 --- a/basis/ui/backend/cocoa/cocoa.factor +++ b/basis/ui/backend/cocoa/cocoa.factor @@ -39,13 +39,16 @@ M: pasteboard set-clipboard-contents [ 0 0 ] dip dim>> first2 ; : auto-position ( window loc -- ) + #! Note: if this is the initial window, the length of the windows + #! vector should be 1, since (open-window) calls auto-position + #! after register-window. dup { 0 0 } = [ drop - windows get [ -> center ] [ - peek second window-loc>> + windows get length 1 <= [ -> center ] [ + windows get peek second window-loc>> dupd first2 -> cascadeTopLeftFromPoint: -> setFrameTopLeftPoint: - ] if-empty + ] if ] [ first2 -> setFrameTopLeftPoint: ] if ; M: cocoa-ui-backend set-title ( string world -- )