dthelp: Change to ANSI function definitions
[oweals/cde.git] / cde / programs / dtstyle / Protocol.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*$TOG: Protocol.c /main/6 1997/06/18 17:30:30 samborn $*/
24 /************************************<+>*************************************
25  ****************************************************************************
26  **
27  **   File:        Protocol.c
28  **
29  **   Project:     DT 3.0
30  **
31  **   Description: inter-client communication for Dtstyle
32  **
33  **
34  ****************************************************************************
35  ************************************<+>*************************************/
36 /*
37  * (c) Copyright 1996 Digital Equipment Corporation.
38  * (c) Copyright 1990, 1993, 1996 Hewlett-Packard Company.
39  * (c) Copyright 1996 International Business Machines Corp.
40  * (c) Copyright 1996 Sun Microsystems, Inc.
41  * (c) Copyright 1996 Novell, Inc. 
42  * (c) Copyright 1996 FUJITSU LIMITED.
43  * (c) Copyright 1996 Hitachi.
44  */
45
46 /*+++++++++++++++++++++++++++++++++++++++*/
47 /* include files                         */
48 /*+++++++++++++++++++++++++++++++++++++++*/
49 #include <stdio.h>
50
51 #include <X11/Xlib.h>
52 #include <X11/Intrinsic.h>
53 #include <X11/Xatom.h>
54
55 #include <Xm/Protocols.h>
56
57
58 #include <Dt/Connect.h>
59 #include <Dt/SessionM.h>
60 #include <Dt/SessionP.h>
61 #include <Dt/Wsm.h>
62 #include <Dt/WsmP.h>
63
64 #include "MainWin.h"
65 #include "SaveRestore.h"
66 #include "Main.h"
67
68 #include <Dt/Message.h>
69 #include <Dt/UserMsg.h>
70
71 /*+++++++++++++++++++++++++++++++++++++++*/
72 /* include extern functions              */
73 /*+++++++++++++++++++++++++++++++++++++++*/
74 #include "Protocol.h"
75
76 #ifndef CDE_INSTALLATION_TOP
77 #define CDE_INSTALLATION_TOP "/opt/dt"
78 #endif
79
80 #define WS_STARTUP_RETRY_COUNT  12
81 #define WS_STARTUP_TIME         5000
82 #define ERR1   ((char *)GETMESSAGE(2, 4, "Cannot communicate with the session\nmanager... Exiting."))
83 #define ERR2   ((char *)GETMESSAGE(2, 9, "Could not obtain screen saver information\nfrom the session manager. Start up settings\nmay be incorrect."))
84
85 /*
86  * Global variable definitions
87  */
88 Window   smWindow;
89
90 static Atom     xaWmSaveYourself;
91 static Atom     xaWmDeleteWindow;
92
93 /* Atoms for client messages */
94 static Atom     xaSmStmProtocol;
95 static Atom     xaSmStateChange;
96 static Atom     xaSmRestoreDefault;
97 static Atom     xaSmLockChange;
98 static Atom     xaSmSaveToHome;
99
100 /* Atoms for window properties */
101 static Atom     xaDtSaveMode;
102 static Atom     xaDtSmAudioInfo;
103 static Atom     xaDtSmKeyboardInfo;
104 static Atom     xaDtSmPointerInfo;
105 static Atom     xaDtSmScreenInfo;
106 static Atom     xaDtSmFontInfo;
107 static Atom     xaDtSmPreeditInfo;
108
109 /* local function definitions */
110 static void SmRestoreDefault(Atom);
111
112 \f
113 /*************************************<->*************************************
114  *
115  *  InitProtocol ()
116  *
117  *
118  *  Description:
119  *  -----------
120  *  Handles interning of atoms for inter-client communication.
121  *  Color Server
122  *  Dtwm
123  *  Dtsession
124  *
125  *************************************<->***********************************/
126 void 
127 InitDtstyleProtocol( void )
128   
129 {
130   enum { XA_DT_SAVE_MODE, XA_WM_SAVE_YOURSELF, XA_WM_DELETE_WINDOW,
131          XA_DT_SM_STM_PROTOCOL, XA_DT_SM_SAVE_TO_HOME,
132          XA_DT_SM_STATE_CHANGE, XA_DT_SM_RESTORE_DEFAULT,
133          XA_DT_SM_LOCK_CHANGE, XA_DT_SM_AUDIO_INFO,
134          XA_DT_SM_SCREEN_INFO, XA_DT_SM_KEYBOARD_INFO,
135          XA_DT_SM_POINTER_INFO, XA_DT_SM_FONT_INFO,
136          XA_DT_SM_PREEDIT_INFO, NUM_ATOMS };
137   static char *atom_names[] = {
138         _XA_DT_SAVE_MODE, "WM_SAVE_YOURSELF", "WM_DELETE_WINDOW",
139         _XA_DT_SM_STM_PROTOCOL, _XA_DT_SM_SAVE_TO_HOME,
140         _XA_DT_SM_STATE_CHANGE, _XA_DT_SM_RESTORE_DEFAULT,
141         _XA_DT_SM_LOCK_CHANGE, _XA_DT_SM_AUDIO_INFO,
142         _XA_DT_SM_SCREEN_INFO, _XA_DT_SM_KEYBOARD_INFO,
143         _XA_DT_SM_POINTER_INFO, _XA_DT_SM_FONT_INFO,
144         _XA_DT_SM_PREEDIT_INFO };
145   Atom atoms[XtNumber(atom_names)];
146
147   /* Get Session Manager Window ID for communication */
148   
149   if (_DtGetSmWindow (style.display, 
150                       XRootWindow(style.display,0),
151                       &smWindow) == Success)
152     {
153       if (_DtGetSmState (style.display, smWindow, &style.smState) != Success)
154         {
155           _DtSimpleError (progName, DtWarning, NULL, ERR1, NULL);
156           exit(1);
157         }
158       if (_DtGetSmSaver (style.display, smWindow, &style.smSaver) != Success)
159         _DtSimpleError (progName, DtWarning, NULL, ERR2, NULL);
160     }
161   else smWindow = 0;
162   
163   
164   XInternAtoms(style.display, atom_names, XtNumber(atom_names), False, atoms);
165
166   xaDtSaveMode = atoms[XA_DT_SAVE_MODE];
167   xaWmSaveYourself = atoms[XA_WM_SAVE_YOURSELF];
168   xaWmDeleteWindow = atoms[XA_WM_DELETE_WINDOW];
169   xaSmStmProtocol = atoms[XA_DT_SM_STM_PROTOCOL];
170   xaSmSaveToHome = atoms[XA_DT_SM_SAVE_TO_HOME];
171   xaSmStateChange = atoms[XA_DT_SM_STATE_CHANGE];
172   xaSmRestoreDefault = atoms[XA_DT_SM_RESTORE_DEFAULT];
173   xaSmLockChange = atoms[XA_DT_SM_LOCK_CHANGE];
174   xaDtSmAudioInfo = atoms[XA_DT_SM_AUDIO_INFO];
175   xaDtSmScreenInfo = atoms[XA_DT_SM_SCREEN_INFO];
176   xaDtSmKeyboardInfo = atoms[XA_DT_SM_KEYBOARD_INFO];
177   xaDtSmPointerInfo = atoms[XA_DT_SM_POINTER_INFO];
178   xaDtSmFontInfo = atoms[XA_DT_SM_FONT_INFO];
179   xaDtSmPreeditInfo = atoms[XA_DT_SM_PREEDIT_INFO];
180   
181 }
182
183 /*************************************<->*************************************
184  *
185  *  SetWindowProperites ()
186  *
187  *
188  *  Description:
189  *  -----------
190  *  Add the WM_DELETE_WINDOW and WM_SAVE_YOURSELF properties to the 
191  *  dtstyle main window 
192  *
193  *************************************<->***********************************/
194 void 
195 SetWindowProperties( void )
196 {
197
198     /* Add WM_SAVE_YOURSELF property to the main window */
199     XmAddWMProtocolCallback(style.shell, xaWmSaveYourself, saveSessionCB, NULL);
200
201     /* Add WM_DELETE_WINDOW property to the main window */
202     XmAddWMProtocolCallback(style.shell, xaWmDeleteWindow, activateCB_exitBtn, NULL);
203
204 }
205
206
207 /*************************************<->*************************************
208  *
209  *  HandleWorkspaceChange
210  *
211  *
212  *  Description:
213  *  -----------
214  *  Do processing required when workspace changes. A DtWsmWsChangeProc.
215  *
216  *************************************<->***********************************/
217 static void
218 HandleWorkspaceChange (
219     Widget              widget,
220     Atom                aWs,
221     Pointer             client_data)
222 {
223     CheckWorkspace ();  /* Backdrop may need to update colors */
224 }
225
226 /*************************************<->*************************************
227  *
228  *  ListenForWorkspaceChange ()
229  *
230  *
231  *  Description:
232  *  -----------
233  *  
234  *
235  *************************************<->***********************************/
236 void 
237 ListenForWorkspaceChange( void )
238 {
239
240   DtWsmAddCurrentWorkspaceCallback (style.shell, 
241                                     (DtWsmWsChangeProc) HandleWorkspaceChange, NULL);
242   
243 }
244
245 /************************************************************************
246  * WorkspaceStartupTimer()
247  *
248  * Check to see if the workspace manager is ready
249  ************************************************************************/
250 static void 
251 WorkspaceStartupTimer( 
252         XtPointer client_data,
253         XtIntervalId *id)
254 {
255     Atom             aWS;
256     intptr_t count = (intptr_t) client_data;
257
258     if (DtWsmGetCurrentWorkspace (style.display, style.root, &aWS) 
259                 == Success)
260     {
261         /*
262          * OK, the workspace manager is ready. Get the
263          * colors and redraw the bitmap.
264          */
265         CheckWorkspace ();
266     }
267     else if (--count > 0)
268     {
269         /* wait a little longer for the workspace manager */
270         client_data = (XtPointer) count;
271         (void) XtAppAddTimeOut (XtWidgetToApplicationContext(style.shell), 
272                 WS_STARTUP_TIME, WorkspaceStartupTimer, client_data);
273     }
274 }
275
276 /*************************************<->*************************************
277  *
278  *  ReparentNotify ()
279  *
280  *
281  *  Description:
282  *  -----------
283  *  Dtstyle has been reparented.  
284  *  The parenting happens twice when the window manager has been restarted.
285  *  First Dtstyle gets reparented to the root window, then reparented to
286  *  the window manager.
287  *
288  *************************************<->***********************************/
289 void 
290 MwmReparentNotify(
291         Widget w,
292         XtPointer client_data,
293         XEvent *event )
294 {
295     if ((event->type == ReparentNotify) &&
296         (event->xreparent.parent != style.root))
297     {
298         if (style.backdropDialog && XtIsManaged(style.backdropDialog))
299         {
300             client_data = (XtPointer) WS_STARTUP_RETRY_COUNT;
301             (void) XtAppAddTimeOut (XtWidgetToApplicationContext(style.shell), 
302                 WS_STARTUP_TIME, WorkspaceStartupTimer, client_data);
303         }
304     }
305 }
306
307 /*************************************<->*************************************
308  *
309  *  GetSessionSaveMode ()
310  *
311  *
312  *  Description:
313  *  -----------
314  *  Get the session save mode from the Session Manager
315  *
316  *************************************<->***********************************/
317 void 
318 GetSessionSaveMode( 
319     unsigned char **mode ) 
320 {
321
322     Atom actualType;
323     int actualFormat;
324     unsigned long nitems;
325     unsigned long leftover;
326
327     XGetWindowProperty(style.display, RootWindow(style.display, 0),
328                          xaDtSaveMode,0L,
329                          (long)BUFSIZ,False,AnyPropertyType,&actualType,
330                          &actualFormat,&nitems,&leftover,
331                          mode);
332
333 }
334
335
336 /*************************************<->*************************************
337  *
338  *  SmSaveHomeSession ()
339  *
340  *  Description:
341  *  -----------
342  *  Tell Session Manager to save the home session
343  *
344  *************************************<->***********************************/
345 void 
346 SmSaveHomeSession(
347     int origStartState,
348     int origConfirmMode)
349 {
350   XClientMessageEvent stmToSmMessage;
351
352   if (smWindow != 0)
353   {
354    /*
355     * Tell session manager save home state using current smStartState
356     * and smConfirmMode. Note that the session state will retain the
357     * original smStartState and smConfirmMode values.
358     */
359     stmToSmMessage.type = ClientMessage;
360     stmToSmMessage.window = smWindow;
361     stmToSmMessage.message_type = xaSmStmProtocol;
362     stmToSmMessage.format = 32;
363     stmToSmMessage.data.l[0] = xaSmSaveToHome;
364     stmToSmMessage.data.l[1] = style.smState.smStartState;
365     stmToSmMessage.data.l[2] = style.smState.smConfirmMode;
366     stmToSmMessage.data.l[3] = CurrentTime;
367     XSendEvent(style.display, smWindow, False, NoEventMask,
368                           (XEvent *) &stmToSmMessage);
369   }
370 }                                                                 
371
372 /*************************************<->*************************************
373  *
374  *  SmNewStartupSettings ()
375  *
376  *  Description:
377  *  -----------
378  *  Tell Session Manager about new Startup settings
379  *
380  *************************************<->***********************************/
381 void 
382 SmNewStartupSettings( void )
383 {
384   SmStateInfo state;
385
386   if (smWindow != 0)
387   {
388     state.flags = SM_STATE_START | SM_STATE_CONFIRM;
389     state.smStartState = style.smState.smStartState;
390     state.smConfirmMode = style.smState.smConfirmMode;
391     _DtSetSmState(style.display, smWindow, &state);
392   }
393 }                                                                 
394
395 /*************************************<->*************************************
396  *
397  *  SmRestoreDefault ()
398  *
399  *  Description:
400  *  -----------
401  *  Tell Session Manager to restore the default value to one of the settings
402  *
403  *************************************<->***********************************/
404 static void 
405 SmRestoreDefault(Atom toRestore)
406 {
407      XClientMessageEvent stmToSmMessage;
408
409     if (smWindow != 0)
410     {
411          stmToSmMessage.type = ClientMessage;
412          stmToSmMessage.window = smWindow;
413          stmToSmMessage.message_type = xaSmStmProtocol;
414          stmToSmMessage.format = 32;
415          stmToSmMessage.data.l[0] = xaSmRestoreDefault;
416          stmToSmMessage.data.l[1] = toRestore;
417          stmToSmMessage.data.l[2] = CurrentTime;
418          XSendEvent(style.display, smWindow, False, NoEventMask,
419                           (XEvent *) &stmToSmMessage);
420     }
421 }                                                                 
422
423
424 /*************************************<->*************************************
425  *
426  *  SmDefaultAudioSettings ()
427  *
428  *  Description:
429  *  -----------
430  *  Tell Session Manager to set default Xserver audio settings
431  *
432  *************************************<->***********************************/
433 void 
434 SmDefaultAudioSettings( void )
435 {
436     if (smWindow != 0)
437     {
438         /*  Delete the property to indicate default settings to SM */
439         SmRestoreDefault(xaDtSmAudioInfo);
440     }
441 }                                                                 
442
443 /*************************************<->*************************************
444  *
445  *  SmNewAudioSettings ()
446  *
447  *  Description:
448  *  -----------
449  *  Tell Session Manager about new Xserver audio settings
450  *
451  *************************************<->***********************************/
452 void 
453 SmNewAudioSettings(
454     int volume,
455     int tone,
456     int duration )
457 {
458
459     PropDtSmAudioInfo   audioProp;
460
461     if (smWindow != 0)
462     {
463         /*
464          * Set the property on the Session Manager window
465          * indicating the new screen saver settings
466          */
467
468         audioProp.flags = 0;
469         audioProp.smBellPercent = (CARD32) volume;
470         audioProp.smBellPitch = (CARD32) tone;
471         audioProp.smBellDuration = (CARD32) duration;
472         XChangeProperty (style.display, smWindow,
473                          xaDtSmAudioInfo, 
474                          xaDtSmAudioInfo,
475                          32, PropModeReplace, 
476                          (unsigned char *)&audioProp,
477                          PROP_DT_SM_AUDIO_INFO_ELEMENTS);
478     }
479 }                                                                 
480
481 /*************************************<->*************************************
482  *
483  *  SmDefaultScreenSettings ()
484  *
485  *  Description:
486  *  -----------
487  *  Tell Session Manager to set default Xserver screen settings
488  *
489  *************************************<->***********************************/
490 void 
491 SmDefaultScreenSettings( void )
492 {
493     if (smWindow != 0)
494     {
495         /*  Delete the property to indicate default settings to SM */
496         SmRestoreDefault(xaDtSmScreenInfo);
497     }
498 }                                                                 
499
500
501 /*************************************<->*************************************
502  *
503  *  SmNewScreenSettings ()
504  *
505  *  Description:
506  *  -----------
507  *  Tell Session Manager about new Xserver screen settings
508  *
509  *************************************<->***********************************/
510 void 
511 SmNewScreenSettings( 
512     int timeout,
513     int blanking,
514     int interval,
515     int exposures )
516
517 {
518
519     PropDtSmScreenInfo  screenProp;
520
521     if (smWindow != 0)
522     {
523         /*
524          * Set the property on the Session Manager window
525          * indicating the new screen saver settings
526          */
527
528         screenProp.flags = 0;
529         screenProp.smTimeout = (CARD32) timeout;  /* 0-7200 */
530         screenProp.smInterval = (CARD32) interval;    /* -1  */
531         screenProp.smPreferBlank = (CARD32) blanking; /* 0,1 */
532         screenProp.smAllowExp = (CARD32) exposures;
533         XChangeProperty (style.display, smWindow,
534                          xaDtSmScreenInfo, 
535                          xaDtSmScreenInfo,
536                          32, PropModeReplace, 
537                          (unsigned char *)&screenProp,
538                          PROP_DT_SM_SCREEN_INFO_ELEMENTS);
539     }
540 }                                                                 
541
542 /*************************************<->*************************************
543  *
544  *  SmNewSaverSettings ()
545  *
546  *  Description:
547  *  -----------
548  *  Tell Session Manager about new saver settings: 
549  *  saver timeout, lock timeout, cycle timeout, selected saver list
550  *
551  *************************************<->***********************************/
552 void 
553 SmNewSaverSettings( 
554     int saverTime,
555     int lockTime,
556     int cycleTime,                 
557     char *selsaversList)
558 {
559   SmStateInfo state;     /* structure that will contain new state info */
560   SmSaverInfo saver;     /* structure that will contain selected saver list */
561
562   int saverTime_change;  /* saver timeout */
563   int lockTime_change;   /* lock timeout */
564   int cycleTime_change;  /* saver timeout */
565
566   if (smWindow != 0)
567     {
568       lockTime_change = (style.smState.smLockTimeout != lockTime);
569       saverTime_change = (style.smState.smSaverTimeout != saverTime);
570       cycleTime_change = (style.smState.smCycleTimeout != cycleTime);
571       state.flags = (saverTime_change ? SM_STATE_SAVERTIMEOUT : 0) | 
572                     (lockTime_change ?  SM_STATE_LOCKTIMEOUT  : 0) |
573                     (cycleTime_change ? SM_STATE_CYCLETIMEOUT : 0);
574       
575       if (state.flags)
576         {
577           state.smSaverTimeout = saverTime;
578           state.smLockTimeout = lockTime;
579           state.smCycleTimeout = cycleTime;
580           
581           _DtSetSmState(style.display, smWindow, &state);
582         }
583       saver.saverList = selsaversList;
584       _DtSetSmSaver(style.display, smWindow, &saver);
585     }
586   
587 }
588
589
590 /*************************************<->*************************************
591  *
592  *  SmNewSaverTime()
593  *
594  *  Description:
595  *  -----------
596  *  Tell Session Manager about new saver timeout
597  *  used for telling the session manager if it should run savers or not when
598  *  the user enables/disables saver toggle (or the savers toggle in no saver
599  *  extension mode) without having to press OK. A zero is sent to the session 
600  *  manager when no savers should be run.  
601  *************************************<->***********************************/
602 void 
603 SmNewSaverTime(int saverTime)
604 {
605   SmStateInfo state;     /* structure that will contain new state info */
606
607   if (smWindow != 0)
608     {
609       state.flags = SM_STATE_SAVERTIMEOUT;
610       state.smSaverTimeout = saverTime;
611       _DtSetSmState(style.display, smWindow, &state);
612     }
613 }
614
615
616
617 /*************************************<->*************************************
618  *
619  *  SmDefaultKeyboardSettings ()
620  *
621  *  Description:
622  *  -----------
623  *  Tell Session Manager to set default Xserver Keyboard settings
624  *
625  *************************************<->***********************************/
626 void 
627 SmDefaultKeyboardSettings( void )
628 {
629     if (smWindow != 0)
630     {
631         /*  Delete the property to indicate default settings to SM */
632         SmRestoreDefault(xaDtSmKeyboardInfo);
633     }
634 }                                                                 
635
636 /*************************************<->*************************************
637  *
638  *  SmNewKeyboardSettings ()
639  *
640  *  Description:
641  *  -----------
642  *  Tell Session Manager about new Xserver Keyboard settings
643  *
644  *************************************<->***********************************/
645 void 
646 SmNewKeyboardSettings(
647     int keyClickPercent,
648     int  autoRepeat)
649 {
650
651     PropDtSmKeyboardInfo        KeyboardProp;
652
653     if (smWindow != 0)
654     {
655         /*
656          * Set the property on the Session Manager window
657          * indicating the new screen saver settings
658          */
659
660         KeyboardProp.flags = 0;
661         KeyboardProp.smKeyClickPercent = (CARD32) keyClickPercent;
662         KeyboardProp.smGlobalAutoRepeat = (CARD32) autoRepeat;
663         XChangeProperty (style.display, smWindow,
664                          xaDtSmKeyboardInfo, 
665                          xaDtSmKeyboardInfo,
666                          32, PropModeReplace, 
667                          (unsigned char *)&KeyboardProp,
668                          PROP_DT_SM_KEYBOARD_INFO_ELEMENTS);
669     }
670 }                                                                 
671
672 /*************************************<->*************************************
673  *
674  *  SmDefaultPointerSettings ()
675  *
676  *  Description:
677  *  -----------
678  *  Tell Session Manager to set default Xserver Pointer settings
679  *
680  *************************************<->***********************************/
681 void 
682 SmDefaultPointerSettings( void )
683 {
684     if (smWindow != 0)
685     {
686         /*  Delete the property to indicate default settings to SM */
687         SmRestoreDefault(xaDtSmPointerInfo);
688     }
689 }                                                                 
690
691 /*************************************<->*************************************
692  *
693  *  SmNewPointerSettings ()
694  *
695  *  Description:
696  *  -----------
697  *  Tell Session Manager about new Xserver Pointer settings
698  *
699  *************************************<->***********************************/
700 void 
701 SmNewPointerSettings(
702     char *pointerString)
703 {
704
705     if (smWindow != 0)
706     {
707         /*
708          * Set the property on the Session Manager window
709          * indicating the new screen saver settings
710          */
711
712         XChangeProperty (style.display, smWindow,
713                          xaDtSmPointerInfo, 
714                          XA_STRING,
715                          8, PropModeReplace, 
716                          (unsigned char *)pointerString,
717                          strlen(pointerString));
718     }
719 }                                                                 
720
721 /*************************************<->*************************************
722  *
723  *  SmNewPreeditSettings ()
724  *
725  *  Description:
726  *  -----------
727  *  Tell Session Manager about new preeditType resources
728  *
729  *************************************<->***********************************/
730 void 
731 SmNewPreeditSettings(
732     char *preeditResourceString)
733 {
734
735                      
736     if (smWindow != 0)
737     {
738         /*
739          * Set the property on the Session Manager window
740          * indicating the new font resource string
741          */
742
743         XChangeProperty (style.display, smWindow,
744                          xaDtSmPreeditInfo, 
745                          XA_STRING,
746                          8, PropModeReplace, 
747                          (unsigned char *)preeditResourceString,
748                          strlen(preeditResourceString));
749     }
750 }                                                                 
751 /*************************************<->*************************************
752  *
753  *  SmNewFontSettings ()
754  *
755  *  Description:
756  *  -----------
757  *  Tell Session Manager about new font resources
758  *
759  *************************************<->***********************************/
760 void 
761 SmNewFontSettings(
762     char *fontResourceString)
763 {
764
765                      
766     if (smWindow != 0)
767     {
768         /*
769          * Set the property on the Session Manager window
770          * indicating the new font resource string
771          */
772
773         XChangeProperty (style.display, smWindow,
774                          xaDtSmFontInfo, 
775                          XA_STRING,
776                          8, PropModeReplace, 
777                          (unsigned char *)fontResourceString,
778                          strlen(fontResourceString));
779     }
780 }                                                                 
781