Paste: Patch default window location in Windows

Author: p1dzkl
Mode: factor
Date: Thu, 25 Sep 2008 21:45:16
Plain Text |
diff --git a/basis/ui/windows/windows.factor b/basis/ui/windows/windows.factor
index 345c73b..6a17c55 100755
--- a/basis/ui/windows/windows.factor
+++ b/basis/ui/windows/windows.factor
@@ -419,8 +419,13 @@ M: windows-ui-backend do-events
 : adjust-RECT ( RECT -- )
     style 0 ex-style AdjustWindowRectEx win32-error=0/f ;
 
+: auto-position ( loc -- loc )
+    dup { 0 0 } =
+    [ drop CW_USEDEFAULT dup 2array ] when ;
+
 : make-RECT ( world -- RECT )
-    dup window-loc>> { 40 40 } vmax dup rot rect-dim v+
+    dup window-loc>> auto-position
+    dup rot rect-dim v+
     "RECT" <c-object>
     over first over set-RECT-right
     swap second over set-RECT-bottom

Annotation: Info

Author: p1dzkl
Mode: text
Date: Thu, 25 Sep 2008 21:56:57
Plain Text |
The default window location on Windows is (40,40). This is very annoying for me because it's behind my task bar ( http://i35.tinypic.com/2qwhgrp.png ). The correct way to handle this is to let Windows decide where to put it with CW_USEDEFAULT.

Caveat emptor: I didn't test this with a full compile; I'm not sure how to cross-compile from the Linux VM where I do my dev-work.

Annotation: Oops

Author: p1dzkl
Mode: text
Date: Fri, 26 Sep 2008 01:24:43
Plain Text |
I realized that this patch can't work this way because AdjustWindowRectEx doesn't respect CW_USEDEFAULT. Working around that is more involved.

Anyway, please don't apply the above patch.

New Annotation

Summary:
Author:
Mode:
Body: