changeset 72269:b37e887392d9

(w32_createwindow): Handle -geometry command line option and the geometry settings in the Registry.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 04 Aug 2006 11:36:02 +0000
parents c3d7d4008d2d
children cba77d605fba
files src/w32fns.c
diffstat 1 files changed, 36 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32fns.c	Fri Aug 04 10:42:41 2006 +0000
+++ b/src/w32fns.c	Fri Aug 04 11:36:02 2006 +0000
@@ -2066,7 +2066,8 @@
 {
   HWND hwnd;
   RECT rect;
-  Lisp_Object top, left;
+  Lisp_Object top = Qunbound;
+  Lisp_Object left = Qunbound;
 
   rect.left = rect.top = 0;
   rect.right = FRAME_PIXEL_WIDTH (f);
@@ -2079,13 +2080,41 @@
 
   if (!hprevinst)
     {
+      Lisp_Object ifa;
+
       w32_init_class (hinst);
-    }
-
-  /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
-     for anything that is not a number and is not Qunbound.  */
-  left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
-  top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
+
+      /* Handle the -geometry command line option and the geometry
+	 settings in the registry.  They are decoded and put into
+	 initial-frame-alist by w32-win.el:x-handle-geometry.  */
+      ifa = Fsymbol_value (intern ("initial-frame-alist"));
+      if (CONSP (ifa))
+	{
+	  Lisp_Object lt = Fassq (Qleft, ifa);
+	  Lisp_Object tp = Fassq (Qtop,  ifa);
+
+	  if (!NILP (lt))
+	    {
+	      lt = XCDR (lt);
+	      if (INTEGERP (lt))
+		left = lt;
+	    }
+	  if (!NILP (tp))
+	    {
+	      tp = XCDR (tp);
+	      if (INTEGERP (tp))
+		top = tp;
+	    }
+	}
+    }
+
+  if (EQ (left, Qunbound) && EQ (top, Qunbound))
+    {
+      /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
+	 for anything that is not a number and is not Qunbound.  */
+      left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
+      top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
+    }
 
   FRAME_W32_WINDOW (f) = hwnd
     = CreateWindow (EMACS_CLASS,