emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110094: * lisp/startup.el (command-l


From: Jan Djärv
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110094: * lisp/startup.el (command-line-ns-option-alist): Add -g and --geometry.
Date: Wed, 19 Sep 2012 08:47:01 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110094
fixes bug: http://debbugs.gnu.org/12368
committer: Jan Djärv <address@hidden>
branch nick: trunk
timestamp: Wed 2012-09-19 08:47:01 +0200
message:
  * lisp/startup.el (command-line-ns-option-alist): Add -g and --geometry.
  
  * src/frame.c (read_integer, XParseGeometry): Moved from w32xfns.c.
  (Fx_parse_geometry): If there is a space in string, call
  Qns_parse_geometry, otherwise do as on other terms.
  
  * src/w32xfns.c (read_integer, XParseGeometry): Move to frame.c.
  
  * src/nsfns.m (XParseGeometry): Remove.
  (Fx_create_frame): Call x_set_offset to correctly interpret
  top_pos in geometry.
modified:
  lisp/ChangeLog
  lisp/startup.el
  src/ChangeLog
  src/frame.c
  src/nsfns.m
  src/w32xfns.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-18 23:40:39 +0000
+++ b/lisp/ChangeLog    2012-09-19 06:47:01 +0000
@@ -1,3 +1,7 @@
+2012-09-19  Jan Djärv  <address@hidden>
+
+       * startup.el (command-line-ns-option-alist): Add -g and --geometry.
+
 2012-09-18  Juri Linkov  <address@hidden>
 
        * dired-aux.el (dired-diff): Restore original functionality of

=== modified file 'lisp/startup.el'
--- a/lisp/startup.el   2012-09-17 05:41:04 +0000
+++ b/lisp/startup.el   2012-09-19 06:47:01 +0000
@@ -216,8 +216,8 @@
     ("-fn" 1 x-handle-switch font)
     ("-font" 1 x-handle-switch font)
     ("-ib" 1 x-handle-numeric-switch internal-border-width)
-    ;;("-g" .               x-handle-geometry)
-    ;;("-geometry" .        x-handle-geometry)
+    ("-g" 1 x-handle-geometry)
+    ("-geometry" 1 x-handle-geometry)
     ("-fg" 1 x-handle-switch foreground-color)
     ("-foreground" 1 x-handle-switch foreground-color)
     ("-bg" 1 x-handle-switch background-color)

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-17 20:11:34 +0000
+++ b/src/ChangeLog     2012-09-19 06:47:01 +0000
@@ -1,3 +1,15 @@
+2012-09-19  Jan Djärv  <address@hidden>
+
+       * w32xfns.c (read_integer, XParseGeometry): Move to frame.c.
+
+       * nsfns.m (XParseGeometry): Remove.
+       (Fx_create_frame): Call x_set_offset to correctly interpret
+       top_pos in geometry.
+
+       * frame.c (read_integer, XParseGeometry): Moved from w32xfns.c.
+       (Fx_parse_geometry): If there is a space in string, call
+       Qns_parse_geometry, otherwise do as on other terms (Bug#12368).
+
 2012-09-17  Eli Zaretskii  <address@hidden>
 
        * search.c (scan_buffer): Use character positions in calls to

=== modified file 'src/frame.c'
--- a/src/frame.c       2012-09-15 07:06:56 +0000
+++ b/src/frame.c       2012-09-19 06:47:01 +0000
@@ -3897,6 +3897,140 @@
 }
 
 
+#if !defined (HAVE_X_WINDOWS) && defined (NoValue)
+
+/*
+ *    XParseGeometry parses strings of the form
+ *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
+ *   width, height, xoffset, and yoffset are unsigned integers.
+ *   Example:  "=80x24+300-49"
+ *   The equal sign is optional.
+ *   It returns a bitmask that indicates which of the four values
+ *   were actually found in the string.  For each value found,
+ *   the corresponding argument is updated;  for each value
+ *   not found, the corresponding argument is left unchanged.
+ */
+
+static int
+read_integer (register char *string, char **NextString)
+{
+  register int Result = 0;
+  int Sign = 1;
+
+  if (*string == '+')
+    string++;
+  else if (*string == '-')
+    {
+      string++;
+      Sign = -1;
+    }
+  for (; (*string >= '0') && (*string <= '9'); string++)
+    {
+      Result = (Result * 10) + (*string - '0');
+    }
+  *NextString = string;
+  if (Sign >= 0)
+    return (Result);
+  else
+    return (-Result);
+}
+
+int
+XParseGeometry (char *string,
+               int *x, int *y,
+               unsigned int *width, unsigned int *height)
+{
+  int mask = NoValue;
+  register char *strind;
+  unsigned int tempWidth, tempHeight;
+  int tempX, tempY;
+  char *nextCharacter;
+
+  if ((string == NULL) || (*string == '\0')) return (mask);
+  if (*string == '=')
+    string++;  /* ignore possible '=' at beg of geometry spec */
+
+  strind = (char *)string;
+  if (*strind != '+' && *strind != '-' && *strind != 'x')
+    {
+      tempWidth = read_integer (strind, &nextCharacter);
+      if (strind == nextCharacter)
+       return (0);
+      strind = nextCharacter;
+      mask |= WidthValue;
+    }
+
+  if (*strind == 'x' || *strind == 'X')
+    {
+      strind++;
+      tempHeight = read_integer (strind, &nextCharacter);
+      if (strind == nextCharacter)
+       return (0);
+      strind = nextCharacter;
+      mask |= HeightValue;
+    }
+
+  if ((*strind == '+') || (*strind == '-'))
+    {
+      if (*strind == '-')
+       {
+         strind++;
+         tempX = -read_integer (strind, &nextCharacter);
+         if (strind == nextCharacter)
+           return (0);
+         strind = nextCharacter;
+         mask |= XNegative;
+
+       }
+      else
+       {
+         strind++;
+         tempX = read_integer (strind, &nextCharacter);
+         if (strind == nextCharacter)
+           return (0);
+         strind = nextCharacter;
+       }
+      mask |= XValue;
+      if ((*strind == '+') || (*strind == '-'))
+       {
+         if (*strind == '-')
+           {
+             strind++;
+             tempY = -read_integer (strind, &nextCharacter);
+             if (strind == nextCharacter)
+               return (0);
+             strind = nextCharacter;
+             mask |= YNegative;
+           }
+         else
+           {
+             strind++;
+             tempY = read_integer (strind, &nextCharacter);
+             if (strind == nextCharacter)
+               return (0);
+             strind = nextCharacter;
+           }
+         mask |= YValue;
+       }
+    }
+
+  /* If strind isn't at the end of the string then it's an invalid
+     geometry specification. */
+
+  if (*strind != '\0') return (0);
+
+  if (mask & XValue)
+    *x = tempX;
+  if (mask & YValue)
+    *y = tempY;
+  if (mask & WidthValue)
+    *width = tempWidth;
+  if (mask & HeightValue)
+    *height = tempHeight;
+  return (mask);
+}
+
+#endif /* !defined (HAVE_X_WINDOWS) && defined (NoValue) */
 
 
 /* NS used to define x-parse-geometry in ns-win.el, but that confused
@@ -3917,15 +4051,16 @@
 On Nextstep, this just calls `ns-parse-geometry'.  */)
   (Lisp_Object string)
 {
-#ifdef HAVE_NS
-  return call1 (Qns_parse_geometry, string);
-#else
   int geometry, x, y;
   unsigned int width, height;
   Lisp_Object result;
 
   CHECK_STRING (string);
 
+#ifdef HAVE_NS
+  if (strchr (SSDATA (string), ' ') != NULL)
+    return call1 (Qns_parse_geometry, string);
+#endif
   geometry = XParseGeometry (SSDATA (string),
                             &x, &y, &width, &height);
   result = Qnil;
@@ -3961,7 +4096,6 @@
     result = Fcons (Fcons (Qheight, make_number (height)), result);
 
   return result;
-#endif /* HAVE_NS */
 }
 
 

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2012-09-16 09:11:50 +0000
+++ b/src/nsfns.m       2012-09-19 06:47:01 +0000
@@ -870,16 +870,6 @@
 }
 
 
-/* Xism; we stub out (we do implement this in ns-win.el) */
-int
-XParseGeometry (char *string, int *x, int *y,
-                unsigned int *width, unsigned int *height)
-{
-  message1 ("Warning: XParseGeometry not supported under NS.\n");
-  return 0;
-}
-
-
 /* TODO: move to nsterm? */
 int
 ns_lisp_to_cursor_type (Lisp_Object arg)
@@ -1399,6 +1389,9 @@
 
   UNGCPRO;
 
+  if (window_prompting & USPosition)
+    x_set_offset (f, f->left_pos, f->top_pos, 1);
+
   /* Make sure windows on this frame appear in calls to next-window
      and similar functions.  */
   Vwindow_list = Qnil;

=== modified file 'src/w32xfns.c'
--- a/src/w32xfns.c     2012-09-15 08:03:11 +0000
+++ b/src/w32xfns.c     2012-09-19 06:47:01 +0000
@@ -303,138 +303,6 @@
     }
 }
 
-
-/*
- *    XParseGeometry parses strings of the form
- *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
- *   width, height, xoffset, and yoffset are unsigned integers.
- *   Example:  "=80x24+300-49"
- *   The equal sign is optional.
- *   It returns a bitmask that indicates which of the four values
- *   were actually found in the string.  For each value found,
- *   the corresponding argument is updated;  for each value
- *   not found, the corresponding argument is left unchanged.
- */
-
-static int
-read_integer (register char *string, char **NextString)
-{
-  register int Result = 0;
-  int Sign = 1;
-
-  if (*string == '+')
-    string++;
-  else if (*string == '-')
-    {
-      string++;
-      Sign = -1;
-    }
-  for (; (*string >= '0') && (*string <= '9'); string++)
-    {
-      Result = (Result * 10) + (*string - '0');
-    }
-  *NextString = string;
-  if (Sign >= 0)
-    return (Result);
-  else
-    return (-Result);
-}
-
-int
-XParseGeometry (char *string,
-               int *x, int *y,
-               unsigned int *width, unsigned int *height)
-{
-  int mask = NoValue;
-  register char *strind;
-  unsigned int tempWidth, tempHeight;
-  int tempX, tempY;
-  char *nextCharacter;
-
-  if ((string == NULL) || (*string == '\0')) return (mask);
-  if (*string == '=')
-    string++;  /* ignore possible '=' at beg of geometry spec */
-
-  strind = (char *)string;
-  if (*strind != '+' && *strind != '-' && *strind != 'x')
-    {
-      tempWidth = read_integer (strind, &nextCharacter);
-      if (strind == nextCharacter)
-       return (0);
-      strind = nextCharacter;
-      mask |= WidthValue;
-    }
-
-  if (*strind == 'x' || *strind == 'X')
-    {
-      strind++;
-      tempHeight = read_integer (strind, &nextCharacter);
-      if (strind == nextCharacter)
-       return (0);
-      strind = nextCharacter;
-      mask |= HeightValue;
-    }
-
-  if ((*strind == '+') || (*strind == '-'))
-    {
-      if (*strind == '-')
-       {
-         strind++;
-         tempX = -read_integer (strind, &nextCharacter);
-         if (strind == nextCharacter)
-           return (0);
-         strind = nextCharacter;
-         mask |= XNegative;
-
-       }
-      else
-       {
-         strind++;
-         tempX = read_integer (strind, &nextCharacter);
-         if (strind == nextCharacter)
-           return (0);
-         strind = nextCharacter;
-       }
-      mask |= XValue;
-      if ((*strind == '+') || (*strind == '-'))
-       {
-         if (*strind == '-')
-           {
-             strind++;
-             tempY = -read_integer (strind, &nextCharacter);
-             if (strind == nextCharacter)
-               return (0);
-             strind = nextCharacter;
-             mask |= YNegative;
-           }
-         else
-           {
-             strind++;
-             tempY = read_integer (strind, &nextCharacter);
-             if (strind == nextCharacter)
-               return (0);
-             strind = nextCharacter;
-           }
-         mask |= YValue;
-       }
-    }
-
-  /* If strind isn't at the end of the string then it's an invalid
-     geometry specification. */
-
-  if (*strind != '\0') return (0);
-
-  if (mask & XValue)
-    *x = tempX;
-  if (mask & YValue)
-    *y = tempY;
-  if (mask & WidthValue)
-    *width = tempWidth;
-  if (mask & HeightValue)
-    *height = tempHeight;
-  return (mask);
-}
-
 /* x_sync is a no-op on W32.  */
 void
 x_sync (struct frame *f)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]