summaryrefslogtreecommitdiff
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2011-12-04 14:25:16 +0100
committerJan Djärv <jan.h.d@swipnet.se>2011-12-04 14:25:16 +0100
commita0c3fad023c0b5812db38d2f1bd41998d7c001b1 (patch)
treeefe5b9581aef9c5f5e52ce4d222b918f1138e103 /src/nsfns.m
parentcdbbc22d1f23ad0a6a8e26a5fea5abd74f4386bc (diff)
downloademacs-a0c3fad023c0b5812db38d2f1bd41998d7c001b1.tar.gz
* nsfns.m (get_geometry_from_preferences): New function.
(Fx_create_frame): Call get_geometry_from_preferences. Fixes: debbugs:10103
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 280fee0b27b..482650fab2b 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1076,7 +1076,41 @@ unwind_create_frame (Lisp_Object frame)
return Qnil;
}
+/*
+ * Read geometry related parameters from preferences if not in PARMS.
+ * Returns the union of parms and any preferences read.
+ */
+
+static Lisp_Object
+get_geometry_from_preferences (struct ns_display_info *dpyinfo,
+ Lisp_Object parms)
+{
+ struct {
+ const char *val;
+ const char *cls;
+ Lisp_Object tem;
+ } r[] = {
+ { "width", "Width", Qwidth },
+ { "height", "Height", Qheight },
+ { "left", "Left", Qleft },
+ { "top", "Top", Qtop },
+ };
+
+ int i;
+ for (i = 0; i < sizeof (r)/sizeof (r[0]); ++i)
+ {
+ if (NILP (Fassq (r[i].tem, parms)))
+ {
+ Lisp_Object value
+ = x_get_arg (dpyinfo, parms, r[i].tem, r[i].val, r[i].cls,
+ RES_TYPE_NUMBER);
+ if (! EQ (value, Qunbound))
+ parms = Fcons (Fcons (r[i].tem, value), parms);
+ }
+ }
+ return parms;
+}
/* ==========================================================================
@@ -1285,6 +1319,7 @@ This function is an internal primitive--use `make-frame' instead. */)
x_default_parameter (f, parms, Qtitle, Qnil, "title", "Title",
RES_TYPE_STRING);
+ parms = get_geometry_from_preferences (dpyinfo, parms);
window_prompting = x_figure_window_size (f, parms, 1);
tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);