changeset 2999:33c820044087

(check_x): New function. Call it in almost every Lisp function in this file. (x_set_menu_bar_lines_1): Pass both args in recursive call.
author Richard M. Stallman <rms@gnu.org>
date Mon, 24 May 1993 00:04:18 +0000
parents 885e08ef0577
children 0fdd43a27e15
files src/xfns.c
diffstat 1 files changed, 38 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Mon May 24 00:03:08 1993 +0000
+++ b/src/xfns.c	Mon May 24 00:04:18 1993 +0000
@@ -195,6 +195,14 @@
 /* Points to table of defined typefaces.  */
 struct face *x_face_table[MAX_FACES_AND_GLYPHS];
 
+/* Error if we are not connected to X.  */
+static void
+check_x ()
+{
+  if (x_current_display == 0)
+    error ("X windows are not in use or not initialized");
+}
+
 /* Return the Emacs frame-object corresponding to an X window.
    It could be the frame's main window or an icon window.  */
 
@@ -880,13 +888,13 @@
     {
       struct window *w = XWINDOW (window);
 
-      w->top += n;
+      XFASTINT (w->top) += n;
 
       if (!NILP (w->vchild))
-	x_set_menu_bar_lines_1 (w->vchild);
+	x_set_menu_bar_lines_1 (w->vchild, n);
 
       if (!NILP (w->hchild))
-	x_set_menu_bar_lines_1 (w->hchild);
+	x_set_menu_bar_lines_1 (w->hchild, n);
     }
 }
 
@@ -1296,6 +1304,8 @@
   char *name_key;
   char *class_key;
 
+  check_x ();
+
   CHECK_STRING (attribute, 0);
   CHECK_STRING (class, 0);
 
@@ -1503,6 +1513,7 @@
   unsigned int width, height;
   Lisp_Object values[4];
 
+  check_x ();
   CHECK_STRING (string, 0);
 
   geometry = XParseGeometry ((char *) XSTRING (string)->data,
@@ -1833,8 +1844,7 @@
   long window_prompting = 0;
   int width, height;
 
-  if (x_current_display == 0)
-    error ("X windows are not in use or not initialized");
+  check_x ();
 
   name = x_get_arg (parms, Qname, "title", "Title", string);
   if (XTYPE (name) != Lisp_String
@@ -2321,6 +2331,7 @@
 {
   Color foo;
   
+  check_x ();
   CHECK_STRING (color, 0);
 
   if (defined_color (XSTRING (color)->data, &foo))
@@ -2333,6 +2344,8 @@
   "Return t if the X screen currently in use supports color.")
   ()
 {
+  check_x ();
+
   if (x_screen_planes <= 2)
     return Qnil;
 
@@ -2356,6 +2369,7 @@
      Lisp_Object frame;
 {
   Display *dpy = x_current_display;
+  check_x ();
   return make_number (DisplayWidth (dpy, DefaultScreen (dpy)));
 }
 
@@ -2366,6 +2380,7 @@
      Lisp_Object frame;
 {
   Display *dpy = x_current_display;
+  check_x ();
   return make_number (DisplayHeight (dpy, DefaultScreen (dpy)));
 }
 
@@ -2376,6 +2391,7 @@
      Lisp_Object frame;
 {
   Display *dpy = x_current_display;
+  check_x ();
   return make_number (DisplayPlanes (dpy, DefaultScreen (dpy)));
 }
 
@@ -2386,6 +2402,7 @@
      Lisp_Object frame;
 {
   Display *dpy = x_current_display;
+  check_x ();
   return make_number (DisplayCells (dpy, DefaultScreen (dpy)));
 }
 
@@ -2396,6 +2413,7 @@
 {
   Display *dpy = x_current_display;
   char *vendor;
+  check_x ();
   vendor = ServerVendor (dpy);
   if (! vendor) vendor = "";
   return build_string (vendor);
@@ -2410,6 +2428,8 @@
      Lisp_Object frame;
 {
   Display *dpy = x_current_display;
+
+  check_x ();
   return Fcons (make_number (ProtocolVersion (dpy)),
 		Fcons (make_number (ProtocolRevision (dpy)),
 		       Fcons (make_number (VendorRelease (dpy)), Qnil)));
@@ -2420,6 +2440,7 @@
   (frame)
      Lisp_Object frame;
 {
+  check_x ();
   return make_number (ScreenCount (x_current_display));
 }
 
@@ -2428,6 +2449,7 @@
   (frame)
      Lisp_Object frame;
 {
+  check_x ();
   return make_number (HeightMMOfScreen (x_screen));
 }
 
@@ -2436,6 +2458,7 @@
   (frame)
      Lisp_Object frame;
 {
+  check_x ();
   return make_number (WidthMMOfScreen (x_screen));
 }
 
@@ -2446,6 +2469,8 @@
   (frame)
      Lisp_Object frame;
 {
+  check_x ();
+
   switch (DoesBackingStore (x_screen))
     {
     case Always:
@@ -2470,6 +2495,8 @@
 	(screen)
      Lisp_Object screen;
 {
+  check_x ();
+
   switch (screen_visual->class)
     {
     case StaticGray:  return (intern ("static-gray"));
@@ -2489,6 +2516,8 @@
   (frame)
      Lisp_Object frame;
 {
+  check_x ();
+
   if (DoesSaveUnders (x_screen) == True)
     return Qt;
   else
@@ -3374,6 +3403,7 @@
   register KeySym keysym;
   KeySym modifier_list[16];
 
+  check_x ();
   CHECK_STRING (x_keysym, 1);
   CHECK_STRING (newstring, 3);
 
@@ -3425,6 +3455,7 @@
   int strsize;
   register unsigned i;
 
+  check_x ();
   CHECK_NUMBER (keycode, 1);
   CHECK_CONS (strings, 2);
   rawkey = (KeySym) ((unsigned) (XINT (keycode))) & 255;
@@ -3665,6 +3696,8 @@
   (on)
     Lisp_Object on;
 {
+  check_x ();
+
   XSynchronize (x_current_display, !EQ (on, Qnil));
 
   return Qnil;