Paste: Windows window location (again)

Author: p1dzkl
Mode: factor
Date: Tue, 7 Oct 2008 18:59:42
Plain Text |
diff --git a/basis/ui/windows/windows.factor b/basis/ui/windows/windows.factor
index 345c73b..e2d594b 100644
--- a/basis/ui/windows/windows.factor
+++ b/basis/ui/windows/windows.factor
@@ -420,15 +420,25 @@ M: windows-ui-backend do-events
     style 0 ex-style AdjustWindowRectEx win32-error=0/f ;
 
 : make-RECT ( world -- RECT )
-    dup window-loc>> { 40 40 } vmax dup rot rect-dim v+
+    dup window-loc>> dup rot rect-dim v+
     "RECT" <c-object>
     over first over set-RECT-right
     swap second over set-RECT-bottom
     over first over set-RECT-left
     swap second over set-RECT-top ;
 
-: make-adjusted-RECT ( rect -- RECT )
-    make-RECT dup adjust-RECT ;
+: default-position-RECT ( RECT -- )
+    dup get-RECT-dimensions >r >r 2drop r> r>
+    CW_USEDEFAULT + pick set-RECT-bottom
+    CW_USEDEFAULT + over set-RECT-right
+    CW_USEDEFAULT over set-RECT-left
+    CW_USEDEFAULT swap set-RECT-top ;
+
+: make-adjusted-RECT ( world -- RECT )
+    make-RECT
+    dup get-RECT-top-left [ zero? ] both? swap
+    dup adjust-RECT
+    swap [ dup default-position-RECT ] when ;
 
 : create-window ( rect -- hwnd )
     make-adjusted-RECT

Annotation: annotation

Author: p1dzkl
Mode: factor
Date: Tue, 7 Oct 2008 19:03:31
Plain Text |
Same as http://paste.factorcode.org/paste?id=24 but this time the patch actually works, tested with a full compile and latest git sources.

New Annotation

Summary:
Author:
Mode:
Body: