From b9f5361f74ac00e6e62a7970bcaa5e384dc8afdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Sat, 10 Jan 1998 06:10:07 +0100
Subject: [PATCH] * Atom.pmod (InternAtom): Support blocking mode.

Rev: lib/modules/Protocols.pmod/X.pmod/Atom.pmod:1.2
---
 lib/modules/Protocols.pmod/X.pmod/Atom.pmod | 27 ++++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/lib/modules/Protocols.pmod/X.pmod/Atom.pmod b/lib/modules/Protocols.pmod/X.pmod/Atom.pmod
index f941a22f36..6ffbc4d9dc 100644
--- a/lib/modules/Protocols.pmod/X.pmod/Atom.pmod
+++ b/lib/modules/Protocols.pmod/X.pmod/Atom.pmod
@@ -104,9 +104,19 @@ class atom_manager
 
     object req = Requests.InternAtom();
     req->name = name;
-    send_async_request(req, pending_intern(this_object(), atom,
-					   callback)->handle_reply);
-    return 0;
+    if (callback)
+      {
+	send_async_request(req, pending_intern(this_object(), atom,
+					       callback)->handle_reply);
+	return 0;
+      } else {
+	array a = blocking_request(req);
+	if (!a[0])
+	  return 0;
+	atom->id = a[1];
+	remember_atom(atom);
+	return atom;
+      }
   }
 
   object GetAtomName_req(object atom)
@@ -138,5 +148,14 @@ class atom_manager
       }
   }
 
-  void create() { }
+  void create()
+  {
+    for(int i = 1; i<sizeof(_Xlib.predefined_atoms); i++)
+      {
+	object atom = Atom(this_object());
+	atom->id = i;
+	atom->name = _Xlib.predefined_atoms[i];
+	remember_atom(atom);
+      }
+  }
 }
-- 
GitLab