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>
72 #include "SaveRestore.h"
74 /*+++++++++++++++++++++++++++++++++++++++*/
76 /*+++++++++++++++++++++++++++++++++++++++*/
78 #define FONT_MSG ((char *)GETMESSAGE(5, 23, "Style Manager - Font"))
79 #define PREVIEW ((char *)GETMESSAGE(5, 17, "Preview"))
80 #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."))
81 #define LATER ((char *)GETMESSAGE(5, 19, "The selected font will be used when\n you restart this session."))
82 #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."))
83 #define SYSTEM_MSG ((char *)GETMESSAGE(5, 20, "AaBbCcDdEeFfGg0123456789"))
84 #define USER_MSG ((char *)GETMESSAGE(5, 21, "AaBbCcDdEeFfGg0123456789"))
86 #define SIZE ((char *)GETMESSAGE(5, 22, "Size"))
89 /*+++++++++++++++++++++++++++++++++++++++*/
90 /* Internal Variables */
91 /*+++++++++++++++++++++++++++++++++++++++*/
102 int originalFontIndex;
103 int selectedFontIndex;
104 String selectedFontStr;
105 Boolean userTextChanged;
107 static FontData font;
109 static saveRestore save = {FALSE, 0, };
111 /*+++++++++++++++++++++++++++++++++++++++*/
112 /* Internal Functions */
113 /*+++++++++++++++++++++++++++++++++++++++*/
116 static void CreateFontDlg(
118 static void _DtmapCB_fontBB(
120 XtPointer client_data,
121 XtPointer call_data) ;
122 static void ButtonCB(
124 XtPointer client_data,
125 XtPointer call_data) ;
126 static void changeSampleFontCB(
128 XtPointer client_data,
129 XtPointer call_data) ;
130 static void valueChangedCB(
132 XtPointer client_data,
133 XtPointer call_data) ;
136 /*+++++++++++++++++++++++++++++++++++++++*/
138 /*+++++++++++++++++++++++++++++++++++++++*/
143 if (style.fontDialog == NULL) {
144 _DtTurnOnHourGlass(shell);
145 CreateFontDlg(shell);
146 XtManageChild(style.fontDialog);
147 _DtTurnOffHourGlass(shell);
149 XtManageChild(style.fontDialog);
150 raiseWindow(XtWindow(XtParent(style.fontDialog)));
153 /* If no font is found to match current Desktop
154 font, pop up informative message */
155 if (font.selectedFontIndex < 0)
156 InfoDialog(INFO_MSG, style.shell, False);
159 /*+++++++++++++++++++++++++++++++++++++++*/
161 /*+++++++++++++++++++++++++++++++++++++++*/
172 XmString button_string[NUM_LABELS];
175 Widget widget_list[6];
177 XmStringTable selectedSize;
179 Dimension fontheight;
182 font.selectedFontStr = style.xrdb.systemFontStr;
184 /* Assume nothing is selected */
185 font.selectedFontIndex = -1;
188 * The following flag is used to determine if the user has
189 * entered anything into the sample user font field. If
190 * he does, than when the font selection is changed, the
191 * default message "aAbBcC..." won't be displayed overwriting
192 * the user's text, only the fontlist will be changed.
193 * This flag will be set in the valueChanged callback for the
194 * font.sizeList widget.
196 font.userTextChanged = FALSE;
199 * Look for the selectedFont in the fontChoice array and set
200 * selectedFontIndex to that entry
202 for (i=0; i<style.xrdb.numFonts; i++)
203 if (strcmp (font.selectedFontStr,
204 style.xrdb.fontChoice[i].sysStr) == 0)
206 font.selectedFontIndex = i;
207 if (!style.xrdb.fontChoice[i].userFont)
208 GetUserFontResource(i);
209 if (!style.xrdb.fontChoice[i].sysFont)
210 GetSysFontResource(i);
215 * Save the index of the originally selected font. If no
216 * font is selected, this value will remain -1.
218 font.originalFontIndex = font.selectedFontIndex;
220 /* Set up button labels. */
221 button_string[0] = CMPSTR((String) _DtOkString);
222 button_string[1] = CMPSTR((String) _DtCancelString);
223 button_string[2] = CMPSTR((String) _DtHelpString);
225 /* Create toplevel DialogBox */
227 * Note that save.poscnt has been initialized elsewhere.
228 * save.posArgs may contain information from restoreFont().
231 XtSetArg(save.posArgs[save.poscnt], XmNallowOverlap, False); save.poscnt++;
232 XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False);
234 XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS);
236 XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string);
239 __DtCreateDialogBoxDialog(parent, "Fonts", save.posArgs, save.poscnt);
240 XtAddCallback(style.fontDialog, XmNcallback, ButtonCB, NULL);
241 XtAddCallback(style.fontDialog, XmNmapCallback, _DtmapCB_fontBB,
243 XtAddCallback(style.fontDialog, XmNhelpCallback,
244 (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FONT_DIALOG);
246 XmStringFree(button_string[0]);
247 XmStringFree(button_string[1]);
248 XmStringFree(button_string[2]);
250 widget_list[0] = _DtDialogBoxGetButton(style.fontDialog,2);
252 XtSetArg(args[n], XmNautoUnmanage, False); n++;
253 XtSetArg(args[n], XmNcancelButton, widget_list[0]); n++;
254 XtSetValues (style.fontDialog, args, n);
257 XtSetArg(args[n], XmNtitle, FONT_MSG); n++;
258 XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
259 XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++;
260 XtSetValues (XtParent(style.fontDialog), args, n);
263 XtSetArg (args[n], XmNchildType, XmWORK_AREA); n++;
264 XtSetArg(args[n], XmNhorizontalSpacing, style.horizontalSpacing); n++;
265 XtSetArg(args[n], XmNverticalSpacing, style.verticalSpacing); n++;
266 XtSetArg(args[n], XmNallowOverlap, False); n++;
267 font.fontWkarea = XmCreateForm(style.fontDialog, "fontWorkArea", args, n);
270 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
271 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing); n++;
272 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
274 XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++;
275 XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++;
276 XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++;
277 XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++;
278 XtSetArg(args[n], XmNstring, NULL); n++;
279 XtSetArg(args[n], XmNshadowThickness, 0); n++;
280 XtSetArg(args[n], XmNimageName, FONT_ICON); n++;
281 XtSetArg(args[n], XmNtraversalOn, False); n++;
282 widget_list[count++] = font.fontpictLabel =
283 _DtCreateIcon(font.fontWkarea, "fontpictLabel", args, n);
285 /* Create a TitleBox and Scale/List to choose the font size */
288 string = CMPSTR(SIZE);
289 XtSetArg(args[n], XmNtitleString, string); n++;
290 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
291 XtSetArg(args[n], XmNtopWidget, font.fontpictLabel); n++;
292 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing+5); n++;
293 XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
294 XtSetArg(args[n], XmNleftOffset, style.horizontalSpacing); n++;
295 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
296 widget_list[count++] = font.sizeTB =
297 _DtCreateTitleBox(font.fontWkarea, "sizeTB", args, n);
298 XmStringFree(string);
300 /* calculate size for each of the fonts based on system font size */
302 sizeItems = (XmString *) XtMalloc(sizeof(XmString) * style.xrdb.numFonts);
303 for (n=0; n<style.xrdb.numFonts; n++)
305 sprintf(sizeStr, "%d", (int)(n+1));
306 sizeItems[n] = CMPSTR(sizeStr);
307 style.xrdb.fontChoice[n].pointSize = CMPSTR(sizeStr);
312 XtSetArg (args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
313 XtSetArg (args[n], XmNautomaticSelection, True); n++;
314 XtSetArg (args[n], XmNvisibleItemCount, 7); n++;
315 XtSetArg (args[n], XmNitemCount, style.xrdb.numFonts); n++;
316 XtSetArg (args[n], XmNitems, sizeItems); n++;
319 * If matching font was found for current selection,
320 * display it as selected. Otherwise, don't select
323 if (font.selectedFontIndex >=0) {
324 selectedSize = &(style.xrdb.fontChoice[font.selectedFontIndex].pointSize);
325 XtSetArg (args[n], XmNselectedItems, selectedSize); n++;
326 XtSetArg (args[n], XmNselectedItemCount, 1); n++;
328 font.sizeList = XmCreateScrolledList(font.sizeTB,"sizeList",args,n);
329 XtAddCallback(font.sizeList, XmNbrowseSelectionCallback,
330 changeSampleFontCB, NULL);
332 /* If a font match was found and selected, then set it's point size. */
333 if (font.selectedFontIndex >=0)
334 XmListSetItem(font.sizeList,
335 style.xrdb.fontChoice[font.selectedFontIndex].pointSize);
336 XtFree((char *)sizeItems);
338 /* preview TitleBox */
340 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
341 XtSetArg(args[n], XmNtopWidget, font.fontpictLabel); n++;
342 XtSetArg(args[n], XmNtopOffset, style.verticalSpacing+5); n++;
343 XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); n++;
344 XtSetArg(args[n], XmNleftWidget, font.sizeTB); n++;
345 XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
346 XtSetArg(args[n], XmNrightOffset, style.horizontalSpacing); n++;
347 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
348 XtSetArg(args[n], XmNbottomOffset, style.verticalSpacing); n++;
349 string = CMPSTR(PREVIEW);
350 XtSetArg(args[n], XmNtitleString, string); n++;
351 widget_list[count++] = font.previewTB =
352 _DtCreateTitleBox(font.fontWkarea, "systemSample", args, n);
353 XmStringFree(string);
355 /*form to contain preview font area*/
358 XmCreateForm(font.previewTB, "previewForm", args, n);
360 /* sample system font */
364 * If a font match was found and selected, then set the fontlist
365 * and the sample string. Otherwise, output a blank message.
367 if (font.selectedFontIndex >=0) {
368 XtSetArg (args[n], XmNfontList,
369 style.xrdb.fontChoice[font.selectedFontIndex].sysFont); n++;
370 string = CMPSTR(SYSTEM_MSG);
372 string = CMPSTR(BLANK_MSG);
374 XtSetArg (args[n], XmNlabelString, string); n++;
375 XtSetArg (args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++;
376 XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
377 XtSetArg (args[n], XmNtopOffset, 2 * style.verticalSpacing); n++;
378 XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
379 XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
380 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
382 XmCreateLabelGadget(font.previewForm, "systemSample", args, n);
383 XmStringFree(string);
385 /* sample user font */
388 * If a font match was found and selected, then set the fontlist
389 * and the sample string. Otherwise output a blank message.
391 if (font.selectedFontIndex >=0) {
392 XtSetArg (args[n], XmNfontList,
393 style.xrdb.fontChoice[font.selectedFontIndex].userFont); n++;
394 XtSetArg (args[n], XmNvalue, USER_MSG); n++;
396 XtSetArg (args[n], XmNvalue, NULL); n++;
399 XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
400 XtSetArg (args[n], XmNtopWidget, font.systemLabel); n++;
401 XtSetArg (args[n], XmNtopOffset, 2 * style.verticalSpacing); n++;
402 XtSetArg (args[n], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
403 XtSetArg (args[n], XmNleftWidget, font.systemLabel); n++;
404 XtSetArg (args[n], XmNbottomAttachment, XmATTACH_NONE); n++;
405 XtSetArg (args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
406 XtSetArg (args[n], XmNrightWidget, font.systemLabel); n++;
408 XmCreateText(font.previewForm, "userText", args, n);
409 /* Add callback to determine if user changes text in sample field */
410 XtAddCallback(font.userText, XmNvalueChangedCallback, valueChangedCB, NULL);
412 XtManageChild(font.systemLabel);
413 XtManageChild(font.userText);
414 XtManageChild(font.previewForm);
415 XtManageChild(font.sizeList);
416 XtManageChildren(widget_list,count);
417 XtManageChild(font.fontWkarea);
422 /*+++++++++++++++++++++++++++++++++++++++*/
423 /* _DtmapCB_fontBB */
424 /*+++++++++++++++++++++++++++++++++++++++*/
428 XtPointer client_data,
429 XtPointer call_data )
432 DtWsmRemoveWorkspaceFunctions(style.display, XtWindow(XtParent(w)));
434 if (!save.restoreFlag)
435 putDialog ((Widget)client_data, w);
437 XmTextShowPosition(font.userText, 0);
439 XtRemoveCallback(style.fontDialog, XmNmapCallback, _DtmapCB_fontBB, NULL);
444 /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
446 /* Process callback from PushButtons in DialogBox. */
447 /*+++++++++++++++++++++++++++++++++++++++++++++++++*/
451 XtPointer client_data,
452 XtPointer call_data )
454 DtDialogBoxCallbackStruct *cb
455 = (DtDialogBoxCallbackStruct *) call_data;
458 char *str, *fntstr, *fntsetstr;
462 switch (cb->button_position)
464 /* Set the xrdb or pass to dtsession and close the window */
467 * Need to test for the case where the Font dialog maps without
468 * any fonts selected, and the user presses OK. Do this by
469 * checking for number of items selected before changing
472 XtVaGetValues (font.sizeList, XmNselectedItemCount, &items, NULL);
474 /* Post an info dialog explaining when the new fonts will appear */
475 if ((font.selectedFontIndex != font.originalFontIndex) && (items > 0))
477 XtUnmanageChild(style.fontDialog);
479 if(style.xrdb.writeXrdbImmediate)
481 InfoDialog(IMMEDIATE, style.shell, False);
485 InfoDialog(LATER, style.shell, False);
489 for *FontSet resource: find first font entry delimited by a ":"
492 len =strcspn(style.xrdb.fontChoice[font.selectedFontIndex].userStr,
494 fntsetstr = (char *) XtCalloc(1, len + 1);
496 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
500 Since the *Font and *FontSet resources may be used by old
501 X applications, a fontlist of multiple fonts must be converted
502 to Xt font set format (';'s converted to ','s since many old X
503 apps don't understand ';' syntax.)
505 str = strstr(fntsetstr,";");
508 str = strstr(str,";");
512 for *Font resource: find first font entry delimited by a comma,
515 len = strcspn(fntsetstr,",:=");
516 fntstr = (char *) XtCalloc(1, len + 1);
518 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
522 for *FontSet resource: if we got a font (instead of a font set)
523 from the first entry, then wildcard its charset fields
525 len = strlen(fntsetstr);
526 if (style.xrdb.fontChoice[font.selectedFontIndex].userStr[len]
528 str = strchr(fntsetstr, '-');
529 for (n = 1; n < 13 && str; n++)
530 str = strchr(str + 1, '-');
532 strcpy(str + 1, "*-*");
535 /* create the font resource specs with the selected font for xrdb */
537 "*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",
538 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
539 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
540 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
541 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
542 style.xrdb.fontChoice[font.selectedFontIndex].sysStr,
543 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
544 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
545 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
546 style.xrdb.fontChoice[font.selectedFontIndex].userStr,
552 /* if writeXrdbImmediate true write to Xrdb else send to session mgr */
553 if(style.xrdb.writeXrdbImmediate)
554 _DtAddToResource(style.display,fontres);
556 SmNewFontSettings(fontres);
558 font.originalFontIndex = font.selectedFontIndex;
559 style.xrdb.systemFontStr = font.selectedFontStr;
563 XtUnmanageChild(style.fontDialog);
569 /* reset preview area fonts to original and close the window*/
571 XtUnmanageChild(style.fontDialog);
573 if (font.originalFontIndex >= 0)
574 XmListSelectPos(font.sizeList, font.originalFontIndex+1, True);
577 * if no font was originally selected, need to undo any results
578 * from selections that were made by user before pressing Cancel.
580 XtVaSetValues (font.sizeList, XmNselectedItemCount, 0, NULL);
581 XtVaSetValues (font.userText,
583 XmNfontList, style.xrdb.userFont,
585 XtVaSetValues (font.systemLabel,
586 XmNlabelString, CMPSTR(BLANK_MSG),
587 XmNfontList, style.xrdb.systemFont,
589 font.userTextChanged = FALSE;
590 font.selectedFontIndex = -1;
595 XtCallCallbacks(style.fontDialog, XmNhelpCallback, (XtPointer)NULL);
604 /*+++++++++++++++++++++++++++++++++++++++*/
605 /* changSampleFontCB */
606 /* Change the font in the sample areas */
607 /*+++++++++++++++++++++++++++++++++++++++*/
611 XtPointer client_data,
612 XtPointer call_data )
618 XmListCallbackStruct *cb = (XmListCallbackStruct *) call_data;
620 pos = cb->item_position-1;
622 font.selectedFontIndex = pos;
623 font.selectedFontStr = style.xrdb.fontChoice[pos].sysStr;
625 hourGlassOn = !style.xrdb.fontChoice[pos].userFont ||
626 !style.xrdb.fontChoice[pos].sysFont;
629 _DtTurnOnHourGlass(style.fontDialog);
631 if (!style.xrdb.fontChoice[pos].userFont)
632 GetUserFontResource(pos);
633 if (!style.xrdb.fontChoice[pos].sysFont)
634 GetSysFontResource(pos);
637 _DtTurnOffHourGlass(style.fontDialog);
639 /* Set the sample System Font string to different Font */
641 XtSetArg(args[n], XmNfontList, style.xrdb.fontChoice[pos].sysFont); n++;
642 /* string_val = CMPSTR(SYSTEM_MSG);*/
643 XtSetArg (args[n], XmNlabelString, CMPSTR(SYSTEM_MSG)); n++;
644 XtSetValues (font.systemLabel, args, n);
647 * If the user didn't change the text field, output standard user
651 if (!font.userTextChanged)
652 XtSetArg (args[n], XmNvalue, USER_MSG); n++;
653 XtSetArg(args[n], XmNfontList, style.xrdb.fontChoice[pos].userFont); n++;
654 XtSetValues (font.userText, args, n);
655 XmTextShowPosition(font.userText, 0);
658 /*+++++++++++++++++++++++++++++++++++++++*/
660 /* Set flag indicating that the user */
661 /* text field has been modified. */
662 /*+++++++++++++++++++++++++++++++++++++++*/
666 XtPointer client_data,
667 XtPointer call_data )
670 font.userTextChanged = TRUE;
673 /************************************************************************
676 * restore any state information saved with saveFonts.
677 * This is called from restoreSession with the application
678 * shell and the special xrm database retrieved for restore.
679 ************************************************************************/
686 XrmRepresentation rep_type;
689 xrm_name [0] = XrmStringToQuark ("Fonts");
693 xrm_name [1] = XrmStringToQuark ("x");
694 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
695 XtSetArg (save.posArgs[save.poscnt], XmNx, atoi((char *)value.addr));
697 save.restoreFlag = True;
701 xrm_name [1] = XrmStringToQuark ("y");
702 if (XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value)){
703 XtSetArg (save.posArgs[save.poscnt], XmNy, atoi((char *)value.addr));
707 xrm_name [1] = XrmStringToQuark ("ismapped");
708 XrmQGetResource (db, xrm_name, xrm_name, &rep_type, &value);
709 /* Are we supposed to be mapped? */
710 if (strcmp(value.addr, "True") == 0)
714 /************************************************************************
717 * This routine will write out to the passed file descriptor any state
718 * information this dialog needs. It is called from saveSessionCB with the
719 * file already opened.
720 * All information is saved in xrm format. There is no restriction
721 * on what can be saved. It doesn't have to be defined or be part of any
722 * widget or Xt definition. Just name and save it here and recover it in
723 * restoreFonts. The suggested minimum is whether you are mapped, and your
725 ************************************************************************/
731 char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */
732 XmVendorShellExtObject vendorExt;
733 XmWidgetExtData extData;
735 if (style.fontDialog != NULL) {
736 if (XtIsManaged(style.fontDialog))
737 sprintf(bufr, "*Fonts.ismapped: True\n");
739 sprintf(bufr, "*Fonts.ismapped: False\n");
741 /* Get and write out the geometry info for our Window */
743 x = XtX(XtParent(style.fontDialog));
744 y = XtY(XtParent(style.fontDialog));
746 /* Modify x & y to take into account window mgr frames
747 * This is pretty bogus, but I don't know a better way to do it.
749 extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION);
750 vendorExt = (XmVendorShellExtObject)extData->widget;
751 x -= vendorExt->vendor.xOffset;
752 y -= vendorExt->vendor.yOffset;
754 sprintf(bufr, "%s*Fonts.x: %d\n", bufr, x);
755 sprintf(bufr, "%s*Fonts.y: %d\n", bufr, y);
757 if(-1 == write (fd, bufr, strlen(bufr))) {
758 perror(strerror(errno));