2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /************************************<+>*************************************
24 ****************************************************************************
30 ** Description: Controls the Dtstyle Font dialog
33 ** (c) Copyright Hewlett-Packard Company, 1990.
37 ****************************************************************************
38 ************************************<+>*************************************/
39 /* $XConsortium: Font.c /main/7 1996/10/30 11:14:15 drk $ */
41 /*+++++++++++++++++++++++++++++++++++++++*/
43 /*+++++++++++++++++++++++++++++++++++++++*/
46 #include <Xm/MwmUtil.h>
50 #include <Xm/MessageB.h>
53 #include <Xm/LabelG.h>
58 #include <Xm/VendorSEP.h>
60 #include <Dt/DialogBox.h>
62 #include <Dt/TitleBox.h>
64 #include <Dt/Message.h>
65 #include <Dt/SessionM.h>
66 #include <Dt/HourGlass.h>
71 #include "SaveRestore.h"
73 /*+++++++++++++++++++++++++++++++++++++++*/
75 /*+++++++++++++++++++++++++++++++++++++++*/
77 #define FONT_MSG ((char *)GETMESSAGE(5, 23, "Style Manager - Font"))
78 #define PREVIEW ((char *)GETMESSAGE(5, 17, "Preview"))
79 #define IMMEDIATE ((char *)GETMESSAGE(5, 18, "The changes to fonts will show up in some\napplications the next time they are started.\nOther applications, such as file manager and\napplication manager, will not show the font\nchanges until you Exit the desktop and then log\nback in."))
80 #define LATER ((char *)GETMESSAGE(5, 19, "The selected font will be used when\n you restart this session."))
81 #define INFO_MSG ((char *)GETMESSAGE(5, 24, "The font that is currently used for your desktop is not\navailable in the Size list. If a new font is selected and\napplied, you will not be able to return to the current font\nusing the Style Manager - Font dialog."))
82 #define SYSTEM_MSG ((char *)GETMESSAGE(5, 20, "AaBbCcDdEeFfGg0123456789"))
83 #define USER_MSG ((char *)GETMESSAGE(5, 21, "AaBbCcDdEeFfGg0123456789"))
85 #define SIZE ((char *)GETMESSAGE(5, 22, "Size"))
88 /*+++++++++++++++++++++++++++++++++++++++*/
89 /* Internal Variables */
90 /*+++++++++++++++++++++++++++++++++++++++*/
101 int originalFontIndex;
102 int selectedFontIndex;
103 String selectedFontStr;
104 Boolean userTextChanged;
106 static FontData font;
108 static saveRestore save = {FALSE, 0, };
110 /*+++++++++++++++++++++++++++++++++++++++*/
111 /* Internal Functions */
112 /*+++++++++++++++++++++++++++++++++++++++*/
115 static void CreateFontDlg(
117 static void _DtmapCB_fontBB(
119 XtPointer client_data,
120 XtPointer call_data) ;
121 static void ButtonCB(
123 XtPointer client_data,
124 XtPointer call_data) ;
125 static void changeSampleFontCB(
127 XtPointer client_data,
128 XtPointer call_data) ;
129 static void valueChangedCB(
131 XtPointer client_data,
132 XtPointer call_data) ;
135 /*+++++++++++++++++++++++++++++++++++++++*/
137 /*+++++++++++++++++++++++++++++++++++++++*/
142 if (style.fontDialog == NULL) {
143 _DtTurnOnHourGlass(shell);
144 CreateFontDlg(shell);
145 XtManageChild(style.fontDialog);
146 _DtTurnOffHourGlass(shell);
148 XtManageChild(style.fontDialog);
149 raiseWindow(XtWindow(XtParent(style.fontDialog)));
152 /* If no font is found to match current Desktop
153 font, pop up informative message */
154 if (font.selectedFontIndex < 0)
155 InfoDialog(INFO_MSG, style.shell, False);
158 /*+++++++++++++++++++++++++++++++++++++++*/
160 /*+++++++++++++++++++++++++++++++++++++++*/
171 XmString button_string[NUM_LABELS];
174 Widget widget_list[6];
176 XmStringTable selectedSize;
178 Dimension fontheight;
181 font.selectedFontStr = style.xrdb.systemFontStr;
183 /* Assume nothing is selected */
184 font.selectedFontIndex = -1;
187 * The following flag is used to determine if the user has
188 * entered anything into the sample user font field. If
189 * he does, than when the font selection is changed, the
190 * default message "aAbBcC..." won't be displayed overwriting
191 * the user's text, only the fontlist will be changed.
192 * This flag will be set in the valueChanged callback for the
193 * font.sizeList widget.
195 font.userTextChanged = FALSE;
198 * Look for the selectedFont in the fontChoice array and set
199 * selectedFontIndex to that entry
201 for (i=0; i<style.xrdb.numFonts; i++)
202 if (strcmp (font.selectedFontStr,
203 style.xrdb.fontChoice[i].sysStr) == 0)
205 font.selectedFontIndex = i;
206 if (!style.xrdb.fontChoice[i].userFont)
207 GetUserFontResource(i);
208 if (!style.xrdb.fontChoice[i].sysFont)
209 GetSysFontResource(i);
214 * Save the index of the originally selected font. If no
215 * font is selected, this value will remain -1.
217 font.originalFontIndex = font.selectedFontIndex;
219 /* Set up button labels. */
220 button_string[0] = CMPSTR((String) _DtOkString);
221 button_string[1] = CMPSTR((String) _DtCancelString);
222 button_string[2] = CMPSTR((String) _DtHelpString);
224 /* Create toplevel DialogBox */
226 * Note that save.poscnt has been initialized elsewhere.
227 * save.posArgs may contain information from restoreFont().
230 XtSetArg(save.posArgs[save.poscnt], XmNallowOverlap, False); save.poscnt++;
231 XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
233 XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);
235 XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);
238 __DtCreateDialogBoxDialog(parent, "Fonts", save.posArgs, save.poscnt);
239 XtAddCallback(style.fontDialog, XmNcallback, ButtonCB, NULL);
240 XtAddCallback(style.fontDialog, XmNmapCallback, _DtmapCB_fontBB,
242 XtAddCallback(style.fontDialog, XmNhelpCallback,
243 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FONT_DIALOG);
245 XmStringFree(button_string[0]);
246 XmStringFree(button_string[1]);
247 XmStringFree(button_string[2]);
249 widget_list[0] = _DtDialogBoxGetButton(style.fontDialog,2);
251 XtSetArg(args[n], XmNautoUnmanage, False); n++;
252 XtSetArg(args[n], XmNcancelButton, widget_list[0]); n++;
253 XtSetValues (style.fontDialog, args, n);
256 XtSetArg(args[n], XmNtitle, FONT_MSG); n++;
257 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
258 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
259 XtSetValues (XtParent(style.fontDialog), args, n);
262 XtSetArg (args[n], XmNchildType, XmWORK_AREA); n++;
263 XtSetArg(args[n], XmNhorizontalSpacing, style.horizontalSpacing); n++;
264 XtSetArg(args[n], XmNverticalSpacing, style.verticalSpacing); n++;
265 XtSetArg(args[n], XmNallowOverlap, False); n++;
266 font.fontWkarea = XmCreateForm(style.fontDialog, "fontWorkArea", args, n);
269 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
270 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
271 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
273 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
274 XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
275 XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
276 XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
277 XtSetArg(args[n], XmNstring, NULL); n++;
278 XtSetArg(args[n], XmNshadowThickness, 0); n++;
279 XtSetArg(args[n], XmNimageName, FONT_ICON); n++;
280 XtSetArg(args[n], XmNtraversalOn, False); n++;
281 widget_list[count++] = font.fontpictLabel =
282 _DtCreateIcon(font.fontWkarea, "fontpictLabel", args, n);
284 /* Create a TitleBox and Scale/List to choose the font size */
287 string = CMPSTR(SIZE);
288 XtSetArg(args[n], XmNtitleString, string); n++;
289 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
290 XtSetArg(args[n], XmNtopWidget, font.fontpictLabel); n++;
291 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing+5); n++;
292 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
293 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
294 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
295 widget_list[count++] = font.sizeTB =
296 _DtCreateTitleBox(font.fontWkarea, "sizeTB", args, n);
297 XmStringFree(string);
299 /* calculate size for each of the fonts based on system font size */
301 sizeItems = (XmString *) XtMalloc(sizeof(XmString) * style.xrdb.numFonts);
302 for (n=0; n<style.xrdb.numFonts; n++)
304 sprintf(sizeStr, "%d", (int)(n+1));
305 sizeItems[n] = CMPSTR(sizeStr);
306 style.xrdb.fontChoice[n].pointSize = CMPSTR(sizeStr);
311 XtSetArg (args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
312 XtSetArg (args[n], XmNautomaticSelection, True); n++;
313 XtSetArg (args[n], XmNvisibleItemCount, 7); n++;
314 XtSetArg (args[n], XmNitemCount, style.xrdb.numFonts); n++;
315 XtSetArg (args[n], XmNitems, sizeItems); n++;
318 * If matching font was found for current selection,
319 * display it as selected. Otherwise, don't select
322 if (font.selectedFontIndex >=0) {
323 selectedSize = &(style.xrdb.fontChoice[font.selectedFontIndex].pointSize);
324 XtSetArg (args[n], XmNselectedItems, selectedSize); n++;
325 XtSetArg (args[n], XmNselectedItemCount, 1); n++;
327 font.sizeList = XmCreateScrolledList(font.sizeTB,"sizeList",args,n);
328 XtAddCallback(font.sizeList, XmNbrowseSelectionCallback,
329 changeSampleFontCB, NULL);
331 /* If a font match was found and selected, then set it's point size. */
332 if (font.selectedFontIndex >=0)
333 XmListSetItem(font.sizeList,
334 style.xrdb.fontChoice[font.selectedFontIndex].pointSize);
335 XtFree((char *)sizeItems);
337 /* preview TitleBox */
339 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
340 XtSetArg(args[n], XmNtopWidget, font.fontpictLabel); n++;
341 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing+5); n++;
342 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
343 XtSetArg(args[n], XmNleftWidget, font.sizeTB); n++;
344 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
345 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
346 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
347 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
348 string = CMPSTR(PREVIEW);
349 XtSetArg(args[n], XmNtitleString, string); n++;
350 widget_list[count++] = font.previewTB =
351 _DtCreateTitleBox(font.fontWkarea, "systemSample", args, n);
352 XmStringFree(string);
354 /*form to contain preview font area*/
357 XmCreateForm(font.previewTB, "previewForm", args, n);
359 /* sample system font */
363 * If a font match was found and selected, then set the fontlist
364 * and the sample string. Otherwise, output a blank message.
366 if (font.selectedFontIndex >=0) {
367 XtSetArg (args[n], XmNfontList,
368 style.xrdb.fontChoice[font.selectedFontIndex].sysFont); n++;
369 string = CMPSTR(SYSTEM_MSG);
371 string = CMPSTR(BLANK_MSG);
373 XtSetArg (args[n], XmNlabelString, string); n++;
374 XtSetArg (args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
375 XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
376 XtSetArg (args[n], XmNtopOffset, 2 * style.verticalSpacing); n++;
377 XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
378 XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
379 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
381 XmCreateLabelGadget(font.previewForm, "systemSample", args, n);
382 XmStringFree(string);
384 /* sample user font */
387 * If a font match was found and selected, then set the fontlist
388 * and the sample string. Otherwise output a blank message.
390 if (font.selectedFontIndex >=0) {
391 XtSetArg (args[n], XmNfontList,
392 style.xrdb.fontChoice[font.selectedFontIndex].userFont); n++;
393 XtSetArg (args[n], XmNvalue, USER_MSG); n++;
395 XtSetArg (args[n], XmNvalue, NULL); n++;
398 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
399 XtSetArg (args[n], XmNtopWidget, font.systemLabel); n++;
400 XtSetArg (args[n], XmNtopOffset, 2 * style.verticalSpacing); n++;
401 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
402 XtSetArg (args[n], XmNleftWidget, font.systemLabel); n++;
403 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
404 XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
405 XtSetArg (args[n], XmNrightWidget, font.systemLabel); n++;
407 XmCreateText(font.previewForm, "userText", args, n);
408 /* Add callback to determine if user changes text in sample field */
409 XtAddCallback(font.userText, XmNvalueChangedCallback, valueChangedCB, NULL);
411 XtManageChild(font.systemLabel);
412 XtManageChild(font.userText);
413 XtManageChild(font.previewForm);
414 XtManageChild(font.sizeList);
415 XtManageChildren(widget_list,count);
416 XtManageChild(font.fontWkarea);
421 /*+++++++++++++++++++++++++++++++++++++++*/
422 /* _DtmapCB_fontBB */
423 /*+++++++++++++++++++++++++++++++++++++++*/
427 XtPointer client_data,
428 XtPointer call_data )
431 DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
433 if (!save.restoreFlag)
434 putDialog ((Widget)client_data, w);
436 XmTextShowPosition(font.userText, 0);
438 XtRemoveCallback(style.fontDialog, XmNmapCallback, _DtmapCB_fontBB, NULL);
443 /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
445 /* Process callback from PushButtons in DialogBox. */
446 /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
450 XtPointer client_data,
451 XtPointer call_data )
453 DtDialogBoxCallbackStruct *cb
454 = (DtDialogBoxCallbackStruct *) call_data;
457 char *str, *fntstr, *fntsetstr;
461 switch (cb->button_position)
463 /* Set the xrdb or pass to dtsession and close the window */
466 * Need to test for the case where the Font dialog maps without
467 * any fonts selected, and the user presses OK. Do this by
468 * checking for number of items selected before changing
471 XtVaGetValues (font.sizeList, XmNselectedItemCount, &items, NULL);
473 /* Post an info dialog explaining when the new fonts will appear */
474 if ((font.selectedFontIndex != font.originalFontIndex) && (items > 0))
476 XtUnmanageChild(style.fontDialog);
478 if(style.xrdb.writeXrdbImmediate)
480 InfoDialog(IMMEDIATE, style.shell, False);
484 InfoDialog(LATER, style.shell, False);
488 for *FontSet resource: find first font entry delimited by a ":"
491 len =strcspn(style.xrdb.fontChoice[font.selectedFontIndex].userStr,
493 fntsetstr = (char *) XtCalloc(1, len + 1);
495 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
499 Since the *Font and *FontSet resources may be used by old
500 X applications, a fontlist of multiple fonts must be converted
501 to Xt font set format (';'s converted to ','s since many old X
502 apps don't understand ';' syntax.)
504 str = strstr(fntsetstr,";");
507 str = strstr(str,";");
511 for *Font resource: find first font entry delimited by a comma,
514 len = strcspn(fntsetstr,",:=");
515 fntstr = (char *) XtCalloc(1, len + 1);
517 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
521 for *FontSet resource: if we got a font (instead of a font set)
522 from the first entry, then wildcard its charset fields
524 len = strlen(fntsetstr);
525 if (style.xrdb.fontChoice[font.selectedFontIndex].userStr[len]
527 str = strchr(fntsetstr, '-');
528 for (n = 1; n < 13 && str; n++)
529 str = strchr(str + 1, '-');
531 strcpy(str + 1, "*-*");
534 /* create the font resource specs with the selected font for xrdb */
536 "*systemFont: %s\n*userFont: %s\n*FontList: %s\n*buttonFontList: %s\n*labelFontList: %s\n*textFontList: %s\n*XmText*FontList: %s\n*XmTextField*FontList: %s\n*DtEditor*textFontList: %s\n*Font: %s\n*FontSet: %s\n",
537 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
538 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
539 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
540 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
541 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
542 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
543 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
544 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
545 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
551 /* if writeXrdbImmediate true write to Xrdb else send to session mgr */
552 if(style.xrdb.writeXrdbImmediate)
553 _DtAddToResource(style.display,fontres);
555 SmNewFontSettings(fontres);
557 font.originalFontIndex = font.selectedFontIndex;
558 style.xrdb.systemFontStr = font.selectedFontStr;
562 XtUnmanageChild(style.fontDialog);
568 /* reset preview area fonts to original and close the window*/
570 XtUnmanageChild(style.fontDialog);
572 if (font.originalFontIndex >= 0)
573 XmListSelectPos(font.sizeList, font.originalFontIndex+1, True);
576 * if no font was originally selected, need to undo any results
577 * from selections that were made by user before pressing Cancel.
579 XtVaSetValues (font.sizeList, XmNselectedItemCount, 0, NULL);
580 XtVaSetValues (font.userText,
582 XmNfontList, style.xrdb.userFont,
584 XtVaSetValues (font.systemLabel,
585 XmNlabelString, CMPSTR(BLANK_MSG),
586 XmNfontList, style.xrdb.systemFont,
588 font.userTextChanged = FALSE;
589 font.selectedFontIndex = -1;
594 XtCallCallbacks(style.fontDialog, XmNhelpCallback, (XtPointer)NULL);
603 /*+++++++++++++++++++++++++++++++++++++++*/
604 /* changSampleFontCB */
605 /* Change the font in the sample areas */
606 /*+++++++++++++++++++++++++++++++++++++++*/
610 XtPointer client_data,
611 XtPointer call_data )
617 XmListCallbackStruct *cb = (XmListCallbackStruct *) call_data;
619 pos = cb->item_position-1;
621 font.selectedFontIndex = pos;
622 font.selectedFontStr = style.xrdb.fontChoice[pos].sysStr;
624 hourGlassOn = !style.xrdb.fontChoice[pos].userFont ||
625 !style.xrdb.fontChoice[pos].sysFont;
628 _DtTurnOnHourGlass(style.fontDialog);
630 if (!style.xrdb.fontChoice[pos].userFont)
631 GetUserFontResource(pos);
632 if (!style.xrdb.fontChoice[pos].sysFont)
633 GetSysFontResource(pos);
636 _DtTurnOffHourGlass(style.fontDialog);
638 /* Set the sample System Font string to different Font */
640 XtSetArg(args[n], XmNfontList, style.xrdb.fontChoice[pos].sysFont); n++;
641 /* string_val = CMPSTR(SYSTEM_MSG);*/
642 XtSetArg (args[n], XmNlabelString, CMPSTR(SYSTEM_MSG)); n++;
643 XtSetValues (font.systemLabel, args, n);
646 * If the user didn't change the text field, output standard user
650 if (!font.userTextChanged)
651 XtSetArg (args[n], XmNvalue, USER_MSG); n++;
652 XtSetArg(args[n], XmNfontList, style.xrdb.fontChoice[pos].userFont); n++;
653 XtSetValues (font.userText, args, n);
654 XmTextShowPosition(font.userText, 0);
657 /*+++++++++++++++++++++++++++++++++++++++*/
659 /* Set flag indicating that the user */
660 /* text field has been modified. */
661 /*+++++++++++++++++++++++++++++++++++++++*/
665 XtPointer client_data,
666 XtPointer call_data )
669 font.userTextChanged = TRUE;
672 /************************************************************************
675 * restore any state information saved with saveFonts.
676 * This is called from restoreSession with the application
677 * shell and the special xrm database retrieved for restore.
678 ************************************************************************/
685 XrmRepresentation rep_type;
688 xrm_name [0] = XrmStringToQuark ("Fonts");
692 xrm_name [1] = XrmStringToQuark ("x");
693 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
694 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr));
696 save.restoreFlag = True;
700 xrm_name [1] = XrmStringToQuark ("y");
701 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
702 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr));
706 xrm_name [1] = XrmStringToQuark ("ismapped");
707 XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
708 /* Are we supposed to be mapped? */
709 if (strcmp(value.addr, "True") == 0)
713 /************************************************************************
716 * This routine will write out to the passed file descriptor any state
717 * information this dialog needs. It is called from saveSessionCB with the
718 * file already opened.
719 * All information is saved in xrm format. There is no restriction
720 * on what can be saved. It doesn't have to be defined or be part of any
721 * widget or Xt definition. Just name and save it here and recover it in
722 * restoreFonts. The suggested minimum is whether you are mapped, and your
724 ************************************************************************/
730 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
731 XmVendorShellExtObject vendorExt;
732 XmWidgetExtData extData;
734 if (style.fontDialog != NULL) {
735 if (XtIsManaged(style.fontDialog))
736 sprintf(bufr, "*Fonts.ismapped: True\n");
738 sprintf(bufr, "*Fonts.ismapped: False\n");
740 /* Get and write out the geometry info for our Window */
742 x = XtX(XtParent(style.fontDialog));
743 y = XtY(XtParent(style.fontDialog));
745 /* Modify x & y to take into account window mgr frames
746 * This is pretty bogus, but I don't know a better way to do it.
748 extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
749 vendorExt = (XmVendorShellExtObject)extData->widget;
750 x -= vendorExt->vendor.xOffset;
751 y -= vendorExt->vendor.yOffset;
753 sprintf(bufr, "%s*Fonts.x: %d\n", bufr, x);
754 sprintf(bufr, "%s*Fonts.y: %d\n", bufr, y);
756 write (fd, bufr, strlen(bufr));