Dtwm.c 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  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. /************************************<+>*************************************
  24. ****************************************************************************
  25. **
  26. ** File: Dtwm.c
  27. **
  28. ** Project: DT 3.0
  29. **
  30. ** Description: Controls the Dtstyle Window Manager customization dialog
  31. **
  32. **
  33. ** (c) Copyright Hewlett-Packard Company, 1990, 1993.
  34. **
  35. **
  36. **
  37. ****************************************************************************
  38. ************************************<+>*************************************/
  39. /* $XConsortium: Dtwm.c /main/4 1995/10/30 13:09:13 rswiston $ */
  40. /*+++++++++++++++++++++++++++++++++++++++*/
  41. /* include files */
  42. /*+++++++++++++++++++++++++++++++++++++++*/
  43. #include <X11/Xlib.h>
  44. #include <errno.h>
  45. #include <Xm/MwmUtil.h>
  46. #include <Xm/XmP.h>
  47. #include <Xm/Xm.h>
  48. #include <Xm/Form.h>
  49. #include <Xm/LabelG.h>
  50. #include <Xm/PushBG.h>
  51. #include <Xm/RowColumn.h>
  52. #include <Xm/ToggleBG.h>
  53. #include <Xm/SeparatoG.h>
  54. #include <Xm/VendorSEP.h>
  55. #include <Xm/MessageB.h>
  56. #include <Dt/DialogBox.h>
  57. #include <Dt/Icon.h>
  58. #include <Dt/TitleBox.h>
  59. #include <Dt/Message.h>
  60. #include <Dt/HourGlass.h>
  61. #include <Dt/Wsm.h>
  62. #include "Help.h"
  63. #include "Main.h"
  64. #include "SaveRestore.h"
  65. #include "Protocol.h"
  66. #include <ctype.h>
  67. /*+++++++++++++++++++++++++++++++++++++++*/
  68. /* include extern functions */
  69. /*+++++++++++++++++++++++++++++++++++++++*/
  70. #include "Dtwm.h"
  71. /*+++++++++++++++++++++++++++++++++++++++*/
  72. /* Local #defines */
  73. /*+++++++++++++++++++++++++++++++++++++++*/
  74. #define POINTER 0
  75. #define EXPLICIT 1
  76. #define POINTER_STR "pointer"
  77. #define EXPLICIT_STR "explicit"
  78. #define NUM_PLACEMENT_ICONS 8
  79. #define TOP_LEFT 0
  80. #define TOP_RIGHT 1
  81. #define BOTTOM_LEFT 2
  82. #define BOTTOM_RIGHT 3
  83. #define LEFT_TOP 4
  84. #define LEFT_BOTTOM 5
  85. #define RIGHT_TOP 6
  86. #define RIGHT_BOTTOM 7
  87. #define WARN_MSG ((char *)GETMESSAGE(18, 12, "The workspace manager must be restarted in\n\
  88. order for your changes to take effect.\n\
  89. Press OK to restart the workspace manager\n\
  90. or Cancel to reset the changes."))
  91. /*+++++++++++++++++++++++++++++++++++++++*/
  92. /* Internal Functions */
  93. /*+++++++++++++++++++++++++++++++++++++++*/
  94. static Widget build_dtwmDlg ( Widget shell ) ;
  95. static void formLayoutCB ( Widget, XtPointer, XtPointer ) ;
  96. static void _DtmapCB_dtwmDlg ( Widget, XtPointer, XtPointer ) ;
  97. static void systemDefaultCB ( Widget, XtPointer, XtPointer ) ;
  98. static void ButtonCB ( Widget, XtPointer, XtPointer ) ;
  99. static void getDtwmValues ( ) ;
  100. static void _DtWmParseToLower (unsigned char *string) ;
  101. static void okWarnCB ( Widget, XtPointer, XtPointer ) ;
  102. static void cancelWarnCB ( Widget, XtPointer, XtPointer ) ;
  103. /*+++++++++++++++++++++++++++++++++++++++*/
  104. /* Internal Variables */
  105. /*+++++++++++++++++++++++++++++++++++++++*/
  106. typedef struct {
  107. Widget pictLabel;
  108. Widget systemDefault;
  109. Widget windowFocusTB;
  110. Widget focusPolicyRC;
  111. Widget focusSeparator;
  112. Widget autoRaiseTG;
  113. Widget secStackTG;
  114. Widget moveOpaqueTG;
  115. Widget iconPlacementTB;
  116. Widget useIconBoxRC;
  117. Widget pointerTG;
  118. Widget explicitTG;
  119. Widget iconBoxTG;
  120. Widget desktopTG;
  121. Boolean systemDefaultFlag;
  122. int origKeyboardFocusPolicy;
  123. int origFocusAutoRaise;
  124. int origSecStack;
  125. int origMoveOpaque;
  126. int origUseIconBox;
  127. Widget warnDialog;
  128. } Dtwm, *DtwmPtr;
  129. static Dtwm dtwm;
  130. static saveRestore save = {FALSE, 0, };
  131. static char dtwmRes[150]="";
  132. static char *icon[] = {
  133. "iconTL",
  134. "iconTR",
  135. "iconBL",
  136. "iconBR",
  137. "iconLT",
  138. "iconLB",
  139. "iconRT",
  140. "iconRB"
  141. };
  142. static char *placementStr[] = {
  143. "top left",
  144. "top right",
  145. "bottom left",
  146. "bottom right",
  147. "left top",
  148. "left bottom",
  149. "right top",
  150. "right bottom"
  151. };
  152. /*+++++++++++++++++++++++++++++++++++++++*/
  153. /* popup_dtwmBB */
  154. /*+++++++++++++++++++++++++++++++++++++++*/
  155. void
  156. popup_dtwmBB(
  157. Widget shell )
  158. {
  159. if (style.dtwmDialog == NULL) {
  160. _DtTurnOnHourGlass(shell);
  161. build_dtwmDlg(shell);
  162. getDtwmValues();
  163. XtManageChild(style.dtwmDialog);
  164. _DtTurnOffHourGlass(shell);
  165. }
  166. else
  167. {
  168. XtManageChild(style.dtwmDialog);
  169. raiseWindow(XtWindow(XtParent(style.dtwmDialog)));
  170. }
  171. dtwm.systemDefaultFlag = False;
  172. }
  173. /*+++++++++++++++++++++++++++++++++++++++*/
  174. /* getDtwmValues */
  175. /*+++++++++++++++++++++++++++++++++++++++*/
  176. static void
  177. getDtwmValues(void)
  178. {
  179. char *str_type_return;
  180. XrmValue value_return;
  181. XrmValue cvt_value;
  182. XrmDatabase db;
  183. Boolean status;
  184. char *string;
  185. db = XtDatabase(style.display);
  186. /* Get KeyboardFocusPolicy value */
  187. if (status = XrmGetResource (db, "dtwm.keyboardFocusPolicy",
  188. "Dtwm.KeyboardFocusPolicy",
  189. &str_type_return, &value_return))
  190. {
  191. /* make local copy of string */
  192. string = (char *) XtMalloc( value_return.size );
  193. strcpy (string, value_return.addr);
  194. /* convert to lower case */
  195. _DtWmParseToLower((unsigned char *)string);
  196. if (strcmp(string, "pointer") == 0)
  197. {
  198. XmToggleButtonGadgetSetState (dtwm.pointerTG, True, True);
  199. dtwm.origKeyboardFocusPolicy = POINTER;
  200. }
  201. if (strcmp(string, "explicit") == 0)
  202. {
  203. XmToggleButtonGadgetSetState (dtwm.explicitTG, True, True);
  204. dtwm.origKeyboardFocusPolicy = EXPLICIT;
  205. }
  206. XtFree (string);
  207. }
  208. else /* KeyboardFocusPolicy not specified */
  209. {
  210. /* set the Dtwm default value - explicit */
  211. XmToggleButtonGadgetSetState (dtwm.explicitTG, True, True);
  212. dtwm.origKeyboardFocusPolicy = EXPLICIT;
  213. }
  214. /* Get FocusAutoRaise value */
  215. if (status = XrmGetResource (db, "dtwm.focusAutoRaise",
  216. "Dtwm.FocusAutoRaise",
  217. &str_type_return, &value_return))
  218. {
  219. /* make local copy of string */
  220. string = (char *) XtMalloc( value_return.size );
  221. strcpy (string, value_return.addr);
  222. /* convert to lower case */
  223. _DtWmParseToLower((unsigned char *)string);
  224. dtwm.origFocusAutoRaise =
  225. (strcmp(string, "true") ? False : True);
  226. XmToggleButtonGadgetSetState (dtwm.autoRaiseTG,
  227. dtwm.origFocusAutoRaise, True);
  228. XtFree (string);
  229. }
  230. else /* FocusAutoRaise not specified */
  231. {
  232. /* set the Dtwm default value:
  233. * True when keyboardFocusPolicy is explicit
  234. * False when keyboardFocusPolicy is pointer
  235. */
  236. dtwm.origFocusAutoRaise =
  237. ((dtwm.origKeyboardFocusPolicy == EXPLICIT) ? True : False);
  238. XmToggleButtonGadgetSetState (dtwm.autoRaiseTG,
  239. dtwm.origFocusAutoRaise, True);
  240. }
  241. /* Get SecStack value from secondaries OnTop resource*/
  242. if (status = XrmGetResource (db, "dtwm.secondariesOnTop",
  243. "Dtwm.secondariesOnTop",
  244. &str_type_return, &value_return))
  245. {
  246. /* make local copy of string */
  247. string = (char *) XtMalloc( value_return.size );
  248. strcpy (string, value_return.addr);
  249. /* convert to lower case */
  250. _DtWmParseToLower((unsigned char *)string);
  251. dtwm.origSecStack =
  252. (strcmp(string, "true") ? False : True);
  253. XmToggleButtonGadgetSetState (dtwm.secStackTG,
  254. !dtwm.origSecStack, True);
  255. XtFree (string);
  256. }
  257. else /* SecStack resource not specified */
  258. {
  259. #ifdef sun
  260. dtwm.origSecStack = False;
  261. XmToggleButtonGadgetSetState (dtwm.secStackTG,
  262. !dtwm.origSecStack, False);
  263. #else
  264. dtwm.origSecStack = True;
  265. XmToggleButtonGadgetSetState (dtwm.secStackTG,
  266. !dtwm.origSecStack, True);
  267. #endif
  268. }
  269. /* Get UseIconBox value */
  270. if (status = XrmGetResource (db, "dtwm.useIconBox",
  271. "Dtwm.UseIconBox",
  272. &str_type_return, &value_return))
  273. {
  274. /* make local copy of string */
  275. string = (char *) XtMalloc( value_return.size );
  276. strcpy (string, value_return.addr);
  277. /* convert to lower case */
  278. _DtWmParseToLower((unsigned char *)string);
  279. dtwm.origUseIconBox =
  280. (strcmp(string, "true") ? False : True);
  281. if (dtwm.origUseIconBox)
  282. XmToggleButtonGadgetSetState (dtwm.iconBoxTG, True, True);
  283. else
  284. XmToggleButtonGadgetSetState (dtwm.desktopTG, True, True);
  285. XtFree (string);
  286. }
  287. else /* UseIconBox not specified */
  288. {
  289. /* set the Dtwm default value - False, desktop - True*/
  290. dtwm.origUseIconBox = False;
  291. XmToggleButtonGadgetSetState (dtwm.desktopTG, True, True);
  292. }
  293. /* Get MoveOpaque value */
  294. if (status = XrmGetResource (db, "dtwm.moveOpaque",
  295. "Dtwm.MoveOpaque",
  296. &str_type_return, &value_return))
  297. {
  298. /* make local copy of string */
  299. string = (char *) XtMalloc( value_return.size );
  300. strcpy (string, value_return.addr);
  301. /* convert to lower case */
  302. _DtWmParseToLower((unsigned char *)string);
  303. dtwm.origMoveOpaque =
  304. (strcmp(string, "true") ? False : True);
  305. XmToggleButtonGadgetSetState (dtwm.moveOpaqueTG,
  306. dtwm.origMoveOpaque, True);
  307. XtFree (string);
  308. }
  309. else /* MoveOpaque not specified */
  310. {
  311. /* set the Dtwm default value: False */
  312. dtwm.origMoveOpaque = False;
  313. XmToggleButtonGadgetSetState (dtwm.moveOpaqueTG,
  314. dtwm.origMoveOpaque, True);
  315. }
  316. }
  317. /*+++++++++++++++++++++++++++++++++++++++*/
  318. /* build__dtwmDlg */
  319. /*+++++++++++++++++++++++++++++++++++++++*/
  320. static Widget
  321. build_dtwmDlg(
  322. Widget shell )
  323. {
  324. int i, n;
  325. Arg args[MAX_ARGS];
  326. XmString button_string[NUM_LABELS];
  327. XmString string;
  328. Widget form;
  329. Widget windowFocusForm;
  330. Widget iconPlacementForm;
  331. int count = 0;
  332. Widget widgetList1[6];
  333. /* get dtwm resource values */
  334. /* Set up DialogBoxDialog button labels */
  335. button_string[0] = CMPSTR((String) _DtOkString);
  336. button_string[1] = CMPSTR((String) _DtCancelString);
  337. button_string[2] = CMPSTR((String) _DtHelpString);
  338. /* Create toplevel DialogBox */
  339. /* saveRestore
  340. * Note that save.poscnt has been initialized elsewhere.
  341. * save.posArgs may contain information from restoreBeep().*/
  342. XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS); save.poscnt++;
  343. XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string); save.poscnt++;
  344. XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
  345. save.poscnt++;
  346. style.dtwmDialog =
  347. __DtCreateDialogBoxDialog(shell, "dtwmDialog", save.posArgs, save.poscnt);
  348. XtAddCallback(style.dtwmDialog, XmNhelpCallback,
  349. (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_DTWM_DIALOG);
  350. XmStringFree(button_string[0]);
  351. XmStringFree(button_string[1]);
  352. XmStringFree(button_string[2]);
  353. widgetList1[0] = _DtDialogBoxGetButton(style.dtwmDialog,2);
  354. n=0;
  355. XtSetArg(args[n], XmNautoUnmanage, False); n++;
  356. XtSetArg(args[n], XmNcancelButton, widgetList1[0]); n++;
  357. XtSetValues (style.dtwmDialog, args, n);
  358. n=0;
  359. XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(18, 1, "Style Manager - Window"))); n++;
  360. XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
  361. XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
  362. XtSetValues (XtParent(style.dtwmDialog), args, n);
  363. n = 0;
  364. XtSetArg(args[n], XmNallowOverlap, False); n++;
  365. XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
  366. form = XmCreateForm(style.dtwmDialog, "dtwmForm", args, n);
  367. n = 0;
  368. XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
  369. XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
  370. XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
  371. XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
  372. XtSetArg(args[n], XmNstring, NULL); n++;
  373. XtSetArg(args[n], XmNshadowThickness, 0); n++;
  374. XtSetArg(args[n], XmNimageName, DTWM_ICON); n++;
  375. XtSetArg(args[n], XmNtraversalOn, False); n++;
  376. widgetList1[count++] =
  377. dtwm.pictLabel = _DtCreateIcon(form, "dtwmpictLabel", args, n);
  378. n = 0;
  379. XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++;
  380. XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++;
  381. string = CMPSTR(((char *)GETMESSAGE(18, 2, "Default")));
  382. XtSetArg(args[n], XmNlabelString, string); n++;
  383. widgetList1[count++] = dtwm.systemDefault =
  384. XmCreatePushButtonGadget(form, "systemDefault", args, n);
  385. XmStringFree(string);
  386. n = 0;
  387. string = CMPSTR((char *)GETMESSAGE(18, 3, "Window Behavior"));
  388. XtSetArg(args[n], XmNtitleString, string); n++;
  389. widgetList1[count++] = dtwm.windowFocusTB
  390. = _DtCreateTitleBox(form, "windowFocusTB", args, n);
  391. XmStringFree(string);
  392. n = 0;
  393. XtSetArg(args[n], XmNallowOverlap, False); n++;
  394. XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
  395. windowFocusForm =
  396. XmCreateForm(dtwm.windowFocusTB, "windowFocusForm", args, n);
  397. n = 0;
  398. string = CMPSTR((char *)GETMESSAGE(18, 4, "Window Icons"));
  399. XtSetArg(args[n], XmNtitleString, string); n++;
  400. widgetList1[count++] = dtwm.iconPlacementTB
  401. = _DtCreateTitleBox(form, "iconPlacementTB", args, n);
  402. XmStringFree(string);
  403. n = 0;
  404. XtSetArg(args[n], XmNallowOverlap, False); n++;
  405. XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++;
  406. iconPlacementForm =
  407. XmCreateForm(dtwm.iconPlacementTB, "iconPlacementForm", args, n);
  408. n = 0;
  409. XtSetArg(args[n], XmNmarginWidth, 0); n++;
  410. XtSetArg(args[n], XmNmarginHeight, 0); n++;
  411. dtwm.focusPolicyRC =
  412. XmCreateRadioBox(windowFocusForm, "focusPolicyRC", args, n);
  413. n = 0;
  414. string = CMPSTR((char *)GETMESSAGE(18, 13, "Point In Window To Make Active"));
  415. XtSetArg(args[n], XmNlabelString, string); n++;
  416. dtwm.pointerTG =
  417. XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "pointerTG", args, n);
  418. XmStringFree(string);
  419. n = 0;
  420. string = CMPSTR((char *)GETMESSAGE(18, 14, "Click In Window To Make Active"));
  421. XtSetArg(args[n], XmNlabelString, string); n++;
  422. dtwm.explicitTG =
  423. XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "explicitTG", args, n);
  424. XmStringFree(string);
  425. n = 0;
  426. XtSetArg(args[n], XmNmargin, 0); n++;
  427. dtwm.focusSeparator =
  428. XmCreateSeparatorGadget(windowFocusForm, "focusSeparator", args, n);
  429. n = 0;
  430. string = CMPSTR((char *)GETMESSAGE(18, 15, "Raise Window When Made Active"));
  431. XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;
  432. XtSetArg(args[n], XmNlabelString, string); n++;
  433. XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
  434. dtwm.autoRaiseTG =
  435. XmCreateToggleButtonGadget(windowFocusForm, "autoRaiseTG", args, n);
  436. XmStringFree(string);
  437. n = 0;
  438. string = CMPSTR((char *)GETMESSAGE(18, 11, "Allow Primary Windows On Top"));
  439. XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;
  440. XtSetArg(args[n], XmNlabelString, string); n++;
  441. XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
  442. dtwm.secStackTG =
  443. XmCreateToggleButtonGadget(windowFocusForm, "secStackTG", args, n);
  444. XmStringFree(string);
  445. n = 0;
  446. string = CMPSTR((char *)GETMESSAGE(18, 16, "Show Contents During Move"));
  447. XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;
  448. XtSetArg(args[n], XmNlabelString, string); n++;
  449. XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
  450. dtwm.moveOpaqueTG =
  451. XmCreateToggleButtonGadget(windowFocusForm, "moveOpaqueTG", args, n);
  452. XmStringFree(string);
  453. n = 0;
  454. XtSetArg(args[n], XmNmarginWidth, 0); n++;
  455. XtSetArg(args[n], XmNmarginHeight, 0); n++;
  456. dtwm.useIconBoxRC =
  457. XmCreateRadioBox(iconPlacementForm, "useIconBoxRC", args, n);
  458. n = 0;
  459. string = CMPSTR((char *)GETMESSAGE(18, 9, "Use Icon Box"));
  460. XtSetArg(args[n], XmNlabelString, string); n++;
  461. dtwm.iconBoxTG =
  462. XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "iconBoxTG", args, n);
  463. XmStringFree(string);
  464. n = 0;
  465. string = CMPSTR((char *)GETMESSAGE(18, 10, "Place On Workspace"));
  466. XtSetArg(args[n], XmNlabelString, string); n++;
  467. dtwm.desktopTG =
  468. XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "desktopTG", args, n);
  469. XmStringFree(string);
  470. XtAddCallback(style.dtwmDialog, XmNmapCallback, formLayoutCB, NULL);
  471. XtAddCallback(style.dtwmDialog, XmNmapCallback, _DtmapCB_dtwmDlg, shell);
  472. XtAddCallback(style.dtwmDialog, XmNcallback, ButtonCB, NULL);
  473. XtAddCallback(dtwm.systemDefault, XmNactivateCallback, systemDefaultCB, NULL);
  474. XtManageChild(form);
  475. XtManageChildren(widgetList1,count);
  476. XtManageChild(windowFocusForm);
  477. XtManageChild(iconPlacementForm);
  478. XtManageChild(dtwm.focusPolicyRC);
  479. XtManageChild(dtwm.pointerTG);
  480. XtManageChild(dtwm.explicitTG);
  481. XtManageChild(dtwm.focusSeparator);
  482. XtManageChild(dtwm.autoRaiseTG);
  483. XtManageChild(dtwm.secStackTG);
  484. XtManageChild(dtwm.moveOpaqueTG);
  485. XtManageChild(dtwm.useIconBoxRC);
  486. XtManageChild(dtwm.iconBoxTG);
  487. XtManageChild(dtwm.desktopTG);
  488. return(style.dtwmDialog);
  489. }
  490. /*+++++++++++++++++++++++++++++++++++++++*/
  491. /* formLayoutCB */
  492. /*+++++++++++++++++++++++++++++++++++++++*/
  493. static void
  494. formLayoutCB(
  495. Widget w,
  496. XtPointer client_data,
  497. XtPointer call_data )
  498. {
  499. int n;
  500. Arg args[MAX_ARGS];
  501. /* Picture Label */
  502. n=0;
  503. XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  504. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
  505. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
  506. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  507. XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
  508. XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); n++;
  509. XtSetValues (dtwm.pictLabel, args, n);
  510. /* system Default */
  511. n=0;
  512. XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  513. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
  514. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
  515. XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
  516. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  517. XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
  518. XtSetValues (dtwm.systemDefault, args, n);
  519. /* Window Focus TitleBox */
  520. n=0;
  521. XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  522. XtSetArg(args[n], XmNtopWidget, dtwm.pictLabel); n++;
  523. XtSetArg(args[n], XmNtopOffset, style.horizontalSpacing); n++;
  524. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
  525. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  526. XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
  527. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  528. XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
  529. XtSetValues (dtwm.windowFocusTB, args, n);
  530. /* Icon Placement TitleBox */
  531. n=0;
  532. XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  533. XtSetArg(args[n], XmNtopWidget, dtwm.windowFocusTB); n++;
  534. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
  535. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  536. XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
  537. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  538. XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
  539. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  540. XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
  541. XtSetValues (dtwm.iconPlacementTB, args, n);
  542. /* FocusPolicy RC */
  543. n=0;
  544. XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  545. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
  546. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
  547. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  548. XtSetArg(args[n], XmNleftOffset, 0); n++;
  549. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  550. XtSetArg(args[n], XmNrightOffset, 0); n++;
  551. XtSetValues (dtwm.focusPolicyRC, args, n);
  552. /* FocusSeparator */
  553. n=0;
  554. XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  555. XtSetArg(args[n], XmNtopWidget, dtwm.focusPolicyRC); n++;
  556. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
  557. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
  558. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  559. XtSetArg(args[n], XmNleftOffset, 0); n++;
  560. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  561. XtSetArg(args[n], XmNrightOffset, 0); n++;
  562. XtSetValues (dtwm.focusSeparator, args, n);
  563. /* AutoRaise TG */
  564. n=0;
  565. XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  566. XtSetArg(args[n], XmNtopWidget, dtwm.focusSeparator); n++;
  567. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
  568. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
  569. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  570. XtSetArg(args[n], XmNleftOffset, 0); n++;
  571. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  572. XtSetArg(args[n], XmNrightOffset, 0); n++;
  573. XtSetValues (dtwm.autoRaiseTG, args, n);
  574. /* secStack TG */
  575. n=0;
  576. XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  577. XtSetArg(args[n], XmNtopWidget, dtwm.autoRaiseTG); n++;
  578. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing-3); n++;
  579. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
  580. XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
  581. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  582. XtSetArg(args[n], XmNleftOffset, 0); n++;
  583. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  584. XtSetArg(args[n], XmNrightOffset, 0); n++;
  585. XtSetValues (dtwm.secStackTG, args, n);
  586. /* MoveOpaque TG */
  587. n=0;
  588. XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  589. XtSetArg(args[n], XmNtopWidget, dtwm.secStackTG); n++;
  590. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing-3); n++;
  591. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  592. XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
  593. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  594. XtSetArg(args[n], XmNleftOffset, 0); n++;
  595. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  596. XtSetArg(args[n], XmNrightOffset, 0); n++;
  597. XtSetValues (dtwm.moveOpaqueTG, args, n);
  598. /* Use Icon Box RC */
  599. n=0;
  600. XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  601. XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
  602. XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  603. XtSetArg(args[n], XmNbottomOffset, 0); n++;
  604. XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  605. XtSetArg(args[n], XmNleftOffset, 0); n++;
  606. XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  607. XtSetArg(args[n], XmNrightOffset, 0); n++;
  608. XtSetValues (dtwm.useIconBoxRC, args, n);
  609. XtRemoveCallback(style.dtwmDialog, XmNmapCallback, formLayoutCB, NULL);
  610. }
  611. /*+++++++++++++++++++++++++++++++++++++++*/
  612. /* _DtmapCB_dtwmDlg */
  613. /*+++++++++++++++++++++++++++++++++++++++*/
  614. static void
  615. _DtmapCB_dtwmDlg(
  616. Widget w,
  617. XtPointer client_data,
  618. XtPointer call_data )
  619. {
  620. static int first_time = 1;
  621. int n;
  622. Arg args[MAX_ARGS];
  623. DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
  624. if (!save.restoreFlag)
  625. putDialog ((Widget)client_data, w);
  626. XtRemoveCallback(style.dtwmDialog, XmNmapCallback, _DtmapCB_dtwmDlg, NULL);
  627. }
  628. /*+++++++++++++++++++++++++++++++++++++++*/
  629. /* systemDefaultCB */
  630. /*+++++++++++++++++++++++++++++++++++++++*/
  631. static void
  632. systemDefaultCB(
  633. Widget w,
  634. XtPointer client_data,
  635. XtPointer call_data )
  636. {
  637. /* KeyboardFocusPolicy: explicit */
  638. XmToggleButtonGadgetSetState (dtwm.explicitTG, True, True);
  639. /* FocusAutoRaise: True */
  640. XmToggleButtonGadgetSetState (dtwm.autoRaiseTG, True, True);
  641. #ifdef sun
  642. /* Sun default is secStack: False */
  643. XmToggleButtonGadgetSetState (dtwm.secStackTG, True, True);
  644. #else
  645. /* secStack: True */
  646. XmToggleButtonGadgetSetState (dtwm.secStackTG, False, True);
  647. #endif
  648. /* OpaqueMove: False */
  649. XmToggleButtonGadgetSetState (dtwm.moveOpaqueTG, False, True);
  650. /* PlaceOnDesktop: True */
  651. XmToggleButtonGadgetSetState (dtwm.desktopTG, True, True);
  652. }
  653. /*+++++++++++++++++++++++++++++++++++++++*/
  654. /* ButtonCB */
  655. /* callback for PushButtons in DialogBox */
  656. /*+++++++++++++++++++++++++++++++++++++++*/
  657. static void
  658. ButtonCB(
  659. Widget w,
  660. XtPointer client_data,
  661. XtPointer call_data )
  662. {
  663. int n;
  664. Arg args[MAX_ARGS];
  665. char *resPtr;
  666. Boolean state;
  667. Boolean changeFlag = 0;
  668. DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *) call_data;
  669. switch (cb->button_position)
  670. {
  671. case OK_BUTTON:
  672. XtUnmanageChild (w);
  673. /* create the Dtwm resource specs for xrdb */
  674. state = XmToggleButtonGadgetGetState (dtwm.explicitTG);
  675. if ( state != dtwm.origKeyboardFocusPolicy)
  676. {
  677. sprintf(dtwmRes, "Dtwm.keyboardFocusPolicy: %s\n",
  678. XmToggleButtonGadgetGetState (dtwm.pointerTG)
  679. ? POINTER_STR : EXPLICIT_STR);
  680. changeFlag = 1;
  681. }
  682. /* write out FocusAutoRaise if toggle has changed or if
  683. * KeyboardFocusPolicy has changed. FAR default value is
  684. * based off of KFP so must set explicitly or visible toggle
  685. * will be inacurate */
  686. state = XmToggleButtonGadgetGetState (dtwm.autoRaiseTG);
  687. if (state != dtwm.origFocusAutoRaise || changeFlag)
  688. {
  689. sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*focusAutoRaise: %s\n",
  690. XmToggleButtonGadgetGetState (dtwm.autoRaiseTG)
  691. ? "True" : "False");
  692. changeFlag = 1;
  693. }
  694. state = !XmToggleButtonGadgetGetState (dtwm.secStackTG);
  695. if ( state != dtwm.origSecStack)
  696. {
  697. sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*secondariesOnTop: %s\n",
  698. XmToggleButtonGadgetGetState (dtwm.secStackTG)
  699. ? "False" : "True");
  700. changeFlag = 1;
  701. }
  702. state = XmToggleButtonGadgetGetState (dtwm.moveOpaqueTG);
  703. if ( state != dtwm.origMoveOpaque)
  704. {
  705. sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*moveOpaque: %s\n",
  706. XmToggleButtonGadgetGetState (dtwm.moveOpaqueTG)
  707. ? "True" : "False");
  708. changeFlag = 1;
  709. }
  710. state = XmToggleButtonGadgetGetState (dtwm.iconBoxTG);
  711. if (state != dtwm.origUseIconBox)
  712. {
  713. sprintf(dtwmRes+strlen(dtwmRes), "Dtwm*useIconBox: %s\n",
  714. XmToggleButtonGadgetGetState (dtwm.iconBoxTG)
  715. ? "True" : "False");
  716. changeFlag = 1;
  717. }
  718. if (changeFlag)
  719. {
  720. if (dtwm.warnDialog == NULL)
  721. {
  722. n = 0;
  723. XtSetArg(args[n], XmNokLabelString, CMPSTR((String) _DtOkString)); n++;
  724. XtSetArg(args[n], XmNcancelLabelString, CMPSTR((String) _DtCancelString)); n++;
  725. XtSetArg(args[n], XmNborderWidth, 3); n++;
  726. XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC ); n++;
  727. XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
  728. XtSetArg(args[n], XmNdialogTitle, CMPSTR((char *)GETMESSAGE(2,2, "Notice"))); n++;
  729. XtSetArg(args[n], XmNmessageString, CMPSTR(WARN_MSG)); n++;
  730. dtwm.warnDialog = XmCreateInformationDialog(style.shell, "warnDialog", args, n);
  731. XtUnmanageChild (XmMessageBoxGetChild(dtwm.warnDialog, XmDIALOG_HELP_BUTTON));
  732. XtAddCallback(dtwm.warnDialog, XmNokCallback, okWarnCB,
  733. client_data);
  734. XtAddCallback(dtwm.warnDialog, XmNcancelCallback, cancelWarnCB,
  735. client_data);
  736. }
  737. XtManageChild(dtwm.warnDialog);
  738. }
  739. break;
  740. case CANCEL_BUTTON:
  741. /* reset to dtwm values from when dialog is mapped */
  742. XtUnmanageChild(w);
  743. XmToggleButtonGadgetSetState (dtwm.pointerTG,
  744. dtwm.origKeyboardFocusPolicy ? POINTER : EXPLICIT , True);
  745. XmToggleButtonGadgetSetState (dtwm.explicitTG,
  746. dtwm.origKeyboardFocusPolicy ? EXPLICIT : POINTER , True);
  747. XmToggleButtonGadgetSetState (dtwm.autoRaiseTG,
  748. dtwm.origFocusAutoRaise ? True : False , True);
  749. XmToggleButtonGadgetSetState (dtwm.secStackTG,
  750. dtwm.origSecStack ? False : True , True);
  751. XmToggleButtonGadgetSetState (dtwm.moveOpaqueTG,
  752. dtwm.origMoveOpaque ? True : False , True);
  753. XmToggleButtonGadgetSetState (dtwm.iconBoxTG,
  754. dtwm.origUseIconBox ? True : False , True);
  755. XmToggleButtonGadgetSetState (dtwm.desktopTG,
  756. dtwm.origUseIconBox ? False : True , True);
  757. break;
  758. case HELP_BUTTON:
  759. XtCallCallbacks(style.dtwmDialog, XmNhelpCallback, (XtPointer)NULL);
  760. break;
  761. default:
  762. break;
  763. }
  764. }
  765. /************************************************************************
  766. * restoreDtwm()
  767. * /u1/shakib/ncode
  768. * restore any state information saved with savedtwm.
  769. * This is called from restoreSession with the application
  770. * shell and the special xrm database retrieved for restore.
  771. ************************************************************************/
  772. void
  773. restoreDtwm(
  774. Widget shell,
  775. XrmDatabase db )
  776. {
  777. XrmName xrm_name[5];
  778. XrmRepresentation rep_type;
  779. XrmValue value;
  780. xrm_name [0] = XrmStringToQuark ("dtwmDlg");
  781. xrm_name [2] = 0;
  782. /* get x position */
  783. xrm_name [1] = XrmStringToQuark ("x");
  784. if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
  785. XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr)); save.poscnt++;
  786. save.restoreFlag = True;
  787. }
  788. /* get y position */
  789. xrm_name [1] = XrmStringToQuark ("y");
  790. if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
  791. XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr)); save.poscnt++;
  792. }
  793. xrm_name [1] = XrmStringToQuark ("ismapped");
  794. XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
  795. /* Are we supposed to be mapped? */
  796. if (strcmp(value.addr, "True") == 0)
  797. popup_dtwmBB(shell);
  798. }
  799. /************************************************************************
  800. * saveDtwm()
  801. *
  802. * This routine will write out to the passed file descriptor any state
  803. * information this dialog needs. It is called from saveSessionCB with the
  804. * file already opened.
  805. * All information is saved in xrm format. There is no restriction
  806. * on what can be saved. It doesn't have to be defined or be part of any
  807. * widget or Xt definition. Just name and save it here and recover it in
  808. * restoreBackdrop. The suggested minimum is whether you are mapped, and your
  809. * location.
  810. ************************************************************************/
  811. void
  812. saveDtwm(
  813. int fd )
  814. {
  815. Position x,y;
  816. Dimension width, height;
  817. char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
  818. XmVendorShellExtObject vendorExt;
  819. XmWidgetExtData extData;
  820. if (style.dtwmDialog != NULL)
  821. {
  822. if (XtIsManaged(style.dtwmDialog))
  823. sprintf(bufr, "*dtwmDlg.ismapped: True\n");
  824. else
  825. sprintf(bufr, "*dtwmDlg.ismapped: False\n");
  826. /* Get and write out the geometry info for our Window */
  827. x = XtX(XtParent(style.dtwmDialog));
  828. y = XtY(XtParent(style.dtwmDialog));
  829. /* Modify x & y to take into account window mgr frames
  830. * This is pretty bogus, but I don't know a better way to do it.
  831. */
  832. extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
  833. vendorExt = (XmVendorShellExtObject)extData->widget;
  834. x -= vendorExt->vendor.xOffset;
  835. y -= vendorExt->vendor.yOffset;
  836. width = XtWidth(style.dtwmDialog);
  837. height = XtHeight(style.dtwmDialog);
  838. sprintf(bufr, "%s*dtwmDlg.x: %d\n", bufr, x);
  839. sprintf(bufr, "%s*dtwmDlg.y: %d\n", bufr, y);
  840. sprintf(bufr, "%s*dtwmDlg.width: %d\n", bufr, width);
  841. sprintf(bufr, "%s*dtwmDlg.height: %d\n", bufr, height);
  842. if(-1 == write (fd, bufr, strlen(bufr))) {
  843. perror(strerror(errno));
  844. }
  845. }
  846. }
  847. /*************************************<->*************************************
  848. *
  849. * _DtWmParseToLower (string)
  850. *
  851. *
  852. * Description:
  853. * -----------
  854. * Lower all characters in a string.
  855. *
  856. *
  857. * Inputs:
  858. * ------
  859. * string = NULL-terminated character string or NULL
  860. *
  861. *
  862. * Outputs:
  863. * -------
  864. * string = NULL-terminated lower case character string or NULL
  865. *
  866. *
  867. * Comments:
  868. * --------
  869. * Can handle multi-byte characters
  870. *
  871. *************************************<->***********************************/
  872. static
  873. void _DtWmParseToLower (unsigned char *string)
  874. {
  875. unsigned char *pch = string;
  876. #ifdef MULTIBYTE
  877. int chlen;
  878. while ((chlen = mblen ((char *)pch, MB_CUR_MAX)) > 0)
  879. {
  880. if ((chlen == 1) && (isupper (*pch)))
  881. {
  882. *pch = tolower(*pch);
  883. }
  884. pch += chlen;
  885. }
  886. #else
  887. while (*pch != NULL)
  888. {
  889. if (isupper (*pch))
  890. {
  891. *pch = tolower(*pch);
  892. }
  893. pch++;
  894. }
  895. #endif
  896. } /* END OF FUNCTION _DtWmParseToLower */
  897. /*+++++++++++++++++++++++++++++++++++++++*/
  898. /* cancelWarnCB - callback for the */
  899. /* cancel button of the warnDialog */
  900. /*+++++++++++++++++++++++++++++++++++++++*/
  901. static void
  902. cancelWarnCB(
  903. Widget w,
  904. XtPointer client_data,
  905. XtPointer call_data )
  906. {
  907. XmToggleButtonGadgetSetState (dtwm.pointerTG,
  908. dtwm.origKeyboardFocusPolicy ? POINTER : EXPLICIT , True);
  909. XmToggleButtonGadgetSetState (dtwm.explicitTG,
  910. dtwm.origKeyboardFocusPolicy ? EXPLICIT : POINTER , True);
  911. XmToggleButtonGadgetSetState (dtwm.autoRaiseTG,
  912. dtwm.origFocusAutoRaise ? True : False , True);
  913. XmToggleButtonGadgetSetState (dtwm.secStackTG,
  914. dtwm.origSecStack ? False : True , True);
  915. XmToggleButtonGadgetSetState (dtwm.moveOpaqueTG,
  916. dtwm.origMoveOpaque ? True : False , True);
  917. XmToggleButtonGadgetSetState (dtwm.iconBoxTG,
  918. dtwm.origUseIconBox ? True : False , True);
  919. XmToggleButtonGadgetSetState (dtwm.desktopTG,
  920. dtwm.origUseIconBox ? False : True , True);
  921. }
  922. /*+++++++++++++++++++++++++++++++++++++++*/
  923. /* okWarnCB - callback for the */
  924. /* OK button of the warnDialog */
  925. /*+++++++++++++++++++++++++++++++++++++++*/
  926. static void
  927. okWarnCB(
  928. Widget w,
  929. XtPointer client_data,
  930. XtPointer call_data )
  931. {
  932. dtwm.origKeyboardFocusPolicy = XmToggleButtonGadgetGetState (dtwm.explicitTG);
  933. dtwm.origFocusAutoRaise = XmToggleButtonGadgetGetState (dtwm.autoRaiseTG);
  934. dtwm.origSecStack = !XmToggleButtonGadgetGetState (dtwm.secStackTG);
  935. dtwm.origMoveOpaque = XmToggleButtonGadgetGetState (dtwm.moveOpaqueTG);
  936. dtwm.origUseIconBox = XmToggleButtonGadgetGetState (dtwm.iconBoxTG);
  937. /* write out resources to xrdb */
  938. _DtAddToResource(style.display, dtwmRes);
  939. /* force the workspace manager to restart */
  940. _DtWmRestartNoConfirm(style.display, style.root);
  941. }