* lisp/startup.el (command-line-ns-option-alist): Add -g and --geometry.
[bpt/emacs.git] / src / w32xfns.c
index 8fee42d..018dd14 100644 (file)
@@ -1,6 +1,5 @@
-/* Functions taken directly from X sources for use with the Microsoft W32 API.
-   Copyright (C) 1989, 1992, 1993, 1994, 1995, 1999, 2001, 2002, 2003,
-                 2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+/* Functions taken directly from X sources for use with the Microsoft Windows API.
+   Copyright (C) 1989, 1992-1995, 1999, 2001-2012  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -20,7 +19,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <signal.h>
 #include <stdio.h>
-#include <setjmp.h>
 #include "lisp.h"
 #include "keyboard.h"
 #include "frame.h"
@@ -98,7 +96,7 @@ select_palette (FRAME_PTR f, HDC hdc)
   else
     f->output_data.w32->old_palette = NULL;
 
-  if (RealizePalette (hdc))
+  if (RealizePalette (hdc) != GDI_ERROR)
   {
     Lisp_Object frame, framelist;
     FOR_EACH_FRAME (framelist, frame)
@@ -123,7 +121,7 @@ get_frame_dc (FRAME_PTR f)
   HDC hdc;
 
   if (f->output_method != output_w32)
-    abort ();
+    emacs_abort ();
 
   enter_crit ();
 
@@ -189,7 +187,7 @@ get_next_msg (W32Msg * lpmsg, BOOL bWait)
       }
 
       nQueue--;
-      /* Consolidate WM_PAINT messages to optimise redrawing.  */
+      /* Consolidate WM_PAINT messages to optimize redrawing.  */
       if (lpmsg->msg.message == WM_PAINT && nQueue)
         {
           int_msg * lpCur = lpHead;
@@ -305,144 +303,8 @@ drain_message_queue (void)
     }
 }
 
-
-/*
- *    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 the 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 (void *f)
+x_sync (struct frame *f)
 {
 }
-
-/* arch-tag: 4fab3695-4ad3-4cc6-a2b1-fd2c67dc46be
-   (do not change this comment) */