changeset 641:78a0b78aa6de

*** empty log message ***
author Joseph Arceneaux <jla@gnu.org>
date Tue, 12 May 1992 02:31:53 +0000
parents 36e7f4e402bd
children b0ddc138b0b5
files src/=xselect.c.old src/xfns.c
diffstat 2 files changed, 218 insertions(+), 195 deletions(-) [+]
line wrap: on
line diff
--- a/src/=xselect.c.old	Mon May 11 19:59:33 1992 +0000
+++ b/src/=xselect.c.old	Tue May 12 02:31:53 1992 +0000
@@ -20,19 +20,17 @@
 #include "config.h"
 #include "lisp.h"
 #include "xterm.h"
+#include "buffer.h"
 #include "screen.h"
 
 #ifdef HAVE_X11
 
 /* Macros for X Selections */
-#define MAX_SELECTION(dpy) (((dpy)->max_request_size << 3) - 100)
-#define SELECTION_LENGTH(len,format) ((len) * ((format) >> 3))
+#define MAX_SELECTION(dpy) (((dpy)->max_request_size << 2) - 100)
+#define SELECTION_LENGTH(len,format) ((len) * ((format) >> 2))
 
-/* From keyboard.c.  This is almost always the right timestamp for
-   ownership arbitration, since the last event was either the
-   keystroke bound to the command now running, or something else read
-   by that command.  */
-extern unsigned long last_event_timestamp;
+/* The last 23 bits of the timestamp of the last mouse button event. */
+extern Time mouse_timestamp;
 
 /* t if a mouse button is depressed. */
 extern Lisp_Object Vmouse_grabbed;
@@ -40,6 +38,9 @@
 /* When emacs became the PRIMARY selection owner. */
 Time x_begin_selection_own;
 
+/* When emacs became the SECONDARY selection owner. */
+Time x_begin_secondary_selection_own;
+
 /* When emacs became the CLIPBOARD selection owner. */
 Time x_begin_clipboard_own;
 
@@ -49,8 +50,15 @@
 /* The value of the current PRIMARY selection. */
 Lisp_Object Vx_selection_value;
 
-/* Emacs' selection property identifier. */
+/* The value of the current SECONDARY selection. */
+Lisp_Object Vx_secondary_selection_value;
+
+/* Types of selections we may make. */
+Lisp_Object Qprimary, Qsecondary, Qclipboard;
+
+/* Emacs' selection property identifiers. */
 Atom Xatom_emacs_selection;
+Atom Xatom_emacs_secondary_selection;
 
 /* Clipboard selection atom. */
 Atom Xatom_clipboard_selection;
@@ -85,6 +93,14 @@
 /* Atom for indicating property type TEXT */
 Atom Xatom_text;
 
+/* Kinds of protocol things we may receive. */
+Atom Xatom_wm_take_focus;
+Atom Xatom_wm_save_yourself;
+Atom Xatom_wm_delete_window;
+
+/* Communication with window managers. */
+Atom Xatom_wm_protocols;
+
 /* These are to handle incremental selection transfer. */
 Window incr_requestor;
 Atom incr_property;
@@ -94,81 +110,82 @@
 
 /* SELECTION OWNER CODE */
 
+
+/* Request selection ownership if we do not already have it. */
+
+static int
+own_selection (selection_type, time)
+     Atom selection_type;
+     Time time;
+{
+  Window owner_window, selecting_window;
+
+  if ((EQ (selection_type, Qprimary) && !NILP (Vx_selection_value))
+      || ((EQ (selection_type, Qsecondary)) && !NILP (Vx_secondary_selection_value))
+      || ((EQ (selection_type, Qclipboard)) && !NILP (Vx_clipboard_value)))
+    return 1;
+
+  selecting_window = selected_screen->display.x->window_desc;
+  XSetSelectionOwner (x_current_display, selection_type,
+		      selecting_window, time);
+  owner_window = XGetSelectionOwner (x_current_display, selection_type);
+
+  if (owner_window != selecting_window)
+    return 0;
+
+  return 1;
+}
+
 /* Become the selection owner and make our data the selection value.
    If we are already the owner, merely change data and timestamp values.
    This avoids generating SelectionClear events for ourselves. */
 
 DEFUN ("x-own-selection", Fx_own_selection, Sx_own_selection,
-  1, 1, "sStore text for pasting: ",
-  "Stores string STRING for pasting in another X window.\n\
-This is done with the X11 selection mechanism.")
-  (string)
-     register Lisp_Object string;
+  1, 2, "",
+  "Make STRING the selection value.  Default is the primary selection,\n\
+but optional second argument TYPE may specify secondary or clipboard.")
+  (string, type)
+     register Lisp_Object string, type;
 {
-  Window owner_window, selecting_window;
-  Time event_time;
-
+  Atom selection_type;
+  Lisp_Object val;
+  Time event_time = mouse_timestamp;
   CHECK_STRING (string, 0);
 
-  BLOCK_INPUT;
-  selecting_window = selected_screen->display.x->window_desc;
-
-  if (EQ (Qnil, Vx_selection_value)) /* We are not the owner. */
+  if (NILP (type) || EQ (type, Qprimary))
     {
-      event_time = last_event_timestamp;
-      XSetSelectionOwner (x_current_display, XA_PRIMARY,
-			  selecting_window,  event_time);
-      owner_window = XGetSelectionOwner (x_current_display, XA_PRIMARY);
-
-      if (owner_window != selecting_window)
+      BLOCK_INPUT;
+      if (own_selection (XA_PRIMARY, event_time))
+	{
+	  x_begin_selection_own = event_time;
+	  val = Vx_selection_value = string;
+	}
+      UNBLOCK_INPUT;
+    }
+  else if (EQ (type, Qsecondary))
+    {
+      BLOCK_INPUT;
+      if (own_selection (XA_SECONDARY, event_time))
 	{
-	  UNBLOCK_INPUT;
-	  error ("X error: could not acquire selection ownership");
+	  x_begin_secondary_selection_own = event_time;
+	  val = Vx_secondary_selection_value = string;
 	}
+      UNBLOCK_INPUT;
     }
-
-  x_begin_selection_own = event_time;
-  Vx_selection_value = string;
-  UNBLOCK_INPUT;
-
-  return Qnil;
-}
-
-/* CLIPBOARD OWNERSHIP */
+  else if (EQ (type, Qclipboard))
+    {
+      BLOCK_INPUT;
+      if (own_selection (Xatom_clipboard, event_time))
+	{
+	  x_begin_clipboard_own = event_time;
+	  val = Vx_clipboard_value = string;
+	}
+      UNBLOCK_INPUT;
+    }
+  else
+    error ("Invalid X selection type");
 
-DEFUN ("x-own-clipboard", Fx_own_clipboard, Sx_own_clipboard,
-  1, 1, "sCLIPBOARD string: ",
-  "Assert X clipboard ownership with value STRING.")
-  (string)
-     register Lisp_Object string;
-{
-  Window owner_window, selecting_window;
-  Time event_time;
-
-  CHECK_STRING (string, 0);
-
-  BLOCK_INPUT;
-  selecting_window = selected_screen->display.x->window_desc;
-
-  if (EQ (Qnil, Vx_clipboard_value))
-    {
-      event_time = last_event_timestamp;
-      XSetSelectionOwner (x_current_display, Xatom_clipboard,
-			  selecting_window,  event_time);
-      owner_window = XGetSelectionOwner (x_current_display, Xatom_clipboard);
-
-      if (owner_window != selecting_window)
-	{
-	  UNBLOCK_INPUT;
-	  error ("X error: could not acquire selection ownership");
-	}
-    }
-
-  x_begin_clipboard_own = event_time;
-  Vx_clipboard_value = string;
-  UNBLOCK_INPUT;
-
-  return Qnil;
+  return val;
 }
 
 /* Clear our selection ownership data, as some other client has
@@ -189,6 +206,11 @@
 	  x_begin_selection_own = 0;
 	  Vx_selection_value = Qnil;
 	}
+      else if (selection == XA_SECONDARY)
+	{
+	  x_begin_secondary_selection_own = 0;
+	  Vx_secondary_selection_value = Qnil;
+	}
       else if (selection == Xatom_clipboard)
 	{
 	  x_begin_clipboard_own = 0;
@@ -234,6 +256,11 @@
       emacs_own_time = x_begin_selection_own;
       selection_value = Vx_selection_value;
     }
+  else if (event.selection == XA_SECONDARY)
+    {
+      emacs_own_time = x_begin_secondary_selection_own;
+      selection_value = Vx_secondary_selection_value;
+    }
   else if (event.selection == Xatom_clipboard)
     {
       emacs_own_time = x_begin_clipboard_own;
@@ -264,7 +291,7 @@
       unsigned char *data;
       int result, i;
 
-      if (event.property == 0	/* 0 == NULL */
+      if (event.property == 0	/* 0 == NILP */
 	  || event.property == None)
 	return;
 
@@ -291,7 +318,7 @@
       format = 32;
       XChangeProperty (evt.display, evt.requestor, evt.property,
 		       evt.target, format, PropModeReplace,
-		       (unsigned char *) &emacs_own_time, format);
+		       (unsigned char *) &emacs_own_time, 1);
       return;
     }
   else if (event.target == Xatom_delete)      /* Delete our selection. */
@@ -301,7 +328,7 @@
 
       x_disown_selection (event.owner, event.selection, event.time);
 
-      /* Now return property of type NULL, length 0. */
+      /* Now return property of type NILP, length 0. */
       XChangeProperty (event.display, event.requestor, event.property,
 		       0, format, PropModeReplace, (unsigned char *) 0, 0);
       return;
@@ -337,6 +364,8 @@
 	{
 	  if (event.selection == Xatom_emacs_selection)
 	    Vx_selection_value = make_string (data);
+	  else if (event.selection == Xatom_emacs_secondary_selection)
+	    Vx_secondary_selection_value = make_string (data);
 	  else if (event.selection == Xatom_clipboard_selection)
 	    Vx_clipboard_value = make_string (data);
 	  else
@@ -473,27 +502,22 @@
   return False;
 }
 
-/* Request the selection value from the owner.  If we are the owner,
-   simply return our selection value.  If we are not the owner, this
-   will block until all of the data has arrived. */
+/* Request a selection value from its owner.  This will block until
+   all the data is arrived. */
 
-DEFUN ("x-get-selection", Fx_get_selection, Sx_get_selection, 0, 0, 0,
-  "Return text selected from some X window.\n\
-This is done with the X11 selection mechanism.")
-  ()
+static Lisp_Object
+get_selection_value (type)
+     Atom type;
 {
   XEvent event;
   Lisp_Object val;
   Time requestor_time;		/* Timestamp of selection request. */
   Window requestor_window;
 
-  if (!EQ (Qnil, Vx_selection_value)) /* We are the owner */
-    return Vx_selection_value;
-
   BLOCK_INPUT;
-  requestor_time = last_event_timestamp;
+  requestor_time = mouse_timestamp;
   requestor_window = selected_screen->display.x->window_desc;
-  XConvertSelection (x_current_display, XA_PRIMARY, XA_STRING,
+  XConvertSelection (x_current_display, type, XA_STRING,
 		     Xatom_emacs_selection, requestor_window, requestor_time);
   XIfEvent (x_current_display,
 	    &event,
@@ -505,36 +529,42 @@
   return val;
 }
 
-/* Request the clipboard contents from its owner.  If we are the owner,
-   simply return the clipboard string. */
+/* Request a selection value from the owner.  If we are the owner,
+   simply return our selection value.  If we are not the owner, this
+   will block until all of the data has arrived. */
 
-DEFUN ("x-get-clipboard", Fx_get_clipboard, Sx_get_clipboard, 0, 0, 0,
-  "Return text pasted to the clipboard.\n\
-This is done with the X11 selection mechanism.")
-  ()
+DEFUN ("x-selection-value", Fx_selection_value, Sx_selection_value,
+  0, 1, "",
+  "Return the value of one of the selections.  Default is the primary\n\
+selection, but optional argument TYPE may specify secondary or clipboard.")
+  (type)
+     register Lisp_Object type;
 {
-  XEvent event;
-  Lisp_Object val;
-  Time requestor_time;		/* Timestamp of selection request. */
-  Window requestor_window;
+  Atom selection_type;
+
+  if (NILP (type) || EQ (type, Qprimary))
+    {
+      if (!NILP (Vx_selection_value))
+	return Vx_selection_value;
 
-  if (!EQ (Qnil, Vx_clipboard_value)) /* We are the owner */
-    return Vx_selection_value;
+      return get_selection_value (XA_PRIMARY);
+    }
+  else if (EQ (type, Qsecondary))
+    {
+      if (!NILP (Vx_secondary_selection_value))
+	return Vx_secondary_selection_value;
 
-  BLOCK_INPUT;
-  requestor_time = last_event_timestamp;
-  requestor_window = selected_screen->display.x->window_desc;
-  XConvertSelection (x_current_display, Xatom_clipboard, XA_STRING,
-		     Xatom_clipboard_selection,
-		     requestor_window, requestor_time);
-  XIfEvent (x_current_display,
-	    &event,
-	    XCheckSelectionEvent,
-	    (char *) requestor_window);
-  val = x_selection_arrival (&event, requestor_window, requestor_time);
-  UNBLOCK_INPUT;
+      return get_selection_value (XA_SECONDARY);
+    }
+  else if (EQ (type, Qclipboard))
+    {
+      if (!NILP (Vx_clipboard_value))
+	return Vx_clipboard_value;
 
-  return val;
+      return get_selection_value (Xatom_clipboard);
+    }
+  else
+    error ("Invalid X selection type");
 }
 
 Lisp_Object
@@ -553,6 +583,8 @@
 
   if (event->selection == XA_PRIMARY)
     selection = Xatom_emacs_selection;
+  else if (event->selection == XA_SECONDARY)
+    selection = Xatom_emacs_secondary_selection;
   else if (event->selection == Xatom_clipboard)
     selection = Xatom_clipboard_selection;
   else
@@ -568,8 +600,7 @@
 
 	do
 	  {
-	    result = XGetWindowProperty (x_current_display,
-					 requestor_window,
+	    result = XGetWindowProperty (x_current_display, requestor_window,
 					 event->property, 0L,
 					 10000000L, True, XA_STRING,
 					 &type, &format, &items,
@@ -656,13 +687,22 @@
 	       "The value of emacs' last cut-string.");
   Vx_selection_value = Qnil;
 
+  DEFVAR_LISP ("x-secondary-selection-value", &Vx_secondary_selection_value,
+	       "The value of emacs' last secondary cut-string.");
+  Vx_secondary_selection_value = Qnil;
+
   DEFVAR_LISP ("x-clipboard-value", &Vx_clipboard_value,
 	       "The string emacs last sent to the clipboard.");
   Vx_clipboard_value = Qnil;
 
+  Qprimary = intern ("primary");
+  staticpro (&Qprimary);
+  Qsecondary = intern ("secondary");
+  staticpro (&Qsecondary);
+  Qclipboard = intern ("clipboard");
+  staticpro (&Qclipboard);
+
   defsubr (&Sx_own_selection);
-  defsubr (&Sx_get_selection);
-  defsubr (&Sx_own_clipboard);
-  defsubr (&Sx_get_clipboard);
+  defsubr (&Sx_selection_value);
 }
 #endif	/* X11 */
--- a/src/xfns.c	Mon May 11 19:59:33 1992 +0000
+++ b/src/xfns.c	Tue May 12 02:31:53 1992 +0000
@@ -1,11 +1,11 @@
 /* Functions for the X window system.
-   Copyright (C) 1989, 1992 Free Software Foundation.
+   Copyright (C) 1989 Free Software Foundation.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 1, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -50,10 +50,6 @@
 /* The class of this X application.  */
 #define EMACS_CLASS "Emacs"
 
-/* The class of Emacs screens.  */
-#define SCREEN_CLASS "Screen"
-Lisp_Object screen_class;
-
 /* Title name and application name for X stuff. */
 extern char *x_id_name;
 extern Lisp_Object invocation_name;
@@ -166,6 +162,18 @@
 /* Atom for indicating property type TEXT */
 extern Atom Xatom_text;
 
+/* Communication with window managers. */
+extern Atom Xatom_wm_protocols;
+
+/* Kinds of protocol things we may receive. */
+extern Atom Xatom_wm_take_focus;
+extern Atom Xatom_wm_save_yourself;
+extern Atom Xatom_wm_delete_window;
+
+/* Other WM communication */
+Atom Xatom_wm_configure_denied;	  /* When our config request is denied */
+Atom Xatom_wm_window_moved;	  /* When the WM moves us. */
+
 #else	/* X10 */
 
 /* Default size of an Emacs window without scroll bar.  */
@@ -1395,16 +1403,15 @@
 /* Return the value of parameter PARAM.
 
    First search ALIST, then Vdefault_screen_alist, then the X defaults
-   database, using SCREEN_NAME as the subcomponent of emacs and
-   ATTRIBUTE as the attribute name.
+   database, using ATTRIBUTE as the attribute name.
 
    Convert the resource to the type specified by desired_type.
 
    If no default is specified, return nil.  */
 
 static Lisp_Object
-x_get_arg (alist, param, screen_name, attribute, type)
-     Lisp_Object alist, param, screen_name;
+x_get_arg (alist, param, attribute, type)
+     Lisp_Object alist, param;
      char *attribute;
      enum resource_types type;
 {
@@ -1415,42 +1422,7 @@
     tem = Fassq (param, Vdefault_screen_alist);
   if (EQ (tem, Qnil) && attribute)
     {
-      Lisp_Object sterile_name;
-
-      /* Build a version of screen name that is safe to use as a
-	 component name.  */
-      if (XTYPE (screen_name) == Lisp_String)
-	{
-	  int i;
-
-	  sterile_name = make_uninit_string (XSTRING (screen_name)->size);
-	  for (i = 0; i < XSTRING (screen_name)->size; i++)
-	    {
-	      int c = XSTRING (screen_name)->data[i];
-
-	      switch (c)
-		{
-		case ':':
-		case '.':
-		case '*':
-		case ' ':
-		case '\t':
-		case '\n':
-		  c = '_';
-		  break;
-		default:
-		  break;
-		}
-
-	      XSTRING (sterile_name)->data[i] = c;
-	    }
-	}
-      else
-	sterile_name = Qnil;
-
-      tem = Fx_get_resource (build_string (attribute),
-			     sterile_name,
-			     (NILP (sterile_name) ? Qnil : screen_class));
+      tem = Fx_get_resource (build_string (attribute), Qnil, Qnil);
 
       if (NILP (tem))
 	return Qnil;
@@ -1496,7 +1468,7 @@
   Lisp_Object propsym = intern (propname);
   Lisp_Object tem;
 
-  tem = x_get_arg (alist, propsym, s->name, xprop, type);
+  tem = x_get_arg (alist, propsym, xprop, type);
   if (EQ (tem, Qnil))
     tem = deflt;
   store_screen_param (s, propsym, tem);
@@ -1583,8 +1555,8 @@
   s->display.x->top_pos = 1;
   s->display.x->left_pos = 1;
 
-  tem0 = x_get_arg (parms, intern ("height"), s->name, 0, 0);
-  tem1 = x_get_arg (parms, intern ("width"), s->name, 0, 0);
+  tem0 = x_get_arg (parms, intern ("height"), 0, 0);
+  tem1 = x_get_arg (parms, intern ("width"), 0, 0);
   if (! EQ (tem0, Qnil) && ! EQ (tem1, Qnil))
     {
       CHECK_NUMBER (tem0, 0);
@@ -1601,8 +1573,8 @@
   s->display.x->pixel_height = (FONT_HEIGHT (s->display.x->font) * s->height
 				+ 2 * s->display.x->internal_border_width);
 
-  tem0 = x_get_arg (parms, intern ("top"), s->name, 0, 0);
-  tem1 = x_get_arg (parms, intern ("left"), s->name, 0, 0);
+  tem0 = x_get_arg (parms, intern ("top"), 0, 0);
+  tem1 = x_get_arg (parms, intern ("left"), 0, 0);
   if (! EQ (tem0, Qnil) && ! EQ (tem1, Qnil))
     {
       CHECK_NUMBER (tem0, 0);
@@ -1701,8 +1673,8 @@
 
   /* Set the position of the icon.  Note that twm groups all
      icons in an icon window. */
-  tem0 = x_get_arg (parms, intern ("icon-left"), s->name, 0, 0);
-  tem1 = x_get_arg (parms, intern ("icon-top"), s->name, 0, 0);
+  tem0 = x_get_arg (parms, intern ("icon-left"), 0, 0);
+  tem1 = x_get_arg (parms, intern ("icon-top"), 0, 0);
   if (!EQ (tem0, Qnil) && !EQ (tem1, Qnil))
     {
       CHECK_NUMBER (tem0, 0);
@@ -1719,7 +1691,7 @@
     }
 
   /* Start up iconic or window? */
-  tem0 = x_get_arg (parms, intern ("iconic-startup"), s->name, 0, 0);
+  tem0 = x_get_arg (parms, intern ("iconic-startup"), 0, 0);
   if (!EQ (tem0, Qnil))
     hints.initial_state = IconicState;
   else
@@ -1843,13 +1815,13 @@
   if (x_current_display == 0)
     error ("X windows are not in use or not initialized");
 
-  name = x_get_arg (parms, intern ("name"), Qnil, "Title", string);
+  name = x_get_arg (parms, intern ("name"), "Title", string);
   if (NILP (name))
     name = build_string (x_id_name);
   if (XTYPE (name) != Lisp_String)
     error ("x-create-screen: name parameter must be a string");
 
-  tem = x_get_arg (parms, intern ("minibuffer"), name, 0, 0);
+  tem = x_get_arg (parms, intern ("minibuffer"), 0, 0);
   if (EQ (tem, intern ("none")))
     s = make_screen_without_minibuffer (Qnil);
   else if (EQ (tem, intern ("only")))
@@ -1915,7 +1887,7 @@
   x_wm_set_size_hint (s, window_prompting);
   UNBLOCK_INPUT;
 
-  tem = x_get_arg (parms, intern ("unsplittable"), name, 0, 0);
+  tem = x_get_arg (parms, intern ("unsplittable"), 0, 0);
   s->no_split = minibuffer_only || EQ (tem, Qt);
 
   /* Now handle the rest of the parameters. */
@@ -1925,7 +1897,7 @@
 		       Qnil, "?VScrollBar", string);
 
   /* Make the window appear on the screen and enable display.  */
-  if (!EQ (x_get_arg (parms, intern ("suppress-initial-map"), name, 0, 0), Qt))
+  if (!EQ (x_get_arg (parms, intern ("suppress-initial-map"), 0, 0), Qt))
     x_make_screen_visible (s);
 
   return screen;
@@ -1946,7 +1918,7 @@
 
   name = Fassq (intern ("name"), parms);
 
-  tem = x_get_arg (parms, intern ("minibuffer"), name, 0, 0);
+  tem = x_get_arg (parms, intern ("minibuffer"), 0, 0);
   if (EQ (tem, intern ("none")))
     s = make_screen_without_minibuffer (Qnil);
   else if (EQ (tem, intern ("only")))
@@ -1983,7 +1955,7 @@
   /* Extract some window parameters from the supplied values.
      These are the parameters that affect window geometry.  */
 
-  tem = x_get_arg (parms, intern ("font"), name, "BodyFont", string);
+  tem = x_get_arg (parms, intern ("font"), "BodyFont", string);
   if (EQ (tem, Qnil))
     tem = build_string ("9x15");
   x_set_font (s, tem);
@@ -2004,13 +1976,13 @@
   x_default_parameter (s, parms, "auto-raise",
 		       Qnil, "AutoRaise", boolean);
 
-  hscroll = x_get_arg (parms, intern ("horizontal-scroll-bar"), name, 0, 0);
-  vscroll = x_get_arg (parms, intern ("vertical-scroll-bar"), name, 0, 0);
+  hscroll = x_get_arg (parms, intern ("horizontal-scroll-bar"), 0, 0);
+  vscroll = x_get_arg (parms, intern ("vertical-scroll-bar"), 0, 0);
 
   if (s->display.x->internal_border_width < 0)
     s->display.x->internal_border_width = 0;
 
-  tem = x_get_arg (parms, intern ("window-id"), name, 0, 0);
+  tem = x_get_arg (parms, intern ("window-id"), 0, 0);
   if (!EQ (tem, Qnil))
     {
       WINDOWINFO_TYPE wininfo;
@@ -2038,29 +2010,29 @@
     }
   else
     {
-      tem = x_get_arg (parms, intern ("parent-id"), name, 0, 0);
+      tem = x_get_arg (parms, intern ("parent-id"), 0, 0);
       if (!EQ (tem, Qnil))
 	{
 	  CHECK_STRING (tem, 0);
 	  parent = (Window) atoi (XSTRING (tem)->data);
 	}
       s->display.x->parent_desc = parent;
-      tem = x_get_arg (parms, intern ("height"), name, 0, 0);
+      tem = x_get_arg (parms, intern ("height"), 0, 0);
       if (EQ (tem, Qnil))
 	{
-	  tem = x_get_arg (parms, intern ("width"), name, 0, 0);
+	  tem = x_get_arg (parms, intern ("width"), 0, 0);
 	  if (EQ (tem, Qnil))
 	    {
-	      tem = x_get_arg (parms, intern ("top"), name, 0, 0);
+	      tem = x_get_arg (parms, intern ("top"), 0, 0);
 	      if (EQ (tem, Qnil))
-		tem = x_get_arg (parms, intern ("left"), name, 0, 0);
+		tem = x_get_arg (parms, intern ("left"), 0, 0);
 	    }
 	}
       /* Now TEM is nil if no edge or size was specified.
 	 In that case, we must do rubber-banding.  */
       if (EQ (tem, Qnil))
 	{
-	  tem = x_get_arg (parms, intern ("geometry"), name, 0, 0);
+	  tem = x_get_arg (parms, intern ("geometry"), 0, 0);
 	  x_rubber_band (s,
 			 &s->display.x->left_pos, &s->display.x->top_pos,
 			 &width, &height,
@@ -2073,25 +2045,25 @@
 	{
 	  /* Here if at least one edge or size was specified.
 	     Demand that they all were specified, and use them.  */
-	  tem = x_get_arg (parms, intern ("height"), name, 0, 0);
+	  tem = x_get_arg (parms, intern ("height"), 0, 0);
 	  if (EQ (tem, Qnil))
 	    error ("Height not specified");
 	  CHECK_NUMBER (tem, 0);
 	  height = XINT (tem);
 
-	  tem = x_get_arg (parms, intern ("width"), name, 0, 0);
+	  tem = x_get_arg (parms, intern ("width"), 0, 0);
 	  if (EQ (tem, Qnil))
 	    error ("Width not specified");
 	  CHECK_NUMBER (tem, 0);
 	  width = XINT (tem);
 
-	  tem = x_get_arg (parms, intern ("top"), name, 0, 0);
+	  tem = x_get_arg (parms, intern ("top"), 0, 0);
 	  if (EQ (tem, Qnil))
 	    error ("Top position not specified");
 	  CHECK_NUMBER (tem, 0);
 	  s->display.x->left_pos = XINT (tem);
 
-	  tem = x_get_arg (parms, intern ("left"), name, 0, 0);
+	  tem = x_get_arg (parms, intern ("left"), 0, 0);
 	  if (EQ (tem, Qnil))
 	    error ("Left position not specified");
 	  CHECK_NUMBER (tem, 0);
@@ -2132,11 +2104,11 @@
   XStoreName (XDISPLAY s->display.x->window_desc, XSTRING (s->name)->data);
   /* Now override the defaults with all the rest of the specified
      parms.  */
-  tem = x_get_arg (parms, intern ("unsplittable"), name, 0, 0);
+  tem = x_get_arg (parms, intern ("unsplittable"), 0, 0);
   s->no_split = minibuffer_only || EQ (tem, Qt);
 
   /* Do not create an icon window if the caller says not to */
-  if (!EQ (x_get_arg (parms, intern ("suppress-icon"), name, 0, 0), Qt)
+  if (!EQ (x_get_arg (parms, intern ("suppress-icon"), 0, 0), Qt)
       || s->display.x->parent_desc != ROOT_WINDOW)
     {
       x_text_icon (s, iconidentity);
@@ -2166,7 +2138,7 @@
 
   /* Make the window appear on the screen and enable display.  */
 
-  if (!EQ (x_get_arg (parms, intern ("suppress-initial-map"), name, 0, 0), Qt))
+  if (!EQ (x_get_arg (parms, intern ("suppress-initial-map"), 0, 0), Qt))
     x_make_window_visible (s);
   SCREEN_GARBAGED (s);
 
@@ -3950,8 +3922,7 @@
      register Lisp_Object newstring;
 {
   char *rawstring;
-  register KeySym keysym;
-  KeySym modifier_list[16];
+  register KeySym keysym, modifier_list[16];
 
   CHECK_STRING (x_keysym, 1);
   CHECK_STRING (newstring, 3);
@@ -4241,6 +4212,20 @@
 					False);
   Xatom_text =             XInternAtom (x_current_display, "TEXT",
 					False);
+  Xatom_wm_protocols =     XInternAtom (x_current_display, "WM_PROTOCOLS",
+					False);
+  Xatom_wm_take_focus =    XInternAtom (x_current_display, "WM_TAKE_FOCUS",
+					False);
+  Xatom_wm_save_yourself = XInternAtom (x_current_display, "WM_SAVE_YOURSELF",
+					False);
+  Xatom_wm_delete_window = XInternAtom (x_current_display, "WM_DELETE_WINDOW",
+					False);
+  Xatom_wm_change_state =  XInternAtom (x_current_display, "WM_CHANGE_STATE",
+					False);
+  Xatom_wm_configure_denied =  XInternAtom (x_current_display,
+					    "WM_CONFIGURE_DENIED", False);
+  Xatom_wm_window_moved =  XInternAtom (x_current_display, "WM_MOVED",
+					False);
   UNBLOCK_INPUT;
 #else /* not HAVE_X11 */
   XFASTINT (Vwindow_system_version) = 10;
@@ -4297,8 +4282,6 @@
   Fput (Qundefined_color, Qerror_message,
 	build_string ("Undefined color"));
 
-  screen_class = make_pure_string (SCREEN_CLASS, sizeof (SCREEN_CLASS)-1);
-
   DEFVAR_INT ("mouse-x-position", &x_mouse_x,
 	      "The X coordinate of the mouse position, in characters.");
   x_mouse_x = Qnil;