~compiz-team/compiz/0.9.10

1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
1
/*
2
 * Copyright © 2005 Novell, Inc.
3
 *
4
 * Permission to use, copy, modify, distribute, and sell this software
5
 * and its documentation for any purpose is hereby granted without
6
 * fee, provided that the above copyright notice appear in all copies
7
 * and that both that copyright notice and this permission notice
8
 * appear in supporting documentation, and that the name of
9
 * Novell, Inc. not be used in advertising or publicity pertaining to
10
 * distribution of the software without specific, written prior permission.
11
 * Novell, Inc. makes no representations about the suitability of this
12
 * software for any purpose. It is provided "as is" without express or
13
 * implied warranty.
14
 *
15
 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17
 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
 *
23
 * Author: Radek Doulik <rodo@novell.com>
24
 */
25
2908.5.1 by Alan Griffiths
Remove annoying and excessive include dependencies on core/core.h
26
27
#include "core/session.h"
28
#include "core/screen.h"
29
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
30
#ifdef HAVE_CONFIG_H
2099 by Dennis Kasprzyk
Added CMake package generation and fixed compiling
31
#  include <config.h>
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
32
#endif
33
34
#include <stdlib.h>
35
#include <stdio.h>
36
#include <poll.h>
37
#include <unistd.h>
38
#include <fcntl.h>
39
#include <string.h>
2260 by Danny Baumann
SM spec says that SmUserID is a required property.
40
#include <pwd.h>
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
41
#include <X11/SM/SMlib.h>
42
#include <X11/ICE/ICElib.h>
43
1982.1.26 by Dennis Kasprzyk
Cleanup compiz[-core].h
44
#include <boost/bind.hpp>
45
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
46
#define SM_DEBUG(x)
47
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
48
static SmcConn           smcConnection;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
49
static CompWatchFdHandle iceWatchFdHandle;
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
50
static bool              connected    = false;
51
static bool              iceConnected = false;
2248 by Danny Baumann
Improve session API.
52
static char              *smClientId, *smPrevClientId;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
53
54
static void iceInit (void);
55
56
static void
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
57
setStringListProperty (SmcConn    connection,
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
58
		       const char *name,
59
		       const char **values,
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
60
		       int        nValues)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
61
{
62
    SmProp prop, *pProp;
63
64
    prop.name = (char *) name;
1982.1.24 by Dennis Kasprzyk
Moved session related functions/structs into own header and namespace.
65
    prop.type = const_cast<char *> (SmLISTofARRAY8);
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
66
67
    prop.vals = (SmPropValue *) malloc (nValues * sizeof (SmPropValue));
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
68
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
69
    if (!prop.vals)
70
	return;
71
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
72
    for (int i = 0; i < nValues; ++i)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
73
    {
74
	prop.vals[i].value = (char *) values[i];
75
	prop.vals[i].length = strlen (values[i]);
76
    }
77
78
    prop.num_vals = nValues;
79
80
    pProp = &prop;
81
82
    SmcSetProperties (connection, 1, &pProp);
83
84
    free (prop.vals);
85
}
86
87
static void
88
setCloneRestartCommands (SmcConn connection)
89
{
90
    /* at maximum, we pass our old arguments + our new client id
91
       to the SM, so allocate for that case */
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
92
    const char **args = (const char **) malloc ((programArgc + 2) * sizeof (char *));
93
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
94
    if (!args)
95
	return;
96
3473.3.27 by MC Return
Do not create the variable count until we need it
97
    int i, count = 0;
3473.3.26 by MC Return
Fixed compilation (made i an int again and declare i separately)
98
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
99
    for (i = 0; i < programArgc; ++i)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
100
    {
101
	if (strcmp (programArgv[i], "--sm-client-id") == 0)
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
102
	    ++i; /* skip old client id, we'll add the new one later */
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
103
	else if (strcmp (programArgv[i], "--replace") == 0)
104
	    continue; /* there's nothing to replace when starting session */
105
	else
106
	    args[count++] = programArgv[i];
107
    }
108
109
    setStringListProperty (connection, SmCloneCommand, args, count);
110
111
    /* insert new client id at position 1 and 2;
112
       position 0 is the executable name */
113
    for (i = count - 1; i >= 1; i--)
114
	args[i + 2] = args[i];
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
115
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
116
    args[1] = "--sm-client-id";
117
    args[2] = smClientId;
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
118
    count  += 2;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
119
120
    setStringListProperty (connection, SmRestartCommand, args, count);
121
122
    free (args);
123
}
124
125
static void
126
setRestartStyle (SmcConn connection,
127
		 char    hint)
128
{
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
129
    SmProp      prop, *pProp;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
130
    SmPropValue propVal;
131
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
132
    prop.name      = const_cast<char *> (SmRestartStyleHint);
133
    prop.type      = const_cast<char *> (SmCARD8);
134
    prop.num_vals  = 1;
135
    prop.vals      = &propVal;
136
    propVal.value  = &hint;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
137
    propVal.length = 1;
138
139
    pProp = &prop;
140
141
    SmcSetProperties (connection, 1, &pProp);
142
}
143
144
static void
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
145
setProgramInfo (SmcConn connection,
146
		pid_t   pid,
147
		uid_t   uid)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
148
{
2260 by Danny Baumann
SM spec says that SmUserID is a required property.
149
    SmProp        progProp, pidProp, userProp;
150
    SmPropValue   progVal, pidVal, userVal;
151
    SmProp        *props[3];
152
    char          pidBuffer[32];
153
    unsigned int  count = 0;
154
    struct passwd *pw;
2259 by Danny Baumann
Also save process ID to session manager.
155
156
    progProp.name     = const_cast<char *> (SmProgram);
157
    progProp.type     = const_cast<char *> (SmARRAY8);
158
    progProp.num_vals = 1;
159
    progProp.vals     = &progVal;
2261 by Danny Baumann
Always register as "compiz" to the SM, even if that doesn't match the
160
    progVal.value     = (SmPointer) "compiz";
2262 by Danny Baumann
Build fixes.
161
    progVal.length    = strlen ((char *) progVal.value);
2259 by Danny Baumann
Also save process ID to session manager.
162
2260 by Danny Baumann
SM spec says that SmUserID is a required property.
163
    props[count++] = &progProp;
164
2259 by Danny Baumann
Also save process ID to session manager.
165
    snprintf (pidBuffer, sizeof (pidBuffer), "%d", pid);
166
167
    pidProp.name     = const_cast<char *> (SmProcessID);
168
    pidProp.type     = const_cast<char *> (SmARRAY8);
169
    pidProp.num_vals = 1;
170
    pidProp.vals     = &pidVal;
171
    pidVal.value     = (SmPointer) pidBuffer;
172
    pidVal.length    = strlen (pidBuffer);
173
2260 by Danny Baumann
SM spec says that SmUserID is a required property.
174
    props[count++] = &pidProp;
175
176
    pw = getpwuid (uid);
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
177
2260 by Danny Baumann
SM spec says that SmUserID is a required property.
178
    if (pw)
179
    {
180
	userProp.name     = const_cast<char *> (SmUserID);
181
	userProp.type     = const_cast<char *> (SmARRAY8);
182
	userProp.num_vals = 1;
183
	userProp.vals     = &userVal;
184
	userVal.value     = (SmPointer) pw->pw_name;
185
	userVal.length    = strlen (pw->pw_name);
186
187
	props[count++] = &userProp;
188
    }
189
190
    SmcSetProperties (connection, count, props);
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
191
}
192
193
static void
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
194
saveYourselfCallback (SmcConn   connection,
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
195
		      SmPointer client_data,
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
196
		      int       saveType,
197
		      Bool      shutdown,
198
		      int       interact_Style,
199
		      Bool      fast)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
200
{
1982.1.14 by Dennis Kasprzyk
Port of CompOption and CompAction to C++.
201
    CompOption::Vector args;
202
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
203
    args.push_back (CompOption ("save_type",      CompOption::TypeInt));
204
    args.push_back (CompOption ("shutdown",       CompOption::TypeBool));
1982.1.14 by Dennis Kasprzyk
Port of CompOption and CompAction to C++.
205
    args.push_back (CompOption ("interact_style", CompOption::TypeInt));
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
206
    args.push_back (CompOption ("fast",           CompOption::TypeBool));
1982.1.14 by Dennis Kasprzyk
Port of CompOption and CompAction to C++.
207
208
    args[0].value ().set (saveType);
209
    args[1].value ().set ((bool) shutdown);
210
    args[2].value ().set (interact_Style);
211
    args[3].value ().set ((bool) fast);
212
1992 by Dennis Kasprzyk
Merge CompCore and CompDisplay into CompScreen class.
213
    screen->sessionEvent (CompSession::EventSaveYourself, args);
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
214
215
    setCloneRestartCommands (connection);
216
    setRestartStyle (connection, SmRestartImmediately);
2261 by Danny Baumann
Always register as "compiz" to the SM, even if that doesn't match the
217
    setProgramInfo (connection, getpid (), getuid ());
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
218
    SmcSaveYourselfDone (connection, 1);
219
}
220
221
static void
222
dieCallback (SmcConn   connection,
223
	     SmPointer clientData)
224
{
3003.3.2 by smspillaz
Only call removeAction on the CompOption destructor and not the CompOption::Value
225
    screen->sessionEvent (CompSession::EventDie, noOptions ());
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
226
2248 by Danny Baumann
Improve session API.
227
    CompSession::close ();
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
228
    exit (0);
229
}
230
231
static void
232
saveCompleteCallback (SmcConn	connection,
233
		      SmPointer clientData)
234
{
3003.3.2 by smspillaz
Only call removeAction on the CompOption destructor and not the CompOption::Value
235
    screen->sessionEvent (CompSession::EventSaveComplete, noOptions ());
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
236
}
237
238
static void
239
shutdownCancelledCallback (SmcConn   connection,
240
			   SmPointer clientData)
241
{
3003.3.2 by smspillaz
Only call removeAction on the CompOption destructor and not the CompOption::Value
242
    screen->sessionEvent (CompSession::EventShutdownCancelled, noOptions ());
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
243
}
244
245
void
2248 by Danny Baumann
Improve session API.
246
CompSession::init (char *prevClientId)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
247
{
248
    static SmcCallbacks callbacks;
249
250
    if (getenv ("SESSION_MANAGER"))
251
    {
252
	char errorBuffer[1024];
253
254
	iceInit ();
255
256
	callbacks.save_yourself.callback    = saveYourselfCallback;
257
	callbacks.save_yourself.client_data = NULL;
258
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
259
	callbacks.die.callback    = dieCallback;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
260
	callbacks.die.client_data = NULL;
261
262
	callbacks.save_complete.callback    = saveCompleteCallback;
263
	callbacks.save_complete.client_data = NULL;
264
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
265
	callbacks.shutdown_cancelled.callback    = shutdownCancelledCallback;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
266
	callbacks.shutdown_cancelled.client_data = NULL;
267
268
	smcConnection = SmcOpenConnection (NULL,
269
					   NULL,
270
					   SmProtoMajor,
271
					   SmProtoMinor,
272
					   SmcSaveYourselfProcMask |
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
273
					   SmcDieProcMask          |
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
274
					   SmcSaveCompleteProcMask |
275
					   SmcShutdownCancelledProcMask,
276
					   &callbacks,
277
					   prevClientId,
278
					   &smClientId,
279
					   sizeof (errorBuffer),
280
					   errorBuffer);
281
	if (!smcConnection)
1992 by Dennis Kasprzyk
Merge CompCore and CompDisplay into CompScreen class.
282
	    compLogMessage ("core", CompLogLevelWarn,
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
283
			    "SmcOpenConnection failed: %s",
284
			    errorBuffer);
285
	else
286
	{
2364 by Erkin Bahceci
Convert Bool -> bool, TRUE -> true, FALSE -> false.
287
	    connected = true;
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
288
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
289
	    if (prevClientId)
290
		smPrevClientId = strdup (prevClientId);
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
291
2707.1.3 by Rob Taylor
If there's a sesion manager, ask it to always restart compiz.
292
	    setRestartStyle (smcConnection, SmRestartImmediately);
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
293
	}
294
    }
295
}
296
297
void
2248 by Danny Baumann
Improve session API.
298
CompSession::close ()
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
299
{
300
    if (connected)
301
    {
302
	setRestartStyle (smcConnection, SmRestartIfRunning);
303
304
	if (SmcCloseConnection (smcConnection, 0, NULL) != SmcConnectionInUse)
2364 by Erkin Bahceci
Convert Bool -> bool, TRUE -> true, FALSE -> false.
305
	    connected = false;
2248 by Danny Baumann
Improve session API.
306
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
307
	if (smClientId)
308
	{
309
	    free (smClientId);
310
	    smClientId = NULL;
311
	}
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
312
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
313
	if (smPrevClientId)
314
	{
315
	    free (smPrevClientId);
316
	    smPrevClientId = NULL;
317
	}
318
    }
319
}
320
2248 by Danny Baumann
Improve session API.
321
CompString
322
CompSession::getClientId (CompSession::ClientIdType type)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
323
{
324
    if (!connected)
2248 by Danny Baumann
Improve session API.
325
	return "";
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
326
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
327
    switch (type)
328
    {
1982.1.24 by Dennis Kasprzyk
Moved session related functions/structs into own header and namespace.
329
	case CompSession::ClientId:
330
	    if (smClientId)
2248 by Danny Baumann
Improve session API.
331
		return smClientId;
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
332
3569.2.1 by MC Return
Added missing break (x2) to CompSession::getClientId (CompSession::ClientIdType type) function
333
	    break;
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
334
1982.1.24 by Dennis Kasprzyk
Moved session related functions/structs into own header and namespace.
335
	case CompSession::PrevClientId:
336
	    if (smPrevClientId)
2248 by Danny Baumann
Improve session API.
337
		return smPrevClientId;
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
338
339
	    break;
340
341
	default:
3569.2.1 by MC Return
Added missing break (x2) to CompSession::getClientId (CompSession::ClientIdType type) function
342
	    break;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
343
    }
344
2248 by Danny Baumann
Improve session API.
345
    return "";
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
346
}
347
/* ice connection handling taken and updated from gnome-ice.c
348
 * original gnome-ice.c code written by Tom Tromey <tromey@cygnus.com>
349
 */
350
351
/* This is called when data is available on an ICE connection. */
1965 by Dennis Kasprzyk
Conversion ob main classes to C++.
352
static bool
1982.1.26 by Dennis Kasprzyk
Cleanup compiz[-core].h
353
iceProcessMessages (IceConn connection)
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
354
{
355
    SM_DEBUG (printf ("ICE connection process messages\n"));
356
3753.10.1 by MC Return
src/session.cpp cleanup (please see main commit message for details)
357
    IceProcessMessagesStatus status = IceProcessMessages (connection, NULL, NULL);
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
358
359
    if (status == IceProcessMessagesIOError)
360
    {
361
	SM_DEBUG (printf ("ICE connection process messages"
362
			  " - error => shutting down the connection\n"));
363
364
	IceSetShutdownNegotiation (connection, False);
365
	IceCloseConnection (connection);
366
    }
367
368
    return 1;
369
}
370
371
/* This is called when a new ICE connection is made.  It arranges for
372
   the ICE connection to be handled via the event loop.  */
373
static void
374
iceNewConnection (IceConn    connection,
375
		  IcePointer clientData,
376
		  Bool	     opening,
377
		  IcePointer *watchData)
378
{
379
    if (opening)
380
    {
381
	SM_DEBUG (printf ("ICE connection opening\n"));
382
383
	/* Make sure we don't pass on these file descriptors to any
384
	   exec'ed children */
385
	fcntl (IceConnectionNumber (connection), F_SETFD,
386
	       fcntl (IceConnectionNumber (connection),
387
		      F_GETFD,0) | FD_CLOEXEC);
388
1992 by Dennis Kasprzyk
Merge CompCore and CompDisplay into CompScreen class.
389
	iceWatchFdHandle = screen->addWatchFd (IceConnectionNumber (connection),
1982.1.26 by Dennis Kasprzyk
Cleanup compiz[-core].h
390
	    POLLIN | POLLPRI | POLLHUP | POLLERR,
391
	    boost::bind (iceProcessMessages, connection));
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
392
2364 by Erkin Bahceci
Convert Bool -> bool, TRUE -> true, FALSE -> false.
393
	iceConnected = true;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
394
    }
395
    else
396
    {
397
	SM_DEBUG (printf ("ICE connection closing\n"));
398
399
	if (iceConnected)
400
	{
1992 by Dennis Kasprzyk
Merge CompCore and CompDisplay into CompScreen class.
401
	    screen->removeWatchFd (iceWatchFdHandle);
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
402
403
	    iceWatchFdHandle = 0;
2364 by Erkin Bahceci
Convert Bool -> bool, TRUE -> true, FALSE -> false.
404
	    iceConnected = false;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
405
	}
406
    }
407
}
408
409
static IceIOErrorHandler oldIceHandler;
410
411
static void
412
iceErrorHandler (IceConn connection)
413
{
414
    if (oldIceHandler)
415
	(*oldIceHandler) (connection);
416
}
417
418
/* We call any handler installed before (or after) iceInit but
419
   avoid calling the default libICE handler which does an exit() */
420
static void
421
iceInit (void)
422
{
2364 by Erkin Bahceci
Convert Bool -> bool, TRUE -> true, FALSE -> false.
423
    static bool iceInitialized = false;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
424
425
    if (!iceInitialized)
426
    {
427
	IceIOErrorHandler defaultIceHandler;
428
429
	oldIceHandler	  = IceSetIOErrorHandler (NULL);
430
	defaultIceHandler = IceSetIOErrorHandler (iceErrorHandler);
431
432
	if (oldIceHandler == defaultIceHandler)
433
	    oldIceHandler = NULL;
434
435
	IceAddConnectionWatch (iceNewConnection, NULL);
436
2364 by Erkin Bahceci
Convert Bool -> bool, TRUE -> true, FALSE -> false.
437
	iceInitialized = true;
1964 by Dennis Kasprzyk
Switch to c++ and compile with a basic set of plugins.
438
    }
439
}