Protocol.c 23 KB

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